|
|
[???1]???一下,以下?一行是什?意思?是??B?定adjacencyBuffer的size??
std::vector<DWORD> adjacencyBuffer(Mesh->GetNumFaces() * 3);
[???2]Mesh->GetNumFaces() * 3是如何定出?淼?
IDirect3DDevice9* Device = 0;
const int Width = 640;
const int Height = 480;
ID3DXMesh* Mesh = 0;
const DWORD NumSubsets = 3;
IDirect3DTexture9* Textures[3] = {0, 0, 0};// texture for each subset
std: fstream OutFile; // used to dump mesh data to file
//
// Framework functions
//
bool Setup()
{
HRESULT hr = 0;
//
// We are going to fill the empty mesh with the geometry of a box,
// so we need 12 triangles and 24 vetices.
//
hr = D3DXCreateMeshFVF(
12,
24,
D3DXMESH_MANAGED,
Vertex::FVF,
Device,
&Mesh);
......
std::vector<DWORD> adjacencyBuffer(Mesh->GetNumFaces() * 3);
//DWORD adjacencyBuffer[Mesh->GetNumFaces() * 3];
Mesh->GenerateAdjacency(0.0f, &adjacencyBuffer[0]);
hr = Mesh->OptimizeInplace(
D3DXMESHOPT_ATTRSORT |
D3DXMESHOPT_COMPACT |
D3DXMESHOPT_VERTEXCACHE,
&adjacencyBuffer[0],
0, 0, 0);
......
}
|
|