TAILIEUCHUNG - Character Animation with Direct3D- P4
Character Animation with Direct3D- P4:This book is primarily aimed at teaching indie and hobby game developers how to create character animation with Direct3D. Also, the seasoned professional game developer may find some interesting things in this book. You will need a solid understanding of the C++ programming language as well as general object-oriented programming skills. | 46 Character Animation with Direct3D void SkinnedMesh Load char fileName BoneHierarchyLoader boneHierarchy Load a bone hierarchy from a file D3DXLoadMeshHierarchyFromX fileName D3DXMESH_MANAGED pDevice boneHierarchy NULL m_pRootBone NULL Update all Bone transformation matrices D3DXMATRIX i D3DXMatrixIdentity i UpdateMatrices Bone m_pRootBone i Sometimes it can be useful to locate a specific bone in a hierarchy for example if you would like to find the neck bone of a character and apply a rotation transformation matrix and make the head turn. The following D3DX function is then very useful LPD3DXFRAME D3DXFrameFind CONST D3DXFRAME pFrameRoot The root bone LPCSTR Name Name of bone you are looking for This function returns a pointer to the correct bone in the hierarchy or returns NULL if the bone wasn t found. Try to use this function in Example to find the neck bone. Hopefully you know by now how to load a bone hierarchy by implementing the lD3DXAllocateHierarchy interface. Later on in the book you ll see how you can use the same interface to load several different morph targets from a single .x file rather than keeping these meshes in separate files. However for now it is time to actually apply a mesh to the bone hierarchy. lease purchase PDF Split-Merge on to remove this watermark. Chapter 3 Skinned Meshes 47 Character Animation with DirectSD Example Applying a Mesh to the Bone Hierarchy As you probably know a mesh consists of several polygons that in turn consist of one or more triangles. Each triangle in turn is defined by three vertices . three points in 3D space. Before you look at how to skin a complex character mesh to a bone hierarchy first just look at a single vertex. A vertex can be linked influenced by one or more bones in the bone hierarchy. The amount a bone influences a vertex is determined by a weight value as shown in Figure . sase purchase PDF Split-Merge on to remove this watermark. 48 Character .
đang nạp các trang xem trước