Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
data from the passed animation set that can make i

Data from the passed animation set that can make its own copy

data from the passed animation set so that it can make its own copy. However, the base ID3DXAnimationSet interface does not support functions for retrieving the keyframe data so we will first need to query the passed object for an ID3DXKeyframedAnimationSet interface. If the function succeeds then we will have an ID3DXKeyframedAnimationSet interface from which we can extract the data. If the QueryInterface method fails, then the interface we have been passed is attached to an unsupported object which does not expose the ID3DXKeyframedAnimationSet interface. If this is the case, we throw an exception.

CAnimationSet::CAnimationSet( ID3DXAnimationSet * pAnimSet ) {
ULONG i;
HRESULT hRet;
ID3DXKeyframedAnimationSet * pKeySet = NULL;

Our next task will be to copy over any callback keys that may be contained in the set we are copying. First we call the ID3DXKeyframedAnimationSet::GetNumCallbackKeys and, provided this is greater than zero, allocate the CAnimationSet’s callback key array to store this many elements. We then call the ID3DXKeyframedAnimationSet::GetCallbackKeys method and pass in a pointer to this member array. This function will copy all the callback keys in the original animation set into our object’s callback keys array.

// Copy callback keys
m_pCallbacks = NULL;
m_nCallbackCount = pKeySet->GetNumCallbackKeys( );
if ( m_nCallbackCount > 0 )
{
// Allocate memory to hold the callback keys
m_pCallbacks = new D3DXKEY_CALLBACK[ m_nCallbackCount ]; if ( !m_pCallbacks ) throw E_OUTOFMEMORY;

The next task will be to find out how many animations exist inside the passed animation set so that we

can allocate that many CAnimationItem objects. Remember, a CAnimationItem represents the data for a

can see in the following code snippet, we pass in the ID3DXKeyframedAnimationSet interface and the

index of the animation we wish to have copied into our CAnimationItem. The

m_pAnimations[5].BuildItem( pKeySet , 5 )

then the sixth CAnimationItem in our array will contain the SRT keyframes from the sixth animation in the keyframed animation set (pKeySet).

} // End if any animations

// Release our keyframed friend
pKeySet->Release();

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Dr. Nadia Dunleavey

PageId: DOCF654DE1