Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Animation Class Referenceabstract

An animation is a transformation evaluated at each frame and applied to an object. More...

#include <Animation.hpp>

Public Types

enum class  Frame { MODEL , WORLD }
 Frame in which the transformation shoud be applied. More...
 

Public Member Functions

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
 

Static Public Member Functions

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

 Animation ()=default
 
 Animation (Frame frame, float speed)
 
bool decodeBase (const KeyValues &params)
 

Protected Attributes

Frame _frame = Frame::WORLD
 The frame of transformation.
 
float _speed = 0.0f
 Speed of the animation.
 

Detailed Description

An animation is a transformation evaluated at each frame and applied to an object.

Inherited by BackAndForth, and Rotation.

Member Enumeration Documentation

◆ Frame

enum class Animation::Frame
strong

Frame in which the transformation shoud be applied.

Enumerator
MODEL 

Model space (right multiplication)

WORLD 

World space (left multiplication)

Constructor & Destructor Documentation

◆ ~Animation()

virtual Animation::~Animation ( )
virtualdefault

Virtual destructor.

◆ Animation() [1/4]

Animation::Animation ( const Animation )
delete

Copy constructor.

◆ Animation() [2/4]

Animation::Animation ( Animation &&  )
delete

Move constructor.

◆ Animation() [3/4]

Animation::Animation ( )
protecteddefault

Constructor.

◆ Animation() [4/4]

Animation::Animation ( Frame  frame,
float  speed 
)
protected

Constructor.

Parameters
framethe frame in which the transformation is expressed
speedthe speed of the animation

Member Function Documentation

◆ apply() [1/2]

virtual glm::mat4 Animation::apply ( const glm::mat4 &  m,
double  fullTime,
double  frameTime 
)
pure virtual

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.

Implemented in Rotation, and BackAndForth.

◆ apply() [2/2]

virtual glm::vec4 Animation::apply ( const glm::vec4 &  v,
double  fullTime,
double  frameTime 
)
pure virtual

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.

Implemented in Rotation, and BackAndForth.

◆ decode()

std::vector< std::shared_ptr< Animation > > Animation::decode ( const std::vector< KeyValues > &  params)
static

Helper that can instantiate a list of animations of any type from the passed keywords and parameters.

Parameters
paramsa list of key-value tuple containing animations parameters
Returns
a vector of animations

◆ decodeBase()

bool Animation::decodeBase ( const KeyValues params)
protected

Setup shared animation parameters from a key-value tuple. The expected format is as follows:

animationtype: speed frame ...

(where frame is one of 'world' or 'model').

Parameters
paramsthe parameters tuple
Returns
decoding status

◆ encode() [1/2]

KeyValues Animation::encode ( ) const
virtual

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

Returns
a tuple representing the animation.

Reimplemented in Rotation, and BackAndForth.

◆ encode() [2/2]

std::vector< KeyValues > Animation::encode ( const std::vector< std::shared_ptr< Animation > > &  anims)
static

Helper that can instantiate a list of key-values tuples that are Codable-compatible from the passed animations.

Parameters
animsa vector of animations
Returns
a list of key-value tuple containing animations parameters

◆ operator=() [1/2]

Animation & Animation::operator= ( Animation &&  )
delete

Move assignment.

Returns
a reference to the object assigned to

◆ operator=() [2/2]

Animation & Animation::operator= ( const Animation )
delete

Copy assignment.

Returns
a reference to the object assigned to

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