Assimp  v3.1.1 (June 2014)
Assimp::LWO::AnimResolver Class Reference

Utility class to build Assimp animations from LWO envelopes. More...

Public Member Functions

 AnimResolver (std::list< Envelope > &envelopes, double tick)
 Construct an AnimResolver from a given list of envelopes. More...
 
void ExtractAnimChannel (aiNodeAnim **out, unsigned int flags=0)
 Extract a node animation channel. More...
 
void ExtractBindPose (aiMatrix4x4 &out)
 Extract the bind-pose transformation matrix. More...
 
double GetSampleRate () const
 Getter for SetSampleRate() More...
 
void SetAnimationRange (double _first, double _last)
 Set the animation time range. More...
 
void SetSampleRate (double sr)
 Set the sampling rate for ExtractAnimChannel(). More...
 

Protected Member Functions

void ClearAnimRangeSetup ()
 Delete all keys which we inserted to match anim setup. More...
 
void DoInterpolation (std::vector< LWO::Key >::const_iterator cur, LWO::Envelope *envl, double time, float &fill)
 Resolve a single animation key by applying the right interpolation to it. More...
 
void DoInterpolation2 (std::vector< LWO::Key >::const_iterator beg, std::vector< LWO::Key >::const_iterator end, double time, float &fill)
 Almost the same, except we won't handle pre/post conditions here. More...
 
void GetKeys (std::vector< aiVectorKey > &out, LWO::Envelope *envl_x, LWO::Envelope *envl_y, LWO::Envelope *envl_z, unsigned int flags)
 Build linearly subsampled keys from 3 single envelopes. More...
 
void InterpolateTrack (std::vector< aiVectorKey > &out, aiVectorKey &key_out, double time)
 Interpolate 2 tracks if one is given. More...
 
void SubsampleAnimTrack (std::vector< aiVectorKey > &out, double time, double sample_delta)
 Subsample an animation track by a given sampling rate. More...
 
void UpdateAnimRangeSetup ()
 Insert extra keys to match LWO's pre and post behaviours in a given time range [first...last]. More...
 

Detailed Description

Utility class to build Assimp animations from LWO envelopes.

Used for both LWO and LWS (MOT also).

Constructor & Destructor Documentation

§ AnimResolver()

AnimResolver::AnimResolver ( std::list< Envelope > &  envelopes,
double  tick 
)

Construct an AnimResolver from a given list of envelopes.

Parameters
envelopesInput envelopes. May be empty.
Outputtick rate, per second
Note
The input envelopes are possibly modified.

Member Function Documentation

§ ClearAnimRangeSetup()

void AnimResolver::ClearAnimRangeSetup ( )
protected

Delete all keys which we inserted to match anim setup.

§ DoInterpolation()

void AnimResolver::DoInterpolation ( std::vector< LWO::Key >::const_iterator  cur,
LWO::Envelope envl,
double  time,
float &  fill 
)
protected

Resolve a single animation key by applying the right interpolation to it.

Parameters
curCurrent key
envlEnvelope working on
timetime to be interpolated
fillReceives the interpolated output value.

§ DoInterpolation2()

void AnimResolver::DoInterpolation2 ( std::vector< LWO::Key >::const_iterator  beg,
std::vector< LWO::Key >::const_iterator  end,
double  time,
float &  fill 
)
protected

Almost the same, except we won't handle pre/post conditions here.

See also
DoInterpolation

§ ExtractAnimChannel()

void AnimResolver::ExtractAnimChannel ( aiNodeAnim **  out,
unsigned int  flags = 0 
)

Extract a node animation channel.

Parameters
outReceives a pointer to a newly allocated node anim. If there's just one keyframe defined, *out is set to NULL and no animation channel is computed.
flagsAny combination of the AI_LWO_ANIM_FLAG_XXX flags.

§ ExtractBindPose()

void AnimResolver::ExtractBindPose ( aiMatrix4x4 out)

Extract the bind-pose transformation matrix.

Parameters
outReceives bind-pose transformation matrix

§ GetKeys()

void AnimResolver::GetKeys ( std::vector< aiVectorKey > &  out,
LWO::Envelope envl_x,
LWO::Envelope envl_y,
LWO::Envelope envl_z,
unsigned int  flags 
)
protected

Build linearly subsampled keys from 3 single envelopes.

Parameters
outReceives output keys
envl_xX-component envelope
envl_yY-component envelope
envl_zZ-component envelope
flagsAny combination of the AI_LWO_ANIM_FLAG_XXX flags.
Note
Up to two input envelopes may be NULL

§ GetSampleRate()

double Assimp::LWO::AnimResolver::GetSampleRate ( ) const
inline

Getter for SetSampleRate()

§ InterpolateTrack()

void AnimResolver::InterpolateTrack ( std::vector< aiVectorKey > &  out,
aiVectorKey key_out,
double  time 
)
protected

Interpolate 2 tracks if one is given.

Parameters
outReceives extra output keys
key_outPrimary output key
timeTime to interpolate for

§ SetAnimationRange()

void Assimp::LWO::AnimResolver::SetAnimationRange ( double  _first,
double  _last 
)
inline

Set the animation time range.

Parameters
firstTime where the animation starts, in ticks
lastTime where the animation ends, in ticks

§ SetSampleRate()

void Assimp::LWO::AnimResolver::SetSampleRate ( double  sr)
inline

Set the sampling rate for ExtractAnimChannel().

Non-linear interpolations are subsampled with this rate (keys per second). Closer sampling positions, if existent, are kept. The sampling rate defaults to 0, if this value is not changed and AI_LWO_ANIM_FLAG_SAMPLE_ANIMS is specified for ExtractAnimChannel(), the class finds a suitable sample rate by itself.

§ SubsampleAnimTrack()

void AnimResolver::SubsampleAnimTrack ( std::vector< aiVectorKey > &  out,
double  time,
double  sample_delta 
)
protected

Subsample an animation track by a given sampling rate.

Parameters
outReceives output keys. Last key at input defines the time where subsampling starts.
timeTime to end subsampling at
sample_deltaTime delta between two samples

§ UpdateAnimRangeSetup()

void AnimResolver::UpdateAnimRangeSetup ( )
protected

Insert extra keys to match LWO's pre and post behaviours in a given time range [first...last].


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