Game Development Reference
In-Depth Information
Figure 11.1: A
screen shot taken
from the XFile
sample
This sample uses the following global variables:
ID3DXMesh* Mesh = 0;
std::vector<D3DMATERIAL9> Mtrls(0);
std::vector<IDirect3DTexture9*> Textures(0);
Here we have an ID3DXMesh object that is used to store the mesh data
that we load from the XFile. We also have a vector of materials and tex-
tures that we use to hold the mesh's materials and textures.
We begin by implementing our standard Setup function. First, we
load the XFile:
bool Setup()
{
HRESULT hr = 0;
//
// Load the XFile data.
//
ID3DXBuffer* adjBuffer = 0;
ID3DXBuffer* mtrlBuffer = 0;
DWORD
numMtrls
= 0;
hr = D3DXLoadMeshFromX(
"bigship1.x",
D3DXMESH_MANAGED,
Device,
&adjBuffer,
&mtrlBuffer,
0,
&numMtrls,
&Mesh);
if(FAILED(hr))
{
Search WWH ::




Custom Search