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

Translate an object back and forth along a direction. More...

#include <Animation.hpp>

Public Member Functions

 BackAndForth ()=default
 
 BackAndForth (const glm::vec3 &axis, float speed, float amplitude, 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)
 Translation direction.
 
float _amplitude = 0.0f
 Amplitude of the translation (maximum distance).
 
double _previousAbscisse = 0.0f
 Position on the path at the previous frame.
 

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

Translate an object back and forth along a direction.

Inherits Animation.

Constructor & Destructor Documentation

◆ BackAndForth() [1/2]

BackAndForth::BackAndForth ( )
default

Default constructor.

◆ BackAndForth() [2/2]

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

Setup a back and forth animation.

Parameters
axisthe translation direction
speedthe animation speed
amplitudethe amplitude of the movement
framethe animation frame

Member Function Documentation

◆ apply() [1/2]

glm::mat4 BackAndForth::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 BackAndForth::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 BackAndForth::decode ( const KeyValues params)

Setup back-and-forth translation animation parameters from a key-value tuple. The expected format is as follows:

backandforth: speed frame axisX,axisY,axisZ amplitude

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

Parameters
paramsthe parameters tuple
Returns
decoding status

◆ encode()

KeyValues BackAndForth::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: