Clutter Engine 0.0.1
|
Base class for all components attached to an Actor. More...
#include <Component.h>
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. | |
Actor * | GetOwner () 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. | |
Actor * | mOwner |
The actor that owns this component. | |
Transform | mRelativeTransform |
The relative transform of the component to its owner. | |
Base class for all components attached to an Actor.
|
inline |
Constructor for Component.
pUpdateOrder | The order in which the component is updated. |
|
inline |
Adds a rotation to the current relative rotation.
rot | The rotation to add as a Vector3 (Euler angles). |
|
inline |
Gets the owner actor of this component.
|
inline |
Gets the relative location of the component.
|
inline |
Gets the relative rotation of the component.
|
inline |
Gets the relative rotation of the component as Euler angles.
|
inline |
Gets the relative scale of the component.
|
inline |
Gets the relative transform of the component.
|
inline |
Gets the update order of the component.
|
inline |
Gets the world location of the component.
|
inline |
Gets the world rotation of the component.
|
inline |
Gets the world scale of the component.
|
inlinevirtual |
Gets the world transform of the component.
|
inline |
Checks if the component is enabled.
|
inlineprotected |
Performs a line trace (raycast) using the owning actor.
start | The start position of the trace. |
direction | The direction of the trace. |
maxDistance | The maximum distance for the trace. |
hit | The result of the raycast. |
debugPersistant | Whether to persist debug visualization. |
|
inline |
Enables or disables the component.
pActive | True to enable the component, false to disable it. |
|
inlineprotectedvirtual |
Sets the owner of this component and calls Start().
pOwner | The actor that owns this component. |
Reimplemented in clt::ColliderComponent, clt::FlipbookComponent, clt::HUDComponent, clt::MeshComponent, clt::PlayerController2D, clt::RigidBody, and clt::SpriteComponent.
|
inline |
Sets the relative location of the component.
loc | The new relative location as a Vector2. |
|
inline |
Sets the relative location of the component.
loc | The new relative location as a Vector3. |
|
inline |
Sets the relative rotation of the component.
rot | The new relative rotation as a float (for 2D). |
|
inline |
Sets the relative rotation of the component.
rot | The new relative rotation as a Quaternion. |
|
inline |
Sets the relative rotation of the component.
rot | The new relative rotation as a Vector3 (Euler angles). |
|
inline |
Sets the relative scale of the component.
scale | The new relative scale as a Vector2. |
|
inline |
Sets the relative scale of the component.
scale | The new relative scale as a Vector3. |
|
inline |
Sets the relative transform of the component.
transform | The new relative transform. |
|
inline |
Sets the world location of the component.
loc | The new world location. |
|
inline |
Sets the world rotation of the component.
rot | The new world rotation as a Quaternion. |
|
inline |
Sets the world rotation of the component.
rot | The new world rotation as a Vector3 (Euler angles). |
|
inlinevirtual |
Called when the component is started.
Reimplemented in BowlingController, clt::SpringArmComponent, DoomController, and DoomHUD.
|
inlinevirtual |
Called every frame to update the component.
Reimplemented in BowlingController, clt::CameraComponent, clt::FlipbookComponent, clt::FPSController, clt::HUDComponent, clt::PlayerController2D, clt::SpringArmComponent, DoomController, DoomHUD, and MainMenuHUD.