Ocular Engine
Ocular::Math::Transform Class Reference
Inheritance diagram for Ocular::Math::Transform:
Ocular::Core::ObjectIO Ocular::Core::Exposable Ocular::Core::Buildable

Public Types

enum  DirtyFlags { None = 0, Position = 1, Rotation = 2, Scale = 4 }
 

Public Member Functions

 Transform (Vector3f const &position, Quaternion const &rotation, Vector3f const &scale)
 
void refresh ()
 
uint32_t getDirtyFlags (bool clearFlags=true)
 
void setPosition (Vector3f const &position)
 
void setPosition (float const x, float const y, float const z)
 
Vector3f const & getPosition () const
 
void setRotation (Quaternion const &rotation)
 
Quaternion const & getRotation () const
 
void setScale (Vector3f const &scale)
 
Vector3f const & getScale () const
 
Vector3f getForwards () const
 
Vector3f getUp () const
 
Vector3f getRight () const
 
Matrix4x4 const & getModelMatrix () const
 
void translate (Vector3f const &translation, bool local=true)
 
void moveForward (float const delta)
 
void moveUp (float const delta)
 
void moveRight (float const delta)
 
void rotate (float angle, Vector3f const &axis)
 
void rotate (Math::Quaternion const &rotation)
 
void lookAt (Vector3f const &point, Vector3f const &upVector=Vector3f::Up())
 
virtual void onLoad (Core::BuilderNode const *node) override
 
virtual void onVariableModified (std::string const &varName) override
 
- Public Member Functions inherited from Ocular::Core::ObjectIO
virtual void onSave (BuilderNode *node) const override
 
- Public Member Functions inherited from Ocular::Core::Exposable
void getAllExposedNames (std::vector< std::string > &names) const
 
bool getVariable (std::string const &name, ExposedVariable &var)
 
template<typename T >
bool getVariableValue (std::string const &name, T &var)
 
template<typename T >
bool setVariableValue (std::string const &name, T const &value)
 

Additional Inherited Members

- Protected Member Functions inherited from Ocular::Core::Exposable
void exposeVariable (std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data)
 
- Protected Attributes inherited from Ocular::Core::Exposable
std::unordered_map< std::string, ExposedVariablem_ExposedVariables
 

Member Function Documentation

Vector3f Ocular::Math::Transform::getForwards ( ) const

Retrieves the forwards (negative z-axis) vector of this transform.

Matrix4x4 const & Ocular::Math::Transform::getModelMatrix ( ) const

Returns the model matrix composed of the current position, rotation, and scale.

Vector3f Ocular::Math::Transform::getRight ( ) const

Retrieves the right (positive x-axis) vector of this transform.

Vector3f Ocular::Math::Transform::getUp ( ) const

Retrieves the upwards (positive y-axis) vector of this transform.

void Ocular::Math::Transform::lookAt ( Vector3f const &  point,
Vector3f const &  upVector = Vector3f::Up() 
)

Rotates the transform so that the forward vector points at the specified point.

Parameters
[in]pointPoint position in space to look at.
[in]upVectorVector that specifies the new up vector.
void Ocular::Math::Transform::moveForward ( float const  delta)

Moves the transform along the forward vector for the given delta. Moving backwards can be achieved by specifying a negative delta.

Parameters
[in]delta
void Ocular::Math::Transform::moveRight ( float const  delta)

Moves the transform along the right vector for the given delta. Moving left can be achieved by specifying a negative delta.

Parameters
[in]delta
void Ocular::Math::Transform::moveUp ( float const  delta)

Moves the transform along the up vector for the given delta. Moving downwards can be achieved by specifying a negative delta.

Parameters
[in]delta
void Ocular::Math::Transform::onLoad ( Core::BuilderNode const *  node)
overridevirtual

Alternate creation method (opposed to the constructor) in which one is provided with a BuilderNode chain. This chain may be explored to retrieve any relevant variables, and their values, that may have been stored in it.

This method will typically mirror the onSave, in which relevant values are stored within the chain.

Parameters
[in]nodeNode to extract variable information from

Reimplemented from Ocular::Core::ObjectIO.

void Ocular::Math::Transform::onVariableModified ( std::string const &  varName)
overridevirtual

Optional method that should be called after modifying an exposed variable. This allows the implementation a chance to react to the modification if necessary.

Reimplemented from Ocular::Core::Exposable.

void Ocular::Math::Transform::refresh ( )

Forces a rebuild of the Model matrix. Typically this matrix is only built when a 'set' method is called.

void Ocular::Math::Transform::rotate ( float  angle,
Vector3f const &  axis 
)

Rotates the transform on the specified axis by the given angle.

Parameters
[in]angleAngles to rotate in degrees.
[in]axisNormalized vector axis to rotate on.
void Ocular::Math::Transform::translate ( Vector3f const &  translation,
bool  local = true 
)

Translates the transform in the specified direction and distance.

Parameters
[in]translation

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