//----------------------------------------------------------------------------- // Name: CBipedAnimInstance::AddCallbackKeysAndCompress() // Desc: Replaces an animation set in the animation controller with the // compressed version and callback keys added to it. //----------------------------------------------------------------------------- HRESULT CXFileAnimInstance::AddCallbackKeysAndCompress( LPD3DXANIMATIONCONTROLLER pAC, LPD3DXKEYFRAMEDANIMATIONSET pAS, DWORD dwNumCallbackKeys, D3DXKEY_CALLBACK aKeys[], DWORD dwCompressionFlags, FLOAT fCompression ) { HRESULT hr; LPD3DXCOMPRESSEDANIMATIONSET pASNew = NULL; LPD3DXBUFFER pBufCompressed = NULL; hr = pAS->Compress( dwCompressionFlags, fCompression, NULL, &pBufCompressed ); if( FAILED( hr ) ) goto e_Exit; hr = D3DXCreateCompressedAnimationSet( pAS->GetName(), pAS->GetSourceTicksPerSecond(), pAS->GetPlaybackType(), pBufCompressed, dwNumCallbackKeys, aKeys, &pASNew ); pBufCompressed->Release(); if( FAILED( hr ) ) goto e_Exit; pAC->UnregisterAnimationSet( pAS ); pAS->Release(); hr = pAC->RegisterAnimationSet( pASNew ); if( FAILED( hr ) ) goto e_Exit; pASNew->Release(); pASNew = NULL; e_Exit: if( pASNew ) pASNew->Release(); return hr; }