[osg-users] different materials for a geometry and highlight
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Mon Sep 19 02:13:27 PDT 2016
Hi Gianni,
I browsed the LineSegmentIntersector code and it seems, the intersector
is using a triangleFunctor to traverse your primitive sets as triangles
anyways. So the Ifnromation
So basically you cannot find out which primitive set was affected
without reverse-engineering which primitive sets the triangle originated
from.
One easy way would be to use multiple drawables (I think you could still
share the vertex data) or to specialize the intersector to traverse per
primitive set.
Cheers
Sebastian
Am 9/19/2016 um 10:50 AM schrieb Sebastian Messerschmidt:
> Hi Gianni,
>> Code:
>> osg::Geometry* buildGeometry() {
>> osg::Geometry* geometry = new osg::Geometry;
>> geometry->setVertexArray(buildVertices());
>> geometry->setColorArray(buildColors(),
>> osg::Array::BIND_PER_PRIMITIVE_SET);
>>
>> std::vector<osg::DrawElementsUInt*> elements = buildElements();
>> for (std::vector<osg::DrawElementsUInt*>::iterator i =
>> elements.begin(); i != elements.end(); ++i) {
>> geometry->addPrimitiveSet(*i);
>> }
>>
>> return geometry;
>> }
>>
>>
>>
>> When I pick a triangle, is there a way from the information stored
>> into a osgUtil::LineSegmentIntersector::Intersection to get the
>> related primitive set?
> I might be wrong, but I think the intersector.primitiveIndex might
> yield the number you are looking for
> Also be sure to handle all intersections returned.
>
> Cheers
> Sebastian
>>
>> Regards,
>> Gianni
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=68630#68630
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list