From ef88a54125ef06cd53a613566e202214f8fdfcf0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 9 Aug 2013 07:38:32 +0000 Subject: [PATCH] Removed old cursor code --- applications/present3D/present3D.cpp | 161 +-------------------------- 1 file changed, 2 insertions(+), 159 deletions(-) diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 251c8a7ec..837911a79 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -149,161 +149,6 @@ private: }; -class FollowMouseCallback: public osgGA::GUIEventHandler -{ - public: - - FollowMouseCallback(): - _mousePostition(0.5,0.5) {} - - virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv) - { - osg::AutoTransform* transform = dynamic_cast(object); - if (!transform) return false; - - osg::NotifySeverity level = osg::INFO; - - switch(ea.getEventType()) - { - case(osgGA::GUIEventAdapter::PUSH): - case(osgGA::GUIEventAdapter::RELEASE): - case(osgGA::GUIEventAdapter::MOVE): - case(osgGA::GUIEventAdapter::DRAG): - - osg::notify(level)<getNumChildren(); ++i) - { - osg::Node* node = transform->getChild(i); - node->setNodeMask( - node->getNodeMask()!=0 ? - 0 : - 0xffffff); - } - } - break; - } - default: - break; - } - return false; - } - - virtual void accept(osgGA::GUIEventHandlerVisitor& v) - { - v.visit(*this); - } - - osg::Vec2d _mousePostition; - osg::observer_ptr _camera; -}; - -osg::Node* createCursorSubgraph(const std::string& filename, float size) -{ - osg::Geode* geode = new osg::Geode; - - size = 20.0f; - - osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f)); - geom->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); - - osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename)); - if (image) - { - osg::StateSet* stateset = geom->getOrCreateStateSet(); - stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON|osg::StateAttribute::PROTECTED); - stateset->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::PROTECTED); - // stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); - stateset->setRenderBinDetails(1000, "DepthSortedBin"); - } - - geode->addDrawable(geom); - - osg::AutoTransform* transform = new osg::AutoTransform; - transform->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA); - transform->setAutoScaleToScreen(true); - - transform->addChild(geode); - - transform->setEventCallback(new FollowMouseCallback()); - - return transform; - -} - enum P3DApplicationType { @@ -332,12 +177,10 @@ void processLoadedModel(osg::ref_ptr& loadedModel, int optimizer_opti { osg::ref_ptr group = new osg::Group; group->addChild(loadedModel.get()); -#if 1 + OSG_NOTICE<<"Creating Cursor"<addChild(new osgPresentation::Cursor(cursorFileName, 20.0f)); -#else - group->addChild(createCursorSubgraph(cursorFileName, 20.0f)); -#endif + loadedModel = group; } }