optimized progressive mesh problem
Hi,
I have a problem when trying to generate a PMesh from previously optimized non-P mesh. In the debug output there are about 550 assertion failures, for example:
D3DX: Assertion failure! (d:\builds\nt32_chk\multimedia\directx\dxg\d3dx8\mesh\simplify.inl 2480): iNextPoint < 3
or
D3DX: Assertion failure! (d:\builds\nt32_chk\multimedia\directx\dxg\d3dx8\mesh\simplify.inl 5727): m_tmTriMesh.FindPoint(m_tmTriMesh.m_pFaces[iCurFace].m_wIndices, pwFace[iPoint]) < 3
and some other. Here''s a fragment of code doing the optimization&PMesh conversion:
//tempMesh is correctly loaded mesh and pAdjBuffer is valid pointer to buffer containing mesh adjacency
DWORD *dwAdj=new DWORD[tempMesh->GetNumFaces()*3];
LPD3DXMESH cM;
D3DXCleanMesh(tempMesh, (DWORD*)pAdjBuffer->GetBufferPointer(), &cM, dwAdj, NULL);
cM->Optimize(D3DXMESHOPT_COMPACT|D3DXMESHOPT_ATTRSORT,
dwAdj, dwAdj, NULL, NULL, &tempMesh);
SAFE_RELEASE(cM);
tempMesh->OptimizeInplace(D3DXMESHOPT_COMPACT|D3DXMESHOPT_ATTRSORT|D3DXMESHOPT_VERTEXCACHE, dwAdj, NULL, NULL, NULL);
tempMesh->CloneMeshFVF(dw32bit|D3DXMESH_MANAGED, tempMesh->GetFVF(),pd3dDevice, &m_pMesh);
D3DXCleanMesh(m_pMesh, dwAdj, &cM, dwAdj, NULL);
D3DXGeneratePMesh(cM, dwAdj, NULL, NULL, 1, D3DXMESHSIMP_VERTEX, &m_pPMesh);
//here are interface releases...
Please help...
Thank you
Is the assertion happening on the D3DXGeneratePMesh() call or one of the earlier calls (i.e. have you tried a breakpoint and a single step to confirm that it is actually that call which asserts).
Also which mesh are you trying to use ? - is it one of the ones from the SDK (i.e. can you confirm that your source mesh is valid).
You could try setting up a buffer to recieve the error messages and warnings when you call D3DXCleanMesh to see what problems there are with the mesh.
Also ensure that you link with d3dx8d.lib rather than d3dx8.lib and ramp up the D3D debug output level - that way you''ll get much more descriptive debug output and more checks.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
Also which mesh are you trying to use ? - is it one of the ones from the SDK (i.e. can you confirm that your source mesh is valid).
You could try setting up a buffer to recieve the error messages and warnings when you call D3DXCleanMesh to see what problems there are with the mesh.
Also ensure that you link with d3dx8d.lib rather than d3dx8.lib and ramp up the D3D debug output level - that way you''ll get much more descriptive debug output and more checks.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
The assertion fails only on D3DXGeneratePMesh. The non-P mesh is optimized correctly and works fine. The problem occurs only when I try to generate a PMesh from optimized mesh. If the source mesh is unoptimized, the PMesh conversion succeeds.
Edited by - malyskolacek on January 12, 2002 8:47:16 AM
Edited by - malyskolacek on January 12, 2002 8:47:16 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement