Original Post
I've got a terrible headache from playing around with these SDK functions for so long. Can anyone see what I'm doing wrong?
See results of simplification here.
Please note that the boundries are not being screwed up, even though they appear to be in the image. Just from taking snapshots at different angles.
See all of those faces that could be oh-so-easily removed? But DirectX seems to prefer only removing the easy ones on the top and bottom. This is useless to me.
Here's the code I'm using to do this. Not much to it:
VOID KTileMesh::ReduceMesh(LPD3DXMESH *Mem) // Simplifies mesh, stores new mesh in Mem
{
ULONG *Adjacency = new ULONG[3 * Mesh->GetNumFaces()];
ULONG *AdjacencyOut = new ULONG[3 * Mesh->GetNumFaces()];
hVal = Mesh->GenerateAdjacency(0.01f, Adjacency);
if(FAILED(hVal))
Error("KTileMesh::ReduceMesh():GenerateAdjacency()");
hVal = Mesh->OptimizeInplace(D3DXMESHOPT_COMPACT | D3DXMESHOPT_VERTEXCACHE, Adjacency, AdjacencyOut, NULL, NULL);
if(FAILED(hVal))
Error("KTileMesh::ReduceMesh():OptimizeInplace()");
delete [] Adjacency;
Adjacency = AdjacencyOut;
hVal = D3DXSimplifyMesh(Mesh, Adjacency, NULL, NULL, 1 /* Min value */, D3DXMESHSIMP_FACE, Mem);
if(FAILED(hVal))
Error("KTileMesh::ReduceMesh():D3DXSimplifyMesh()");
delete [] Adjacency;
}
Any help / pointers would be appreciated.
[edited by - Jiia on May 14, 2004 10:31:55 AM]