Changeset 3205

Show
Ignore:
Timestamp:
07/30/04 17:44:59 (10 years ago)
Author:
robert
Message:

Added beginnings of new TrackballManipulator?

Location:
OpenSceneGraph/trunk
Files:
2 added
6 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/VisualStudio/osgGA/osgGA.dsp

    r3181 r3205  
    140140# Begin Source File 
    141141 
     142SOURCE=..\..\src\osgGA\TrackerManipulator.cpp 
     143# End Source File 
     144# Begin Source File 
     145 
    142146SOURCE=..\..\src\osgGA\Version.cpp 
    143147# End Source File 
     
    201205 
    202206SOURCE=..\..\Include\osgGA\TrackballManipulator 
     207# End Source File 
     208# Begin Source File 
     209 
     210SOURCE=..\..\Include\osgGA\TrackerManipulator 
    203211# End Source File 
    204212# Begin Source File 
  • OpenSceneGraph/trunk/examples/osglightpoint/osglightpoint.cpp

    r2727 r3205  
    22#include <osgProducer/Viewer> 
    33 
    4 #include <osg/Transform> 
     4#include <osg/MatrixTransform> 
    55#include <osg/Billboard> 
    66#include <osg/Geode> 
     
    6060    end._color.set(1.0f,1.0f,1.0f,1.0f); 
    6161     
    62     osg::Transform* transform = new osg::Transform; 
     62    osg::MatrixTransform* transform = new osg::MatrixTransform; 
     63     
     64    transform->setDataVariance(osg::Object::STATIC); 
     65    transform->setMatrix(osg::Matrix::scale(0.1,0.1,0.1)); 
    6366 
    6467    osg::Vec3 start_delta(0.0f,10.0f,0.0f); 
  • OpenSceneGraph/trunk/examples/osgsimulation/osgsimulation.cpp

    r3098 r3205  
    1919#include <osgParticle/ParticleSystemUpdater> 
    2020 
     21#include <osgGA/TrackerManipulator> 
     22 
    2123// for the grid data.. 
    2224#include "../osghangglide/terrain_coords.h" 
     
    6062    if (glider) 
    6163    { 
     64        glider->setName("glider"); 
     65 
    6266        const osg::BoundingSphere& bs = glider->getBound(); 
    6367 
     
    8286    if (cessna) 
    8387    { 
     88        cessna->setName("cessna"); 
     89     
    8490        const osg::BoundingSphere& bs = cessna->getBound(); 
    8591 
     
    246252} 
    247253 
     254class FindNamedNodeVisitor : public osg::NodeVisitor 
     255{ 
     256public: 
     257    FindNamedNodeVisitor(const std::string& name): 
     258        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), 
     259        _name(name) {} 
     260     
     261    virtual void apply(osg::Node& node) 
     262    { 
     263        if (node.getName()==_name) 
     264        { 
     265            _foundNodes.push_back(&node); 
     266        } 
     267        traverse(node); 
     268    } 
     269     
     270    typedef std::vector< osg::ref_ptr<osg::Node> > NodeList; 
     271 
     272    std::string _name; 
     273    NodeList _foundNodes; 
     274}; 
     275 
     276 
    248277 
    249278////////////////////////////////////////////////////////////////////////////// 
     
    268297    // set up the value with sensible default event handlers. 
    269298    viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
     299 
     300 
    270301 
    271302    // get details on keyboard and mouse bindings used by the viewer. 
     
    295326    viewer.setSceneData(root); 
    296327         
     328         
     329    FindNamedNodeVisitor fnnv("cessna"); 
     330    root->accept(fnnv); 
     331     
     332    if (!fnnv._foundNodes.empty()) 
     333    { 
     334        osgGA::TrackerManipulator* tm = new osgGA::TrackerManipulator; 
     335        tm->setTrackNode(fnnv._foundNodes[0].get()); 
     336         
     337        std::cout<<"Found "<<std::endl; 
     338         
     339        unsigned int num = viewer.addCameraManipulator(tm); 
     340        viewer.selectCameraManipulator(num); 
     341    } 
     342 
     343 
     344 
    297345    // create the windows and run the threads. 
    298346    viewer.realize(); 
  • OpenSceneGraph/trunk/include/osg/NodeVisitor

    r3062 r3205  
    185185          * Note, the user does not typically call pushNodeOnPath() as it 
    186186          * will be called automatically by the Node::accept() method.*/ 
    187         inline void pushOntoNodePath(Node* node) { _nodePath.push_back(node); } 
     187        inline void pushOntoNodePath(Node* node) { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.push_back(node); else _nodePath.insert(_nodePath.begin(),node); } 
    188188         
    189189        /** Method callby osg::Node::accept() method after 
     
    191191          * Note, the user does not typically call pushNodeOnPath() as it 
    192192          * will be called automatically by the Node::accept() method.*/ 
    193         inline void popFromNodePath()            { _nodePath.pop_back(); } 
     193        inline void popFromNodePath()            { if (_traversalMode!=TRAVERSE_PARENTS) _nodePath.pop_back(); else _nodePath.erase(_nodePath.begin()); } 
    194194         
    195195        /** Get the non const NodePath from the top most node applied down 
  • OpenSceneGraph/trunk/include/osgProducer/Viewer

    r3127 r3205  
    5555            FLIGHT_MANIPULATOR      = 4, 
    5656            TERRAIN_MANIPULATOR     = 8, 
    57             STATE_MANIPULATOR       = 16, 
    58             HEAD_LIGHT_SOURCE       = 32, 
    59             SKY_LIGHT_SOURCE        = 64, 
    60             STATS_MANIPULATOR       = 128, 
    61             VIEWER_MANIPULATOR      = 256, 
    62             ESCAPE_SETS_DONE        = 512, 
     57            STATE_MANIPULATOR       = 32, 
     58            HEAD_LIGHT_SOURCE       = 64, 
     59            SKY_LIGHT_SOURCE        = 128, 
     60            STATS_MANIPULATOR       = 256, 
     61            VIEWER_MANIPULATOR      = 512, 
     62            ESCAPE_SETS_DONE        = 1024, 
    6363            STANDARD_SETTINGS = TRACKBALL_MANIPULATOR| 
    6464                                DRIVE_MANIPULATOR | 
  • OpenSceneGraph/trunk/src/osgGA/GNUmakefile

    r2953 r3205  
    1414        StateSetManipulator.cpp\ 
    1515        TerrainManipulator.cpp\ 
     16        TrackerManipulator.cpp\ 
    1617        TrackballManipulator.cpp\ 
    1718        Version.cpp\