On Thu, Apr 8, 2010 at 5:01 PM, Martin Beckett <[email protected]> wrote:

>
> Tim Moore wrote:
> > I presume you mean that the common vertex array(s) is shared among
> several Geometry objects, which are the children of Geodes?
>
> Also shared between several geodes (all under a group object) because I
> need to use the nodemask and this is only supported at geode level
>
>
> > If you have one big shared vertex array, then you can look at the
> PrimitiveSet objects in the containing Geometry in order to get the mapping
> from primitive index to actual index in the vertex array.
>
>
> Yes but I can't easily find all the vertices used by part A if it's
> drawable is say triangles, without doing a visitor on all the triangles and
> building a list.
>
> If I kept the vertex array in part order (so all A's points were first,
> then B etc) I would just need to know the range of vertices used by A - but
> you can't easily find this for any primitive except a drawarrya.
> I can only find the number of entries in the primitive set - which if it
> isn't simply points doesn't easily relate to the number of vertices.
>
> PrimitiveSet::getNumIndices() returns the number of vertices in the
PrimitiveSet. PrimitiveSet::index() returns the actual index of vertex n in
the vertex arrays.

It's true that if the Mode of a PrimitiveSet is not TRIANGLE then you'll
need to look very carefully at the TriangleFunctor code to figure out how to
map the triangle primitive index back to the actual primitive in the
PrimitiveSet, but it can be done.


> What I need is a quick way of knowing the first and last vertices for each
> part in the vertexarray.
>
ps->index(0)
ps->index(ps->getNumIndices() - 1)

Tim

>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=26586#26586
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to