Changeset 9065 for OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp
- Timestamp:
- 10/27/08 17:16:28 (5 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp
r8551 r9065 46 46 #include <osg/Camera> 47 47 #include <osg/io_utils> 48 #include <osg/ShapeDrawable> 48 49 49 50 #include <osgText/Text> … … 108 109 float x = ea.getX(); 109 110 float y = ea.getY(); 111 #if 0 112 osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y); 113 osgUtil::IntersectionVisitor iv(picker.get()); 114 view->getCamera()->accept(iv); 115 if (picker->containsIntersections()) 116 { 117 intersections = picker->getIntersections(); 118 #else 110 119 if (view->computeIntersections(x,y,intersections)) 111 120 { 121 #endif 112 122 for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); 113 123 hitr != intersections.end(); … … 242 252 // read the scene from the list of file specified commandline args. 243 253 osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments); 244 254 255 if (!scene) 256 { 257 osg::Group* group = new osg::Group(); 258 259 osg::Geode* sphere = new osg::Geode(); 260 sphere->setName("Sphere"); 261 sphere->addDrawable(new osg::ShapeDrawable(new osg::Sphere())); 262 263 osg::Geode* cube = new osg::Geode(); 264 cube->setName("Cube"); 265 cube->addDrawable(new osg::ShapeDrawable(new osg::Box())); 266 267 osg::Camera* camera = new osg::Camera(); 268 camera->setRenderOrder(osg::Camera::POST_RENDER); 269 camera->setClearMask(GL_DEPTH_BUFFER_BIT); 270 //camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); 271 272 group->addChild(sphere); 273 group->addChild(camera); 274 camera->addChild(cube); 275 276 scene = group; 277 } 278 245 279 // if not loaded assume no arguments passed in, try use default mode instead. 246 280 if (!scene) scene = osgDB::readNodeFile("fountain.osg"); … … 314 348 // set the scene to render 315 349 viewer.setSceneData(group.get()); 316 350 317 351 return viewer.run(); 318 352 }
