rent-now

Rent More, Save More! Use code: ECRENTAL

5% off 1 book, 7% off 2 books, 10% off 3+ books

9781592000937

Physics Modeling for Game Programmers

by
  • ISBN13:

    9781592000937

  • ISBN10:

    1592000932

  • Edition: CD
  • Format: Paperback
  • Copyright: 2004-08-12
  • Publisher: Cengage Learning Ptr
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $59.99

Summary

Programmers who want to include 3D math and physics in a game have to wade through physics textbooks and dreary tomes on linear algebra and group theory, only to find that the material is too abstract to be used directly in their games. This book gives readers the skills they want and need to incorporate real physics into their games. As they work through the book, they will constantly develop tools, demos, and working games. The highly graphical demos ensure that instead of just reading about how to calculate the trajectory of a projectile, the reader will actually see a canon firing rounds toward the front lines. From the successful Game Development series, this book thoroughly addresses the specific needs of game developers.

Table of Contents

Introduction xxiii
Part One: Physics, Math, and Game Programming
1(144)
Physics in Games
3(8)
How Much Physics Do I Need to Know to Write Games?
4(3)
3-D Objects
4(1)
3-D Scenes
5(1)
Movement
5(1)
Rigid Objects
5(1)
Rotation
5(1)
Friction
5(1)
Air and Water Resistance
6(1)
Gravity
6(1)
Collisions and Explosions
7(1)
Springy Things
7(1)
Waves
7(1)
How Much Math Do I Need to Know to Write Games?
7(2)
The Essential Geometry of Triangles
8(1)
Vectors
8(1)
Matrices
8(1)
Derivatives
8(1)
How Much Programming Do I Need to Know?
9(1)
Summary
9(2)
Simulating 3-D with DirectX
11(30)
What Is DirectX?
11(1)
Two Views of DirectX
12(3)
The Low-Level View: The HAL and the HEL
12(1)
The High-Level View: DirectX Components
13(1)
COM Objects
14(1)
Using DirectX
15(24)
Initializing DirectX the Hard Way
16(10)
Initializing Direct3D with the DirectX AppWizard
26(3)
Initializing Direct3D with the Physics Modeling Framework
29(10)
Summary
39(2)
Mathematical Tools for Physics and 3-D Programming
41(44)
The Geometry of Triangles
41(2)
2-D Coordinate Systems
43(1)
3-D and 4-D Coordinate Systems
44(2)
Units
46(3)
Vectors
49(21)
Implementing Vectors in Code: The Physics Modeling Math Library
51(6)
Multiplication and Division of a Vector by a Scalar
57(3)
The Dot Product
60(2)
The Cross Product
62(2)
Unit Vectors
64(2)
Projection
66(3)
Vectors in Direct3D
69(1)
Matrices
70(14)
The Identity Matrix
72(1)
Addition and Subtraction
73(1)
Multiplication and Division by a Scalar
73(1)
Matrix Multiplication
74(5)
Transpose
79(1)
Determinants
79(1)
Matrix Inversion
80(4)
Summary
84(1)
2-D Transformations and Rendering
85(22)
2-D Transformations
85(11)
Active Versus Passive Transformations
86(1)
Translation
87(1)
Rotation
88(4)
Scaling
92(2)
Combining Transformations
94(2)
Implementing Transformations: Spinning a Triangle
96(9)
Using the Physics Modeling Framework
97(2)
Setting Up the Geometry
99(3)
Updating Frames
102(2)
Rendering Frames
104(1)
Putting It All Together
105(1)
Summary
105(2)
3-D Transformations and Rendering
107(18)
3-D Transformations
107(6)
Homogenous Coordinates
107(1)
Translations
108(1)
Scaling
109(1)
Rotations
110(3)
The 3-D Pipeline
113(3)
Local Coordinates to World Coordinates
113(1)
World Coordinates to Viewing Coordinates
114(1)
Viewing Coordinates to Projection Coordinates
115(1)
Projection Coordinates to Screen Coordinates
116(1)
Rendering in 3-D
116(8)
Example 1: The 3-D Spinning Triangle
116(3)
Example 2: The Spinning Pyramid
119(5)
Summary
124(1)
Meshes and X Files
125(20)
Textures
126(2)
Creating Textures from Files
127(1)
Setting the Texture
127(1)
Materials
128(1)
Loading a Mesh
129(3)
Extracting Textures and Materials
129(2)
Rendering the Mesh
131(1)
Cleaning Up the Mesh
131(1)
The d3d_mesh Class
132(12)
Loading a Mesh
133(3)
Rendering a Mesh
136(2)
Reference Counting in the d3d_mesh Class
138(6)
Summary
144(1)
Part Two: 3-D Objects, Movement, and Collisions
145(220)
Dynamics of Particles
147(26)
Point Particles
147(1)
1-D Kinematics
148(5)
Velocity
149(1)
Velocity as a Derivative
150(3)
Acceleration
153(1)
Forces
153(2)
2-D and 3-D Kinematics
155(3)
The Modeling Point Masses
158(13)
Introducing the d3d_point_mass Class
158(5)
Using the d3d_point_mass Class
163(8)
Point Masses in Games
171(1)
Summary
172(1)
Collisions of Point Particles
173(28)
Collision Detection
173(8)
Bounding Spheres
174(3)
Bounding Cylinders
177(1)
Bounding Boxes
178(1)
Optimization with Spatial Partitioning
179(2)
Collision Response
181(18)
Conservation of Momentum
182(2)
Energy
184(1)
Elastic Collisions
185(1)
Inelastic Collisions
186(1)
The Coefficient of Restitution
187(1)
Point Particle Collisions in Two and Three Dimensions
188(1)
Collisions of Spheres
189(1)
Implementation
190(9)
Summary
199(2)
Rigid Body Dynamics
201(34)
Rigid Bodies
201(1)
The Center of Mass
202(2)
2-D Rigid Body Rotation
204(10)
Point Particles of a 2-D Rigid Body
205(4)
Torque and the Moment of Inertia
209(5)
Rigid Bodies in 3-D
214(7)
Torque in 3-D
217(3)
The Parallel Axis Theorem in Three Dimensions
220(1)
The Principal Axes
220(1)
Orientation
221(2)
Implementing Rigid Bodies in 3-D
223(11)
The d3d_rigid_body Class
223(3)
Initializing a d3d_rigid_body Object
226(2)
Updating a d3d_rigid_body Object
228(4)
Rendering a d3d_rigid_body Object
232(2)
Summary
234(1)
Collisions of Rigid Bodies
235(32)
Collision Detection
235(6)
Rough Approximations
235(3)
Improved Collision Detection
238(3)
Collision Response
241(25)
Linear Collision Response
241(1)
Angular Collision Response
242(1)
Combining Linear and Angular Collision Response
243(3)
Updating the Physics Modeling Framework
246(20)
Summary
266(1)
Gravity and Projectiles
267(30)
Newton's Law of Gravitation
267(2)
Projectile Trajectories
269(3)
Modeling Projectile Motion
272(24)
Differentiating Between Impulse and Constant Forces
272(23)
Rolling
295(1)
Summary
296(1)
Mass and Spring Systems
297(36)
What Can I Do with Springs?
297(3)
Hair and Ponytails
297(2)
Cloth
299(1)
It All Starts with Harmonic Motion
300(2)
Hooke's Law
302(1)
Dampened Harmonic Motion
302(1)
Implementing Cloth
303(29)
Upgrading Point Masses
303(7)
Springs
310(6)
The cloth Class
316(3)
Initializing a Piece of Cloth
319(7)
Updating and Rendering a Piece of Cloth
326(5)
Tuning Cloth
331(1)
Suggested Enhancements for Cloth
332(1)
Summary
332(1)
Water and Waves
333(32)
Water and Buoyancy
333(5)
The Properties of Water
334(1)
Why Things Float
335(2)
Finding Pressure and Density
337(1)
Resistance to Movement
338(4)
A Quick Look at Friction
339(2)
Viscous Drag
341(1)
Currents in Water
342(2)
Waves
344(3)
Implementing Water
347(3)
Low-Overhead Ways to Cheat
347(2)
3-D Water
349(1)
Putting Objects in Water
350(13)
Adding Buoyancy to Rigid Bodies
350(7)
Will It Float?
357(6)
Summary
363(2)
Part Three: Hands-On 3-D Simulation
365(98)
Getting Ready for Games
367(40)
Redesigning the Physics Modeling Framework
367(21)
Simplifying Program Initialization
367(4)
Adding a game Class
371(4)
Setting Transformation Matrices Efficiently
375(4)
Restoring Lost Device Objects
379(1)
Redefining Rigid Bodies Using Point Masses
380(6)
The Center of Mass and the Origin of the Mesh
386(2)
Introducing DirectInput
388(13)
Initializing DirectInput
389(7)
Getting Keyboard and Mouse Input
396(4)
Closing Down DirectInput
400(1)
Camera Movement in DirectX
401(4)
Summary
405(2)
Cars, Hovercraft, Ships, and Boats
407(26)
Cars
407(14)
Power, Force, Acceleration, and Friction
407(4)
Air Resistance on Cars
411(1)
Braking
411(2)
Turning Cars
413(2)
Implementing a Basic Car
415(6)
Hovercraft and Antigravity Vehicles
421(2)
How Hovercraft Work
421(2)
Air Resistance on Hovercraft
423(1)
Turning Hovercraft
423(1)
Ships and Boats
423(9)
Buoyancy of Ships and Boats
423(1)
Calculating Hull Volume
424(2)
Stability of Ships and Boats
426(1)
Mass and Virtual Mass
427(2)
Resistance and Ships
429(1)
Air Resistance
430(1)
Currents and Waves
430(2)
Summary
432(1)
Aircraft and Spacecraft
433(30)
Flight Simulators the Easy Way
433(12)
Flight with Little or No Physics
435(1)
Implementing a Simple Flight Simulator
435(10)
The Physics of Aircraft
445(5)
Essential Parts of an Aircraft
445(2)
Basic Forces
447(2)
Modeling Aircraft: The Right Forces in the Right Places
449(1)
The Physics of Spacecraft
450(12)
Dogfights in Space
450(1)
Rockets
451(5)
Lunar Landers
456(1)
Getting to Other Planets with Known Physics
457(3)
Getting to Other Planets with Speculative Physics
460(2)
Summary
462(1)
Epilogue
463(2)
Appendixes
465(2)
Appendix A Glossary
467(4)
Appendix B A Brief Overview of C++
471(14)
It All Begins with Functions
471(2)
main() and Functions Called By main()
472(1)
Parameters
472(1)
Return Values
473(1)
Inline Functions
473(1)
Classes and Object-Oriented Programming
473(3)
Namespaces
476(1)
Inheritance
477(4)
Overriding Functions
479(1)
Virtual Functions
479(2)
Exceptions
481(1)
Other Ways of Making Types
482(3)
Structures
482(1)
Enumerated Types
483(1)
typedef Statements
484(1)
Appendix C The Basics of Windows Programming
485(10)
Welcome to WinMain()
485(10)
Writing a WinMain() Function
486(1)
Defining a Window Class
486(2)
Registering a Window Class
488(1)
Creating a Window
489(2)
Displaying the Window
491(1)
Processing Windows Messages
491(1)
Handling Windows Messages
492(3)
Index 495

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program