WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
animated.h File Reference
#include <map>
#include <ostream>
#include <utility>
#include <vector>
#include "glm/glm.hpp"
#include "glm/gtc/quaternion.hpp"
#include "GameFile.h"
#include "modelheaders.h"
#include "types.h"
#include "Logger.h"
Include dependency graph for animated.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  modelAnimData
 Holds per-model animation metadata: index-to-id mapping, external anim files, and global sequences. More...
 
class  Identity< T >
 Identity conversion functor — returns its argument unchanged. More...
 
struct  PACK_QUATERNION
 Packed 16-bit quaternion as stored in WoW 2.0+ M2 files. More...
 
class  Quat16ToQuat32
 Converts a packed 16-bit quaternion to a 32-bit float quaternion. More...
 
class  ShortToFloat
 Converts opacity values stored as int16 to normalised float [0, 1]. More...
 
class  Animated< T, D, Conv >
 Generic animated value class that reads keyframe data from M2 files. More...
 

Typedefs

typedef std::pair< size_t, size_t > AnimRange
 A (start, end) frame range for an animation.
 
typedef Animated< float, short, ShortToFloatAnimatedShort
 

Enumerations

enum  Interpolations { INTERPOLATION_NONE , INTERPOLATION_LINEAR , INTERPOLATION_HERMITE , INTERPOLATION_BEZIER }
 Interpolation modes used by animated values in M2 models. More...
 
enum  { MAX_ANIMATED = 500 }
 Maximum number of animation tracks per Animated value. More...
 

Functions

template<class T >
interpolate (const float r, const T &v1, const T &v2)
 Linearly interpolate between two values.
 
template<class T >
interpolateHermite (const float r, const T &v1, const T &v2, const T &in, const T &outVal)
 Hermite spline interpolation between two values.
 
template<class T >
interpolateBezier (const float r, const T &v1, const T &v2, const T &in, const T &outVal)
 Bezier spline interpolation between two values.
 
template<>
glm::fquat interpolate< glm::fquat > (const float r, const glm::fquat &v1, const glm::fquat &v2)
 
float frand ()
 
float randfloat (float lower, float upper)
 
int randint (int lower, int upper)
 

Variables

size_t globalTime
 Global clock for global-sequence animations.
 

Typedef Documentation

◆ AnimatedShort

typedef Animated<float, short, ShortToFloat> AnimatedShort

Definition at line 540 of file animated.h.

◆ AnimRange

typedef std::pair<size_t, size_t> AnimRange

A (start, end) frame range for an animation.

Definition at line 90 of file animated.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Maximum number of animation tracks per Animated value.

Enumerator
MAX_ANIMATED 

Definition at line 150 of file animated.h.

◆ Interpolations

Interpolation modes used by animated values in M2 models.

Enumerator
INTERPOLATION_NONE 

No interpolation (step).

INTERPOLATION_LINEAR 

Linear interpolation.

INTERPOLATION_HERMITE 

Hermite spline.

INTERPOLATION_BEZIER 

Bezier spline.

Definition at line 96 of file animated.h.

Function Documentation

◆ frand()

float frand ( )

Definition at line 5 of file animated.cpp.

Here is the caller graph for this function:

◆ interpolate()

template<class T >
T interpolate ( const float  r,
const T &  v1,
const T &  v2 
)
inline

Linearly interpolate between two values.

Template Parameters
TValue type.
Parameters
rInterpolation factor in [0, 1].
v1Start value.
v2End value.
Returns
Interpolated result.

Definition at line 32 of file animated.h.

◆ interpolate< glm::fquat >()

template<>
glm::fquat interpolate< glm::fquat > ( const float  r,
const glm::fquat &  v1,
const glm::fquat &  v2 
)
inline

Definition at line 84 of file animated.h.

◆ interpolateBezier()

template<class T >
T interpolateBezier ( const float  r,
const T &  v1,
const T &  v2,
const T &  in,
const T &  outVal 
)
inline

Bezier spline interpolation between two values.

Template Parameters
TValue type.
Parameters
rInterpolation factor in [0, 1].
v1Start value.
v2End value.
inIncoming control point.
outValOutgoing control point.
Returns
Interpolated result.

Definition at line 67 of file animated.h.

◆ interpolateHermite()

template<class T >
T interpolateHermite ( const float  r,
const T &  v1,
const T &  v2,
const T &  in,
const T &  outVal 
)
inline

Hermite spline interpolation between two values.

Template Parameters
TValue type.
Parameters
rInterpolation factor in [0, 1].
v1Start value.
v2End value.
inIncoming tangent.
outValOutgoing tangent.
Returns
Interpolated result.

Definition at line 46 of file animated.h.

◆ randfloat()

float randfloat ( float  lower,
float  upper 
)

Definition at line 10 of file animated.cpp.

Here is the caller graph for this function:

◆ randint()

int randint ( int  lower,
int  upper 
)

Definition at line 15 of file animated.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ globalTime

size_t globalTime
extern

Global clock for global-sequence animations.

Definition at line 3 of file animated.cpp.