Changeset 74
- Timestamp:
- Jan 5, 2005, 6:08:53 PM (20 years ago)
- Location:
- Swollen/swollen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Swollen/swollen/customviewer.cpp
r70 r74 11 11 CustomViewer::CustomViewer(osg::ArgumentParser& arguments) : Viewer(arguments) 12 12 { 13 14 13 } 15 14 … … 61 60 62 61 63 _trackball = new CustomTrackballManipulator;64 _eventHandlerList.push_back( _trackball );62 //_trackball = new CustomTrackballManipulator; 63 //_eventHandlerList.push_back( _trackball ); 65 64 66 65 _terrainmanipulator = new CustomTerrainManipulator; 67 if (options&TERRAIN_MANIPULATOR) addCameraManipulator( _terrainmanipulator ); 68 //if (options&TRACKBALL_MANIPULATOR) addCameraManipulator( _trackball ); 66 if( options&TERRAIN_MANIPULATOR ) addCameraManipulator( _terrainmanipulator ); 69 67 70 68 71 if (options&STATE_MANIPULATOR)69 if( options&STATE_MANIPULATOR ) 72 70 { 73 71 osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator; … … 76 74 } 77 75 78 if (options&VIEWER_MANIPULATOR)76 if( options&VIEWER_MANIPULATOR ) 79 77 { 80 78 osg::ref_ptr<osgProducer::ViewerEventHandler> viewereventhandler = new osgProducer::ViewerEventHandler(this); -
Swollen/swollen/main.cpp
r73 r74 16 16 #include <SWWReader.h> 17 17 #include <bedslope.h> 18 #include <customtrackball.h>19 18 #include <customviewer.h> 20 19 #include <hud.h> 21 20 #include <keyboardeventhandler.h> 22 //#include <spotlight.h>23 21 #include <directionallight.h> 24 22 #include <watersurface.h> … … 99 97 100 98 // 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; 110 102 if( arguments.read("-hmin",tmpfloat) ) sww->setHeightMin( tmpfloat ); 111 103 if( arguments.read("-hmax",tmpfloat) ) sww->setHeightMax( tmpfloat ); 112 104 if( arguments.read("-alphamin",tmpfloat) ) sww->setAlphaMin( tmpfloat ); 113 105 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 115 111 116 112 // root node … … 177 173 // create the windows and run the threads. 178 174 viewer.realize(); 179 180 181 // initial light position182 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();190 175 191 176 … … 202 187 203 188 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 204 203 unsigned int timestep = 0; 205 204 while( !viewer.done() ) … … 224 223 } 225 224 226 // light position manipulator227 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 236 225 // events 237 226 if( event_handler->toggleWireframe() ) … … 241 230 if( event_handler->toggleManipulatorMode() ) 242 231 { 243 if( lightmanipulator->isEnabled() )244 {245 lightmanipulator->disable();246 terrainmanipulator->enable();247 light->hide();248 }249 else250 {251 lightmanipulator->enable();252 terrainmanipulator->disable();253 light->show();254 }255 232 } 256 233 -
Swollen/swollen/version.cpp
r73 r74 1 const char* version() { const char* s = "Revision: 7 2M"; return s; }1 const char* version() { const char* s = "Revision: 73M"; return s; }
Note: See TracChangeset
for help on using the changeset viewer.