Skip to main content
gamedev.net
🔒 Locked

problems with D3DXMesh

Started by prgrmmr Feb 21, 2003 at 1:27 PM 5 replies 450+ views
Original Post
prgrmmr
prgrmmr
Hi! i''m (currently) using this object to load a mesh file created 3dsmax. ( Because I can convert from 3ds->x with that converter ). So I open it, and quickly get the vertex and index buffer. But when I want to get the ''attribute table'' the functions return with 0 attrivutes. why? what did I write wrong? please help me! Tnx! for some more accurate image of my problem: at the rendering: D3DXATTRIBUTERANGE attribs[32]; //and I even tried it with DAR* attrubs; DWORD atrnum; g_pMesh->GetAttributeTable( attribs, &atrnum ); g_pd3dDevice->SetStreamSource( 0, g_dologVB, sizeof(ULVERTEX) ); g_pd3dDevice->SetIndices( g_dologIB, 0 ); for( int i=0;iSetTexture( 0, g_pMeshTextures ); g_pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, attribs[i].VertexStart, attribs[i].VertexCount, attribs[i].FaceStart, attribs[i].FaceCount ); }
prgrmmr
prgrmmr
no idea?
Jim Adams
Jim Adams
quote:

no idea?



*Rolls eyes* It''s only been like two hours


From the DX SDK:

quote:

An attribute table is created by ID3DXMesh::Optimize and passing D3DXMESHOPT_ATTRSORT for the Flags parameter.



You need to optimize the mesh before you can access the attribute table.
dracoon
dracoon
hey prgmmr! contact me! your email is wrong...
prgrmmr
prgrmmr
quote:
Original post by Jim Adams
[quote]
no idea?



*Rolls eyes* It''s only been like two hours

um, excuse me , but I''m very ...

anyway thanks for the answer, but is it really needed to Optimize the mesh????

so, I just want to get what texture to use at rendering? Isn''t there any way to determine the texture count without getting the mesh Optimized?

and an other question: am I right that I think that OptimizeMesh just make strips, and reorder the vertices and indices, for subsets with different texture at rendering not have to transform each vertex multiple times?



prgrmmr
prgrmmr
sorry dracoon, that was my old mail.
I''ve corrected it!
Jim Adams
Jim Adams
I use OptimizeInPlace, which can reorder the faces to render polygons in groups based on their material ID. When I say reorder, I mean it only rearranges the indices, not vertices.

If you only want to get the material ID numbers for each face, then you can use LockAttributeBuffer/UnlockAttributeBuffer to access the DWORD array (a 1:1 of faces to material IDs).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.