PDA

View Full Version : X Meshes



tux
05-02-2005, 07:21 PM
im building a tool for my 3D Modelers to get a model into the game and im learning D3D at the same time.

ive got the mesh loading and GUI setup but i need to somehow get the names of the objects in the model so i can assign physics to that object and draw a bounding box around it.

how would i get the object name and the vertices to calculate the bounding box?

thanks :)

Clootie
06-02-2005, 09:14 PM
How to get mesh names: SkinnedMesh (URL) (http://clootie.narod.ru/delphi/download_dx90.html#D3Dex_Meshes) parses X-files with extracting sub-mesh names. I'm not sure about easiest way to calculate sub-mesh bounding boxes.

tux
07-02-2005, 08:45 AM
is it possible to access the sub mesh vertices? if i can get the vertices into an array then its easy to calculate the bounding box

Clootie
07-02-2005, 10:24 AM
var
Mesh: ID3DXMesh;
AttribTableSize: DWORD;
AttribTable: array of TD3DXAttributeRange;
begin
...
Mesh.Optimize(D3DXMESHOPT_ATTRSORT....);

Mesh.GetAttributeTable(nil, @AttribTableSize);
SetLength(AttribTable, AttribTableSize);
Mesh.GetAttributeTable(@AttribTable[0], @AttribTableSize);

// here you get attribute ranges --- later lock vertex buffer...

tux
07-02-2005, 10:58 AM
thanks