TAILIEUCHUNG - Character Animation with Direct3D- P21

Character Animation with Direct3D- P21: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. | 386 Character Animation with Direct3D Skin the vertex for int i 0 i n i lastweight i posWorld i mul position FinalTransforms i normWorld i mul normal FinalTransforms i lastweight - lastweight posWorld lastWeight mul position FinalTransforms n normWorld lastWeight mul normal FinalTransforms n Project the vertex to screen space mul posWorld matVP Lighting. max dot normWorld normalize lightPos - posWorld return OUT There On the screen you ll now have a skinned and morphed face on your character. This code is all implemented in the new Character class. The result is shown in Figure . As you can see in Figure the face is no longer a static standalone face but is now attached to the body. When the head moves the neck area stretches according to how the original face mesh was skinned. lease purchase PDF Split-Merge on to remove this watermark. Chapter 16 Putting It All Together 387 FIGURE Skinned and morphed face. The Character Class The Character class takes everything you ve learned in this book and puts it together under one interface The Character class can play keyframed animation morphed facial animation physical-based ragdoll animation and inverse kinematics-based animation. The class is defined as follows class Character public RagDoll public Character char fileName D3DXMATRIX world Character void Update float deltaTime void Render void RenderMesh Bone bone void RenderFace BoneMesh pFacePlaceholder void PlayAnimation string name void Kill public bool m_lookAtIK m_armIK bool m_dead sase purchase PDF Split-Merge on to remove this watermark. 388 Character Animation with Direct3D private Face m_pFace FaceController m_pFaceController ID3DXAnimationController m_pAnimController InverseKinematics m_pIK IDirect3DVertexDeclaration9 m_pFaceVertexDecl int m_animation As you