Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Transform Class Referencefinal

#include <Transform.h>

+ Inheritance diagram for Divide::Transform:

Public Member Functions

 Transform () noexcept=default
 
 Transform (const Quaternion< F32 > &orientation, const vec3< F32 > &translation, const vec3< F32 > &scale) noexcept
 
void setPosition (const vec3< F32 > &position) noexcept override
 Set the local X,Y and Z position.
 
void setPosition (F32 x, F32 y, F32 z) noexcept override
 Set the local X,Y and Z position.
 
void setPositionX (F32 positionX) noexcept override
 Set the object's position on the X axis.
 
void setPositionY (F32 positionY) noexcept override
 Set the object's position on the Y axis.
 
void setPositionZ (F32 positionZ) noexcept override
 Set the object's position on the Z axis.
 
void translate (const vec3< F32 > &axisFactors) noexcept override
 Add the specified translation factors to the current local position.
 
void setScale (const vec3< F32 > &amount) noexcept override
 Set the local X,Y and Z amount factors.
 
void setScaleX (F32 amount) noexcept override
 Set the scaling factor on the X axis.
 
void setScaleY (F32 amount) noexcept override
 Set the scaling factor on the Y axis.
 
void setScaleZ (F32 amount) noexcept override
 Set the scaling factor on the Z axis.
 
void scale (const vec3< F32 > &axisFactors) noexcept override
 Add the specified scale factors to the current local position.
 
void scaleX (F32 amount) noexcept override
 Increase the scaling factor on the X axis by the specified factor.
 
void scaleY (F32 amount) noexcept override
 Increase the scaling factor on the Y axis by the specified factor.
 
void scaleZ (F32 amount) noexcept override
 Increase the scaling factor on the Z axis by the specified factor.
 
void setRotation (const vec3< F32 > &axis, Angle::DEGREES< F32 > degrees) noexcept override
 
void setRotation (Angle::DEGREES< F32 > pitch, Angle::DEGREES< F32 > yaw, Angle::DEGREES< F32 > roll) noexcept override
 
void setRotation (const Quaternion< F32 > &quat) noexcept override
 Set the local orientation so that it matches the specified quaternion.
 
void setRotationX (Angle::DEGREES< F32 > angle) noexcept override
 
void setRotationY (Angle::DEGREES< F32 > angle) noexcept override
 
void setRotationZ (Angle::DEGREES< F32 > angle) noexcept override
 
void rotate (const vec3< F32 > &axis, Angle::DEGREES< F32 > degrees) noexcept override
 
void rotate (Angle::DEGREES< F32 > pitch, Angle::DEGREES< F32 > yaw, Angle::DEGREES< F32 > roll) noexcept override
 
void rotate (const Quaternion< F32 > &quat) noexcept override
 Apply the specified Quaternion rotation starting from the current orientation.
 
void rotateSlerp (const Quaternion< F32 > &quat, D64 deltaTime) override
 Perform a SLERP rotation towards the specified quaternion.
 
void rotateX (Angle::DEGREES< F32 > angle) noexcept override
 
void rotateY (Angle::DEGREES< F32 > angle) noexcept override
 
void rotateZ (Angle::DEGREES< F32 > angle) noexcept override
 
void getScale (vec3< F32 > &scaleOut) const noexcept override
 Return the scale factor.
 
void getPosition (vec3< F32 > &posOut) const noexcept override
 Return the position.
 
void getOrientation (Quaternion< F32 > &quatOut) const noexcept override
 Return the orientation quaternion.
 
bool isUniformScale (const F32 tolerance=EPSILON_F32) const noexcept
 
void setTransforms (const mat4< F32 > &transform)
 
void clone (const Transform *transform) noexcept
 Set all of the internal values to match those of the specified transform.
 
void setValues (const TransformValues &values) noexcept
 Set position, scale and rotation based on the specified transform values.
 
bool operator== (const Transform &other) const
 Compares 2 transforms.
 
bool operator!= (const Transform &other) const
 
void identity () noexcept
 Reset transform to identity.
 
- Public Member Functions inherited from Divide::ITransform
virtual ~ITransform ()=default
 
virtual void setPosition (const vec3< F32 > &position)=0
 Set the local X,Y and Z position.
 
virtual void setPosition (F32 x, F32 y, F32 z)=0
 Set the local X,Y and Z position.
 
virtual void setPositionX (F32 positionX)=0
 Set the object's position on the X axis.
 
virtual void setPositionY (F32 positionY)=0
 Set the object's position on the Y axis.
 
virtual void setPositionZ (F32 positionZ)=0
 Set the object's position on the Z axis.
 
virtual void translate (const vec3< F32 > &axisFactors)=0
 Add the specified translation factors to the current local position.
 
virtual void setScale (const vec3< F32 > &amount)=0
 Set the local X,Y and Z scale factors.
 
virtual void setScaleX (F32 amount)=0
 Set the scaling factor on the X axis.
 
virtual void setScaleY (F32 amount)=0
 Set the scaling factor on the Y axis.
 
virtual void setScaleZ (F32 amount)=0
 Set the scaling factor on the Z axis.
 
virtual void scale (const vec3< F32 > &axisFactors)=0
 Add the specified scale factors to the current local position.
 
virtual void scaleX (F32 amount)=0
 Increase the scaling factor on the X axis by the specified factor.
 
virtual void scaleY (F32 amount)=0
 Increase the scaling factor on the Y axis by the specified factor.
 
virtual void scaleZ (F32 amount)=0
 Increase the scaling factor on the Z axis by the specified factor.
 
virtual void setRotation (const vec3< F32 > &axis, Angle::DEGREES< F32 > degrees)=0
 
virtual void setRotation (Angle::DEGREES< F32 > pitch, Angle::DEGREES< F32 > yaw, Angle::DEGREES< F32 > roll)=0
 
virtual void setRotation (const Quaternion< F32 > &quat)=0
 Set the local orientation so that it matches the specified quaternion.
 
virtual void setRotationX (Angle::DEGREES< F32 > angle)=0
 
virtual void setRotationY (Angle::DEGREES< F32 > angle)=0
 
virtual void setRotationZ (Angle::DEGREES< F32 > angle)=0
 
virtual void rotate (const vec3< F32 > &axis, Angle::DEGREES< F32 > degrees)=0
 
virtual void rotate (Angle::DEGREES< F32 > pitch, Angle::DEGREES< F32 > yaw, Angle::DEGREES< F32 > roll)=0
 
virtual void rotate (const Quaternion< F32 > &quat)=0
 Apply the specified Quaternion rotation starting from the current orientation.
 
virtual void rotateSlerp (const Quaternion< F32 > &quat, D64 deltaTime)=0
 Perform a SLERP rotation towards the specified quaternion.
 
virtual void rotateX (Angle::DEGREES< F32 > angle)=0
 Rotate on the X axis (Axis-Angle used) by the specified angle (either degrees or radians)
 
virtual void rotateY (Angle::DEGREES< F32 > angle)=0
 Rotate on the Y axis (Axis-Angle used) by the specified angle (either degrees or radians)
 
virtual void rotateZ (Angle::DEGREES< F32 > angle)=0
 Rotate on the Z axis (Axis-Angle used) by the specified angle (either degrees or radians)
 
void setScale (F32 amount)
 Set an uniform scale on all three axis.
 
void setScale (F32 x, F32 y, F32 z)
 Set a scaling factor for each axis.
 
void setRotationEuler (const vec3< F32 > &euler)
 Set the euler rotation in degrees.
 
void translate (F32 x, F32 y, F32 z)
 Translate the object on each axis by the specified amount.
 
void translateX (F32 positionX)
 Translate the object on the X axis by the specified amount.
 
void translateY (F32 positionY)
 Translate the object on the Y axis by the specified amount.
 
void translateZ (F32 positionZ)
 Translate the object on the Z axis by the specified amount.
 
void scale (F32 amount)
 Increase the scaling factor on all three axis by an uniform factor.
 
void scale (F32 x, F32 y, F32 z)
 Increase the scaling factor on all three axis by the specified amounts.
 
void rotate (F32 xAxis, F32 yAxis, F32 zAxis, Angle::DEGREES< F32 > degrees)
 Apply an axis-angle rotation.
 
void rotate (const vec3< F32 > &euler)
 Apply an euler rotation.
 
virtual void getScale (vec3< F32 > &scaleOut) const =0
 Return the scale factor.
 
virtual void getPosition (vec3< F32 > &posOut) const =0
 Return the position.
 
virtual void getOrientation (Quaternion< F32 > &quatOut) const =0
 Return the orientation quaternion.
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 
- Public Attributes inherited from Divide::TransformValues
Quaternion< F32_orientation {}
 
vec3< F32_translation { VECTOR3_ZERO }
 The object's position in the world as a 3 component vector.
 
vec3< F32_scale { VECTOR3_UNIT }
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 
- Private Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Detailed Description

Definition at line 41 of file Transform.h.

Constructor & Destructor Documentation

◆ Transform() [1/2]

Divide::Transform::Transform ( )
defaultnoexcept

◆ Transform() [2/2]

Divide::Transform::Transform ( const Quaternion< F32 > &  orientation,
const vec3< F32 > &  translation,
const vec3< F32 > &  scale 
)
explicitnoexcept

Definition at line 7 of file Transform.cpp.

Member Function Documentation

◆ clone()

void Divide::Transform::clone ( const Transform transform)
inlinenoexcept

Set all of the internal values to match those of the specified transform.

Definition at line 195 of file Transform.inl.

◆ getOrientation()

void Divide::Transform::getOrientation ( Quaternion< F32 > &  quatOut) const
inlineoverridevirtualnoexcept

Return the orientation quaternion.

Implements Divide::ITransform.

Definition at line 187 of file Transform.inl.

◆ getPosition()

void Divide::Transform::getPosition ( vec3< F32 > &  posOut) const
inlineoverridevirtualnoexcept

Return the position.

Implements Divide::ITransform.

Definition at line 182 of file Transform.inl.

◆ getScale()

void Divide::Transform::getScale ( vec3< F32 > &  scaleOut) const
inlineoverridevirtualnoexcept

Return the scale factor.

Implements Divide::ITransform.

Definition at line 177 of file Transform.inl.

◆ identity()

void Divide::Transform::identity ( )
noexcept

Reset transform to identity.

Definition at line 21 of file Transform.cpp.

◆ isUniformScale()

bool Divide::Transform::isUniformScale ( const F32  tolerance = EPSILON_F32) const
inlinenoexcept

Definition at line 191 of file Transform.inl.

◆ operator!=()

FORCE_INLINE bool Divide::Transform::operator!= ( const Transform other) const

Definition at line 211 of file Transform.inl.

◆ operator==()

FORCE_INLINE bool Divide::Transform::operator== ( const Transform other) const

Compares 2 transforms.

Definition at line 207 of file Transform.inl.

◆ rotate() [1/3]

void Divide::Transform::rotate ( Angle::DEGREES< F32 pitch,
Angle::DEGREES< F32 yaw,
Angle::DEGREES< F32 roll 
)
inlineoverridevirtualnoexcept

Apply the specified Euler rotation starting from the current orientation. The angles can be in either degrees(default) or radians

Implements Divide::ITransform.

Definition at line 105 of file Transform.inl.

◆ rotate() [2/3]

void Divide::Transform::rotate ( const Quaternion< F32 > &  quat)
inlineoverridevirtualnoexcept

Apply the specified Quaternion rotation starting from the current orientation.

Implements Divide::ITransform.

Definition at line 110 of file Transform.inl.

◆ rotate() [3/3]

void Divide::Transform::rotate ( const vec3< F32 > &  axis,
Angle::DEGREES< F32 degrees 
)
inlineoverridevirtualnoexcept

Apply the specified Axis-Angle rotation starting from the current orientation. The angles can be in either degrees(default) or radians

Implements Divide::ITransform.

Definition at line 98 of file Transform.inl.

◆ rotateSlerp()

void Divide::Transform::rotateSlerp ( const Quaternion< F32 > &  quat,
D64  deltaTime 
)
inlineoverridevirtual

Perform a SLERP rotation towards the specified quaternion.

Implements Divide::ITransform.

Definition at line 115 of file Transform.inl.

◆ rotateX()

void Divide::Transform::rotateX ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Rotate on the X axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 147 of file Transform.inl.

◆ rotateY()

void Divide::Transform::rotateY ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Rotate on the Y axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 152 of file Transform.inl.

◆ rotateZ()

void Divide::Transform::rotateZ ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Rotate on the Z axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 157 of file Transform.inl.

◆ scale()

void Divide::Transform::scale ( const vec3< F32 > &  axisFactors)
inlineoverridevirtualnoexcept

Add the specified scale factors to the current local position.

Implements Divide::ITransform.

Definition at line 91 of file Transform.inl.

◆ scaleX()

void Divide::Transform::scaleX ( F32  amount)
inlineoverridevirtualnoexcept

Increase the scaling factor on the X axis by the specified factor.

Implements Divide::ITransform.

Definition at line 134 of file Transform.inl.

◆ scaleY()

void Divide::Transform::scaleY ( F32  amount)
inlineoverridevirtualnoexcept

Increase the scaling factor on the Y axis by the specified factor.

Implements Divide::ITransform.

Definition at line 138 of file Transform.inl.

◆ scaleZ()

void Divide::Transform::scaleZ ( F32  amount)
inlineoverridevirtualnoexcept

Increase the scaling factor on the Z axis by the specified factor.

Implements Divide::ITransform.

Definition at line 142 of file Transform.inl.

◆ setPosition() [1/2]

void Divide::Transform::setPosition ( const vec3< F32 > &  position)
inlineoverridevirtualnoexcept

Set the local X,Y and Z position.

Implements Divide::ITransform.

Definition at line 38 of file Transform.inl.

◆ setPosition() [2/2]

void Divide::Transform::setPosition ( F32  x,
F32  y,
F32  z 
)
inlineoverridevirtualnoexcept

Set the local X,Y and Z position.

Implements Divide::ITransform.

Definition at line 43 of file Transform.inl.

◆ setPositionX()

void Divide::Transform::setPositionX ( F32  positionX)
inlineoverridevirtualnoexcept

Set the object's position on the X axis.

Implements Divide::ITransform.

Definition at line 48 of file Transform.inl.

◆ setPositionY()

void Divide::Transform::setPositionY ( F32  positionY)
inlineoverridevirtualnoexcept

Set the object's position on the Y axis.

Implements Divide::ITransform.

Definition at line 52 of file Transform.inl.

◆ setPositionZ()

void Divide::Transform::setPositionZ ( F32  positionZ)
inlineoverridevirtualnoexcept

Set the object's position on the Z axis.

Implements Divide::ITransform.

Definition at line 57 of file Transform.inl.

◆ setRotation() [1/3]

void Divide::Transform::setRotation ( Angle::DEGREES< F32 pitch,
Angle::DEGREES< F32 yaw,
Angle::DEGREES< F32 roll 
)
inlineoverridevirtualnoexcept

Set the local orientation using the Euler system. The angles can be in either degrees(default) or radians

Implements Divide::ITransform.

Definition at line 75 of file Transform.inl.

◆ setRotation() [2/3]

void Divide::Transform::setRotation ( const Quaternion< F32 > &  quat)
inlineoverridevirtualnoexcept

Set the local orientation so that it matches the specified quaternion.

Implements Divide::ITransform.

Definition at line 80 of file Transform.inl.

◆ setRotation() [3/3]

void Divide::Transform::setRotation ( const vec3< F32 > &  axis,
Angle::DEGREES< F32 degrees 
)
inlineoverridevirtualnoexcept

Set the local orientation using the Axis-Angle system. The angle can be in either degrees(default) or radians

Implements Divide::ITransform.

Definition at line 68 of file Transform.inl.

◆ setRotationX()

void Divide::Transform::setRotationX ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Set the rotation on the X axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 162 of file Transform.inl.

◆ setRotationY()

void Divide::Transform::setRotationY ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Set the rotation on the Y axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 167 of file Transform.inl.

◆ setRotationZ()

void Divide::Transform::setRotationZ ( Angle::DEGREES< F32 angle)
inlineoverridevirtualnoexcept

Set the rotation on the Z axis (Axis-Angle used) by the specified angle (either degrees or radians)

Implements Divide::ITransform.

Definition at line 172 of file Transform.inl.

◆ setScale()

void Divide::Transform::setScale ( const vec3< F32 > &  amount)
inlineoverridevirtualnoexcept

Set the local X,Y and Z amount factors.

Implements Divide::ITransform.

Definition at line 62 of file Transform.inl.

◆ setScaleX()

void Divide::Transform::setScaleX ( F32  amount)
inlineoverridevirtualnoexcept

Set the scaling factor on the X axis.

Implements Divide::ITransform.

Definition at line 121 of file Transform.inl.

◆ setScaleY()

void Divide::Transform::setScaleY ( F32  amount)
inlineoverridevirtualnoexcept

Set the scaling factor on the Y axis.

Implements Divide::ITransform.

Definition at line 125 of file Transform.inl.

◆ setScaleZ()

void Divide::Transform::setScaleZ ( F32  amount)
inlineoverridevirtualnoexcept

Set the scaling factor on the Z axis.

Implements Divide::ITransform.

Definition at line 129 of file Transform.inl.

◆ setTransforms()

void Divide::Transform::setTransforms ( const mat4< F32 > &  transform)

Sets the transform to match a certain transformation matrix. Scale, orientation and translation are extracted from the specified matrix

Definition at line 14 of file Transform.cpp.

◆ setValues()

void Divide::Transform::setValues ( const TransformValues values)
inlinenoexcept

Set position, scale and rotation based on the specified transform values.

Definition at line 200 of file Transform.inl.

◆ translate()

void Divide::Transform::translate ( const vec3< F32 > &  axisFactors)
inlineoverridevirtualnoexcept

Add the specified translation factors to the current local position.

Implements Divide::ITransform.

Definition at line 86 of file Transform.inl.


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