List of Examples
Chapter 1:
Overview
Example 1.1:
Vector3 C# Definition
Example 1.2:
Attitude C# Definition
Example 1.3:
Vertex C# Definition
Example 1.4:
Interface Definitions
Example 1.5:
Sample Application
Chapter 2:
User Interface
Example 2.1:
Joystick Enumeration
Example 2.2:
Mapping Structures
Example 2.3:
GameInput Methods
Example 2.4:
Action Map Processing
Example 2.5:
Image Class members
Example 2.6:
Image Load Method
Example 2.7:
SplashScreen Declaration and Constructor
Example 2.8:
SplashScreen Render Method
Example 2.9:
ImageButton Declaration
Example 2.10:
ImageButton Constructor
Example 2.11:
ImageButton Render and Dispose Methods
Example 2.12:
ImageButton GetTexture Method
Example 2.13:
ImageButton Size and Position Properties
Example 2.14:
ImageButton Hit Test Methods
Example 2.15:
OptionScreen Declaration
Example 2.16:
OptionScreen Constructor
Example 2.17:
OptionScreen AddButton Method
Example 2.18:
OptionScreen SetMousePosition Method
Example 2.19:
OptionScreen Render Method (Conclusion)
Example 2.20a:
OptionScreen Render Method
Example 2.20b:
OptionScreen Render Method
Example 2.20c:
OptionScreen Render Method
Example 2.21:
GameCommand Declaration
Example 2.22:
GameCommand Constructor
Example 2.23:
GameCommand Execute Method
Example 2.24:
Console Class Declaration
Example 2.25:
Console Constructor and Reset Method
Example 2.26a:
Console Render Method
Example 2.26b:
Console Render Method
Example 2.26c:
Console Render Method (Conclusion)
Example 2.27:
Console SetMaxScreenSize and SetScreenSize Methods
Example 2.28:
Console AddLine Method
Example 2.29:
Console Data Entry Methods
Example 2.30:
Console ParseCommand Method
Example 2.31:
Console ProcessCommand Method
Example 2.32:
Console Command Methods
Example 2.33:
Console Parameter Methods
Example 2.34:
Console ToggleState Method and IsVisible Property
Example 2.34:
Console Help Method
Example 2.36:
Console Set Method
Example 2.37:
GameEngine Attributes
Example 2.38:
SetOptionScreen Method
Example 2.39:
Initialize Method
Example 2.40:
ShowSplash Method
Example 2.41:
DoOptions Method
Example 2.42:
GetPlayerInputs Method
Example 2.43:
OneTimeSceneInit Method
Example 2.44:
OnKeyDown Message Handler
Chapter 3:
Hanging Ten—A Ride Through the Rendering Pipeline
Example 3.1:
Object3D Declaration
Example 3.2:
Quad Declaration
Example 3.3:
Quad Constructor
Example 3.4:
Quad AddObject Method
Example 3.5:
Quad RemoveObject Method
Example 3.6:
Quad Cull Method
Example 3.7:
Quad Update Method
Example 3.8:
Quad Dispose Method
Example 3.9:
Transform X Rotation
Example 3.10:
Transform Y Rotation
Example 3.11:
Transform Z Rotation
Example 3.12:
Matrix Manipulation Example
Example 3.13:
Face Normal Calculations
Chapter 4:
Basic 3D Objects
Example 4.1:
SkyFace Class Attribute Definition
Example 4.2a:
SkyFace Constructor Definition
Example 4.2b:
SkyFace Constructor Definition
Example 4.2c:
SkyFace Constructor Definition
Example 4.3:
SkyFace CreateQuad Message Handler
Example 4.4:
SkyFace Render Method
Example 4.5:
SkyFace Dispose Method
Example 4.6:
SkyBox Class Definition
Example 4.7:
SkyBox Constructor
Example 4.8:
SkyBox Dispose Method
Example 4.9:
SkyBox Render Method
Example 4.10:
TerrainQuad Class Definition
Example 4.11:
TerrainQuad Constructor
Example 4.12:
TerrainQuad SetCornerNormal Method
Example 4.13:
TerrainQuad Dispose Method
Example 4.14:
TerrainQuad RenderQuad Method
Example 4.15:
TerrainQuad InRect Method
Example 4.16:
Terrain Class Definition
Example 4.17a:
Terrain Class Constructor
Example 4.17b:
Terrain Class Constructor
Example 4.17c:
Terrain Class Constructor
Example 4.17d:
Terrain Class Constructor
Example 4.17e:
Terrain Class Constructor
Example 4.18:
Terrain Class HeightOfTerrain and TerrainHeight Methods
Example 4.19:
Terrain Class HeightAboveTerrain Method
Example 4.20:
Terrain Class InLineOfSight Method
Example 4.21:
Terrain Class GetSlope Method
Example 4.22:
Terrain Class Render Method
Example 4.23:
Terrain Class Dispose Method
Example 4.24:
BillBoard Class Definition
Example 4.25:
BillBoard SetupMatrix Method
Example 4.26:
BillBoard Add Method
Example 4.27:
BillBoard Class Copy Constructor
Example 4.28:
BillBoard Class Constructor
Example 4.29:
BillBoard Copy Method
Example 4.30:
BillBoard Render All Method
Example 4.31:
BillBoard Render and RenderChildren Methods
Example 4.32:
BillBoard Render All Method
Example 4.33:
BillBoard Render All Method
Example 4.34:
Example ParticleUpdateMethod
Example 4.35:
Particle Structure Definition
Example 4.36:
ParticleGenerator Definition
Example 4.37:
ParticleGenerator Copy Constructor
Example 4.38:
ParticleGenerator Constructor
Example 4.39:
ParticleGenerator Copy Method
Example 4.40:
ParticleGenerator Update Method
Example 4.41:
ParticleGenerator Render Method
Example 4.42:
ParticleGenerator InRect Method
Example 4.43:
ParticleGenerator Dispose Method
Chapter 5:
Complex 3D Objects
Example 5.1:
Mesh Class FromFile Method Signatures
Example 5.2:
Model Class Declaration
Example 5.3a:
Model Class Constructor
Example 5.3b:
Model Class Constructor
Example 5.3c:
Model Class Constructor
Example 5.3d:
Model Class Constructor (Conclusion)
Example 5.3e:
Model Class Constructor
Example 5.4:
Model Class SetLOD Method
Example 5.5:
Model Class CreateLod Method
Example 5.6:
Model Class InRect Method
Example 5.7:
Model Class GetCorner Method
Example 5.8a:
Model Class Collide Method
Example 5.8b:
Model Class Collide Method
Example 5.8c:
Model Class Collide Method (Conclusion)
Example 5.9:
Model Class Render Method
Example 5.10:
Model Class Update Method
Example 5.11:
Model Class Dispose Method
Example 5.12:
Instantiating Models
Example 5.13:
Sample Update Method 1
Example 5.14:
Sample Update Method 2
Chapter 6:
Camera—The Player’s View of the World
Example 6.1:
Camera Culling Enumeration
Example 6.2a:
Camera Class Definition (Attributes)
Example 6.2b:
Camera Class Definition (Properties)
Example 6.3:
Camera Constructors
Example 6.4:
Camera AdjustHeading Method
Example 6.5:
Camera AdjustPitch Method
Example 6.6:
Camera MoveCamera Method
Example 6.7:
Camera Attach Method
Example 6.8:
Camera LookAt Method
Example 6.9:
Camera CheckFrustum Method 1
Example 6.10:
Camera CheckFrustum Method 2
Example 6.11:
Camera GetDistance Method
Example 6.12a:
Camera Render Method
Example 6.12b:
Camera Render Method
Example 6.12c:
Camera Render Method
Example 6.12d:
Camera Render Method (Conclusion)
Example 6.13:
Camera Reset Method
Example 6.14:
Camera AddVisibleObject Method
Chapter 7:
Adding Some Atmosphere—Lighting and Fog
Example 7.1:
GameLights Attributes
Example 7.2:
GameLights Properties
Example 7.3:
GameLights Constructor
Example 7.4:
GameLights CompareTo Method
Example 7.5:
GameLights GetLight Method
Example 7.6:
GameLights AddDirectionalLight Method
Example 7.7:
GameLights AddPointLight Method
Example 7.8:
GameLights AddSpotLight Method
Example 7.9:
GameLights InitializeLights Method
Example 7.10:
GameLights DeactivateLights Method
Example 7.11:
GameLights SetupLights Method
Example 7.12:
GameLights CheckCulling Method
Example 7.13:
GameLights Update Method
Example 7.14:
GameLights Example
Example 7.15:
Fog Properties
Example 7.16:
Using Fog
Chapter 8:
Artificial Intelligence—Adding the Competition
Example 8.1:
Operator Enumeration
Example 8.2:
Fact Attributes
Example 8.3:
Fact Properties
Example 8.4:
Fact Constructor
Example 8.5:
Fact Write Method
Example 8.6:
Logic Attributes
Example 8.7:
Logic Properties
Example 8.8:
Logic Default Constructor
Example 8.9:
Logic Constructor
Example 8.10:
Logic Evaluate Method
Example 8.11:
Logic Write Method
Example 8.12:
Logic Read Method
Example 8.13:
Expression Attributes
Example 8.14:
Expression Property
Example 8.15:
Expression Constructor
Example 8.16:
Expression Clear Method
Example 8.17:
Expression AddLogic Method
Example 8.18:
Expression Evaluate Method
Example 8.19:
Expression Write Method
Example 8.20:
Expression Read Method
Example 8.21:
Transitioner Attributes
Example 8.22:
Transitioner Constructor
Example 8.23:
Transitioner Evaluate Method
Example 8.24:
Transitioner Write Method
Example 8.25:
Transitioner Read Method
Example 8.26:
AIState Attributes
Example 8.27:
AIState Properties
Example 8.28:
AIState Constructor
Example 8.29:
AIState AddAction Method
Example 8.30:
AIState DoActions Method
Example 8.31:
AIState Think Method
Example 8.32:
AIState AddTransitioner Method
Example 8.33:
AIState WriteStateName Method
Example 8.34:
AIState WriteFullState Method
Example 8.35:
AIState Read Method
Example 8.36:
Thinker Delegates
Example 8.37:
Thinker Attributes
Example 8.38:
Thinker Properties
Example 8.39:
Thinker Constructor
Example 8.40:
Thinker AddAction Method
Example 8.41:
Thinker GetAction Method
Example 8.42:
Thinker GetActionName Method
Example 8.43:
Thinker Execute Method
Example 8.44:
Thinker Dispose Method
Example 8.45:
Thinker GetState Method
Example 8.46:
Thinker GetFact Method
Example 8.47:
Thinker SetFact Method
Example 8.48:
Thinker AddSensorMethod Method
Example 8.49:
Thinker AddState Method
Example 8.50:
Thinker Write Method
Example 8.51:
Thinker Read Method
Example 8.52:
Example XML Data File
Example 8.53:
DriverView Method
Example 8.54:
Action Methods
Example 8.55:
Opponent Class
Chapter 9:
Game Audio—Let’s Make Some Noise
Example 9.1:
Music Class Attributes and Properties
Example 9.2:
Music Constructor
Example 9.3:
Music Class ClipEnded Event Handler
Example 9.4:
Jukebox Attributes and Properties
Example 9.5:
Jukebox Constructor
Example 9.6:
Jukebox AddSong Method
Example 9.7:
Jukebox Play Method
Example 9.8:
Jukebox Stop Method
Example 9.9:
Jukebox Next Method
Example 9.10:
Jukebox ClipEnded Event Handler
Example 9.11:
Jukebox Dispose Method
Example 9.12:
Listener Class Attributes and Properties
Example 9.13:
Listener Class Constructor
Example 9.14:
Listener Update Method
Example 9.15:
Listener Dispose Method
Example 9.16:
SoundEffect Attributes
Example 9.17:
SoundEffect Properties
Example 9.18:
SoundEffect Constructor
Example 9.19:
SoundEffect LoadSoundFile Method
Example 9.20:
SoundEffect RestoreBuffer Method
Example 9.21:
SoundEffect PlaySound Method
Example 9.22:
SoundEffect StopSound Method
Example 9.23:
SoundEffect Update Method
Example 9.24:
SoundEffect Dispose Method
Example 9.25:
Ownship Class Constructor Excerpt
Example 9.26:
Ownship Class Update Method Excerpt
Chapter 10:
Game Physics—Keeping It Real
Example 10.1:
Vector Class
Example 10.2:
Euler Class
Example 10.3:
LFI Class
Example 10.4:
Wheel Class Attributes
Example 10.5:
Wheel Class Properties
Example 10.6:
Wheel Class
Example 10.7a:
Wheel Class Process Method
Example 10.7b:
Wheel Class Process Method
Example 10.7c:
Wheel Class Process Method
Example 10.7d:
Wheel Class Process Method
Example 10.7e:
Wheel Class Process Method (Conclusion)
Example 10.8a:
CarDynamics Enumerations and Attributes
Example 10.8b:
CarDynamics Enumerations and Attributes (Conclusion)
Example 10.9:
CarDynamics Properties
Example 10.10:
CarDynamics Constructor
Example 10.11:
CarDynamics Thread Process Method
Example 10.12:
CarDynamics Reset Method
Example 10.13:
CarDynamics IntegratePosition Method
Example 10.14:
CarDynamics CalcWeightTransfer Method
Example 10.15:
CarDynamics SetFriction Method
Example 10.16:
CarDynamics SetGearRatio Method
Example 10.17:
CarDynamics WheelNorth Method
Example 10.18:
CarDynamics WheelEast Method
Example 10.19:
CarDynamics SetWheelAltitude Method
Example 10.20:
CarDynamics SetWheelOffset Method
Example 10.21:
CarDynamics Dispose Method
Example 10.22a:
CarDynamics Process Method
Example 10.22b:
CarDynamics Process Method
Example 10.22c:
CarDynamics Process Method
Example 10.22d:
CarDynamics Process Method
Example 10.22e:
CarDynamics Process Method
Example 10.23:
CarDynamics SetAttitude Method
Example 10.24:
CarDynamics SetPosition and SetVelocity Methods
Example 10.25:
CarDynamics SetGroundHeight and SetAllGroundHeights Methods
Example 10.26:
CarDynamics WheelAngle Method
Example 10.27:
CarDynamics GetPitch and GetRoll Methods
Example 10.28:
CarDynamics IsTireSquealing Method
Example 10.29:
CarDynamics IsTireLoose Method
Example 10.30:
CarDynamics SetTireStiction Method
Example 10.31:
CarDynamics ProcessWheels Method
Example 10.32:
CarDynamics ProcessAttitude Method
Example 10.33:
CarDynamics MinorCollision Method
Example 10.34:
CarDynamics Major Collision Method
Example 10.35:
Cloth Class Node Structure Attributes
Example 10.36:
Cloth Class Node Constructor
Example 10.37:
Cloth Class NodeIndex Structure
Example 10.38:
Cloth Class Spring Structure
Example 10.39:
Cloth Class Attributes and Constants
Example 10.40:
Cloth Class Properties
Example 10.41a:
Cloth Class Constructor
Example 10.41b:
Cloth Class Constructor
Example 10.41c:
Cloth Class Constructor
Example 10.41d:
Cloth Class Constructor
Example 10.41e:
Cloth Class Constructor (Conclusion)
Example 10.42:
Cloth Class PopulateBuffer Method
Example 10.43:
Cloth Class PopulateIndexBuffer Method
Example 10.44:
Cloth Class Render Method
Example 10.45:
Cloth Class Update Method
Example 10.46a:
Cloth Class DoPhysics Method
Example 10.46b:
Cloth Class DoPhysics Method
Example 10.46c:
Cloth Class DoPhysics Method
Example 10.46d:
Cloth Class DoPhysics Method
Example 10.47:
Cloth Class Dispose Method