- Timestamp:
- 09/06/05 17:48:18 (8 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgspheresegment/osgspheresegment.cpp
r4175 r4506 13 13 14 14 #include <osgSim/SphereSegment> 15 #include <osgSim/OverlayNode> 15 16 16 17 #include <osgParticle/ExplosionEffect> … … 174 175 { 175 176 176 osg::Geode* terrainGeode = new osg::Geode;177 177 // create terrain 178 { 178 osg::ref_ptr<osg::Geode> terrainGeode = 0; 179 { 180 terrainGeode = new osg::Geode; 181 179 182 osg::StateSet* stateset = new osg::StateSet(); 180 183 osg::Image* image = osgDB::readImageFile("Images/lz.rgb"); … … 206 209 terrainGeode->addDrawable(new osg::ShapeDrawable(grid)); 207 210 208 root->addChild(terrainGeode);211 209 212 } 210 213 214 211 215 // create sphere segment 212 { 213 osgSim::SphereSegment* ss = new osgSim::SphereSegment( 214 computeTerrainIntersection(terrainGeode,550.0f,780.0f), // center 216 osg::ref_ptr<osgSim::SphereSegment> ss = 0; 217 { 218 ss = new osgSim::SphereSegment( 219 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 215 220 500.0f, // radius 216 221 osg::DegreesToRadians(135.0f), … … 222 227 ss->setSideColor(osg::Vec4(0.0f,1.0f,1.0f,0.1f)); 223 228 224 root->addChild(ss); 225 } 229 root->addChild(ss.get()); 230 } 231 232 #if 1 233 osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode; 234 overlayNode->setOverlaySubgraph(ss.get()); 235 overlayNode->setOverlayTextureSizeHint(2048); 236 overlayNode->addChild(terrainGeode.get()); 237 238 root->addChild(overlayNode); 239 #else 240 root->addChild(terrainGeode); 241 #endif 226 242 227 243 228 244 // create particle effects 229 245 { 230 osg::Vec3 position = computeTerrainIntersection(terrainGeode ,100.0f,100.0f);246 osg::Vec3 position = computeTerrainIntersection(terrainGeode.get(),100.0f,100.0f); 231 247 232 248 osgParticle::ExplosionEffect* explosion = new osgParticle::ExplosionEffect(position, 10.0f); … … 241 257 // create particle effects 242 258 { 243 osg::Vec3 position = computeTerrainIntersection(terrainGeode ,200.0f,100.0f);259 osg::Vec3 position = computeTerrainIntersection(terrainGeode.get(),200.0f,100.0f); 244 260 245 261 osgParticle::ExplosionEffect* explosion = new osgParticle::ExplosionEffect(position, 1.0f);
