Search Home Members Contacts
About Us
Bug #447: Mesh.SetPrimitiveType() does not accept GroupID
TV3D SDK 6.5
Not Specified
Current State:
Created On:
July 1st, 2005
Last Modified:
January 15th, 2006
Reported By:
Cannot set primitive type on a per group basis.

1) Mesh.SetPrimitiveType(iGroupID as Int32)
2) iNewGroupID = Mesh.AddGroup() as Int32

I suspect the latter is needed to properly take advantage of being able to SetPrimtiveType per group. Personally I use a custom file format and use my own vertex loading code. It'd be helpful to have greater flexibility when constructing my meshes.

I notice that SetGeometry () contains a groupID field so I'm wondering how that works. If you use a groupID that doesnt exist does it create it for you? Is that how you do the equivalent of "AddGroup" ? Ill test it as soon as i have time.


Posted by SylvainTV on July 7th, 2005 at 3:17 PM
Actually the thing is :

TV internally only uses Indexed triangle lists to simplify things and to be able to optimize for vertex caches etc..

So PrimitiveType is like a "state" to be set before adding vertices, but the primitive types (fan and strip) are always emulated by triangles list, but these modes allow to share vertices when building the triangle lists, so it's good in some cases.

So primitivetype doesn't have to be here for each group, it's simply here to help during the creation.

Of course line and point primitives are really rendered using lines and points and not using triangle lists, but that's the exception :)

Posted by SylvainTV on July 7th, 2005 at 3:19 PM
About the group thing in SetGeometry, it's used to set the groupID per face.
(just like the attribute buffer in D3DX meshes)

So yes when you SetGeometry, it adds the number of groups that are necessary. For groupID's you must use consecutive numbers starting from 0 .
Posted by Hypnotron on October 16th, 2005 at 8:29 AM
Interesting. I will have to test this because I seem to recall having problems dumping out correct vertex lists from .X files loaded into a mesh. I assumed this was because internally the DirectX files could contain various primitive types. But if you're saying that internally tv3d always converts any mesh loaded into it, into triangle lists then I shouldnt have any problems.

its been a few months since ive looked at that code so i'll have to go back. I'll get back to you on this when i can.
Posted by Hypnotron on October 17th, 2005 at 12:14 PM
Damn. I just verified that using .GetVertex and looping through from 0 to .GetVertexCount - 1 does NOT return vertices in the order of the indices of a triangle list. In other words, GetVertex(0), GetVertex(1), GetVertex(2) does NOT necessarily match ANY triangle in the actual mesh.

THis is a big problem for me.
Posted by SylvainTV on January 15th, 2006 at 4:29 PM
No more problem with GetFaceInfo i guess :) Closing this one