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

Base class for all components attached to an Actor. More...

#include <Component.h>

Inheritance diagram for clt::Component:
clt::CameraComponent clt::ColliderComponent clt::HUDComponent clt::MeshComponent clt::PlayerController clt::RigidBody clt::SpringArmComponent clt::SpriteComponent

Public Member Functions

 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.
 

Public Attributes

friend Actor
 

Protected Member Functions

virtual void SetOwner (Actor *pOwner)
 Sets the owner of this component and calls Start().
 
bool LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false)
 Performs a line trace (raycast) using the owning actor.
 

Protected Attributes

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.
 

Detailed Description

Base class for all components attached to an Actor.

Constructor & Destructor Documentation

◆ Component()

clt::Component::Component ( int pUpdateOrder = 0)
inline

Constructor for Component.

Parameters
pUpdateOrderThe order in which the component is updated.

Member Function Documentation

◆ AddRelativeRotation()

void clt::Component::AddRelativeRotation ( Vector3 rot)
inline

Adds a rotation to the current relative rotation.

Parameters
rotThe rotation to add as a Vector3 (Euler angles).

◆ GetOwner()

Actor * clt::Component::GetOwner ( ) const
inline

Gets the owner actor of this component.

Returns
Pointer to the owner Actor.

◆ GetRelativeLocation()

Vector3 clt::Component::GetRelativeLocation ( ) const
inline

Gets the relative location of the component.

Returns
The relative location as a Vector3.

◆ GetRelativeRotation()

Quaternion clt::Component::GetRelativeRotation ( ) const
inline

Gets the relative rotation of the component.

Returns
The relative rotation as a Quaternion.

◆ GetRelativeRotationEuler()

Vector3 clt::Component::GetRelativeRotationEuler ( ) const
inline

Gets the relative rotation of the component as Euler angles.

Returns
The relative rotation as a Vector3 (Euler angles).

◆ GetRelativeScale()

Vector3 clt::Component::GetRelativeScale ( ) const
inline

Gets the relative scale of the component.

Returns
The relative scale as a Vector3.

◆ GetRelativeTransform()

Transform clt::Component::GetRelativeTransform ( ) const
inline

Gets the relative transform of the component.

Returns
The relative transform.

◆ GetUpdateOrder()

int clt::Component::GetUpdateOrder ( ) const
inline

Gets the update order of the component.

Returns
The update order of the component.

◆ GetWorldLocation()

Vector3 clt::Component::GetWorldLocation ( ) const
inline

Gets the world location of the component.

Returns
The world location as a Vector3.

◆ GetWorldRotation()

Quaternion clt::Component::GetWorldRotation ( ) const
inline

Gets the world rotation of the component.

Returns
The world rotation as a Quaternion.

◆ GetWorldScale()

Vector3 clt::Component::GetWorldScale ( ) const
inline

Gets the world scale of the component.

Returns
The world scale as a Vector3.

◆ GetWorldTransform()

virtual Transform clt::Component::GetWorldTransform ( ) const
inlinevirtual

Gets the world transform of the component.

Returns
The world transform.

◆ IsActive()

bool clt::Component::IsActive ( ) const
inline

Checks if the component is enabled.

Returns
True if the component is enabled, false otherwise.

◆ LineTrace()

bool clt::Component::LineTrace ( Vector3 start,
Vector3 direction,
float maxDistance,
raycastHit & hit,
bool debugPersistant = false )
inlineprotected

Performs a line trace (raycast) using the owning actor.

Parameters
startThe start position of the trace.
directionThe direction of the trace.
maxDistanceThe maximum distance for the trace.
hitThe result of the raycast.
debugPersistantWhether to persist debug visualization.
Returns
True if something was hit, false otherwise.

◆ SetActive()

void clt::Component::SetActive ( bool pActive)
inline

Enables or disables the component.

Parameters
pActiveTrue to enable the component, false to disable it.

◆ SetOwner()

virtual void clt::Component::SetOwner ( Actor * pOwner)
inlineprotectedvirtual

Sets the owner of this component and calls Start().

Parameters
pOwnerThe actor that owns this component.

Reimplemented in clt::ColliderComponent, clt::FlipbookComponent, clt::HUDComponent, clt::MeshComponent, clt::PlayerController2D, clt::RigidBody, and clt::SpriteComponent.

◆ SetRelativeLocation() [1/2]

void clt::Component::SetRelativeLocation ( const Vector2 & loc)
inline

Sets the relative location of the component.

Parameters
locThe new relative location as a Vector2.

◆ SetRelativeLocation() [2/2]

void clt::Component::SetRelativeLocation ( const Vector3 & loc)
inline

Sets the relative location of the component.

Parameters
locThe new relative location as a Vector3.

◆ SetRelativeRotation() [1/3]

void clt::Component::SetRelativeRotation ( float rot)
inline

Sets the relative rotation of the component.

Parameters
rotThe new relative rotation as a float (for 2D).

◆ SetRelativeRotation() [2/3]

void clt::Component::SetRelativeRotation ( Quaternion rot)
inline

Sets the relative rotation of the component.

Parameters
rotThe new relative rotation as a Quaternion.

◆ SetRelativeRotation() [3/3]

void clt::Component::SetRelativeRotation ( Vector3 rot)
inline

Sets the relative rotation of the component.

Parameters
rotThe new relative rotation as a Vector3 (Euler angles).

◆ SetRelativeScale() [1/2]

void clt::Component::SetRelativeScale ( const Vector2 & scale)
inline

Sets the relative scale of the component.

Parameters
scaleThe new relative scale as a Vector2.

◆ SetRelativeScale() [2/2]

void clt::Component::SetRelativeScale ( const Vector3 & scale)
inline

Sets the relative scale of the component.

Parameters
scaleThe new relative scale as a Vector3.

◆ SetRelativeTransform()

void clt::Component::SetRelativeTransform ( Transform & transform)
inline

Sets the relative transform of the component.

Parameters
transformThe new relative transform.

◆ SetWorldLocation()

void clt::Component::SetWorldLocation ( const Vector3 & loc)
inline

Sets the world location of the component.

Parameters
locThe new world location.

◆ SetWorldRotation() [1/2]

void clt::Component::SetWorldRotation ( const Quaternion & rot)
inline

Sets the world rotation of the component.

Parameters
rotThe new world rotation as a Quaternion.

◆ SetWorldRotation() [2/2]

void clt::Component::SetWorldRotation ( const Vector3 & rot)
inline

Sets the world rotation of the component.

Parameters
rotThe new world rotation as a Vector3 (Euler angles).

◆ Start()

virtual void clt::Component::Start ( )
inlinevirtual

Called when the component is started.

Reimplemented in BowlingController, clt::SpringArmComponent, DoomController, and DoomHUD.

◆ Update()

virtual void clt::Component::Update ( )
inlinevirtual

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