Skip to main content

DimensionComponent.ixx File

Stores physical dimensions together with a measurement unit. More...

Included Headers

#include <helios.engine.core.units.Unit> #include <helios.engine.core.spatial> #include <helios.math.types> #include <helios.engine.runtime.world.GameObject>

Namespaces Index

namespacehelios
namespaceengine
namespacespatial
namespacecomponents

Classes Index

classDimensionComponent<THandle>

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

Description

Stores physical dimensions together with a measurement unit.

File Listing

The file content with the documentation metadata removed is:

1
7module;
8
9export module helios.engine.spatial.components.DimensionComponent;
10
11import helios.engine.runtime.world.GameObject;
12import helios.math.types;
13
14import helios.engine.core.spatial;
15import helios.engine.core.units.Unit;
16
17
19
28 template<typename THandle>
33 float width_;
34
38 float height_;
39
43 float depth_;
44
49
53 bool isDirty_ = true;
54
58 bool isEnabled_ = true;
59
60 public:
61
68 return isEnabled_;
69 }
70
74 void enable() noexcept {
75 isEnabled_ = true;
76 }
77
82 isEnabled_ = false;
83 }
84
94 const float width,
95 const float height,
96 const float depth,
98 width_(width), height_(height), depth_(depth), unit_(unit) {}
99
101 const helios::math::vec3f scale,
103 width_(scale[0]), height_(scale[1]), depth_(scale[2]), unit_(unit) {}
104
111 width_(other.width_),
112 height_(other.height_),
113 depth_(other.depth_),
114 unit_(other.unit_),
115 isDirty_(true) {}
116
120
121
122
123
130 isDirty_ = true;
131 }
132
139 isDirty_ = true;
140 }
141
146 isDirty_ = false;
147 }
148
155 return isDirty_;
156 }
157
158
165 return unit_;
166 }
167
173 [[nodiscard]] helios::math::vec3f scaling() const noexcept {
174 return {width_, height_, depth_};
175 }
176
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 };
196
197
198 };
199
200}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.