Example #1
0
	Quat getSlerpValue( const KeyList &keys,float time )const{
		KeyList::const_iterator next,curr;

		//for( next=keys.begin();next!=keys.end() && time>=next->first;++next ){}
		next=keys.upper_bound( (int)time );

		if( next==keys.begin() ) return next->second;
		curr=next;--curr;
		if( next==keys.end() ) return curr->second;

		float delta=( time-curr->first )/( next->first-curr->first );
		return curr->second.slerpTo( next->second,delta );
	}
Example #2
0
	Vector getLinearValue( const KeyList &keys,float time )const{
		KeyList::const_iterator next,curr;

		//for( next=keys.begin();next!=keys.end() && time>=next->first;++next ){}
		next=keys.upper_bound( (int)time );

		if( next==keys.begin() ) return next->second.v;
		curr=next;--curr;
		if( next==keys.end() ) return curr->second.v;

		float delta=( time-curr->first )/( next->first-curr->first );
		return ( next->second.v-curr->second.v )*delta+curr->second.v;
	}