- Timestamp:
- 06/14/10 18:30:43 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgspheresegment/osgspheresegment.cpp
r8998 r11605 157 157 }; 158 158 159 class RotateUpdateCallback : public osg::NodeCallback 160 { 161 public: 162 RotateUpdateCallback() { i=0;} 163 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) 164 { 165 osgSim::SphereSegment * ss = dynamic_cast<osgSim::SphereSegment *>(node); 166 if (ss) 167 { 168 ss->setArea(osg::Vec3(cos(i/(2*osg::PI)),sin(i/(2*osg::PI)),0), osg::PI_2, osg::PI_2); 169 170 i += 0.1f; 171 } 172 173 } 174 protected: 175 float i; 176 }; 159 177 160 178 osg::Node* createMovingModel(const osg::Vec3& center, float radius, osg::Geode * terrainGeode, osg::Group * root, bool createMovingRadar = false) … … 563 581 break; 564 582 } 583 case(7): 584 { 585 ss = new osgSim::SphereSegment( 586 computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center 587 510.0f, // radius 588 osg::DegreesToRadians(-240.0f), 589 osg::DegreesToRadians(-135.0f), 590 osg::DegreesToRadians(-10.0f), 591 osg::DegreesToRadians(30.0f), 592 60); 593 ss->setUpdateCallback(new RotateUpdateCallback()); 594 root->addChild(ss.get()); 595 break; 596 } 565 597 }; 566 598
