Rendu
A lightweight rendering engine for experimentations
|
Rotate an object around an axis. More...
#include <Animation.hpp>
Public Member Functions | |
Rotation ()=default | |
Rotation (const glm::vec3 &axis, float speed, Frame frame) | |
glm::mat4 | apply (const glm::mat4 &m, double fullTime, double frameTime) override |
glm::vec4 | apply (const glm::vec4 &v, double fullTime, double frameTime) override |
bool | decode (const KeyValues ¶ms) |
KeyValues | encode () const override |
Public Member Functions inherited from Animation | |
virtual glm::mat4 | apply (const glm::mat4 &m, double fullTime, double frameTime)=0 |
virtual glm::vec4 | apply (const glm::vec4 &v, double fullTime, double frameTime)=0 |
virtual KeyValues | encode () const |
virtual | ~Animation ()=default |
Animation (const Animation &)=delete | |
Animation & | operator= (const Animation &)=delete |
Animation (Animation &&)=delete | |
Animation & | operator= (Animation &&)=delete |
Private Attributes | |
glm::vec3 | _axis = glm::vec3(1.0f, 0.0f, 0.0f) |
Rotation axis. | |
Additional Inherited Members | |
Public Types inherited from Animation | |
enum class | Frame { MODEL , WORLD } |
Frame in which the transformation shoud be applied. More... | |
Static Public Member Functions inherited from Animation | |
static std::vector< std::shared_ptr< Animation > > | decode (const std::vector< KeyValues > ¶ms) |
static std::vector< KeyValues > | encode (const std::vector< std::shared_ptr< Animation > > &anims) |
Protected Member Functions inherited from Animation | |
Animation ()=default | |
Animation (Frame frame, float speed) | |
bool | decodeBase (const KeyValues ¶ms) |
Protected Attributes inherited from Animation | |
Frame | _frame = Frame::WORLD |
The frame of transformation. | |
float | _speed = 0.0f |
Speed of the animation. | |
Rotate an object around an axis.
Inherits Animation.
|
default |
Default constructor.
Rotation::Rotation | ( | const glm::vec3 & | axis, |
float | speed, | ||
Frame | frame | ||
) |
Setup a rotation animation.
axis | the rotation axis |
speed | the animation speed |
frame | the animation frame |
|
overridevirtual |
Apply the animation transformation to the input matrix.
m | the matrix to transform |
fullTime | the time elapsed since the beginning of the rendering loop |
frameTime | the time elapsed since last frame |
Implements Animation.
|
overridevirtual |
Apply the animation transformation to the input vector.
v | the vector to transform |
fullTime | the time elapsed since the beginning of the rendering loop |
frameTime | the time elapsed since last frame |
Implements Animation.
bool Rotation::decode | ( | const KeyValues & | params | ) |
Setup rotation animation parameters from a key-value tuple. The expected format is as follows:
rotation: speed frame axisX,axisY,axisZ
(where frame is one of 'world' or 'model').
params | the parameters tuple |
|
overridevirtual |
Generate a key-values representation of the animation. See decode for the keywords and layout.
Reimplemented from Animation.