NcEngine
nc::Transform Class Referencefinal

Component with translation, rotation, and scale properties. More...

#include <Transform.h>

Inheritance diagram for nc::Transform:
nc::ComponentBase

Public Member Functions

 Transform (Entity entity, const Vector3 &pos, const Quaternion &rot, const Vector3 &scale)
 
 Transform (Entity entity, const Vector3 &pos, const Quaternion &rot, const Vector3 &scale, DirectX::FXMMATRIX parentTransform)
 
 Transform (Transform &&)=default
 
Transformoperator= (Transform &&)=default
 
 Transform (const Transform &)=delete
 
Transformoperator= (const Transform &)=delete
 
auto Position () const noexcept -> Vector3
 Get world space position.
 
auto PositionXM () const noexcept -> DirectX::FXMVECTOR
 Get world space position as an XMVECTOR.
 
auto LocalPosition () const noexcept -> Vector3
 Get local space position.
 
auto LocalPositionXM () const noexcept -> DirectX::FXMVECTOR
 Get local space position as an XMVECTOR.
 
auto Rotation () const noexcept -> Quaternion
 Get world space rotation.
 
auto RotationXM () const noexcept -> DirectX::XMVECTOR
 Get world space rotation as an XMVECTOR.
 
auto LocalRotation () const noexcept -> Quaternion
 Get local space rotation.
 
auto LocalRotationXM () const noexcept -> DirectX::XMVECTOR
 Get local space rotation as an XMVECTOR.
 
auto Scale () const noexcept -> Vector3
 Get world space scale.
 
auto ScaleXM () const noexcept -> DirectX::XMVECTOR
 Get world space scale as an XMVECTOR.
 
auto LocalScale () const noexcept -> Vector3
 Get local space scale.
 
auto LocalScaleXM () const noexcept -> DirectX::XMVECTOR
 Get local space scale as an XMVECTOR.
 
auto TransformationMatrix () const noexcept -> DirectX::FXMMATRIX
 Get world space matrix.
 
auto LocalTransformationMatrix () const noexcept -> DirectX::FXMMATRIX
 Get local space matrix.
 
auto ToLocalSpace (const Vector3 &vec) const -> Vector3
 Get local space matrix.
 
auto Up () const noexcept -> Vector3
 Get the up axis of the transform.
 
auto UpXM () const noexcept -> DirectX::XMVECTOR
 Get the up axis of the transform as an XMVECTOR.
 
auto Forward () const noexcept -> Vector3
 Get the forward axis of the transform.
 
auto ForwardXM () const noexcept -> DirectX::XMVECTOR
 Get the forward axis of the transform as an XMVECTOR.
 
auto Right () const noexcept -> Vector3
 Get the right axis of the transform.
 
auto RightXM () const noexcept -> DirectX::XMVECTOR
 Get the right axis of the transform as an XMVECTOR.
 
void Set (const Vector3 &pos, const Quaternion &quat, const Vector3 &scale)
 Set all local values [Quaternion].
 
void Set (const Vector3 &pos, const Vector3 &angles, const Vector3 &scale)
 Set all local values [Angles].
 
void SetPosition (const Vector3 &pos)
 Set local position.
 
void SetRotation (const Quaternion &quat)
 Set local rotation [Quaternion].
 
void SetRotation (const Vector3 &angles)
 Set local rotation [Angles].
 
void SetScale (const Vector3 &scale)
 Set local scale.
 
void SetPositionAndRotationXM (DirectX::FXMVECTOR position, DirectX::FXMVECTOR orientation)
 Set local position and rotation from XMVECTORs.
 
void Translate (const Vector3 &vec)
 Add to local position.
 
void Translate (DirectX::FXMVECTOR translation)
 Add to local position [XMVECTOR].
 
void TranslateLocalSpace (const Vector3 &vec)
 Rotate a vector into local space and add it to local position.
 
void Rotate (const Quaternion &quat)
 Apply rotation quaternion to local rotation.
 
void Rotate (DirectX::FXMVECTOR quaternion)
 Apply a rotation quaternion to local rotation [XMVECTOR].
 
void Rotate (const Vector3 &axis, float radians)
 Apply a rotation about an axis to local rotation.
 
void RotateAround (const Vector3 &point, const Vector3 &axis, float radians)
 Apply a rotation about an axis passing through a point.
 
void LookAt (const Vector3 &target)
 Rotate to point towards a target position.
 
- Public Member Functions inherited from nc::ComponentBase
 ComponentBase (Entity entity) noexcept
 
 ComponentBase (const ComponentBase &)=delete
 
 ComponentBase (ComponentBase &&)=default
 
ComponentBaseoperator= (const ComponentBase &)=delete
 
ComponentBaseoperator= (ComponentBase &&)=default
 
Entity ParentEntity () const noexcept
 

Friends

class ecs::EcsModule
 

Detailed Description

Component with translation, rotation, and scale properties.

Note
Transforms are automatically added and removed with their parent Entity. They do not need to be explicity created.

A Transform's initial values can be set in EntityInfo when adding an Entity.

Data is stored for local and world space, but only local space values may be directly modified. World space calculations are done internally based on the Entity's Hierarchy component.


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