I solved my problem...

For reference, the code I am referencing from the OSG Quick Start Guide is this:


Code:
double w( .05 ), h( .05 );
osgUtil::PolytopeIntersector* picker =
new osgUtil::PolytopeIntersector(
osgUtil::Intersector::PROJECTION,
x-w, y-h, x+w, y+h );
osgUtil::IntersectionVisitor iv( picker );
viewer->getCamera()->accept( iv );



Shortly after I posted, I saw that osgUtil::IntersectionVisitor contains a 
function setLODSelectionMode().  I tried setting this to 
USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION but it had no effect.  I did a bit more 
investigating and saw that this enum is referenced in 
IntersectionVisitor::getDistanceToEyePoint().  However, LOD::traverse() calls 
NodeVisitor::getDistanceToViewPoint(), which is not implemented in 
IntersectionVisitor.

I was able to derive from IntersectionVisitor and implement 
getDistanceToViewPoint() similarly to getDistanceToEyePoint():


Code:
if (_lodSelectionMode==USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION)
{
    return (pos-getViewPoint()).length();
}
else
{
    return 0.0f;
}



then used the subclass in my picking code, after which I got the desired effect.

Is this something that should be added to osgUtil::IntersectionVisitor?

... 

Thank you!

Cheers,
Michael

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49653#49653





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

Reply via email to