Post

 Resources 

Console


Polygon Indices in D3D - Argggg!!! Help!!!!! PyroBoy (2 replies, 0 views) (2000-Apr-20)
-
This question has a whole lotta background info, so bear with me.... :-) I'm in the process of fooling with Direct3D. I'm at the point where I'm loading the geometry in an X file into D3DRM objects, and copy the vertices and indices over to my own VB 3d object. 3d objects in my program are represented with 2 arrays: Vertices() as D3DVERTEX -> The object's vertices Indices() as Integer ->Indices into the vertex array defining how all the polys fit together. I use Immediate mode to render, using a DrawIndexedPrimitive call that looks like this: Call Device.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX, Vertices(0), NumVertices, Indices(), NumIndices, D3DDP_WAIT) I can get the vertices fine, but when I try to fetch the indices for all the polys, things get all screwed up... Currently I load the x file into a Direct3DRMMeshBuilder3 object, and use that to create a Direct3DRMMesh object, from which I fetch all the vertices using the Direct3DRMMesh.GetVertex method. This would work fine, if I only wanted to render point lists! Then I get the indices using the Direct3DRMMesh.GetGroupData method. This is supposed to fetch a list of longs composed of polygon vertex counts (how many vertices are in the poly) followed by the indices for that poly. A call to the GetSizes method confirms that the object contains only triangles. Since in a triangle-based object all the polygon vertex counts will be equal to 3 and will be located on array slots divisible by 4 (0,4,8,12 etc. with the actual indice triplets in the spaces in between), that should mean that you can just retrieve the indices in between right? Here's the algo I use to pick out the indices: 'Translate retrieved face data to usable indices by ignoring vertex count data (with 'array slots divisible by 4) ii = 0 For i = 0 To (FaceDataSize - 1) If (i Mod 4) Then ii = ii + 1 Indices(ii) = TempFaceData(i) End If Next i When I render the object, the polys come out all garbled and misplaced. Has anyone got a better way of getting geometry indices???


-
Back to Forum

Yup PyroBoy (0 replies) (2000-Apr-24)

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 88 visitors within the last 20 minutes
RSS News Feed