100.000 polys once again...
In mesh view editor my 100.000 plygons model goes with 30fps but when I run it in my engine it goes only with 5fps. Why? I used standard methods of loading and rendering .x file as in tutorial. Please help.
100,000 polys is way too much. I think most models are between 2000-7000 polys. What is the model of?
Its a man model but it does'n metter. I know it can be done. In Mesh Viewer it runs just fine.
Try
pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, ... )
right after D3DXLoadMesh...
Hope this will help
pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, ... )
right after D3DXLoadMesh...
Hope this will help
// this buffer holds adjacency information, as DXSDK says:
// "The adjacency data contains an array of three DWORDs per face that specify
// the three neighbors for each face in the mesh. For more information about
// accessing the buffer, see ID3DXBuffer"
LPD3DXBUFFER pAdjBuffer;
// this one for materials
LPD3DXBUFFER pMaterials;
// number of materials in buffer
DWORD dwNumMaterials;
//load our mesh
D3DXLoadMeshFromX("mesh.x", D3DXMESH_MANAGED, pDevice, &pAdjBuffer, &pMaterials, NULL, &dwNumMaterials, &pMesh);
//we have to specify adjacency when doing ATTRSORT
pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, NULL, &pAdjBuffer, NULL, NULL, NULL);
pAdjBuffer->Release();
You can also try D3DXMESHOPT_COMPACT and D3DXMESHOPT_VERTEXCACHE OR'ed with D3DXMESHOPT_ATTRSORT
// "The adjacency data contains an array of three DWORDs per face that specify
// the three neighbors for each face in the mesh. For more information about
// accessing the buffer, see ID3DXBuffer"
LPD3DXBUFFER pAdjBuffer;
// this one for materials
LPD3DXBUFFER pMaterials;
// number of materials in buffer
DWORD dwNumMaterials;
//load our mesh
D3DXLoadMeshFromX("mesh.x", D3DXMESH_MANAGED, pDevice, &pAdjBuffer, &pMaterials, NULL, &dwNumMaterials, &pMesh);
//we have to specify adjacency when doing ATTRSORT
pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, NULL, &pAdjBuffer, NULL, NULL, NULL);
pAdjBuffer->Release();
You can also try D3DXMESHOPT_COMPACT and D3DXMESHOPT_VERTEXCACHE OR'ed with D3DXMESHOPT_ATTRSORT
shit, im having an error that
&g_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, NULL, &pAdjBuffer, NULL, NULL, NULL);
can hold only 4 parameters and:
'ID3DXMesh::OptimizeInplace' : cannot convert parameter 2 from 'LPD3DXBUFFER *__w64 ' to 'const DWORD *'
&g_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, NULL, &pAdjBuffer, NULL, NULL, NULL);
can hold only 4 parameters and:
'ID3DXMesh::OptimizeInplace' : cannot convert parameter 2 from 'LPD3DXBUFFER *__w64 ' to 'const DWORD *'
Take out that second parameter so that it's:
&g_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, &pAdjBuffer, NULL, NULL, NULL);
&g_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT, &pAdjBuffer, NULL, NULL, NULL);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement