- Timestamp:
- 10/01/05 21:28:34 (8 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgspheresegment/osgspheresegment.cpp
r4539 r4563 225 225 ////////////////////////////////////////////////////////////////////////////// 226 226 227 void build_world(osg::Group *root )227 void build_world(osg::Group *root, unsigned int testCase) 228 228 { 229 229 … … 329 329 osg::ref_ptr<osgSim::SphereSegment> ss = 0; 330 330 { 331 ss = new osgSim::SphereSegment( 332 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 333 500.0f, // radius 334 osg::DegreesToRadians(135.0f), 335 osg::DegreesToRadians(245.0f), 336 osg::DegreesToRadians(-10.0f), 337 osg::DegreesToRadians(30.0f), 338 60); 331 332 switch(testCase) 333 { 334 case(0): 335 ss = new osgSim::SphereSegment( 336 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 337 510.0f, // radius 338 osg::DegreesToRadians(135.0f), 339 osg::DegreesToRadians(240.0f), 340 osg::DegreesToRadians(-10.0f), 341 osg::DegreesToRadians(30.0f), 342 60); 343 break; 344 case(1): 345 ss = new osgSim::SphereSegment( 346 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 347 510.0f, // radius 348 osg::DegreesToRadians(45.0f), 349 osg::DegreesToRadians(240.0f), 350 osg::DegreesToRadians(-10.0f), 351 osg::DegreesToRadians(30.0f), 352 60); 353 break; 354 case(2): 355 ss = new osgSim::SphereSegment( 356 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 357 510.0f, // radius 358 osg::DegreesToRadians(5.0f), 359 osg::DegreesToRadians(355.0f), 360 osg::DegreesToRadians(-10.0f), 361 osg::DegreesToRadians(30.0f), 362 60); 363 break; 364 case(3): 365 ss = new osgSim::SphereSegment( 366 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 367 510.0f, // radius 368 osg::DegreesToRadians(0.0f), 369 osg::DegreesToRadians(360.0f), 370 osg::DegreesToRadians(-10.0f), 371 osg::DegreesToRadians(30.0f), 372 60); 373 break; 374 }; 375 339 376 ss->setAllColors(osg::Vec4(1.0f,1.0f,1.0f,0.5f)); 340 377 ss->setSideColor(osg::Vec4(0.0f,1.0f,1.0f,0.1f)); 341 378 #if 1 342 379 root->addChild(ss.get()); 343 } 344 380 #endif 381 } 382 383 #if 1 384 root->addChild(ss->computeIntersectionSubgraph(osg::Matrixd::identity(), terrainGeode.get())); 385 #else 345 386 osgSim::SphereSegment::LineList lines = ss->computeIntersection(osg::Matrixd::identity(), terrainGeode.get()); 346 387 if (!lines.empty()) … … 369 410 osg::notify(osg::NOTICE)<<"No intersections found"<<std::endl; 370 411 } 371 372 #if 1 412 #endif 413 414 #if 0 373 415 374 416 … … 386 428 root->addChild(overlayNode); 387 429 388 389 430 #else 390 root->addChild(terrainGeode );431 root->addChild(terrainGeode.get()); 391 432 #endif 392 433 … … 451 492 452 493 // if user request help write it out to cout. 494 unsigned int testCase = 0; 495 if (arguments.read("-t", testCase)) {} 496 497 498 // if user request help write it out to cout. 453 499 if (arguments.read("-h") || arguments.read("--help")) 454 500 { … … 468 514 469 515 osg::Group *root = new osg::Group; 470 build_world(root );516 build_world(root, testCase); 471 517 472 518 // add a viewport to the viewer and attach the scene graph.
