Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::MeshComponent Class Reference

Component for rendering a mesh with optional texture and tiling. More...

#include <MeshComponent.h>

Inheritance diagram for clt::MeshComponent:
clt::Component

Public Member Functions

 MeshComponent (Mesh *pMesh, int pDrawOrder=0, Vector2 pTextureTiling={5, 5})
 Constructs a MeshComponent with a mesh pointer.
 
 MeshComponent (const std::string &pMesh, int pDrawOrder=0, Vector2 pTextureTiling={ 5, 5 })
 Constructs a MeshComponent with a mesh asset name.
 
virtual ~MeshComponent ()
 Destructor.
 
virtual void SetOwner (Actor *pOwner) override
 Sets the owner actor of this component.
 
virtual void Draw (Matrix4Row viewProj)
 Draws the mesh using the given view-projection matrix.
 
virtual void SetMesh (Mesh &pMesh)
 Sets the mesh for this component.
 
MeshGetMesh () const
 Gets the mesh pointer.
 
void SetTexture (Texture *texture, Vector2 tiling={5, 5})
 Sets the texture for this component.
 
void SetTexture (std::string &texture, Vector2 tiling={ 5, 5 })
 Sets the texture for this component by asset name.
 
void SetTextureTiling (Vector2 pTiling)
 Sets the texture tiling factor.
 
- Public Member Functions inherited from clt::Component
 Component (int pUpdateOrder=0)
 Constructor for Component.
 
virtual ~Component ()=default
 Virtual destructor for Component.
 
virtual void Start ()
 Called when the component is started.
 
virtual void Update ()
 Called every frame to update the component.
 
virtual void Destroy ()
 Called to destroy the component.
 
void SetActive (bool pActive)
 Enables or disables the component.
 
void OnDestroy ()
 Called when the component is destroyed.
 
bool IsActive () const
 Checks if the component is enabled.
 
int GetUpdateOrder () const
 Gets the update order of the component.
 
void SetRelativeLocation (const Vector3 &loc)
 Sets the relative location of the component.
 
void SetRelativeLocation (const Vector2 &loc)
 Sets the relative location of the component.
 
void SetWorldLocation (const Vector3 &loc)
 Sets the world location of the component.
 
void SetRelativeScale (const Vector3 &scale)
 Sets the relative scale of the component.
 
void SetRelativeScale (const Vector2 &scale)
 Sets the relative scale of the component.
 
void SetRelativeRotation (Quaternion rot)
 Sets the relative rotation of the component.
 
void SetRelativeRotation (Vector3 rot)
 Sets the relative rotation of the component.
 
void SetWorldRotation (const Quaternion &rot)
 Sets the world rotation of the component.
 
void SetWorldRotation (const Vector3 &rot)
 Sets the world rotation of the component.
 
void AddRelativeRotation (Vector3 rot)
 Adds a rotation to the current relative rotation.
 
void SetRelativeRotation (float rot)
 Sets the relative rotation of the component.
 
void SetRelativeTransform (Transform &transform)
 Sets the relative transform of the component.
 
Vector3 GetRelativeLocation () const
 Gets the relative location of the component.
 
Vector3 GetRelativeScale () const
 Gets the relative scale of the component.
 
Quaternion GetRelativeRotation () const
 Gets the relative rotation of the component.
 
Vector3 GetRelativeRotationEuler () const
 Gets the relative rotation of the component as Euler angles.
 
Transform GetRelativeTransform () const
 Gets the relative transform of the component.
 
Vector3 GetWorldLocation () const
 Gets the world location of the component.
 
Vector3 GetWorldScale () const
 Gets the world scale of the component.
 
Quaternion GetWorldRotation () const
 Gets the world rotation of the component.
 
virtual Transform GetWorldTransform () const
 Gets the world transform of the component.
 
ActorGetOwner () const
 Gets the owner actor of this component.
 

Protected Attributes

MeshmMesh
 Pointer to the mesh asset.
 
TexturemTexture
 Pointer to the texture asset.
 
Vector2 mTextureTiling
 Tiling factor for the texture.
 
bool mTesselate
 Flag indicating if tessellation is enabled.
 
- Protected Attributes inherited from clt::Component
bool mIsActive = true
 Indicates if the component is active.
 
int mUpdateOrder = 0
 The order in which the component is updated.
 
ActormOwner
 The actor that owns this component.
 
Transform mRelativeTransform
 The relative transform of the component to its owner.
 

Additional Inherited Members

- Public Attributes inherited from clt::Component
friend Actor
 
- Protected Member Functions inherited from clt::Component
bool LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false)
 Performs a line trace (raycast) using the owning actor.
 

Detailed Description

Component for rendering a mesh with optional texture and tiling.

Constructor & Destructor Documentation

◆ MeshComponent() [1/2]

MeshComponent::MeshComponent ( Mesh * pMesh,
int pDrawOrder = 0,
Vector2 pTextureTiling = {5,5} )

Constructs a MeshComponent with a mesh pointer.

Parameters
pMeshPointer to the mesh.
pDrawOrderDraw order for rendering.
pTextureTilingTexture tiling factor.

◆ MeshComponent() [2/2]

MeshComponent::MeshComponent ( const std::string & pMesh,
int pDrawOrder = 0,
Vector2 pTextureTiling = { 5,5 } )

Constructs a MeshComponent with a mesh asset name.

Parameters
pMeshName of the mesh asset.
pDrawOrderDraw order for rendering.
pTextureTilingTexture tiling factor.

Member Function Documentation

◆ Draw()

void MeshComponent::Draw ( Matrix4Row viewProj)
virtual

Draws the mesh using the given view-projection matrix.

Parameters
viewProjView-projection matrix.

◆ GetMesh()

Mesh * clt::MeshComponent::GetMesh ( ) const
inline

Gets the mesh pointer.

Returns
Pointer to the mesh.

◆ SetMesh()

virtual void clt::MeshComponent::SetMesh ( Mesh & pMesh)
inlinevirtual

Sets the mesh for this component.

Parameters
pMeshReference to the mesh.

◆ SetOwner()

void MeshComponent::SetOwner ( Actor * pOwner)
overridevirtual

Sets the owner actor of this component.

Parameters
pOwnerPointer to the owner actor.

Reimplemented from clt::Component.

◆ SetTexture() [1/2]

void MeshComponent::SetTexture ( std::string & texture,
Vector2 tiling = { 5,5 } )

Sets the texture for this component by asset name.

Parameters
textureName of the texture asset.
tilingTiling factor for the texture.

◆ SetTexture() [2/2]

void MeshComponent::SetTexture ( Texture * texture,
Vector2 tiling = {5,5} )

Sets the texture for this component.

Parameters
texturePointer to the texture.
tilingTiling factor for the texture.

◆ SetTextureTiling()

void clt::MeshComponent::SetTextureTiling ( Vector2 pTiling)
inline

Sets the texture tiling factor.

Parameters
pTilingTiling factor.

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