Skip to main content
gamedev.net
🔒 Locked

mesh attribute buffer?

Started by supagu Apr 22, 2003 at 1:46 AM 4 replies 700+ views
Original Post
supagu
supagu
i am loading a mesh using the d3d mesh helper class, and im chopping the map into smaller sections, which is working fine, except when it comes to the attribute buffer (ie. what material/texture is applied to what poly), firstly the mesh i load has 8 textures which are being loaded, and the mesh has 8 materials/textures with id ranging from 0 through to 7. Now, when i push a vertex into a vector i have, i also have an adjacent vector for the attribute, i am assuming that the offset of the vertex is the same offset for the attribute buffer eg. 2 textures: id: 0 = example1.bmp id: 1 = test.bmp lets say we have 4 vertices: vertex list: (10,10,0) (30,20,10) (4,2,6) (2,6,7) and an attribute buffer would then have 4 entrys: attribute buffer: 0 1 1 0 1 this would mean that the first vertex would have id 0, which corresponds to texture example1.bmp ? is this right? because this is how i am doing it in my engine, and it doesnt seem to be working?!
craigp
craigp
The attribute buffer in a D3DX mesh corresponds to faces not vertices. There is one DWORD per face that is the attribute id for each triangle.

If you have 4 vertices and 2 triangles, then there are two attribute buffer entries.


Craig Peeper
Microsoft, Direct3D

This posting is provided "AS IS" with no warranties, and confers no rights.
Craig PeeperMicrosoft, Direct3DThis posting is provided "AS IS" with no warranties, and confers no rights.
supagu
supagu
okay, i decided to go about this using a attribute table,
but im getting some weird results:


attributes: id:0 facestart:0 facecount:0 vertstart:2601 vertcount:1244636
attributes: id:1 facestart:5000 facecount:2601 vertstart:665 vertcount:1244636
attributes: id:2 facestart:5460 facecount:3266 vertstart:1720 vertcount:1244636
attributes: id:3 facestart:6664 facecount:4986 vertstart:36 vertcount:1244636
attributes: id:4 facestart:6694 facecount:5022 vertstart:294 vertcount:1244636
attributes: id:5 facestart:7060 facecount:5316 vertstart:100 vertcount:1244636
attributes: id:6 facestart:7120 facecount:5416 vertstart:126 vertcount:1244636
attributes: id:7 facestart:7318 facecount:5542 vertstart:504 vertcount:1244636



attributes: id:0 facestart:0 facecount:0 vertstart:12 vertcount:1244636
attributes: id:1 facestart:12 facecount:12 vertstart:12 vertcount:1244636


why do all have a vertex count of 1244636 and why does the first facecount = 0
?
how do i determine what vertex relates to what face? do i just devide the vertexes offset in the vertex buffer by 3?


[edited by - supagu on April 22, 2003 9:39:30 PM]
craigp
craigp
I would double check your code that is printing the vertexcount field, since that looks incorrect.

The attribute table does not contain information about what vertex belongs to what face. The only reason it contains any information about vertex ranges is so that you can do efficient software vertex processing. i.e. if you want to draw one group of faces by attribute id, you can transform just the vertices that are associated with that set of faces.

BTW, if you are just trying to split your mesh into multiple meshes, have you looked at the D3DXSplitMesh operation? It will split your mess first on attribute id and then on size to get it to the specified mesh/vertex count.


Craig Peeper
Microsoft, Direct3D

This posting is provided "AS IS" with no warranties, and confers no rights.
Craig PeeperMicrosoft, Direct3DThis posting is provided "AS IS" with no warranties, and confers no rights.
supagu
supagu
im actually trying to chop my map up into a grid of smaller meshes, so would the mesh split function be any help for doing that?

i do belive i have done everything right even the out-put up to tghis point they are just integers (DWORDS) that are out putted.

thanks


maybe seeing as you are the only one here that seems to have some idea about what im trying to do, maybe you could email me, would that be faster? (if so, its supagu@hotmail.com)

thanks for your help so far craig


[edited by - supagu on April 24, 2003 6:32:29 AM]

[edited by - supagu on April 24, 2003 8:26:45 AM]
supagu
supagu
*bmp*

Topic Locked

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

Sign in to reply to this topic.