- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/cfg/CameraConfig.cpp
r12577 r13041 55 55 _offset_sheary(0.0f), 56 56 _postmultiply(false) 57 57 58 58 { 59 59 _offset_matrix[0] = 1.0; _offset_matrix[1] = 0.0; _offset_matrix[2] = 0.0; _offset_matrix[3] = 0.0; … … 61 61 _offset_matrix[8] = 0.0; _offset_matrix[9] = 0.0; _offset_matrix[10] = 1.0; _offset_matrix[11] = 0.0; 62 62 _offset_matrix[12] = 0.0; _offset_matrix[13] = 0.0; _offset_matrix[14] = 0.0; _offset_matrix[15] = 1.0; 63 63 64 64 _threadModelDirective = CameraGroup::getDefaultThreadModel(); 65 65 … … 75 75 void CameraConfig::beginVisual( const char * name ) 76 76 { 77 std::pair<std::map<std::string,VisualChooser *>::iterator,bool> res = 77 std::pair<std::map<std::string,VisualChooser *>::iterator,bool> res = 78 78 _visual_map.insert(std::pair<std::string,VisualChooser *>(std::string(name), new VisualChooser)); 79 79 _current_visual_chooser = (res.first)->second; … … 104 104 { 105 105 if( !_current_visual_chooser.valid() || _can_add_visual_attributes == false ) 106 { 106 { 107 107 std::cerr << "CameraConfig::addVisualAttribute(token,param) : ERROR no current visual\n"; 108 108 return; … … 158 158 void CameraConfig::beginRenderSurface( const char *name ) 159 159 { 160 std::pair<std::map<std::string, osg::ref_ptr<RenderSurface> >::iterator,bool> res = 160 std::pair<std::map<std::string, osg::ref_ptr<RenderSurface> >::iterator,bool> res = 161 161 _render_surface_map.insert(std::pair<std::string, osg::ref_ptr< RenderSurface> >( 162 std::string(name), 162 std::string(name), 163 163 new RenderSurface)); 164 164 _current_render_surface = (res.first)->second.get(); … … 276 276 RenderSurface *CameraConfig::getRenderSurface( unsigned int index ) 277 277 { 278 if( index >= _render_surface_map.size() ) 278 if( index >= _render_surface_map.size() ) 279 279 return NULL; 280 280 std::map <std::string, osg::ref_ptr<RenderSurface> >::iterator p; … … 282 282 unsigned int i = 0; 283 283 for( p = _render_surface_map.begin(); p != _render_surface_map.end(); p++ ) 284 if( i++ == index ) 284 if( i++ == index ) 285 285 break; 286 286 if( p == _render_surface_map.end() ) … … 310 310 { 311 311 Camera *camera = new Camera; 312 std::pair<std::map<std::string, osg::ref_ptr<Camera> >::iterator,bool> res = 312 std::pair<std::map<std::string, osg::ref_ptr<Camera> >::iterator,bool> res = 313 313 _camera_map.insert(std::pair<std::string, osg::ref_ptr<Camera> >(name, camera)); 314 314 _current_camera = (res.first)->second.get(); … … 448 448 const Camera *CameraConfig::getCamera( unsigned int n ) const 449 449 { 450 if( n >= _camera_map.size() ) 450 if( n >= _camera_map.size() ) 451 451 return NULL; 452 452 … … 454 454 std::map <std::string, osg::ref_ptr<Camera> >::const_iterator p; 455 455 for( i = 0, p = _camera_map.begin(); p != _camera_map.end(); p++ ) 456 if( i++ == n ) 456 if( i++ == n ) 457 457 break; 458 458 if( p == _camera_map.end() ) … … 463 463 Camera *CameraConfig::getCamera( unsigned int n ) 464 464 { 465 if( n >= _camera_map.size() ) 465 if( n >= _camera_map.size() ) 466 466 return NULL; 467 467 … … 469 469 std::map <std::string, osg::ref_ptr<Camera> >::iterator p; 470 470 for( i = 0, p = _camera_map.begin(); p != _camera_map.end(); p++ ) 471 if( i++ == n ) 471 if( i++ == n ) 472 472 break; 473 473 if( p == _camera_map.end() ) … … 483 483 484 484 void CameraConfig::addInputAreaEntry( char *renderSurfaceName ) 485 { 485 { 486 486 osgProducer::RenderSurface *rs = findRenderSurface( renderSurfaceName ); 487 487 if( rs == NULL ) … … 494 494 } 495 495 496 void CameraConfig::endInputArea() 496 void CameraConfig::endInputArea() 497 497 { 498 498 _can_add_input_area_entries = false; 499 499 } 500 500 501 void CameraConfig::setInputArea(InputArea *ia) 502 { 503 _input_area=ia; 504 } 505 506 InputArea *CameraConfig::getInputArea() 507 { 508 return _input_area.get(); 509 } 510 511 const InputArea *CameraConfig::getInputArea() const 512 { 513 return _input_area.get(); 501 void CameraConfig::setInputArea(InputArea *ia) 502 { 503 _input_area=ia; 504 } 505 506 InputArea *CameraConfig::getInputArea() 507 { 508 return _input_area.get(); 509 } 510 511 const InputArea *CameraConfig::getInputArea() const 512 { 513 return _input_area.get(); 514 514 } 515 515 … … 532 532 } 533 533 534 const std::vector<CameraConfig::StereoSystemCommand> &CameraConfig::getStereoSystemCommands() 535 { 536 return _stereoSystemCommands; 537 } 538 539 540 CameraConfig::~CameraConfig() 534 const std::vector<CameraConfig::StereoSystemCommand> &CameraConfig::getStereoSystemCommands() 535 { 536 return _stereoSystemCommands; 537 } 538 539 540 CameraConfig::~CameraConfig() 541 541 { 542 542 } … … 547 547 { 548 548 osg::Matrix m; 549 m.invert(osg::Matrix::rotate( osg::DegreesToRadians(deg), x,y,z)); 549 m.invert(osg::Matrix::rotate( osg::DegreesToRadians(deg), x,y,z)); 550 550 m = m * osg::Matrix(_offset_matrix); 551 551 memcpy( _offset_matrix, m.ptr(), sizeof( osg::Matrix::value_type[16] )); … … 555 555 { 556 556 osg::Matrix m; 557 m.invert(osg::Matrix::translate( x,y,z)); 557 m.invert(osg::Matrix::translate( x,y,z)); 558 558 m = m * osg::Matrix(_offset_matrix); 559 559 memcpy( _offset_matrix, m.ptr(), sizeof( osg::Matrix::value_type[16] )); … … 578 578 { 579 579 path = std::string(ptr) + '/' + filename; 580 if( osgDB::fileExists(path)) 580 if( osgDB::fileExists(path)) 581 581 return path; 582 582 } … … 585 585 //path.clear(); 586 586 path = std::string( "/usr/local/share/Producer/Config/") + filename; 587 if( osgDB::fileExists(path) ) 587 if( osgDB::fileExists(path) ) 588 588 return path; 589 589 590 590 //path.clear(); 591 591 path = std::string( "/usr/share/Producer/Config/") + filename; 592 if( osgDB::fileExists(path) ) 592 if( osgDB::fileExists(path) ) 593 593 return path; 594 594 595 595 // Check local directory 596 if(osgDB::fileExists(filename)) 596 if(osgDB::fileExists(filename)) 597 597 return filename; 598 598 … … 636 636 std::stringstream sstr; sstr<<"Screen"<<i; 637 637 std::string name = sstr.str(); 638 std::pair<std::map<std::string, osg::ref_ptr<Camera> >::iterator,bool> res = 638 std::pair<std::map<std::string, osg::ref_ptr<Camera> >::iterator,bool> res = 639 639 _camera_map.insert(std::pair<std::string, osg::ref_ptr<Camera> >(name, new Camera)); 640 640 … … 651 651 } 652 652 653 _render_surface_map.insert(std::pair<std::string, 653 _render_surface_map.insert(std::pair<std::string, 654 654 osg::ref_ptr<RenderSurface> >( rs->getWindowName(), rs )); 655 655 … … 660 660 661 661 return true; 662 } 663 662 } 663
