Changeset 212
- Timestamp:
- Jan 30, 2011, 8:30:23 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r208 r212 43 43 <!-- Models can be loaded and placed in the scenery. 44 44 - objectname: Name of the object to identify it in the scenegraph. 45 - tracking ID: ID to manage which object should be tracked 45 46 - label: text to label the model with. 46 47 - dynamic: "yes" to add an standard updater to the model. … … 53 54 - Geometryscale [optional]: Scale factors for the loaded 3D model in all three dimensions. 54 55 --> 55 <model objectname="TestObject" label="TestText!" dynamic="yes">56 <model objectname="TestObject" trackingid="1" label="TestText!" dynamic="yes"> 56 57 <position lat="47.12345" lon="11.234567" alt="1500.0"></position> 57 58 <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude> … … 65 66 <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation> 66 67 </cameraoffset> 67 <geometry filename="../models/ Boing777-200.ive">68 <geometry filename="../models/saenger1.flt"> 68 69 <offset rot_x="0.0" rot_y="0.0" rot_z="0.0"></offset> 69 70 <scalefactor scale_x="1.0" scale_y="1.0" scale_z="1.0"></scalefactor> 70 71 </geometry> 71 72 </model> 73 <trackmodel id="1"></trackmodel> 72 74 </models> 73 75 <datetime day="0" month="0" year="0" hour="12" minute="30"></datetime> -
osgVisual/trunk/include/core/visual_core.h
r187 r212 111 111 112 112 void setupScenery(); 113 void trackNode( osg::Node* node_ ); 113 114 114 115 protected: -
osgVisual/trunk/src/core/visual_core.cpp
r211 r212 404 404 } 405 405 } 406 407 // Track Node 408 406 409 #endif 407 410 }// FOR all nodes END … … 414 417 arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); 415 418 arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the new FSD visualization tool, written by Torben Dannhauer"); 416 arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [ options] Terrain_filename");419 arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [OSG options] -c XML-Configurationfile"); 417 420 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 421 arguments.getApplicationUsage()->addCommandLineOption("-c or --config","XML configuration filename"); 422 418 423 419 424 // if user request help write it out to cout. … … 470 475 ////testObj2->addUpdater( new object_updater(testObj2) ); // todo memleak 471 476 472 osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); // todo memleak473 testObj3->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 );474 testObj3->loadGeometry( "../models/saenger1.flt" );475 testObj3->addUpdater( new object_updater(testObj3) ); // todo memleak476 477 //osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); // todo memleak 478 //testObj3->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); 479 //testObj3->loadGeometry( "../models/saenger1.flt" ); 480 //testObj3->addUpdater( new object_updater(testObj3) ); // todo memleak 481 // 477 482 478 483 osg::ref_ptr<visual_object> testObj4 = new visual_object( rootNode, "SAENGER2" ); // todo memleak … … 482 487 testObj4->addLabel("testLabel", "LabelTest!!\nnächste Zeile :)",osg::Vec4(1.0f,0.25f,1.0f,1.0f)); 483 488 484 osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); // todo memleak 485 testObj5->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 550 ); 486 testObj5->loadGeometry( "../models/saengerCombine.flt" ); 487 //testObj5->setScale( 2 ); 488 testObj5->addUpdater( new object_updater(testObj5) ); // todo memleak 489 490 #ifdef USE_SPACENAVIGATOR 491 // Manipulatoren auf dieses Objekt binden (Primärobjekt) 492 if (objectMountedCameraManip.valid()) 493 objectMountedCameraManip->setAttachedObject( testObj4 ); 494 if (mouseTrackerManip.valid()) 495 { 496 mouseTrackerManip->setTrackNode( testObj4->getGeometry() ); 497 mouseTrackerManip->setMinimumDistance( 100 ); 498 } 499 #endif 500 501 if(nt.valid()) 502 { 503 osgGA::NodeTrackerManipulator::TrackerMode trackerMode = osgGA::NodeTrackerManipulator::NODE_CENTER; 504 osgGA::NodeTrackerManipulator::RotationMode rotationMode = osgGA::NodeTrackerManipulator::ELEVATION_AZIM; 505 nt->setTrackerMode(trackerMode); 506 nt->setRotationMode(rotationMode); 507 //nt->setAutoComputeHomePosition( true ); 508 nt->setMinimumDistance( 100 ); 509 nt->setTrackNode(testObj4->getGeometry()); 510 //nt->computeHomePosition(); 511 nt->setAutoComputeHomePosition( true ); 512 nt->setDistance( 250 ); 513 } 514 489 //osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); // todo memleak 490 //testObj5->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 550 ); 491 //testObj5->loadGeometry( "../models/saengerCombine.flt" ); 492 ////testObj5->setScale( 2 ); 493 //testObj5->addUpdater( new object_updater(testObj5) ); // todo memleak 494 495 trackNode( testObj4 ); 515 496 516 497 // Load EDDF … … 553 534 554 535 } 536 537 void visual_core::trackNode( osg::Node* node_ ) 538 { 539 if(!node_) 540 return; 541 542 osg::Node* node = NULL; 543 // Check if tracked node is a visual_object 544 osgVisual::visual_object* trackedObject = dynamic_cast<osgVisual::visual_object*>(node_); 545 if(trackedObject) 546 { 547 if(trackedObject->getGeometry()) 548 node = trackedObject->getGeometry(); 549 else 550 node = trackedObject; 551 } 552 else 553 node = node_; 554 555 // Object mounted manipulator 556 if (objectMountedCameraManip.valid()) 557 objectMountedCameraManip->setAttachedObject( node ); 558 559 // Spacemouse Node Tracker 560 #ifdef USE_SPACENAVIGATOR 561 if (mouseTrackerManip.valid()) 562 { 563 mouseTrackerManip->setTrackNode( node ); 564 mouseTrackerManip->setMinimumDistance( 100 ); 565 } 566 #endif 567 568 // Classical OSG Nodetracker 569 if(nt.valid()) 570 { 571 osgGA::NodeTrackerManipulator::TrackerMode trackerMode = osgGA::NodeTrackerManipulator::NODE_CENTER; 572 osgGA::NodeTrackerManipulator::RotationMode rotationMode = osgGA::NodeTrackerManipulator::ELEVATION_AZIM; 573 nt->setTrackerMode(trackerMode); 574 nt->setRotationMode(rotationMode); 575 nt->setMinimumDistance( 100 ); 576 nt->setTrackNode( node ); 577 nt->setAutoComputeHomePosition( true ); 578 nt->setDistance( 250 ); 579 } 580 }
Note: See TracChangeset
for help on using the changeset viewer.