Show
Ignore:
Timestamp:
04/11/08 12:10:40 (6 years ago)
Author:
robert
Message:

Added --mouse option to enable mouse tracking, and fixed bug in assumption
that nv is not null.

Files:
1 modified

Legend:

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

    r7648 r8073  
    145145                osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa); 
    146146                osgUtil::LineSegmentIntersector::Intersections intersections; 
    147                 if (view && view->computeIntersections(ea.getX(), ea.getY(), nv->getNodePath(), intersections)) 
     147                bool foundIntersection = view==0 ? false : 
     148                    (nv==0 ? view->computeIntersections(ea.getX(), ea.getY(), intersections) : 
     149                             view->computeIntersections(ea.getX(), ea.getY(), nv->getNodePath(), intersections)); 
     150                 
     151                if (foundIntersection) 
    148152                { 
    149153 
     
    352356    while (arguments.read("--shader")) useShader=true; 
    353357 
     358    bool mouseTracking = false; 
     359    while (arguments.read("--mouse")) mouseTracking=true;  
     360 
     361 
    354362    // if user request help write it out to cout. 
    355363    if (arguments.read("-h") || arguments.read("--help")) 
     
    445453    // pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate. 
    446454    MovieEventHandler* meh = new MovieEventHandler(); 
     455    meh->setMouseTracking( mouseTracking ); 
    447456    meh->set( viewer.getSceneData() ); 
    448457    viewer.addEventHandler( meh );