摘要: If you have explored the DirectX SDK samples, you might have come across a little demo called SkinnedMesh, which shows you how to use a pre−calculated key−frame animation stored in an .X file to animate an on−screen character. The problem is, that sample's code is so convoluted and hard to understand that it'll make your head spin. With no real documentation of how to use .X file animation data, the skinned mesh animation sample remains full of mystery.
阅读全文
摘要: Skeletal animation−two words that bring to mind thoughts of B−rate horror movies in which the dead have risen from the grave to stalk the living. However, those two words mean something entirely different to programmers. If you're like me, this topic gives you more tingles down your spine than any cheesy horror movie ever could.
阅读全文
摘要: As shown in Figure 4.5, the SkeletalAnim mesh demonstrates what you learned in this chapter by loading a skinned mesh (the Tiny.x mesh provided in the DirectX SDK samples) and rendering it to the display.
阅读全文
摘要: When your skeletal structure is in the pose you desire, it's time to update (or rebuild) the skinned mesh to match. Before you rebuild the skinned mesh, you must make sure you have constructed the secondary mesh container and updated the frame hierarchy. To review how to construct the mesh container, consult the "Creating a Secondary Mesh Container" section earlier in this chapter. To refresh your memory about how to update the frame hierarchy, review the "Updating the Hierarchy" section earlier
阅读全文
摘要: If you peruse an .X file, you might notice some similarities between the Frame data objects and the SkinWeights objects. For every bone in your skeletal structure, there is a matching SkinWeights object embedded inside a Mesh object that contains the name of a Frame object (or a reference to a Frame object). That's right−each bone is named after its corresponding Frame data object!
阅读全文
摘要: Loading a skinned mesh from an .X file is much like loading a standard mesh. Using a custom .X parser, you must enumerate your .X file objects using ParseObject. When it comes to processing a Mesh object, instead of calling the D3DXLoadMeshFromXof function to load the mesh data, you call the D3DXLoadSkinMeshFromXof function, which takes one additional parameter−a pointer to an ID3DXSkinInfo object. Check out the D3DXLoadSkinMeshFromXof prototype to see what I mean.
阅读全文
摘要: In the first half of this chapter, you learned how to manipulate a hierarchy of bones that forms the basis of skeletal animation. That's all fine and dandy, but playing with imaginary bones isn't going to cut the mustard. Your game's players need to see all your hard work in the form of rendered meshes, which is where skinned meshes come in.
阅读全文
摘要: After you have loaded the bone hierarchy, you can manipulate it. To modify the orientation of a bone, you first need to locate its respective frame structure by creating a function that recursively searches the frames for a specific bone name. Once it is found, a pointer to the frame is provided so you can directly access the frame's transformation matrix. The recursive search function might look something like this:
阅读全文
摘要: Not to beat a dead horse (why would I do a horrible thing like that?), but I want to quickly review how to load a frame hierarchy from an .X file.
For your frame hierarchy you should use the D3DXFRAME structure (or the D3DXFRAME_EX structure). As I mentioned earlier in this chapter, the D3DXFRAME structure (or the derived D3DXFRAME_EX structure) contains two pointers that you use to create the frame hierarchy−pFrameSibling and pFrameFirstChild. Your job is to link each frame you load fr
阅读全文
摘要: Skeletal animation−two words that bring to mind thoughts of B−rate horror movies in which the dead have risen from the grave to stalk the living. However, those two words mean something entirely different to programmers. If you're like me, this topic gives you more tingles down your spine than any cheesy horror movie ever could.
阅读全文