Changeset 73
- Timestamp:
- Jul 24, 2010, 10:48:02 AM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/include/dataIO/dataIO_transportContainer.h
r70 r73 18 18 #include <osg/Object> 19 19 #include <osg/Matrixd> 20 #include <osg/Vec3d> 20 21 21 22 #include <dataIO_executer.h> … … 34 35 frameID(tC_.frameID), 35 36 viewMatrix(tC_.viewMatrix), 36 projectionMatrix(tC_.projectionMatrix), 37 eye(tC_.eye), 38 center(tC_.center), 39 up(tC_.up), 37 40 executer(tC_.executer), 38 41 ioSlots(tC_.ioSlots){} … … 49 52 int frameID; 50 53 osg::Matrixd viewMatrix; 51 osg:: Matrixd projectionMatrix;54 osg::Vec3d eye, center, up; 52 55 executerList executer; 53 56 slotList ioSlots; … … 58 61 void setFrameID(int frameID_ ){frameID=frameID_;} 59 62 60 void setViewMatrix(const osg::Matrixd& viewMatrix_){viewMatrix =viewMatrix_;}63 void setViewMatrix(const osg::Matrixd& viewMatrix_){viewMatrix = viewMatrix_;} 61 64 const osg::Matrixd& getViewMatrix() const {return viewMatrix;} 62 65 63 void setProjectionMatrix(const osg::Matrixd& projectionMatrix_){projectionMatrix=projectionMatrix_;} 64 const osg::Matrixd& getProjectionMatrix() const {return projectionMatrix;} 66 void setEye(const osg::Vec3d& eye_) { eye = eye_; } 67 const osg::Vec3d& getEye() const { return eye; } 68 69 void setCenter(const osg::Vec3d& center_) { center = center_; } 70 const osg::Vec3d& getCenter() const { return center; } 71 72 void setUp(const osg::Vec3d& up_) { up = up_; } 73 const osg::Vec3d& getUp() const { return up; } 65 74 66 75 void setExecuter(const executerList& executer_) {executer=executer_;} -
osgVisual/include/dataIO/visual_dataIO.h
r70 r73 152 152 bool isStandalone(){if (clusterMode==osgVisual::dataIO_cluster::STANDALONE) return true; else return false;}; 153 153 154 155 154 // SLOT Access functions 156 155 void* getSlotPointer(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, osgVisual::dataIO_slot::varType variableTyp_ ); -
osgVisual/include/extLink/manip_extLink.h
r55 r73 24 24 25 25 /** 26 * \brief This class is a free spacemouse manipulator. It uses the 3DConnexion SpaceNavigator, which interface is implemented in manip_spaceMouse.h26 * \brief This class is a camera manipulator based slots without objects. 27 27 * 28 28 * @author Torben Dannhauer -
osgVisual/src/cluster/dataIO_clusterENet.cpp
r72 r73 125 125 sendContainer->setFrameID(viewer->getFrameStamp()->getFrameNumber()); 126 126 sendContainer->setViewMatrix(viewer->getCamera()->getViewMatrix()); 127 sendContainer->setProjectionMatrix(viewer->getCamera()->getProjectionMatrix()); 127 osg::Vec3d eye, center, up; 128 viewer->getCamera()->getViewMatrixAsLookAt(eye,center,up); 129 sendContainer->setEye(eye); 130 sendContainer->setCenter(center); 131 sendContainer->setUp(up); 132 //std::cout << "sending lookat: eye:"<<eye<<", center:"<<center<<", up:" << up << std::endl; 128 133 129 134 // Writing node to stream … … 166 171 //OSG_NOTIFY( osg::ALWAYS ) << "dataIO_clusterENet::readTO_OBJvaluesFromMaster() - Bytes received: " << bytes_received << std::endl; 167 172 OSG_NOTIFY( osg::ALWAYS ) << "Received: " << std::endl << receivedTransportContainer << std::endl; 173 168 174 169 175 // Unserialize data … … 179 185 { 180 186 OSG_NOTIFY( osg::ALWAYS ) << "Received:: Settings Viewmatrix...FrameID is: " << sendContainer->getFrameID() << std::endl; 181 // Restore Viewmatrix / Projectionmatrix187 // Restore Viewmatrix 182 188 viewer->getCamera()->setViewMatrix(sendContainer->getViewMatrix()); 183 viewer->getCamera()->setProjectionMatrix(sendContainer->getProjectionMatrix()); 189 //viewer->getCamera()->setViewMatrixAsLookAt(sendContainer->getEye(),sendContainer->getCenter(),sendContainer->getUp()); 190 //std::cout << "receiving lookat: eye:"<<eye.x()<<", center:"<<center<<", up:" << up << std::endl; 184 191 } 185 192 else -
osgVisual/src/core/visual_core.cpp
r72 r73 56 56 OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_core..." << std::endl; 57 57 58 // Add manipulators for user interaction59 addManipulators();60 61 58 // Load terrain 62 59 //loadTerrain(arguments); … … 84 81 visual_dataIO::getInstance()->init(viewer, arguments); 85 82 83 // Add manipulators for user interaction - after dataIO to be able to skip it in slaves. 84 addManipulators(); 85 86 86 loadTerrain(arguments); 87 87 … … 118 118 // update the scene by traversing it with the the update visitor which will 119 119 // call all node update callbacks and animations. 120 121 120 viewer->updateTraversal(); 122 121 … … 179 178 void visual_core::addManipulators() 180 179 { 181 // set up the camera manipulators.180 if(!visual_dataIO::getInstance()->isSlave()) // set up the camera manipulators if not slave. 182 181 { 183 182 osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; … … 221 220 222 221 viewer->setCameraManipulator( keyswitchManipulator.get() ); 223 } 222 } // If not Slave END 224 223 225 224 // add the state manipulator … … 328 327 #endif 329 328 330 osgGA::NodeTrackerManipulator::TrackerMode trackerMode = osgGA::NodeTrackerManipulator::NODE_CENTER; 331 osgGA::NodeTrackerManipulator::RotationMode rotationMode = osgGA::NodeTrackerManipulator::ELEVATION_AZIM; 332 nt->setTrackerMode(trackerMode); 333 nt->setRotationMode(rotationMode); 334 //nt->setAutoComputeHomePosition( true ); 335 nt->setMinimumDistance( 100 ); 336 nt->setTrackNode(testObj4->getGeometry()); 337 //nt->computeHomePosition(); 338 nt->setAutoComputeHomePosition( true ); 339 nt->setDistance( 250 ); 329 if(nt.valid()) 330 { 331 osgGA::NodeTrackerManipulator::TrackerMode trackerMode = osgGA::NodeTrackerManipulator::NODE_CENTER; 332 osgGA::NodeTrackerManipulator::RotationMode rotationMode = osgGA::NodeTrackerManipulator::ELEVATION_AZIM; 333 nt->setTrackerMode(trackerMode); 334 nt->setRotationMode(rotationMode); 335 //nt->setAutoComputeHomePosition( true ); 336 nt->setMinimumDistance( 100 ); 337 nt->setTrackNode(testObj4->getGeometry()); 338 //nt->computeHomePosition(); 339 nt->setAutoComputeHomePosition( true ); 340 nt->setDistance( 250 ); 341 } 340 342 341 343 … … 376 378 377 379 visual_dataIO::getInstance()->setSlotData("TestSlot1", osgVisual::dataIO_slot::TO_OBJ, 0.12345); 378 379 380 //// Writing object to stream 381 ////std::ofstream myOstream("test.txt" ); 382 //std::stringstream myOstream; 383 //std::string extension = "osgb"; 384 //bool compressed = false; 385 //osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension(extension.c_str()); 386 //if ( rw ) 387 //{ 388 // osgDB::ReaderWriter::WriteResult wr; 389 390 // if (extension == "osgb") 391 // { 392 // if (compressed) 393 // wr = rw->writeObject( *test, myOstream, new osgDB::Options("Compressor=zlib") ); 394 // else 395 // wr = rw->writeObject( *test, myOstream ); 396 // } 397 398 // if (extension == "osgt") 399 // { 400 // if (compressed) 401 // wr = rw->writeObject( *test, myOstream, new osgDB::Options("Ascii Compressor=zlib") ); 402 // else 403 // wr = rw->writeObject( *test, myOstream, new osgDB::Options("Ascii") ); 404 // } 405 406 // if (extension == "osgx") 407 // { 408 // if (compressed) 409 // wr = rw->writeObject( *test, myOstream, new osgDB::Options("XML Compressor=zlib") ); 410 // else 411 // wr = rw->writeObject( *test, myOstream, new osgDB::Options("XML") ); 412 // } 413 414 415 // if (!wr.success() ) OSG_NOTIFY( osg::WARN ) << "ERROR: Save failed: " << wr.message() << std::endl; 416 //} 417 //else 418 // OSG_NOTIFY( osg::WARN ) << "error getting readerWriter for osgt" << std::endl; 419 420 //// Size ermitteln. 421 //std::stringbuf *pbuf; 422 //pbuf = myOstream.rdbuf(); 423 //OSG_NOTIFY( osg::WARN ) << "PBUF Bytes available: " << pbuf->in_avail() << std::endl; 424 //OSG_NOTIFY( osg::ALWAYS ) << "STRING Bytes available: " << myOstream.str().length() << std::endl; 425 //OSG_NOTIFY( osg::ALWAYS ) << "STRING content: " << myOstream.str() << std::endl; 426 427 ////Reading Stream to node 428 //if ( rw ) 429 //{ 430 // osgDB::ReaderWriter::ReadResult rr = rw->readObject( myOstream ); 431 // osg::ref_ptr<osgVisual::dataIO_transportContainer> test2 = dynamic_cast<osgVisual::dataIO_transportContainer*>(rr.takeObject()); 432 // if (test2) 433 // { 434 // OSG_NOTIFY( osg::WARN ) << "TEST::FrameID is: " << test->getFrameID() << std::endl; 435 // } 436 // else 437 // OSG_NOTIFY( osg::WARN ) << "Error converting stream to Node" << std::endl; 438 //} 439 } 380 } -
osgVisual/src/dataIO/dataIO_transportContainer.cpp
r70 r73 27 27 ADD_INT_SERIALIZER( FrameID, 0 ); 28 28 ADD_MATRIXD_SERIALIZER( ViewMatrix, osg::Matrixd() ); 29 ADD_MATRIXD_SERIALIZER( ProjectionMatrix, osg::Matrixd() ); 29 ADD_VEC3D_SERIALIZER( Eye, osg::Vec3d(-1.0, -1.0, -1.0) ); 30 ADD_VEC3D_SERIALIZER( Center, osg::Vec3d(-1.0,-1.0,-1.0) ); 31 ADD_VEC3D_SERIALIZER( Up, osg::Vec3d(-1.0,-1.0,-1.0) ); 30 32 ADD_LIST_SERIALIZER( Executer, osgVisual::dataIO_transportContainer::executerList ); 31 33 ADD_LIST_SERIALIZER( IOSlots, osgVisual::dataIO_transportContainer::slotList ); -
osgVisual/src/dataIO/visual_dataIO.cpp
r70 r73 154 154 break; 155 155 }; 156 traverse(node, nv); 156 157 } 157 158 -
osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp
r70 r73 41 41 void visual_skySilverLining::skyUpdateCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) 42 42 { 43 std::cout << "Sky silverlining update callback" << std::endl;43 //std::cout << "Sky silverlining update callback" << std::endl; 44 44 // Check if atmosphere is initialized. 45 45 if (!sky->isInitialized()) … … 50 50 51 51 // Update sky 52 double lat, lon, height, x, y, z; 53 util::getXYZofCamera( sceneCamera, x, y, z); 52 double lat, lon, height; 54 53 util::getWGS84ofCamera( sceneCamera, csn, lat, lon, height ); 55 54 //std::cout << "lat: " << osg::RadiansToDegrees(lat) << ", lon: " << osg::RadiansToDegrees(lon) << ", height: " << height << std::endl; … … 247 246 //addWindVolume( 0.0, 15000.0, 300.0, 90.0 ); 248 247 249 addCloudLayer( 0, 300000, 300000, 600.0, 2351.0, 0.5, STRATUS );248 //addCloudLayer( 0, 300000, 300000, 600.0, 2351.0, 0.5, STRATUS ); 250 249 //addCloudLayer( 0, 5000000, 5000000, 600.0, 7351.0, 0.2, CIRRUS_FIBRATUS ); 251 250 //addCloudLayer( 0, 50000, 50000, 600.0, 7351.0, 0.2, CIRROCUMULUS );
Note: See TracChangeset
for help on using the changeset viewer.