Ive came up with this but it returns outside true every time regardless:
Code:
bool outside = false;
if (obj->getParentWidget() && obj->getParentWidget()->getUsingClipBoundingBox())
{
osg::ref_ptr<osg::ClipNode> clipNode =
obj->getParentWidget()->getClipNode();
if (clipNode)
{
for (unsigned int i = 0; i < clipNode->getNumClipPlanes(); i++)
{
osg::ref_ptr<osg::ClipPlane> plane = clipNode->getClipPlane(i);
osg::Vec4d pl = plane->getClipPlane();
osg::Vec3d pt = hitr->getWorldIntersectPoint();
if (( pt.x() * pl.x() + pt.y() * pl.y() + pt.z() * pl.z() + pl.w() )
< 0.f)
{
outside = true;
break;
}
}
}
}
i set the clip node like:
Code:
this->clipBoundingBox.set(pos.x() - this->size.x(),pos.y() -
this->size.y(),pos.z() - this->size.z(),pos.x() + this->size.x(), pos.y() +
this->size.y(), pos.z() + this->size.z());
this->clipNode->createClipBox(this->clipBoundingBox);
this->panel.setStateSet(this->clipNode->getStateSet());
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12745#12745
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org