Cover
Contents
Introduction
Chapter 1 The What, Why, and How of DirectX
What Is DirectX?
DirectX 10 versus DirectX 9
DirectX 11 versus DirectX 10
DirectX 11 versus OpenGL 4.0
Why Is DirectX Needed?
How DirectX Is Put Together
The Components of DirectX 11
Obsolete DirectX Components
Introducing Direct3D 11
Stages of Direct3D 11
Direct3D 11 Considerations
DirectX Tools
Sample Browser and Documentation
PIX
Caps Viewer
Diagnostic Tools
Texture Tool
Error Lookup
Control Panel
Cross-Platform Audio Creation Tool
Game Definition File Editor
Down-Level Hardware
Summary
Chapter Questions
Chapter 2 Your First DirectX Program
Creating the Project
Adding Windows Code
The Main Entry Point
Windows Initialization
Windows Callback Procedure
Time for Direct3D
Adding the DirectX Libraries
Initializing Direct3D
Driver Types and Features Levels
Device and Swap Chain Creation
Render Target View Creation
The Viewport
Clearing and Displaying the Screen
Cleaning Up
Formats
The Blank D3D Window
Design of the Template Framework
The Direct3D Class
The Blank Window Demo Class
Updating the Application Loop
DirectX Error Handling Library
Error Handling Functions
Error Handling Macros
Summary
Chapter Questions
Chapter 3 2D Rendering
2D Game Development
Textures
Sprites
2D Geometry
What Is a Vertex?
Definition of a Triangle
Vertex Buffers
Input Layout
Drawing a 2D Triangle
2D Triangle Demo
Loading the Geometry
Rendering the Geometry
Texture Mapping
Texture Interfaces
MIP Maps
Texture Details
Texture Mapping Demo
Sprites
Z-Ordering
Sprite Image
Getting Sprites to the Screen
Positioning and Scaling Sprites
The Game Sprite Demo
Creating and Rendering the Game Sprite
Summary
What You Have Learned
Chapter Questions
On Your Own
Chapter 4 Text and Font Rendering
Text in Games
Adding Text
Textured Fonts
A Font System Explained
Creating a Font System Using Sprites
Advanced Topics
In-Game Text Boxes
In-Game Console Window
Game Menus
Heads-Up Display
Summary
Chapter Questions
On Your Own
Chapter 5 Input Detection and Response
I Need Input
Input Options
Keyboard Input
Win32 Keyboard Input
DirectInput Keyboard Input
DirectInput Keyboard Demo
Mouse Input
DirectInput Mouse Input
XInput—Game Controllers
Setting Up XInput
Controller Vibrations
XInput for Input
Controller Capabilities
Battery Life
Keystrokes
Headset Sound
XInput Demo
Summary
What You Have Learned
Chapter Questions
On Your Own
Chapter 6 3D Primer
XNA Math
Utilities
Points
Vectors
Vector Arithmetic
Distance Between Vectors
Determining the Length of a Vector
Normalize a Vector
Cross Product
Dot Product
3D Space
Coordinate Systems
Transformations
World Transformations
View Transformations
Projection Transformations
Transforming an Object
Matrices
The Identity Matrix
Matrix Scaling
Matrix Translation
Matrix Rotation
Matrix Concatenation
Cube Demo
Additional XNA Math Topics
Compiler Directives
Constants
Macros
Structures and Types
Additional Functions
Additional Math Structures and Topics
Game Physics and Collision Detection
Summary
What You Have Learned
Chapter Questions
Chapter 7 Shaders and Effects
Shaders in Direct3D
History of Programmable Shaders
Effect Files
Effect File Layout
Loading an Effect File
External Variables and Constant Buffers
Input and Output Structures
Technique Blocks
Rasterizer States
High Level Shading Language
Variable Types
Semantics
Function Declarations
Vertex Shaders
Pixel Shaders
Texture Color Inversion
Color Shifting
Multitexturing
Geometry Shaders
Geometry Shader Function Declaration
The Geometry Shader Explained
Introduction to Lighting
Summary
What You Have Learned
Chapter Questions
On Your Own
Chapter 8 Cameras and Models in Direct3D
Cameras in Direct3D
Look-At Camera Demo
Arc-Ball Camera Demo
Meshes and Models
The OBJ File Format
Reading Tokens from a File
Loading Meshes from OBJ Files
Advanced Topics
Complex Cameras
3D Level Files
Summary
What You Have Learned
Chapter Questions
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z