Đang chuẩn bị liên kết để tải về tài liệu:
Character Animation with Direct3D- P21
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
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 IN.weights i posWorld IN.weights i mul position FinalTransforms IN.boneIndices i normWorld IN.weights i mul normal FinalTransforms IN.boneIndices i lastweight 1.0f - lastweight posWorld lastWeight mul position FinalTransforms IN.boneIndices n normWorld lastWeight mul normal FinalTransforms IN.boneIndices n posWorld.w 1.0f Project the vertex to screen space OUT.position mul posWorld matVP Lighting. OUT.shade max dot normWorld normalize lightPos - posWorld 0.2f OUT.tex0 IN.tex0 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 16.2. As you can see in Figure 16.2 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 www.verypdf.com to remove this watermark. Chapter 16 Putting It All Together 387 FIGURE 16.2 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 www.verypdf.com 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