?/TD> |
Microsoft DirectX 9.0 |
The Volume Texture sample illustrates how to use the new volume textures in Microsoft?Direct3D? Normally, a texture is thought of as a 2-D image, which has a width and a height and whose texels are addressed with two coordinate, tu and tv. Volume textures are the 3-D counterparts, with a width, height, and depth, are addressed with three coordinates, tu, tv, and tw.
You can use volume textures for interesting effects such as patchy fog, explosions, and so on.
Not all cards support all features for volume textures. For more information about volume textures, refer to the Microsoft DirectX® software development kit (SDK) documentation.
Source: (SDK root)\Samples\C++\Direct3D\VolumeTexture
Executable: (SDK root)\Samples\C++\Direct3D\Bin
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. |
Volume textures are no more difficult to use than 3-D textures. In this sample source code, note the vertex declaration, which has a third texture coordinate; texture creation, which also takes a depth dimension; and texture locking, again with the third dimension. The 3-D rasterizer interpolates texel values much as for 2-D textures.
This sample uses common DirectX code that consists of programming elements such as helper functions. This code is shared with other samples in the DirectX SDK. You can find the sample framework headers and source code in (SDK root)\DXSDK\Samples\C++\Common\Include and (SDK root)\DXSDK\Samples\C++\Common\Src.