Chapter 1: Preparing for the BookPrograms on the CD Chapter 2: Timing in Animation and Movement Programs on the CD Chapter 3: Using the .X File Format Programs on the CD Chapter 4: Worki
Trang 2Advanced Animation with DirectX 1
Introduction 4
Part One: Preparations 7
Chapter 1: Preparing for the Book 8
Overview 8
Installing the DirectX SDK 8
Choosing the Debug or Retail Libraries 10
Configuring Your Compiler 11
Setting the DirectX SDK Directories 11
Linking to the DirectX Libraries 12
Setting the Default char State 14
Using the Book's Helper Code 15
Using the Helper Objects 15
Checking Out the Helper Functions 21
Moving On with the Book 34
Part Two: Animation Basics 36
Chapter 2: Timing in Animation and Movement 37
Using Time−Based Motion 37
Reading Time in Windows 37
Animating with Time 38
Moving with Time 41
Moving along Paths 41
Creating an X Path Parser 48
Creating In−Game Cinematic Sequences 53
Check Out the Demos 54
TimedAnim 54
TimedMovement 55
Route 55
Cinematic 56
Chapter 3: Using the X File Format 58
Working with X Templates and Data Objects 58
Defining Templates 61
Creating Data Objects from Templates 63
Embedding Data Objects and Template Restrictions 64
Working with the DirectX Standard Templates 65
Accessing X Files 66
Registering Custom and Standard Templates 66
Opening an X File 67
Enumerating Data Objects 68
Retrieving Data from a Data Object 72
Constructing an X Parser Class 75
Loading Meshes from X 79
Loading Meshes Using D3DX 79
Loading Meshes with Your X Parser 82
Trang 3Chapter 3: Using the X File Format
Loading Skinned Meshes 83
Loading Frame Hierarchies from X 84
Loading Animations from X 86
Loading Custom Data from X 86
Check Out the Demos 88
ParseFrame 88
ParseMesh 88
Part Three: Skeletal Animation 90
Chapter 4: Working with Skeletal Animation 91
Overview 91
Taking on Skeletal Animation 91
Using Skeletal Structures and Bone Hierarchies 92
Loading Hierarchies from X 93
Modifying Bone Orientation 95
Updating the Hierarchy 96
Working with Skinned Meshes 97
Loading Skinned Meshes from X 100
Creating a Secondary Mesh Container 101
Mapping Bones to Frames 102
Manipulating the Skinned Mesh 103
Updating the Skinned Mesh 104
Rendering the Skinned Mesh 106
Check Out the Demo 106
Chapter 5: Using Key−Framed Skeletal Animation 108
Using Key−Framed Skeletal Animation Sets 108
Using Keys in Animation 109
Working with the Four Key Types 110
Reading Animation Data from X Files 112
Matching Animations to Bones 119
Updating Animations 121
Obtaining Skeletal Mesh Data from Alternative Sources 122
Check Out the Demos 123
Chapter 6: Blending Skeletal Animations 125
Overview 125
Blending Skeletal Animations 125
Combining Transformations 126
Enhancing Skeletal Animation Objects 127
Check Out the Demo 132
Chapter 7: Implementing Rag Doll Animation 134
Overview 134
Creating Dolls from Characters 134
Working with Rigid−Body Physics 137
Creating a Rigid Body 138
Positioning and Orienting Your Rigid Bodies 140
Trang 4Chapter 7: Implementing Rag Doll Animation
Processing the Motion of Rigid Bodies 143
Using Forces to Create Motion 150
Connecting Rigid Bodies with Springs 151
Providing Collision Detection and Response 154
Creating a Rag Doll Animation System 160
Defining the Rigid Body State 160
Containing Bones 161
Creating the Rag Doll Controller Class 162
Building Bone Data 165
Computing the Bone Bounding Box 166
Setting the Forces 169
Integrating the Bones 170
Processing Collisions 172
Enforcing Bone−to−Bone Connections 174
Rebuilding the Hierarchy 175
Check Out the Demo 176
Part Four: Morphing Animation 178
Chapter 8: Working with Morphing Animation 179
Morphing in Action 179
Defining Source and Target Meshes 180
Morphing the Meshes 180
Building a Morphed Mesh through Manipulation 182
Drawing Morphed Meshes 185
Dissecting the Subsets 185
Creating a Morphing Vertex Shader 187
Check Out the Demos 190
Chapter 9: Using Key−Framed Morphing Animation 192
Using Morphing Animation Sets 192
Creating X Morphing Animation Templates 192
Loading Morphing Animation Data 194
Rendering the Morphing Mesh 198
Obtaining Morphing Mesh Data from Alternative Sources 201
Check Out the Demos 202
Chapter 10: Blending Morphing Animations 204
Blending Morphing Animations 204
Using a Base Mesh in Blended Morphing Animation 205
Calculating the Differences 205
Blending the Differences 207
Building a Blending Morph Vertex Shader 208
Using the Blending Morph Vertex Shader 213
Check Out the Demos 215
Chapter 11: Morphing Facial Animation 216
The Basics of Facial Animation 216
Blended Morphing Back in Action 216
Trang 5Chapter 11: Morphing Facial Animation
Using Phonemes for Speech 218
Building Facial Meshes 220
Creating the Base Mesh 220
Creating Facial Expressions 221
Creating Viseme Meshes 223
Creating Animation Sequences 225
Automating Basic Features 225
Building Phoneme Sequences 226
Using an X Parser for Sequences 233
Playing Facial Sequences with Sound 237
Using DirectShow for Sound 238
Synchronizing Animation with Sound 239
Looping Sound Playback 240
Check Out the Demo 241
Part Five: Miscellaneous Animation 243
Chapter 12: Using Particles in Animation 244
Working with Particles 244
Starting with the Basics 245
Drawing Particles with Quad Polygons 246
Working with Point Sprites 250
Improving Particle Rendering with Vertex Shaders 253
Bringing Your Particles to Life 260
Moving Particles Using Velocity 261
Using Intelligence in Processing 262
Creating and Destroying Particles 263
Drawing Your Particles 264
Controlling Particles with Class 267
Using the Emitter in Your Project 270
Creating Particle Engines in Vertex Shaders 270
Check Out the Demos 271
Chapter 13: Simulating Cloth and Soft Body Mesh Animation 273
Simulating Cloth in Your Projects 273
Defining Cloth Points and Springs 274
Obtaining Cloth Data from Meshes 275
Applying Force to Create Motion 278
Rebuilding and Rendering the Cloth Mesh 286
Restoring the Original Mesh 287
Adding More Springs 288
Loading Mass and Spring Data from X 289
Building an X Parser for Cloth Data 290
Working with Collision Detection and Response 292
Defining Collision Objects 292
Detecting and Responding to Collisions 295
Creating a Cloth Mesh Class 298
Using Soft Body Meshes 307
Reverting a Soft Body Mesh 307
Trang 6Chapter 1: Preparing for the Book
Programs on the CD
Chapter 2: Timing in Animation and Movement
Programs on the CD
Chapter 3: Using the X File Format
Programs on the CD
Chapter 4: Working with Skeletal Animation
Programs on the CD
Chapter 5: Using Key−Framed Skeletal Animation
Programs on the CD
Chapter 6: Blending Skeletal Animations
Programs on the CD
Chapter 7: Implementing Rag Doll Animation
Programs on the CD
Chapter 8: Working with Morphing Animation
Programs on the CD
Trang 7Chapter 9: Using Key−Framed Morphing Animation
Programs on the CD
Chapter 10: Blending Morphing Animations
Programs on the CD
Chapter 11: Morphing Facial Animation
Programs on the CD
Chapter 12: Using Particles in Animation
Programs on the CD
Chapter 13: Simulating Cloth and Soft Body Mesh Animation
Programs on the CD
Chapter 14: Using Animated Textures
Programs on the CD