Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Rotation Class Referencefinal

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 &params)
 
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
 
Animationoperator= (const Animation &)=delete
 
 Animation (Animation &&)=delete
 
Animationoperator= (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 > &params)
 
static std::vector< KeyValuesencode (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 &params)
 
- Protected Attributes inherited from Animation
Frame _frame = Frame::WORLD
 The frame of transformation.
 
float _speed = 0.0f
 Speed of the animation.
 

Detailed Description

Rotate an object around an axis.

Inherits Animation.

Constructor & Destructor Documentation

◆ Rotation() [1/2]

Rotation::Rotation ( )
default

Default constructor.

◆ Rotation() [2/2]

Rotation::Rotation ( const glm::vec3 &  axis,
float  speed,
Frame  frame 
)

Setup a rotation animation.

Parameters
axisthe rotation axis
speedthe animation speed
framethe animation frame

Member Function Documentation

◆ apply() [1/2]

glm::mat4 Rotation::apply ( const glm::mat4 &  m,
double  fullTime,
double  frameTime 
)
overridevirtual

Apply the animation transformation to the input matrix.

Parameters
mthe matrix to transform
fullTimethe time elapsed since the beginning of the rendering loop
frameTimethe time elapsed since last frame
Returns
the transformed matrix.

Implements Animation.

◆ apply() [2/2]

glm::vec4 Rotation::apply ( const glm::vec4 &  v,
double  fullTime,
double  frameTime 
)
overridevirtual

Apply the animation transformation to the input vector.

Parameters
vthe vector to transform
fullTimethe time elapsed since the beginning of the rendering loop
frameTimethe time elapsed since last frame
Returns
the transformed matrix.

Implements Animation.

◆ decode()

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').

Parameters
paramsthe parameters tuple
Returns
decoding status

◆ encode()

KeyValues Rotation::encode ( ) const
overridevirtual

Generate a key-values representation of the animation. See decode for the keywords and layout.

Returns
a tuple representing the animation.

Reimplemented from Animation.


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