Skip to main content

DimensionComponent Class Template

Component that defines the physical dimensions (scale) of an entity. More...

Declaration

template <typename THandle> class helios::engine::spatial::components::DimensionComponent<THandle> { ... }

Public Constructors Index

template <typename THandle>
DimensionComponent (const float width, const float height, const float depth, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter)

Constructs a DimensionComponent with specified dimensions and unit. More...

template <typename THandle>
DimensionComponent (const helios::math::vec3f scale, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter)
template <typename THandle>
DimensionComponent (const DimensionComponent &other)

Copy constructor. More...

template <typename THandle>
DimensionComponent (DimensionComponent &&) noexcept=default

Public Operators Index

template <typename THandle>
DimensionComponent &operator= (const DimensionComponent &)=default
template <typename THandle>
DimensionComponent &operator= (DimensionComponent &&) noexcept=default

Public Member Functions Index

template <typename THandle>
boolisEnabled () const noexcept

Checks whether this component is enabled. More...

template <typename THandle>
voidenable () noexcept

Enables this component. More...

template <typename THandle>
voiddisable () noexcept

Disables this component. More...

template <typename THandle>
voidonAcquire () noexcept

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

template <typename THandle>
voidonRelease () noexcept

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

template <typename THandle>
voidclearDirty () noexcept

Clears the dirty flag. More...

template <typename THandle>
boolisDirty () const noexcept

Checks if the scale has changed. More...

template <typename THandle>
helios::engine::core::units::Unitunit () const noexcept

Retrieves the unit of measurement. More...

template <typename THandle>
helios::math::vec3fscaling () const noexcept

Retrieves the scaling vector (width, height, depth). More...

template <typename THandle>
voidsetDimensions (const float width, const float height, const float depth, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter) noexcept

Sets the dimensions and unit of the entity. More...

Private Member Attributes Index

template <typename THandle>
floatwidth_

Width of the entity. More...

template <typename THandle>
floatheight_

Height of the entity. More...

template <typename THandle>
floatdepth_

Depth of the entity. More...

template <typename THandle>
helios::engine::core::units::Unitunit_

Unit of measurement for the dimensions. More...

template <typename THandle>
boolisDirty_ = true

Flag indicating if the scale has changed. More...

template <typename THandle>
boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that defines the physical dimensions (scale) of an entity.

This component stores the width, height, and depth of an entity, along with the unit of measurement. It tracks changes via a dirty flag, allowing other systems to react to scale updates.

Definition at line 29 of file DimensionComponent.ixx.

Public Constructors

DimensionComponent()

template <typename THandle>
helios::engine::spatial::components::DimensionComponent< THandle >::DimensionComponent (const float width, const float height, const float depth, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter)
inline explicit

Constructs a DimensionComponent with specified dimensions and unit.

Parameters
width

Width of the entity.

height

Height of the entity.

depth

Depth of the entity.

unit

Unit of measurement (default: Meter).

Definition at line 93 of file DimensionComponent.ixx.

94 const float width,
95 const float height,
96 const float depth,
98 width_(width), height_(height), depth_(depth), unit_(unit) {}

DimensionComponent()

template <typename THandle>
helios::engine::spatial::components::DimensionComponent< THandle >::DimensionComponent (const helios::math::vec3f scale, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter)
inline explicit

Definition at line 100 of file DimensionComponent.ixx.

101 const helios::math::vec3f scale,
103 width_(scale[0]), height_(scale[1]), depth_(scale[2]), unit_(unit) {}

DimensionComponent()

template <typename THandle>
helios::engine::spatial::components::DimensionComponent< THandle >::DimensionComponent (const DimensionComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 110 of file DimensionComponent.ixx.

111 width_(other.width_),
112 height_(other.height_),
113 depth_(other.depth_),
114 unit_(other.unit_),
115 isDirty_(true) {}

DimensionComponent()

template <typename THandle>
helios::engine::spatial::components::DimensionComponent< THandle >::DimensionComponent (DimensionComponent &&)
noexcept default

Definition at line 118 of file DimensionComponent.ixx.

Public Operators

operator=()

template <typename THandle>
DimensionComponent & helios::engine::spatial::components::DimensionComponent< THandle >::operator= (const DimensionComponent &)
default

Definition at line 117 of file DimensionComponent.ixx.

operator=()

template <typename THandle>
DimensionComponent & helios::engine::spatial::components::DimensionComponent< THandle >::operator= (DimensionComponent &&)
noexcept default

Definition at line 119 of file DimensionComponent.ixx.

Public Member Functions

clearDirty()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::clearDirty ()
inline noexcept

Clears the dirty flag.

Definition at line 145 of file DimensionComponent.ixx.

146 isDirty_ = false;
147 }

disable()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::disable ()
inline noexcept

Disables this component.

Definition at line 81 of file DimensionComponent.ixx.

82 isEnabled_ = false;
83 }

enable()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::enable ()
inline noexcept

Enables this component.

Definition at line 74 of file DimensionComponent.ixx.

74 void enable() noexcept {
75 isEnabled_ = true;
76 }

isDirty()

template <typename THandle>
bool helios::engine::spatial::components::DimensionComponent< THandle >::isDirty ()
inline noexcept

Checks if the scale has changed.

Returns

True if dirty, false otherwise.

Definition at line 154 of file DimensionComponent.ixx.

155 return isDirty_;
156 }

isEnabled()

template <typename THandle>
bool helios::engine::spatial::components::DimensionComponent< THandle >::isEnabled ()
inline noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 67 of file DimensionComponent.ixx.

68 return isEnabled_;
69 }

onAcquire()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::onAcquire ()
inline noexcept

Resets the dirty flag to true when acquired.

Makes sure scaling is considered once the component was acquired.

Definition at line 129 of file DimensionComponent.ixx.

130 isDirty_ = true;
131 }

onRelease()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::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 138 of file DimensionComponent.ixx.

139 isDirty_ = true;
140 }

scaling()

template <typename THandle>
helios::math::vec3f helios::engine::spatial::components::DimensionComponent< THandle >::scaling ()
inline noexcept

Retrieves the scaling vector (width, height, depth).

Returns

A vec3f containing the dimensions.

Definition at line 173 of file DimensionComponent.ixx.

173 [[nodiscard]] helios::math::vec3f scaling() const noexcept {
174 return {width_, height_, depth_};
175 }

setDimensions()

template <typename THandle>
void helios::engine::spatial::components::DimensionComponent< THandle >::setDimensions (const float width, const float height, const float depth, const helios::engine::core::units::Unit unit=helios::engine::core::units::Unit::Meter)
inline noexcept

Sets the dimensions and unit of the entity.

Parameters
width

New width.

height

New height.

depth

New depth.

unit

New unit of measurement (default: Meter).

Definition at line 185 of file DimensionComponent.ixx.

185 void setDimensions(const float width, const float height, const float depth,
187 ) noexcept {
188
189 width_ = width;
190 height_ = height;
191 depth_ = depth;
192 unit_ = unit;
193 isDirty_ = true;
194
195 };

References helios::engine::spatial::registerComponents and helios::engine::spatial::components::DimensionComponent< THandle >::unit.

unit()

template <typename THandle>
helios::engine::core::units::Unit helios::engine::spatial::components::DimensionComponent< THandle >::unit ()
inline noexcept

Retrieves the unit of measurement.

Returns

The unit enum value.

Definition at line 164 of file DimensionComponent.ixx.

Referenced by helios::engine::spatial::components::DimensionComponent< THandle >::setDimensions.

Private Member Attributes

depth_

template <typename THandle>
float helios::engine::spatial::components::DimensionComponent< THandle >::depth_

Depth of the entity.

Definition at line 43 of file DimensionComponent.ixx.

43 float depth_;

height_

template <typename THandle>
float helios::engine::spatial::components::DimensionComponent< THandle >::height_

Height of the entity.

Definition at line 38 of file DimensionComponent.ixx.

38 float height_;

isDirty_

template <typename THandle>
bool helios::engine::spatial::components::DimensionComponent< THandle >::isDirty_ = true

Flag indicating if the scale has changed.

Definition at line 53 of file DimensionComponent.ixx.

53 bool isDirty_ = true;

isEnabled_

template <typename THandle>
bool helios::engine::spatial::components::DimensionComponent< THandle >::isEnabled_ = true

Whether this component is enabled.

Definition at line 58 of file DimensionComponent.ixx.

58 bool isEnabled_ = true;

unit_

template <typename THandle>
helios::engine::core::units::Unit helios::engine::spatial::components::DimensionComponent< THandle >::unit_

Unit of measurement for the dimensions.

Definition at line 48 of file DimensionComponent.ixx.

width_

template <typename THandle>
float helios::engine::spatial::components::DimensionComponent< THandle >::width_

Width of the entity.

Definition at line 33 of file DimensionComponent.ixx.

33 float width_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.