![]() |
COGS
Computer Graphics Structures library
|
Class used for effective management and manipulation with bone transformation. More...
Public Member Functions | |
| BoneTransform ()=default | |
| Creates identity bone with unit length. | |
| BoneTransform (const glm::vec3 &global_tail, const glm::mat4 &global_parent_tail_transform, const float basis_roll_angle=0.0f) | |
| Creates child bone, oriented and stretched in length. Relative to the parent. More... | |
| BoneTransform (const BoneTransform &)=default | |
| BoneTransform & | operator= (const BoneTransform &)=default |
| BoneTransform (BoneTransform &&) noexcept=default | |
| BoneTransform & | operator= (BoneTransform &&) noexcept=default |
| void | StretchLength (const float &length_change) |
| Changes length of bone by multiplying current length. | |
| void | SetLength (const float &new_length) |
| Resets bone length to the new value. | |
| const float & | GetLength () const |
| Returns bone length. | |
| const glm::mat4 & | GetHeadMat4 () const |
| Returns local transformation matrix, with origin according to the bone head position. | |
| const glm::mat4 & | GetTailMat4 () const |
| Returns local transformation matrix, with origin according to the bone tail position. | |
| void | InterpolateTo (const BoneTransform &target_transform, const float target_weight, BoneTransform *out_transform) const |
| Interpolates current transform with another, in a specific mix ratio. More... | |
| virtual void | SaveToStream (std::ostream &ostr) const override |
| Writes relevant information to stream. | |
| virtual void | LoadFromStream (std::istream &istr) override |
| Reads relevant information from stream. | |
Public Member Functions inherited from cogs::Transform | |
| Transform ()=default | |
| Creates an identity instance. | |
| Transform (const glm::mat4 &matrix) | |
| Creates an instance from a given matrix. | |
| Transform (const std::function< void(void)> ¬ifier_func) | |
| Creates an identity instance which notifies whenever its state changes. | |
| Transform (const Transform &)=default | |
| Transform & | operator= (const Transform &)=default |
| Transform (Transform &&) noexcept=default | |
| Transform & | operator= (Transform &&) noexcept=default |
| void | Translate (const glm::vec3 &move_vector) |
| Changes position by a given vector. | |
| void | SetPosition (const glm::vec3 &position) |
| Removes current position and replaces with specified position. | |
| const glm::vec3 | GetPosition () const |
| Returns position defined by transformation. | |
| void | Rotate (const glm::quat &rotation) |
| Applies additional rotation to transform, relative to current rotation. | |
| void | SetRotation (const glm::quat &rotation) |
| Removes current rotation and replaces with specified quaternion. | |
| const glm::quat | GetRotation () const |
| Returns rotation defined by transformation. | |
| void | Scale (const glm::vec3 &scale) |
| Applies scale to transform, accumulated with previous scaling. | |
| void | SetScaling (const glm::vec3 &scale) |
| Resets scaling of transform. | |
| const glm::vec3 | GetScaling () const |
| Returns scaling defined by transformation. | |
| void | Set (const glm::mat4 &trans_mat) |
| Resets current transform so that it represents specified matrix. | |
| virtual const glm::mat4 & | GetMat4 () const |
| Returns composed matrix of final transformation: scaling > rotation > translation. | |
| void | AddTransform (const Transform &transform) |
| Multiply this transform by a given one. | |
| void | InterpolateWith (const Transform &target, const float target_weight, Transform *out_transform) const |
| Interpolates current transform with another, in a specific mix ratio. More... | |
| Transform | operator* (const Transform &t) const |
| Multiply two transforms equivalently to matrix multiplication. | |
| operator glm::mat4 () const | |
Protected Member Functions | |
| void | OnInvariantChange () override |
| Function called each time a change on position, rotation or scaling is performed. | |
Class used for effective management and manipulation with bone transformation.
Position represents offset from parent tail node in parent space. All the transformations are relative to parent bone transformation.
| cogs::BoneTransform::BoneTransform | ( | const glm::vec3 & | global_tail, |
| const glm::mat4 & | global_parent_tail_transform, | ||
| const float | basis_roll_angle = 0.0f |
||
| ) |
Creates child bone, oriented and stretched in length. Relative to the parent.
| global_tail | Global position of tail node of bone. |
| global_parent_tail_transform | Transformation matrix which describes parent space at its tail. |
| basis_roll_angle | Angular parameter which influences initial roll of generated y bone basis. |
| void cogs::BoneTransform::InterpolateTo | ( | const BoneTransform & | target_transform, |
| const float | target_weight, | ||
| BoneTransform * | out_transform | ||
| ) | const |
Interpolates current transform with another, in a specific mix ratio.
| target | The Transform which to interpolate to. |
| target_weight | Defines how much of target should be taken. Value 0 results in 100% of this transform, value 1 results in 100% of target. |
| out_transform | A pointer to an object where the computed transformation will be stored. |