Hi all,
I'm writing a piece of code to know, when a picking occurred, if the picked
face is orientated backward or forward... because if I understand well, there
is no "simple" way to avoid picking results on culled backfaces :
Code:
osgUtil::LineSegmentIntersector::Intersections intersections;
float x = ea.getX();
float y = ea.getY();
osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = new
osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y);
osgUtil::IntersectionVisitor iv(picker.get());
iv.setTraversalMask(IS_PICKABLE_MASK);
view->getCamera()->accept(iv);
if (picker->containsIntersections())
{
intersections = picker->getIntersections();
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr =
intersections.begin();hitr != intersections.end();++hitr)
{
osg::Vec3 n = hitr->getLocalIntersectNormal();
osg::Vec3 eye = iv.getEyePoint();
osg::Vec3 inter = hitr->getLocalIntersectPoint();
n.normalize();
osg::Vec3 eyeVec = inter-eye;
eyeVec.normalize();
if (eyeVec*n>0)
{
/*do something */
}
}
}
but the results are not what I thought... is there something wrong in my dot
product computed in local coords just to know if the normal is looking to the
camera or not ?
Thanks for your help
Eric[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31073#31073
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org