Show
Ignore:
Timestamp:
05/18/07 11:49:30 (8 years ago)
Author:
robert
Message:

Added range of CameranManipulators? to allow us to navigate the scene freely

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgsimulation/osgsimulation.cpp

    r6691 r6692  
    4242#include <osgGA/NodeTrackerManipulator> 
    4343#include <osgGA/StateSetManipulator> 
     44#include <osgGA/TrackballManipulator> 
     45#include <osgGA/FlightManipulator> 
     46#include <osgGA/DriveManipulator> 
     47#include <osgGA/KeySwitchMatrixManipulator> 
     48#include <osgGA/AnimationPathManipulator> 
     49#include <osgGA/TerrainManipulator> 
    4450 
    4551#include <iostream> 
     
    295301    viewer.setSceneData(root.get()); 
    296302 
     303    osg::ref_ptr<osgGA::NodeTrackerManipulator> tm; 
     304 
    297305    osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(root.get()); 
    298306    if (csn) 
     
    359367            } 
    360368 
    361             osgGA::NodeTrackerManipulator* tm = new osgGA::NodeTrackerManipulator; 
     369            tm = new osgGA::NodeTrackerManipulator; 
    362370            tm->setTrackerMode(trackerMode); 
    363371            tm->setRotationMode(rotationMode); 
    364372            tm->setTrackNode(scaler); 
    365  
    366             viewer.setCameraManipulator(tm); 
    367373        } 
    368374        else 
     
    372378         
    373379    }     
     380 
     381 
     382    // set up camera manipulators. 
     383    { 
     384        osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; 
     385 
     386        if (tm.valid()) keyswitchManipulator->addMatrixManipulator( '0', "Trackball", tm.get() ); 
     387        keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); 
     388        keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); 
     389        keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); 
     390        keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); 
     391 
     392        viewer.setCameraManipulator( keyswitchManipulator.get() ); 
     393    } 
     394     
    374395 
    375396    viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);