/****************************************************************************** void IFXKeyTrack::Filter(F32 deltatime) remove track entries too close in time ******************************************************************************/ void IFXKeyTrack::Filter(F32 deltatime) { //I32 original=GetNumberElements(); IFXListContext basecontext,nextcontext; IFXKeyFrame *base,*next; ToHead(basecontext); while((base=GetCurrent(basecontext)) != NULL) { nextcontext=basecontext; PostIncrement(nextcontext); if(IsAtTail(nextcontext)) break; next=GetCurrent(nextcontext); if( (next->Time()-base->Time()) < deltatime ) { Delete(next); } else { PostIncrement(basecontext); } } }
void IFXKeyTrack::Compress(F32 deltaposition,F32 deltarotation,F32 deltascale) { //I32 original=GetNumberElements(); IFXListContext basecontext,midcontext,leapcontext; IFXKeyFrame *base,*mid,*leap; ToHead(basecontext); while((base=GetCurrent(basecontext)) != NULL) { midcontext=basecontext; PostIncrement(midcontext); leapcontext=midcontext; PostIncrement(leapcontext); if(IsAtTail(leapcontext)) break; mid=GetCurrent(midcontext); leap=GetCurrent(leapcontext); F32 fraction=(mid->Time()-base->Time())/(leap->Time()-base->Time()); IFXVector3 intervector; intervector.Interpolate(fraction,base->LocationConst(), leap->LocationConst()); IFXQuaternion interquat; interquat.Interpolate(fraction,base->RotationConst(), leap->RotationConst()); IFXVector3 interscale; interscale.Interpolate(fraction,base->ScaleConst(), leap->ScaleConst()); if(mid->LocationConst().IsApproximately(intervector,deltaposition) && mid->RotationConst().IsApproximately(interquat,deltarotation) && mid->ScaleConst().IsApproximately(interscale,deltascale) ) { //* watch out for spans close to 180 degrees F32 radians; IFXVector3 axis; IFXQuaternion inverse,span; inverse.Invert(base->RotationConst()); span.Multiply(inverse,leap->RotationConst()); span.ComputeAngleAxis(radians,axis); if(radians<170.0*IFXTO_RAD) Delete(mid); else PostIncrement(basecontext); } else { PostIncrement(basecontext); } } }
T Dequeue() { if (Front == Back) throw BadDequeue(); return A[PostIncrement(Front)]; }
void Enqueue(T Elem) { if (PlusOne(Back) == Front) throw BadEnqueue(); A[PostIncrement(Back)] = Elem; }