#include <transformcomponent.h>
Public Member Functions | |
TransformComponentInstance (EntityInstance &entity, Component &resource) | |
virtual bool | init (utility::ErrorState &errorState) |
const glm::mat4x4 & | getLocalTransform () const |
void | setLocalTransform (const glm::mat4x4 &matrix) |
const glm::mat4x4 & | getGlobalTransform () const |
void | setDirty () |
bool | isDirty () const |
void | update (const glm::mat4 &parentTransform) |
void | setTranslate (const glm::vec3 &translate) |
const glm::vec3 & | getTranslate () const |
void | setRotate (const glm::quat &rotate) |
const glm::quat & | getRotate () const |
void | setScale (const glm::vec3 &scale) |
const glm::vec3 & | getScale () const |
void | setUniformScale (float scale) |
const float | getUniformScale () const |
virtual void | update (double deltaTime) |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
virtual void | update (double deltaTime) |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Describes the local transform of an entity, used to compute the global transform of an entity at runtime. When the transform is created the global and local transform is invalid. You can always query the current local matrix, the global matrix is updated on update().
TransformComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
const glm::mat4x4& getGlobalTransform | ( | ) | const |
Returns the global transform of this node. Note that the global transform can be out of sync as it's recomputed on update. point on resolve downwards
const glm::mat4x4& getLocalTransform | ( | ) | const |
Constructs and returns the local transform.
const glm::quat& getRotate | ( | ) | const |
const glm::vec3& getScale | ( | ) | const |
const glm::vec3& getTranslate | ( | ) | const |
const float getUniformScale | ( | ) | const |
|
virtual |
Initializes this component.
errorState | The error object |
Reimplemented from ComponentInstance.
bool isDirty | ( | ) | const |
void setDirty | ( | ) |
When set dirty, the transform component will re-compute the global and local transform matrices when requested.
void setLocalTransform | ( | const glm::mat4x4 & | matrix | ) |
Set the local transform based on the given matrix. Note that the matrix is decomposed, result is stored in the individual elements: Uniform scale is discarded, ie: the result will be 1.
matrix | new local transformation matrix. |
void setRotate | ( | const glm::quat & | rotate | ) |
Sets the rotation part of this component.
rotate | new component rotation. |
void setScale | ( | const glm::vec3 & | scale | ) |
Sets the scale factor of the x, y and z axis of this component. Note that the uniform scale is applied after axis dependent scale factor.
scale | the new component scale. |
void setTranslate | ( | const glm::vec3 & | translate | ) |
Sets the transformation part of this component.
translate | new component translation. |
void setUniformScale | ( | float | scale | ) |
Sets the uniform scale factor, applied to all axis. Note that the uniform scale is applied after the axis independent scale factor.
scale | the new component scale. |
void update | ( | const glm::mat4 & | parentTransform | ) |
Updates the global matrix based on the parent matrix If this or the parent matrix was marked dirty the global matrix of this node is recomputed. This is a recursive call
virtual void update |
Update this component
deltaTime | the time in between cooks in seconds |