diff --git a/examples/osgoccluder/osgoccluder.cpp b/examples/osgoccluder/osgoccluder.cpp index 5fa26506e..0e093a2e4 100644 --- a/examples/osgoccluder/osgoccluder.cpp +++ b/examples/osgoccluder/osgoccluder.cpp @@ -20,6 +20,7 @@ #include #include +#include class OccluderEventHandler : public osgGA::GUIEventHandler @@ -43,7 +44,6 @@ class OccluderEventHandler : public osgGA::GUIEventHandler osgProducer::Viewer* _viewer; - osg::ref_ptr _rootnode; osg::ref_ptr _occluders; osg::ref_ptr _convexPlanarOccluder; }; @@ -110,6 +110,16 @@ void OccluderEventHandler::addPoint(const osg::Vec3& pos) osg::ConvexPlanarPolygon& occluder = _convexPlanarOccluder->getOccluder(); occluder.add(pos); + +// +// osg::BoundingSphere bs = rootNode()->getBound(); +// +// osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(pos,bs.radius()*0.001f)); +// osg::Geode* geode = new osg::Geode; +// geode->addDrawable(sd); +// +// rootNode()->addChild(geode); +// } diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 148e2ad07..6fca77a9b 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -38,6 +38,10 @@ public: // the ray transformed by Projection _lineSegment = new osg::LineSegment; _lineSegment->set(nr,fr); // make a line segment + + std::cout<<"near "<accept(*this); @@ -65,7 +69,7 @@ public: // Assumes that the Projection is an absolute projection osg::Matrix mt; mt.invert(pr.getMatrix()); - osg::Vec3 npt=osg::Vec3(xp,yp,1.0f) * mt, farpt=osg::Vec3(xp,yp,-1.0f) * mt; + osg::Vec3 npt=osg::Vec3(xp,yp,-1.0f) * mt, farpt=osg::Vec3(xp,yp,1.0f) * mt; // traversing the nodes children, using the projection direction for (unsigned int i=0; i