KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::UStaticMeshComponent Class Reference

A component that represents a static mesh in the game engine, responsible for rendering and managing static mesh data. More...

#include <StaticMeshComponent.h>

Inheritance diagram for Karma::UStaticMeshComponent:
Karma::UMeshComponent Karma::UPrimitiveComponent Karma::USceneComponent Karma::UActorComponent Karma::UObject Karma::UObjectBase

Public Member Functions

 UStaticMeshComponent (const std::string &name="StaticMeshComponent")
 Constructor for StaticMeshComponent.
virtual ~UStaticMeshComponent ()
 Destructor for StaticMeshComponent.
void SetStaticMesh (std::shared_ptr< Mesh > staticMesh)
 Sets the static mesh associated with this component.
std::shared_ptr< MeshGetStaticMesh () const
 Gets the static mesh associated with this component.
Public Member Functions inherited from Karma::UPrimitiveComponent
virtual void BeginPlay () override
 Used to detach physics objects before simulation begins. This is needed because at runtime we can't have simulated objects inside the attachment hierarchy.
void SetCachedMaxDrawDistance (const float newCachedMaxDrawDistance)
 Utility to cache the max draw distance based on cull distance volumes or the desired max draw distance.
std::shared_ptr< UniformBufferObjectGetComponentTransformUniform () const
 Getter for the transform uniform buffer object.
virtual void SetWorldTransform (const FTransform &NewTransform) override
Public Member Functions inherited from Karma::USceneComponent
 USceneComponent ()
 A constructor.
const glm::vec3 & GetRelativeRotation () const
 Gets the literal value of RelativeRotation.
const glm::vec3 & GetRelativeLocation () const
 Gets the literal value of RelativeLocation.
const glm::vec3 & GetRelativeScale3D () const
 Gets the literal value of RelativeScale3D.
void SetWorldLocation (glm::vec3 newLocation)
std::shared_ptr< USceneComponentGetAttachParent () const
 Get the SceneComponent we are attached to.
virtual FTransform GetSocketTransform (const std::string &InSocketName, ERelativeTransformSpace TransformSpace=RTS_World) const
 Get world-space socket transform.
const FTransformGetComponentTransform () const
 Get the current component-to-world transform for this component.
virtual void BeginDestroy () override
 Overridden BeginDestroy for USceneComponent.
bool IsUsingAbsoluteLocation () const
 Gets the literal value of bAbsoluteLocation.
bool IsUsingAbsoluteRotation () const
 Gets the literal value of bAbsoluteRotation.
bool IsUsingAbsoluteScale () const
 Gets the literal value of bAbsoluteScale.
void SetRelativeTransform (const FTransform &NewTransform)
 Set the transform of the component relative to its parent.
virtual void UpdateComponentToWorld (EUpdateTransformFlags UpdateTransformFlags=EUpdateTransformFlags::None, ETeleportType Teleport=ETeleportType::None) override final
 Recalculate the value of our component to world transform.
FORCEINLINE const std::string & GetAttachSocketName () const
 Getter for the m_AttachSocektName.
Public Member Functions inherited from Karma::UActorComponent
 UActorComponent ()
 A constructor.
virtual void TickComponent (float deltaTime)
 Function called every frame on this ActorComponent. Override this function to implement custom logic to be executed every frame. Only executes if the component is registered, and also PrimaryComponentTick.bCanEverTick must be set to true.
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason)
 Ends gameplay for this component. //Called from AActor::EndPlay only if bHasBegunPlay is true// <- not quite sure about the call.
AActorGetOwner () const
 Follow the Outer chain to get the AActor that 'Owns' this component.
void SetOwner (AActor *NewOwner)
 Sets the owner of this component.
bool HasBeenCreated () const
 Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet.
virtual void OnComponentCreated ()
 Called when a component is created (not loaded). This can happen in the editor or during gameplay.
bool IsRegistered () const
 See if this component is currently registered.
bool IsActive () const
 Returns whether the component is active or not.
virtual void Activate (bool bReset=false)
 Activates the SceneComponent, should be overridden by native child classes.
void SetActiveFlag (const bool bNewIsActive)
 Sets the value of bIsActive without causing other side effects to this instance.
bool HasBeenInitialized () const
 Indicates that InitializeComponent has been called, but UninitializeComponent has not yet.
virtual void InitializeComponent ()
 Initializes the component. Occurs at level startup or actor spawn. This is before BeginPlay (Actor or Component). All Components in the level will be Initialized on load before any Actor/Component gets BeginPlay Requires component to be registered, and bWantsInitializeComponent to be true.
bool HasBegunPlay () const
 Indicates that BeginPlay has been called, but EndPlay has not yet.
virtual void UninitializeComponent ()
 Handle this component being Uninitialized.
virtual void OnComponentDestroyed (bool bDestroyingHierarchy)
 Called when a component is destroyed.
Public Member Functions inherited from Karma::UObject
 UObject ()
virtual void FinishDestroy ()
virtual const std::string & GetDesc ()
 Return a one line description of an object for viewing in the thumbnail view of the generic browser.
virtual class UWorldGetWorld () const
 Returns what UWorld this object is contained within.
bool IsValidChecked (const UObject *Test)
FORCEINLINE bool Modify (bool bAlwaysMarkDirty=true)
bool IsSelected () const
 Test the selection state of a UObject.
Public Member Functions inherited from Karma::UObjectBase
 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 Constructor used by StaticAllocateObject.
virtual void ShivaUObject ()
 One function to destroy them.
UPackageGetPackage () const
 Walks up the list of outers until it finds a package directly associated with the object.
UPackageGetExternalPackage () const
bool IsUnreachable () const
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
FORCEINLINE uint32_t GetInternalIndex () const
void MarkAsGarbage ()
void ClearGarbage ()
FORCEINLINE const std::string & GetName () const
FORCEINLINE void SetObjectName (const std::string &aName)
FORCEINLINE UObjectGetOuter () const
UObjectGetTypedOuter (UClass *Target) const
template<typename T>
T * GetTypedOuter () const
bool IsValidLowLevel () const
template<typename OtherClassType>
FORCEINLINE bool IsA (OtherClassType SomeBase) const
FORCEINLINE UClassGetClass () const
FORCEINLINE EObjectFlags GetFlags () const
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
FORCEINLINE void ClearFlags (EObjectFlags FlagsToClear)
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
FORCEINLINE void AddToRoot ()

Additional Inherited Members

Static Public Member Functions inherited from Karma::UObject
static const char * StaticConfigName ()
Static Public Member Functions inherited from Karma::UObjectBase
static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
Public Attributes inherited from Karma::UPrimitiveComponent
uint8_t CastShadow: 1
Public Attributes inherited from Karma::USceneComponent
glm::vec3 m_ComponentVelocity
std::string m_AttachSocketName
std::vector< std::shared_ptr< USceneComponent > > m_AttachChildren
Public Attributes inherited from Karma::UActorComponent
EComponentCreationMethod m_CreationMethod
uint8_t m_bAutoActivate: 1
uint8_t m_bWantsInitializeComponent: 1
Protected Member Functions inherited from Karma::UActorComponent
virtual bool ShouldActivate () const
Protected Member Functions inherited from Karma::UObjectBase
 UObjectBase ()
 Providing a default constructor.
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
Protected Attributes inherited from Karma::UActorComponent
uint8_t m_bRegistered: 1

Detailed Description

A component that represents a static mesh in the game engine, responsible for rendering and managing static mesh data.

StaticMeshComponent is used to render a static mesh asset in the world. It is a subclass of MeshComponent and provides functionality specific to static meshes.

Since
Karma 1.0.0

Constructor & Destructor Documentation

◆ UStaticMeshComponent()

Karma::UStaticMeshComponent::UStaticMeshComponent ( const std::string & name = "StaticMeshComponent")

Constructor for StaticMeshComponent.

Parameters
nameThe name of the static mesh component.

Member Function Documentation

◆ GetStaticMesh()

std::shared_ptr< Mesh > Karma::UStaticMeshComponent::GetStaticMesh ( ) const
inline

Gets the static mesh associated with this component.

Returns
std::shared_ptr<class Mesh> The static mesh associated with this component.
Since
Karma 1.0.0

◆ SetStaticMesh()

void Karma::UStaticMeshComponent::SetStaticMesh ( std::shared_ptr< Mesh > staticMesh)
inline

Sets the static mesh associated with this component.

Parameters
staticMeshThe static mesh to associate with this component.
Since
Karma 1.0.0

The documentation for this class was generated from the following files: