double CXFileEntity::GetAnimationSetLength(unsigned int index) { if (index>=m_numAnimationSets) return 0; // Get the animation set LPD3DXANIMATIONSET set; m_animController->GetAnimationSet(m_currentAnimationSet, &set ); double pr = set->GetPeriod(); set->Release(); return pr; }
void SkinnedComponent::ChangeAnim(int animNum) { if( CurrentAnim == animNum ) return; CurrentAnim = animNum; CurrentTime = 0; LPD3DXANIMATIONSET animSet = NULL; this->mAnimCtrl->SetTrackSpeed(0, 1.0f); this->mAnimCtrl->GetAnimationSet(animNum, &animSet); this->mAnimCtrl->SetTrackAnimationSet(0, animSet); this->mAnimCtrl->SetTrackPosition(0,CurrentTime); CurrentPeriod = (float)animSet->GetPeriod(); NumFrames = ((ID3DXKeyframedAnimationSet*)animSet)->GetNumTranslationKeys(0); NumFrames = max(NumFrames, (int)((ID3DXKeyframedAnimationSet*)animSet)->GetNumTranslationKeys(0)); NumFrames = max(NumFrames, (int)((ID3DXKeyframedAnimationSet*)animSet)->GetNumRotationKeys(0)); animSet->Release(); //RecalculateBB(); }