Changeset 5956 for OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp
- Timestamp:
- 01/10/07 22:05:26 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp
r5786 r5956 7 7 #include <osg/Stencil> 8 8 #include <osg/CullFace> 9 10 #include <osgProducer/Viewer> 9 #include <osg/Geometry> 10 11 #include <osgGA/TrackballManipulator> 12 13 #include <osgViewer/Viewer> 11 14 12 15 #include <osgShadow/OccluderGeometry> … … 14 17 #include <osgDB/ReadFile> 15 18 19 #include <iostream> 16 20 17 21 class ComputeBoundingBoxVisitor : public osg::NodeVisitor … … 125 129 126 130 // construct the viewer. 127 osgProducer::Viewer viewer(arguments); 128 129 // set up the value with sensible default event handlers. 130 viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 131 132 // get details on keyboard and mouse bindings used by the viewer. 133 viewer.getUsage(*arguments. getApplicationUsage()); 131 osgViewer::Viewer viewer; 134 132 135 133 // if user request help write it out to cout. … … 190 188 osg::Vec3 centerBase( (bb.xMin()+bb.xMax())*0.5f, (bb.yMin()+bb.yMax())*0.5f, bb.zMin()-bb.radius()*0.1f ); 191 189 192 geode->addDrawable( createTexturedQuadGeometry( centerBase-widthVec*1.5f-depthVec*1.5f,193 widthVec*3.0f, depthVec*3.0f) );190 geode->addDrawable( osg::createTexturedQuadGeometry( centerBase-widthVec*1.5f-depthVec*1.5f, 191 widthVec*3.0f, depthVec*3.0f) ); 194 192 newGroup->addChild(geode); 195 193 … … 382 380 viewer.setSceneData(group.get()); 383 381 382 383 viewer.setCameraManipulator(new osgGA::TrackballManipulator()); 384 385 386 osg::notify(osg::NOTICE)<<"Warning: Stencil buffer required, but not yet switched on."<<std::endl; 387 388 384 389 // create the windows and run the threads. 385 390 viewer.realize(); … … 387 392 while (!viewer.done()) 388 393 { 389 // wait for all cull and draw threads to complete.390 viewer.sync();391 392 394 if (updateLightPosition) 393 395 { … … 403 405 light->setPosition(lightpos); 404 406 occluder->computeShadowVolumeGeometry(lightpos, *shadowVolume); 405 } 406 407 // update the scene by traversing it with the the update visitor which will 408 // call all node update callbacks and animations. 409 viewer.update(); 410 411 // fire off the cull and draw traversals of the scene. 412 viewer.frame(); 413 } 414 415 // wait for all cull and draw threads to complete. 416 viewer.sync(); 417 418 // run a clean up frame to delete all OpenGL objects. 419 viewer.cleanup_frame(); 420 421 // wait for all the clean up frame to complete. 422 viewer.sync(); 423 407 } 408 409 viewer.frame(); 410 } 411 424 412 return 0; 425 413 }
