> ShapeDrawable does support the PrimitiveFunctor which makes 
> it possible to get the vertex/primitive data out - this is 
> how the intersection code is able to intersect with geometry. 
>  It's not computationally efficient as the vertex data is 
> generated on demand, but it does at least enable you to do 
> stuff that wouldn't otherwise be possible.

You are correct that code can access ShapeDrawable primitive/vertex data
using the PrimitiveFunctor. Let me explain my thinking in more detail...

The FLT exporter currently takes the VertexArray (and normals, colors, and
texCoords) and adds them wholesale into the FLT vertex palette, so that
shared vertices are stored only once (or only as many times as they actually
appear in the scene graph). This requires the get*Array() methods present in
the Geometry interface. ShapeDrawable doesn't allow this direct access.
Using PrimitiveFunctor to support ShapeDrawable in FLT export would mean
that shared vertices would appear multiple times in the vertex palette.

Clearly, this was a case where I choose to optimize for storage size and
runtime efficiency rather than provide full functionality, something I
wouldn't normally do. However, this only impacts features that I assumed
were not in production use because of their known sub-optimal performance:
VertexIndices, normals and colors using BIND_PER_PRIMITIVE, and
ShapeDrawavbles all force glBegin/glEnd. My assumption was wrong; many
people are using these features, apparently unaware of the performance
limitations. (I think there's a notify message when a Geometry takes the
slow path; perhaps we should bump up its verbosity to WARN.)

The FLT exporter is open source, however, so anyone who feels the code
should handle these cases is free to code it up and submit it. I could
imagine a redesign in which "well-behaved" Geometry uses the corrent code,
and ShapeDrawable and sub-optimal Geometry uses a PrimitiveFunctor ro
populate the vertex palette and create Face records.

However, it seems to me that coding time would be better spent optimizing
one's data to not use sub-optimal rendering features.
   -Paul

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to