From 1f2d381299f0cf991ed331337e6d5d885c2b5f11 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Jun 2010 16:30:43 +0000 Subject: [PATCH] From Luc Frauciel, added extra test case accessible via -t 7. --- .../osgspheresegment/osgspheresegment.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/examples/osgspheresegment/osgspheresegment.cpp b/examples/osgspheresegment/osgspheresegment.cpp index 2960b17ac..c68f291f4 100644 --- a/examples/osgspheresegment/osgspheresegment.cpp +++ b/examples/osgspheresegment/osgspheresegment.cpp @@ -156,6 +156,24 @@ class IntersectionUpdateCallback : public osg::NodeCallback unsigned frameCount_; }; +class RotateUpdateCallback : public osg::NodeCallback +{ +public: + RotateUpdateCallback() { i=0;} + virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) + { + osgSim::SphereSegment * ss = dynamic_cast(node); + if (ss) + { + ss->setArea(osg::Vec3(cos(i/(2*osg::PI)),sin(i/(2*osg::PI)),0), osg::PI_2, osg::PI_2); + + i += 0.1f; + } + + } +protected: + float i; +}; osg::Node* createMovingModel(const osg::Vec3& center, float radius, osg::Geode * terrainGeode, osg::Group * root, bool createMovingRadar = false) { @@ -562,6 +580,20 @@ void build_world(osg::Group *root, unsigned int testCase, bool useOverlay, osgSi root->addChild(mt.get()); break; } + case(7): + { + ss = new osgSim::SphereSegment( + computeTerrainIntersection(terrainGeode.get(),550.0f,780.0f), // center + 510.0f, // radius + osg::DegreesToRadians(-240.0f), + osg::DegreesToRadians(-135.0f), + osg::DegreesToRadians(-10.0f), + osg::DegreesToRadians(30.0f), + 60); + ss->setUpdateCallback(new RotateUpdateCallback()); + root->addChild(ss.get()); + break; + } }; if (ss.valid())