Changeset 74


Ignore:
Timestamp:
Jan 5, 2005, 6:08:53 PM (20 years ago)
Author:
darran
Message:

Removed terrible trackball light interface

Location:
Swollen/swollen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Swollen/swollen/customviewer.cpp

    r70 r74  
    1111CustomViewer::CustomViewer(osg::ArgumentParser& arguments) : Viewer(arguments)
    1212{
    13  
    1413}
    1514
     
    6160
    6261
    63     _trackball = new CustomTrackballManipulator;
    64     _eventHandlerList.push_back( _trackball );
     62    //_trackball = new CustomTrackballManipulator;
     63    //_eventHandlerList.push_back( _trackball );
    6564
    6665    _terrainmanipulator = new CustomTerrainManipulator;
    67     if (options&TERRAIN_MANIPULATOR) addCameraManipulator( _terrainmanipulator );
    68     //if (options&TRACKBALL_MANIPULATOR) addCameraManipulator( _trackball );
     66    if( options&TERRAIN_MANIPULATOR ) addCameraManipulator( _terrainmanipulator );
    6967
    7068   
    71     if (options&STATE_MANIPULATOR)
     69    if( options&STATE_MANIPULATOR )
    7270    {
    7371        osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator;
     
    7674    }
    7775       
    78     if (options&VIEWER_MANIPULATOR)
     76    if( options&VIEWER_MANIPULATOR )
    7977    {
    8078       osg::ref_ptr<osgProducer::ViewerEventHandler> viewereventhandler = new osgProducer::ViewerEventHandler(this);
  • Swollen/swollen/main.cpp

    r73 r74  
    1616#include <SWWReader.h>
    1717#include <bedslope.h>
    18 #include <customtrackball.h>
    1918#include <customviewer.h>
    2019#include <hud.h>
    2120#include <keyboardeventhandler.h>
    22 //#include <spotlight.h>
    2321#include <directionallight.h>
    2422#include <watersurface.h>
     
    9997
    10098    // default arguments and command line parameters
    101     float tps;
    102     if( !arguments.read("-tps",tps) || tps <= 0.0 ) tps = DEF_TPS;
    103     float vscale;
    104     if( !arguments.read("-scale",vscale) ) vscale = 1.0;
    105 
    106     std::string bedslopetexture;
    107     if( arguments.read("-texture",bedslopetexture) ) sww->setBedslopeTexture( bedslopetexture );
    108 
    109     float tmpfloat;
     99    float tmpfloat, tps, vscale;
     100    if( !arguments.read("-tps", tps) || tps <= 0.0 ) tps = DEF_TPS;
     101    if( !arguments.read("-scale", vscale) ) vscale = 1.0;
    110102    if( arguments.read("-hmin",tmpfloat) ) sww->setHeightMin( tmpfloat ); 
    111103    if( arguments.read("-hmax",tmpfloat) ) sww->setHeightMax( tmpfloat );     
    112104    if( arguments.read("-alphamin",tmpfloat) ) sww->setAlphaMin( tmpfloat );   
    113105    if( arguments.read("-alphamax",tmpfloat) ) sww->setAlphaMax( tmpfloat );
    114        
     106
     107    std::string bedslopetexture;
     108    if( arguments.read("-texture",bedslopetexture) ) sww->setBedslopeTexture( bedslopetexture );
     109
     110
    115111
    116112    // root node
     
    177173    // create the windows and run the threads.
    178174    viewer.realize();
    179 
    180 
    181     // initial light position
    182     CustomTrackballManipulator* lightmanipulator = viewer.getTrackball();
    183     lightmanipulator->setNode( model );
    184     lightmanipulator->setAutoComputeHomePosition( false );
    185     lightmanipulator->setByInverseMatrix( osg::Matrixd( -0.707107, -0.408248,  0.57735,  0.0,
    186                                                          0.0,       0.816497,  0.57735,  0.0,
    187                                                         -0.707107,  0.408248, -0.57735,  0.0,
    188                                                          0.0,       0.0,       2.0,      1.0 ) );
    189     lightmanipulator->disable();
    190175
    191176
     
    202187
    203188
     189    // second camera
     190    Producer::ref_ptr<Producer::Camera> pcam1 = viewer.getCamera(0);
     191    Producer::Camera* pcam2 = new Producer::Camera();
     192    pcam1->setProjectionRectangle( 0.0f, 0.75f, 0.0f, 1.0f );
     193
     194    pcam2->setRenderSurface( pcam1->getRenderSurface() );
     195    pcam2->setProjectionRectangle( 0.76f, 1.0f, 0.0f, 0.25f );
     196    viewer.getCameraConfig()->addCamera( "pictureInPicture", pcam2 );
     197    osgProducer::OsgSceneHandler* sh = new osgProducer::OsgSceneHandler();
     198    sh->getSceneView()->setSceneData( rootnode );
     199    pcam2->setSceneHandler( sh );
     200
     201
     202
    204203    unsigned int timestep = 0;
    205204    while( !viewer.done() )
     
    224223        }
    225224
    226         // light position manipulator
    227         if( lightmanipulator->isEnabled() )
    228         {
    229             osg::Matrixd matrix = lightmanipulator->getInverseMatrix();
    230             //std::cout << matrix << std::endl;
    231             osg::Vec3d position = matrix.getTrans();
    232             light->setPosition( position );
    233         }
    234 
    235 
    236225        // events
    237226        if( event_handler->toggleWireframe() )
     
    241230        if( event_handler->toggleManipulatorMode() )
    242231        {
    243             if( lightmanipulator->isEnabled() )
    244             {
    245                 lightmanipulator->disable();
    246                 terrainmanipulator->enable();
    247                 light->hide();
    248             }
    249             else
    250             {
    251                 lightmanipulator->enable();
    252                 terrainmanipulator->disable();
    253                 light->show();
    254             }
    255232        }
    256233       
  • Swollen/swollen/version.cpp

    r73 r74  
    1 const char* version() { const char* s = "Revision: 72M"; return s; }
     1const char* version() { const char* s = "Revision: 73M"; return s; }
Note: See TracChangeset for help on using the changeset viewer.