33#ifndef DVD_TRANSFORM_COMPONENT_H_
34#define DVD_TRANSFORM_COMPONENT_H_
41 class TransformComponentSGN;
54 friend class Attorney::TransformComponentSGN;
68 void getWorldMatrix(
mat4<F32>& matOut)
const;
69 void getWorldMatrixInterpolated(
mat4<F32>& matrixOut)
const;
70 [[nodiscard]]
mat4<F32> getWorldMatrix()
const;
71 [[nodiscard]]
mat4<F32> getWorldMatrixInterpolated()
const;
76 void getLocalRotationMatrix(
mat4<F32>& matOut )
const;
77 void getLocalRotationMatrixInterpolated(
mat4<F32>& matOut )
const;
82 void getWorldRotationMatrix(
mat4<F32>& matOut )
const;
83 void getWorldRotationMatrixInterpolated(
mat4<F32>& matOut )
const;
86 void setPosition(
const vec3<F32>& position)
override;
87 void setPosition(
F32 x,
F32 y,
F32 z)
override;
88 void setPositionX(
F32 positionX)
override;
89 void setPositionY(
F32 positionY)
override;
90 void setPositionZ(
F32 positionZ)
override;
91 void translate(
const vec3<F32>& axisFactors)
override;
94 void setScale(
const vec3<F32>& amount)
override;
95 void setScaleX(
F32 amount)
override;
96 void setScaleY(
F32 amount)
override;
97 void setScaleZ(
F32 amount)
override;
98 void scale(
const vec3<F32>& axisFactors)
override;
99 void scaleX(
F32 amount)
override;
100 void scaleY(
F32 amount)
override;
101 void scaleZ(
F32 amount)
override;
128 [[nodiscard]]
bool isUniformScaled() const noexcept;
131 [[nodiscard]]
vec3<
F32> getWorldPosition() const;
133 [[nodiscard]]
vec3<
F32> getLocalPosition() const;
135 [[nodiscard]]
vec3<
F32> getWorldPositionInterpolated() const;
137 [[nodiscard]]
vec3<
F32> getLocalPositionInterpolated() const;
140 [[nodiscard]]
vec3<
F32> getFwdVector() const;
142 [[nodiscard]]
vec3<
F32> getUpVector() const;
144 [[nodiscard]]
vec3<
F32> getRightVector() const;
147 [[nodiscard]]
vec3<
F32> getWorldScale() const;
149 [[nodiscard]]
vec3<
F32> getLocalScale() const;
151 [[nodiscard]]
vec3<
F32> getWorldScaleInterpolated() const;
153 [[nodiscard]]
vec3<
F32> getLocalScaleInterpolated() const;
160 [[nodiscard]]
Quaternion<
F32> getWorldOrientationInterpolated() const;
162 [[nodiscard]]
Quaternion<
F32> getLocalOrientationInterpolated() const;
167 void setTransforms(const
mat4<
F32>& transform);
171 void pushTransforms();
172 bool popTransforms();
175 void setOffset(
bool state, const
mat4<
F32>& offset =
mat4<
F32>()) noexcept;
177 [[nodiscard]]
bool saveCache(
ByteBuffer& outputBuffer) const override;
178 [[nodiscard]]
bool loadCache(
ByteBuffer& inputBuffer) override;
192 template<typename T, typename U>
197 void setTransformDirty(
U32 typeMask) noexcept;
199 void updateCachedValues();
201 void onParentTransformDirty(
U32 transformMask) noexcept;
207 void getScale(
vec3<
F32>& scaleOut) const override;
208 void getPosition(
vec3<
F32>& posOut) const override;
209 void getOrientation(
Quaternion<
F32>& quatOut) const override;
213 [[nodiscard]]
vec3<
F32> getDerivedPosition() const;
214 [[nodiscard]]
vec3<
F32> getDerivedScale() const;
217 void updateLocalMatrix(
D64 interpolationFactor );
219 void updateLocalMatrixLocked();
220 void updateLocalMatrixInterpolated(
D64 interpolationFactor );
227 std::atomic_uint _transformUpdatedMask{};
235 bool _cacheDirty =
true;
236 bool _uniformScaled =
true;
247 comp.onParentTransformDirty(transformMask);
251 comp.onParentUsageChanged(context);
255 comp.onParentChanged(oldParent, newParent);
#define BEGIN_COMPONENT_EXT1(Name, Enum, Base1)
#define END_COMPONENT(Name)
Handle console commands that start with a forward slash.
NodeUsageContext
Usage context affects lighting, navigation, physics, etc.
std::shared_mutex SharedMutex
static const vec3< F32 > WORLD_Z_NEG_AXIS
void setDirection(const vec3< F32 > &direction)
static const mat4< F32 > MAT4_IDENTITY
static const vec3< F32 > WORLD_Y_AXIS
constexpr T toBit(const T X)
Converts an arbitrary positive integer value to a bitwise value used for masks.