Changeset 212 for osgVisual/trunk/src
- Timestamp:
- Jan 30, 2011, 8:30:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.