Game Development Reference
In-Depth Information
Device->EndScene();
Device->Present(0, 0, 0, 0);
}
return true;
}
Note: We have updated the d3d namespace with a new function
called DrawBasicScene . The function draws the scene in Figure 12.8.
We have added it to the d3d namespace because it is convenient to
have one function that sets up a basic scene so that in later samples
we can concentrate on the code that the sample illustrates rather than
irrelevant drawing code. Its declaration in d3dUtility.h is as follows:
// Function references "desert.bmp" internally. This file must
// be in the working directory.
bool DrawBasicScene(
IDirect3DDevice9* device, // Pass in 0 for cleanup.
float scale); // uniform scale
The first time the function is called with a valid device pointer it sets up
the geometry internally; therefore it is recommended that you call this
function first in the Setup function. To clean up the internal geometry,
call the function in the Cleanup routine, but pass null for the device
pointer. Since this function doesn't implement anything that we haven't
seen, we leave it to you to examine the code, which can be found in
this chapter's folder in the companion files. Make a note that the func-
tion loads the image desert.bmp as a texture. This file can be found in
this sample's folder.
12.4 Summary
We describe the position and orientation of our camera in the world
coordinate system by maintaining four vectors: a right vector, an up
vector, a look vector, and a position vector. With this description,
we can easily implement a camera with six degrees of freedom,
giving a flexible camera interface that works well for flight simula-
tors and games played from the first-person perspective.
Search WWH ::




Custom Search