- Timestamp:
- Feb 13, 2011, 7:25:16 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r230 r234 71 71 </geometry> 72 72 </model> 73 <trackmodel id="2" updater_slot=" "></trackmodel>73 <trackmodel id="2" updater_slot="trackID"></trackmodel> 74 74 </models> 75 75 <datetime day="0" month="0" year="0" hour="12" minute="30"></datetime> -
osgVisual/trunk/include/core/core_manipulator.h
r231 r234 63 63 void trackNode( int trackingID ); 64 64 int getCurrentTrackingID(){return _currentTrackingID;}; 65 void setTrackingIdUpdaterSlot(std::string updaterSlot){_updaterSlot=updaterSlot;}; 66 std::string getTrackingIdUpdaterSlot(){return _updaterSlot;}; 65 67 66 68 private: 69 class core_manipulatorCallback : public osg::NodeCallback 70 { 71 public: 72 /** 73 * \brief Constructor, for setting the member variables. 74 * 75 * @param manipulators : Pointer to the manipulator and tracking class. 76 */ 77 core_manipulatorCallback(core_manipulator* manipulators):_manipulators(manipulators){}; 78 79 /** 80 * \brief This function is executed as callback during event traversal. 81 * 82 */ 83 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); 84 private: 85 /** Pointer to the manipulator class to edit its value */ 86 core_manipulator* _manipulators; 87 }; 88 89 /** Pointer to the callback isntalled to update the tracking ID */ 90 osg::ref_ptr<core_manipulatorCallback> _callback; 91 92 /** core_manipulatorCallback must be a freind of this class to allow the callback to edit the member values of this class directly */ 93 friend class core_manipulatorCallback; 67 94 68 95 #ifdef USE_SPACENAVIGATOR … … 93 120 int _currentTrackingID; 94 121 122 /** Slotname to use for dynamic updated tracking ID. */ 123 std::string _updaterSlot; 124 95 125 /** 96 126 * Pointer to the scene root node 97 127 */ 98 128 osg::ref_ptr<osg::Node> _rootNode; 129 130 /** 131 * Referenced pointer to the applications viewer. 132 */ 133 osg::ref_ptr<osgViewer::Viewer> _viewer; 99 134 }; 100 135 -
osgVisual/trunk/include/dataIO/visual_dataIO.h
r221 r234 80 80 * \brief Constructor, for setting the member variables. 81 81 * 82 * @param viewer_ : Pointer to the viewer. 83 * @param sceneCamera_ : Pointer to the scene camera. 82 * @param dataIO_ : Pointer to the dataIO class. 84 83 */ 85 84 dataIO_eventCallback(visual_dataIO* dataIO_):dataIO(dataIO_){}; 86 85 87 86 /** 88 * \brief This function is execute d as callback during updatetraversal.87 * \brief This function is executed as callback during event traversal. 89 88 * 90 89 */ -
osgVisual/trunk/src/core/core_manipulator.cpp
r231 r234 31 31 { 32 32 _rootNode = rootNode; 33 _viewer = viewer; 33 34 34 35 // Setup manipulators … … 87 88 viewer->addEventHandler(new osgViewer::ScreenCaptureHandler); // add the screen capture handler 88 89 89 90 // Install Callback 91 _callback = new core_manipulatorCallback(this); 92 viewer->getCamera()->addEventCallback(_callback); 90 93 91 94 return true; … … 94 97 void core_manipulator::shutdown() 95 98 { 99 // Remove and Delete Callback 100 _viewer->getCamera()->removeEventCallback(_callback); 101 _callback= NULL; 102 96 103 #ifdef USE_SPACENAVIGATOR 97 104 //Delete SpaceMouse driver … … 107 114 _nt = NULL; 108 115 _rootNode = NULL; 116 _viewer = NULL; 109 117 } 110 118 … … 160 168 } 161 169 } 170 171 void core_manipulator::core_manipulatorCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) 172 { 173 //OSG_NOTIFY( osg::ALWAYS ) << "---- Executing core_manipulatorCallback .." << std::endl; 174 175 if(!_manipulators->_updaterSlot.empty()) 176 { 177 int idToTrack = visual_dataIO::getInstance()->getSlotDataAsDouble(_manipulators->_updaterSlot, osgVisual::dataIO_slot::TO_OBJ ); 178 if(idToTrack!=_manipulators->_currentTrackingID) 179 _manipulators->trackNode(idToTrack); 180 } 181 182 traverse(node, nv); 183 } -
osgVisual/trunk/src/core/visual_core.cpp
r233 r234 215 215 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 216 216 if( attr_name == "id" ) manipulators->trackNode( util::strToInt(attr_value) ); 217 218 217 if( attr_name == "updater_slot" ) manipulators->setTrackingIdUpdaterSlot(attr_value); 219 218 attr = attr->next; 220 219 }
Note: See TracChangeset
for help on using the changeset viewer.