Skip to main content

ComposeTransformComponent Class

Component that holds transformation data (position, rotation, scale). More...

Declaration

class helios::engine::modules::spatial::transform::components::ComposeTransformComponent { ... }

Public Constructors Index

ComposeTransformComponent ()=default

Default constructor. More...

ComposeTransformComponent (const ComposeTransformComponent &other)

Copy constructor. More...

ComposeTransformComponent (ComposeTransformComponent &&) noexcept=default

Public Operators Index

ComposeTransformComponent &operator= (const ComposeTransformComponent &)=default
ComposeTransformComponent &operator= (ComposeTransformComponent &&) noexcept=default

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

boolisDirty () const noexcept

Checks if the transform is dirty. More...

voidclearDirty () noexcept

Clears the dirty flag. More...

voidonAcquire () noexcept

Resets the dirty flag to true when acquired. More...

voidonRelease () noexcept

Resets the dirty flag to true when released. More...

helios::math::mat4flocalTransform () const noexcept

Returns the local transformation matrix. More...

ComposeTransformComponent &setLocalScale (const helios::math::vec3f &scale) noexcept

Sets the local scale. More...

ComposeTransformComponent &setLocalRotation (const helios::math::mat4f &rotation) noexcept

Sets the local rotation matrix. More...

ComposeTransformComponent &setLocalTranslation (const helios::math::vec3f &translation) noexcept

Sets the local translation (position). More...

ComposeTransformComponent &translateLocalBy (const helios::math::vec3f &translation) noexcept

Translates the component locally by a delta vector. More...

helios::math::vec3flocalTranslation () const noexcept

Returns the local translation vector. More...

helios::math::mat4flocalRotation () const noexcept

Returns the local rotation matrix. More...

helios::math::vec3flocalScaling () const noexcept

Returns the local scaling vector. More...

voidsetWorldTransform (const helios::math::mat4f &m) noexcept

Sets the world transform matrix directly. More...

const helios::math::mat4f &worldTransform () noexcept

Returns the current world transform matrix. More...

helios::math::vec3fworldTranslation () noexcept

Extracts the world translation from the world transform. More...

Private Member Attributes Index

helios::core::spatial::Transformtransform_ {}

The local transformation (translation, rotation, scale). More...

boolisDirty_ = true

Flag indicating if the transform has changed since the last update. More...

helios::math::mat4fworldTransform_ = helios::math::mat4f::identity()

The computed world transformation matrix. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that holds transformation data (position, rotation, scale).

The ComposeTransformComponent manages the spatial state of a GameObject. It stores the local transform (relative to parent) and the computed world transform. Changes to local properties mark the component as dirty, signaling systems to recompute the world transform.

Definition at line 23 of file ComposeTransformComponent.ixx.

Public Constructors

ComposeTransformComponent()

helios::engine::modules::spatial::transform::components::ComposeTransformComponent::ComposeTransformComponent ()
default

ComposeTransformComponent()

helios::engine::modules::spatial::transform::components::ComposeTransformComponent::ComposeTransformComponent (const ComposeTransformComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 80 of file ComposeTransformComponent.ixx.

81 transform_(other.transform_),
82 worldTransform_(other.worldTransform_),
83 isDirty_(true){}

Reference ComposeTransformComponent.

ComposeTransformComponent()

helios::engine::modules::spatial::transform::components::ComposeTransformComponent::ComposeTransformComponent (ComposeTransformComponent &&)
noexcept default

Definition at line 86 of file ComposeTransformComponent.ixx.

Reference ComposeTransformComponent.

Public Operators

operator=()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::operator= (const ComposeTransformComponent &)
default

Definition at line 85 of file ComposeTransformComponent.ixx.

Reference ComposeTransformComponent.

operator=()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::operator= (ComposeTransformComponent &&)
noexcept default

Definition at line 87 of file ComposeTransformComponent.ixx.

Reference ComposeTransformComponent.

Public Member Functions

clearDirty()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::clearDirty ()
inline noexcept

Clears the dirty flag.

Definition at line 101 of file ComposeTransformComponent.ixx.

101 void clearDirty() noexcept {
102 isDirty_ = false;
103 }

disable()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::disable ()
inline noexcept

Disables this component.

Definition at line 66 of file ComposeTransformComponent.ixx.

66 void disable() noexcept {
67 isEnabled_ = false;
68 }

enable()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::enable ()
inline noexcept

Enables this component.

Definition at line 59 of file ComposeTransformComponent.ixx.

59 void enable() noexcept {
60 isEnabled_ = true;
61 }

isDirty()

bool helios::engine::modules::spatial::transform::components::ComposeTransformComponent::isDirty ()
inline nodiscard noexcept

Checks if the transform is dirty.

Returns

True if the transform has changed, false otherwise.

Definition at line 94 of file ComposeTransformComponent.ixx.

94 [[nodiscard]] bool isDirty() const noexcept {
95 return isDirty_;
96 }

Reference isDirty.

Referenced by isDirty.

isEnabled()

bool helios::engine::modules::spatial::transform::components::ComposeTransformComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 52 of file ComposeTransformComponent.ixx.

52 [[nodiscard]] bool isEnabled() const noexcept {
53 return isEnabled_;
54 }

localRotation()

helios::math::mat4f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::localRotation ()
inline nodiscard noexcept

Returns the local rotation matrix.

Returns

The rotation relative to the parent.

Definition at line 198 of file ComposeTransformComponent.ixx.

198 [[nodiscard]] helios::math::mat4f localRotation() const noexcept {
199 return transform_.rotation();
200 }

localScaling()

helios::math::vec3f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::localScaling ()
inline nodiscard noexcept

Returns the local scaling vector.

Returns

The scale relative to the parent.

Definition at line 208 of file ComposeTransformComponent.ixx.

208 [[nodiscard]] helios::math::vec3f localScaling() const noexcept {
209 return transform_.scaling();
210 }

localTransform()

helios::math::mat4f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::localTransform ()
inline nodiscard noexcept

Returns the local transformation matrix.

Returns

The 4x4 matrix representing local translation, rotation, and scale.

Definition at line 128 of file ComposeTransformComponent.ixx.

128 [[nodiscard]] helios::math::mat4f localTransform() const noexcept {
129 return transform_.transform();
130 }

localTranslation()

helios::math::vec3f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::localTranslation ()
inline nodiscard noexcept

Returns the local translation vector.

Returns

The position relative to the parent.

Definition at line 188 of file ComposeTransformComponent.ixx.

188 [[nodiscard]] helios::math::vec3f localTranslation() const noexcept {
189 return transform_.translation();
190 }

onAcquire()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::onAcquire ()
inline noexcept

Resets the dirty flag to true when acquired.

Makes sure the transform is considered after the component was acquired.

Definition at line 110 of file ComposeTransformComponent.ixx.

110 void onAcquire() noexcept {
111 isDirty_ = true;
112 }

onRelease()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::onRelease ()
inline noexcept

Resets the dirty flag to true when released.

Makes sure the entities dirty-state is reset to the default state.

Definition at line 119 of file ComposeTransformComponent.ixx.

119 void onRelease() noexcept {
120 isDirty_ = true;
121 }

setLocalRotation()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::setLocalRotation (const helios::math::mat4f & rotation)
inline noexcept

Sets the local rotation matrix.

Parameters
rotation

The new rotation matrix.

Returns

Reference to this component for chaining.

Definition at line 152 of file ComposeTransformComponent.ixx.

153 transform_.setRotation(rotation);
154 isDirty_ = true;
155 return *this;
156 };

Reference ComposeTransformComponent.

setLocalScale()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::setLocalScale (const helios::math::vec3f & scale)
inline noexcept

Sets the local scale.

Parameters
scale

The new scale vector.

Returns

Reference to this component for chaining.

Definition at line 139 of file ComposeTransformComponent.ixx.

140 transform_.setScale(scale);
141 isDirty_ = true;
142 return *this;
143 };

Reference ComposeTransformComponent.

setLocalTranslation()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::setLocalTranslation (const helios::math::vec3f & translation)
inline noexcept

Sets the local translation (position).

Parameters
translation

The new position vector.

Returns

Reference to this component for chaining.

Definition at line 165 of file ComposeTransformComponent.ixx.

166 transform_.setTranslation(translation);
167 isDirty_ = true;
168 return *this;
169 };

Reference ComposeTransformComponent.

setWorldTransform()

void helios::engine::modules::spatial::transform::components::ComposeTransformComponent::setWorldTransform (const helios::math::mat4f & m)
inline noexcept

Sets the world transform matrix directly.

Parameters
m

The new world transform matrix.

Definition at line 217 of file ComposeTransformComponent.ixx.

217 void setWorldTransform(const helios::math::mat4f& m) noexcept {
218 isDirty_ = true;
219 worldTransform_ = m;
220 }

translateLocalBy()

ComposeTransformComponent & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::translateLocalBy (const helios::math::vec3f & translation)
inline noexcept

Translates the component locally by a delta vector.

Parameters
translation

The vector to add to the current position.

Returns

Reference to this component for chaining.

Definition at line 177 of file ComposeTransformComponent.ixx.

178 transform_.setTranslation(transform_.translation() + translation);
179 isDirty_ = true;
180 return *this;
181 };

Reference ComposeTransformComponent.

worldTransform()

const helios::math::mat4f & helios::engine::modules::spatial::transform::components::ComposeTransformComponent::worldTransform ()
inline noexcept

Returns the current world transform matrix.

Returns

Const reference to the world transform.

Definition at line 227 of file ComposeTransformComponent.ixx.

228 return worldTransform_;
229 }

worldTranslation()

helios::math::vec3f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::worldTranslation ()
inline noexcept

Extracts the world translation from the world transform.

Returns

The global position vector.

Definition at line 236 of file ComposeTransformComponent.ixx.

237 return worldTransform_.translation();
238 }

Private Member Attributes

isDirty_

bool helios::engine::modules::spatial::transform::components::ComposeTransformComponent::isDirty_ = true

Flag indicating if the transform has changed since the last update.

Definition at line 33 of file ComposeTransformComponent.ixx.

33 bool isDirty_= true;

isEnabled_

bool helios::engine::modules::spatial::transform::components::ComposeTransformComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 43 of file ComposeTransformComponent.ixx.

43 bool isEnabled_ = true;

transform_

helios::core::spatial::Transform helios::engine::modules::spatial::transform::components::ComposeTransformComponent::transform_ {}

The local transformation (translation, rotation, scale).

Definition at line 28 of file ComposeTransformComponent.ixx.

worldTransform_

helios::math::mat4f helios::engine::modules::spatial::transform::components::ComposeTransformComponent::worldTransform_ = helios::math::mat4f::identity()

The computed world transformation matrix.

Definition at line 38 of file ComposeTransformComponent.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.