Microsoft DirectX 8.1 (C++) |
OptimizedMesh Sample
Description
The OptimizedMesh sample illustrates how to load and optimize a file-based mesh using the Microsoft® Direct3DX mesh utility functions.
For more information on Direct3DX, refer to the Microsoft® DirectX® SDK documentation.
Path
Source: (SDK root)\Samples\Multimedia\Direct3D\OptimizedMesh
Executable: (SDK root)\Samples\Multimedia\Direct3D\Bin
User's Guide
The following table lists the keys that are implemented. You can use menu commands for the same controls.
Key | Action |
---|---|
ENTER | Starts and stops the scene. |
SPACEBAR | Advances the scene by a small increment. |
F2 | Prompts the user to select a new rendering device or display mode. |
ALT+ENTER | Toggles between full-screen and windowed modes. |
ESC | Exits the application. |
CTRL-O | Opens mesh file. |
CTRL-M | Toggles optimized mesh. |
Programming Notes
Many Microsoft Direct3D® samples in the DirectX SDK use file-based meshes. However, the OptimizedMesh sample is a good example of the basic code necessary for loading a mesh. The D3DX mesh loading functionality collapses the frame hierarchy of an .x file into one mesh.
For other samples, the bare bones D3DX mesh functionality is wrapped in a common class CD3DMesh. If you want to keep the frame hierarchy, you can use the common class CD3DFile.
This sample uses common DirectX code that consists programming elements such as helper functions. This code is shared with other samples in the DirectX SDK. You can find the common headers and source code in (SDK root)\Samples\Multimedia\Common.