Game Development Reference
In-Depth Information
&adjacencyBuffer[0],
0, 0, 0);
At this point, setting up the mesh is complete and we are ready to ren-
der it. But there is one last block of code in the Setup function that is
relevant. It uses the previously mentioned dump* functions to output
the internal data contents of the mesh to file. Being able to examine the
data of a mesh helps for debugging and learning the structure of the
mesh.
OutFile.open("Mesh Dump.txt");
dumpVertices(OutFile, Mesh);
dumpIndices(OutFile, Mesh);
dumpAttributeTable(OutFile, Mesh);
dumpAttributeBuffer(OutFile, Mesh);
dumpAdjacencyBuffer(OutFile, Mesh);
OutFile.close();
...Texturing loading, setting render states, etc., snipped
return true;
} // end Setup()
For example, the dumpAttributeTable function writes the attribute
table's data to file. It is implemented as follows:
void dumpAttributeTable(std::ofstream& outFile, ID3DXMesh* mesh)
{
outFile << "Attribute Table:" << std::endl;
outFile << "----------------" << std::endl << std::endl;
// number of entries in the attribute table
DWORD numEntries = 0;
mesh->GetAttributeTable(0, &numEntries);
std::vector<D3DXATTRIBUTERANGE> table(numEntries);
mesh->GetAttributeTable(&table[0], &numEntries);
for(inti=0;i<numEntries; i++)
{
outFile << "Entry " << i << std::endl;
outFile << "------" << std::endl;
outFile << "Subset ID: " << table[i].AttribId << std::endl;
outFile << "Face Start: " << table[i].FaceStart << std::endl;
outFile << "Face Count: " << table[i].FaceCount << std::endl;
outFile << "Vertex Start: " << table[i].VertexStart << std::endl;
outFile << "Vertex Count: " << table[i].VertexCount << std::endl;
outFile << std::endl;
}
Search WWH ::




Custom Search