ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
KeyFrameTrack< maxParameters, maxKeyFrames > Class Template Reference

A template class for managing animations with multiple parameters and keyframes. More...

#include <KeyFrameTrack.h>

Inheritance diagram for KeyFrameTrack< maxParameters, maxKeyFrames >:
Collaboration diagram for KeyFrameTrack< maxParameters, maxKeyFrames >:

Public Member Functions

 KeyFrameTrack (float min, float max, InterpolationMethod interpMethod)
 Constructs a KeyFrameTrack object with the specified settings.
 
float GetCurrentTime ()
 Retrieves the current animation time.
 
void SetCurrentTime (float setTime)
 Sets the current animation time.
 
void Pause ()
 Pauses the animation.
 
void Play ()
 Resumes the animation.
 
void AddParameter (float *parameter)
 Adds a parameter to the track.
 
void AddKeyFrame (float time, float value)
 Adds a keyframe to the track.
 
float GetParameterValue ()
 Retrieves the current interpolated parameter value.
 
void Reset ()
 Resets the animation track to its initial state.
 
float Update ()
 Updates the animation track and computes the new parameter value.
 

Private Member Functions

void ShiftKeyFrameArray (int position)
 Shifts the keyframe array starting at a specific position.
 

Private Attributes

InterpolationMethod interpMethod
 The interpolation method for the track.
 
floatparameters [maxParameters]
 Array of pointers to parameters being animated.
 
KeyFrame keyFrames [maxKeyFrames]
 Array of keyframes defining the animation.
 
float min = 0.0f
 Minimum value for the parameters.
 
float max = 0.0f
 Maximum value for the parameters.
 
float startFrameTime = Mathematics::FLTMAX
 Start time of the animation (initialized out of bounds).
 
float stopFrameTime = Mathematics::FLTMIN
 End time of the animation (initialized out of bounds).
 
uint8_t currentFrames = 0
 Current number of keyframes.
 
uint8_t currentParameters = 0
 Current number of parameters.
 
bool isActive = true
 Indicates whether the track is active.
 
float parameterValue = 0.0f
 Current interpolated parameter value.
 
float currentTime = 0.0f
 Current time of the animation.
 
float timeOffset = 0.0f
 Offset for the animation time.
 

Additional Inherited Members

- Public Types inherited from KeyFrameInterpolation
enum  InterpolationMethod { Linear , Cosine , Step }
 Enumeration of interpolation methods. More...
 

Detailed Description

template<size_t maxParameters, size_t maxKeyFrames>
class KeyFrameTrack< maxParameters, maxKeyFrames >

A template class for managing animations with multiple parameters and keyframes.

The KeyFrameTrack class handles animations by managing a set of parameters and their corresponding keyframes. It supports playback controls, interpolation, and time-based updates.

Template Parameters
maxParametersThe maximum number of parameters this track can handle.
maxKeyFramesThe maximum number of keyframes this track can contain.

Definition at line 50 of file KeyFrameTrack.h.

Constructor & Destructor Documentation

◆ KeyFrameTrack()

template<size_t maxParameters, size_t maxKeyFrames>
KeyFrameTrack ( float  min,
float  max,
InterpolationMethod  interpMethod 
)

Constructs a KeyFrameTrack object with the specified settings.

Parameters
minThe minimum value for the parameters.
maxThe maximum value for the parameters.
interpMethodThe interpolation method for the track.

Member Function Documentation

◆ AddKeyFrame()

◆ AddParameter()

template<size_t maxParameters, size_t maxKeyFrames>
void AddParameter ( float parameter)

◆ GetCurrentTime()

template<size_t maxParameters, size_t maxKeyFrames>
float GetCurrentTime ( )

Retrieves the current animation time.

Returns
The current time of the animation.

◆ GetParameterValue()

template<size_t maxParameters, size_t maxKeyFrames>
float GetParameterValue ( )

Retrieves the current interpolated parameter value.

Returns
The current value of the parameter.

◆ Pause()

◆ Play()

◆ Reset()

◆ SetCurrentTime()

template<size_t maxParameters, size_t maxKeyFrames>
void SetCurrentTime ( float  setTime)

Sets the current animation time.

Parameters
setTimeThe new current time to set.

◆ ShiftKeyFrameArray()

template<size_t maxParameters, size_t maxKeyFrames>
void ShiftKeyFrameArray ( int  position)
private

Shifts the keyframe array starting at a specific position.

Used for reorganizing keyframes when inserting or removing elements.

Parameters
positionThe index from which to shift the keyframe array.

◆ Update()

Member Data Documentation

◆ currentFrames

template<size_t maxParameters, size_t maxKeyFrames>
uint8_t currentFrames = 0
private

Current number of keyframes.

Definition at line 59 of file KeyFrameTrack.h.

◆ currentParameters

template<size_t maxParameters, size_t maxKeyFrames>
uint8_t currentParameters = 0
private

Current number of parameters.

Definition at line 60 of file KeyFrameTrack.h.

◆ currentTime

template<size_t maxParameters, size_t maxKeyFrames>
float currentTime = 0.0f
private

Current time of the animation.

Definition at line 63 of file KeyFrameTrack.h.

◆ interpMethod

template<size_t maxParameters, size_t maxKeyFrames>
InterpolationMethod interpMethod
private

The interpolation method for the track.

Definition at line 52 of file KeyFrameTrack.h.

◆ isActive

template<size_t maxParameters, size_t maxKeyFrames>
bool isActive = true
private

Indicates whether the track is active.

Definition at line 61 of file KeyFrameTrack.h.

◆ keyFrames

template<size_t maxParameters, size_t maxKeyFrames>
KeyFrame keyFrames[maxKeyFrames]
private

Array of keyframes defining the animation.

Definition at line 54 of file KeyFrameTrack.h.

◆ max

template<size_t maxParameters, size_t maxKeyFrames>
float max = 0.0f
private

Maximum value for the parameters.

Definition at line 56 of file KeyFrameTrack.h.

◆ min

template<size_t maxParameters, size_t maxKeyFrames>
float min = 0.0f
private

Minimum value for the parameters.

Definition at line 55 of file KeyFrameTrack.h.

◆ parameters

template<size_t maxParameters, size_t maxKeyFrames>
float* parameters[maxParameters]
private

Array of pointers to parameters being animated.

Definition at line 53 of file KeyFrameTrack.h.

◆ parameterValue

template<size_t maxParameters, size_t maxKeyFrames>
float parameterValue = 0.0f
private

Current interpolated parameter value.

Definition at line 62 of file KeyFrameTrack.h.

◆ startFrameTime

template<size_t maxParameters, size_t maxKeyFrames>
float startFrameTime = Mathematics::FLTMAX
private

Start time of the animation (initialized out of bounds).

Definition at line 57 of file KeyFrameTrack.h.

◆ stopFrameTime

template<size_t maxParameters, size_t maxKeyFrames>
float stopFrameTime = Mathematics::FLTMIN
private

End time of the animation (initialized out of bounds).

Definition at line 58 of file KeyFrameTrack.h.

◆ timeOffset

template<size_t maxParameters, size_t maxKeyFrames>
float timeOffset = 0.0f
private

Offset for the animation time.

Definition at line 64 of file KeyFrameTrack.h.


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