How come the functionality of Geoms and GeomNodes arent combined? Does it have something to do with keeping GeomVertexData tables apart? And how come all the primitives in the same Geom have to be of the same type?
The Geom structures are designed primarily to optimize things for sorting by state and rendering them quickly. Thus, they are divided according to the logical division of state management and graphics API calls.
- A GeomNode contains geometry that is always rendered at the same time, so is always culled as a unit. This is the most fundamental unit of scene graph culling. All geometry within a GeomNode is either drawn, or not drawn. All geometry within a GeomNode always has the same TransformState.
This may, however, include several pieces of geometry that should be rendered with different states; for instance, you might have a “hair” texture and a “face” texture, but the whole head is always rendered as a unit. This leads us to the individual components of a GeomNode, which is the Geom class:
- A Geom contains all of the geometry, within a GeomNode, that is all rendered with a particular RenderState. This is the most fundamental unit of state changes. All geometry within a Geom always has the same TransformState and RenderState. Also, all geometry within a Geom always indexes into the same GeomVertexData.
There is no restriction that all primitives in a Geom have to be the same type. You must be mistaken about that (although there are some minor restrictions that relate to the fact that they all share the same GeomVertexData). In fact, allowing primitives of different type is the whole point of the next class:
- A GeomPrimitive contains all of the geometry, within a Geom, that are of a particular type. For instance, all triangle strips, or independent triangles, or line strips, or whatever. Usually, a single GeomPrimitive can be issued as a single “batch” to the graphics engine, via a single call to glDrawElements() (in OpenGL mode).
So at the end of the day, we have a scene graph that contains multiple GeomNodes, each of which contains one or more Geoms, each of which in turn contains one or more GeomPrimitives. This hierarchical separation is meaningful and very important in optimizing the rendering process.
Note, by the way, that it is perfectly legal for multiple different Geoms to all index into the same GeomVertexData. Although it is possible to have a different GeomVertexData for each Geom, this is not required.
Thanks! Ill add the information to the manual page about it