Changeset 144 for osgVisual/src/core
- Timestamp:
- Nov 1, 2010, 6:24:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/core/visual_core.cpp
r143 r144 34 34 OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_core..." << std::endl; 35 35 36 // Check for config file to provide it to all modules during initialization. 37 if( arguments.read("-c", configFilename) || arguments.read("--config", configFilename) ) 38 { 39 if( !osgDB::fileExists(configFilename) ) 40 configFilename = ""; 41 else 42 OSG_ALWAYS << "Using configuration file: " << configFilename << std::endl; 43 } 44 45 xmlDoc* tmpDoc; 46 util::getModuleXMLConfig( configFilename, "core", tmpDoc ); 47 if(tmpDoc) 48 { 49 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 50 } 51 52 36 53 // Configure osg to use KdTrees 37 54 osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); … … 63 80 // Initialize distortion 64 81 OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl; 65 distortion = new visual_distortion( viewer, arguments );82 distortion = new visual_distortion( viewer, arguments, configFilename ); 66 83 distortion->initialize( rootNode, viewer->getCamera()->getClearColor() ); 67 84 distortedSceneGraph = distortion->getDistortedSceneGraph(); … … 70 87 #ifdef USE_SKY_SILVERLINING 71 88 // Initialize sky 72 sky = new visual_skySilverLining( viewer );73 sky->init(distortedSceneGraph, rootNode); // Without distort edSceneGraph=NULL89 sky = new visual_skySilverLining( viewer, configFilename ); 90 sky->init(distortedSceneGraph, rootNode); // Without distortion: distortedSceneGraph=NULL 74 91 #endif 75 92 76 93 // Initialize DataIO interface 77 visual_dataIO::getInstance()->init(viewer, arguments );78 79 // Add manipulators for user interaction - after dataIO to be able to skip it in slaves .94 visual_dataIO::getInstance()->init(viewer, arguments, configFilename); 95 96 // Add manipulators for user interaction - after dataIO to be able to skip it in slaves rendering machines. 80 97 addManipulators(); 81 98 … … 258 275 void visual_core::parseConfigFile(osg::ArgumentParser& arguments_) 259 276 { 260 configFileValid = false;261 262 std::string filename;263 if( arguments.read("-c", filename) || arguments.read("--config", filename) )264 {265 OSG_ALWAYS << "Using configuration file.." << std::endl;266 if ( osgDB::fileExists(filename))277 if( configFilename != "" ) 278 { 279 xmlDoc *doc = NULL; 280 xmlNode *root_element = NULL; 281 282 doc = xmlReadFile(configFilename.c_str(), NULL, 0); 283 if (doc == NULL) 267 284 { 268 configFileValid = false; 269 xmlDoc *doc = NULL; 270 xmlNode *root_element = NULL; 271 272 doc = xmlReadFile(filename.c_str(), NULL, 0); 273 if (doc == NULL) 274 { 275 configFileValid = false; 276 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: could not parse osgVisual config file" << filename << std::endl; 277 } 278 else 279 { 280 // Get the root element node 281 root_element = xmlDocGetRootElement(doc); 282 283 // Parse the XML document. 284 checkXMLNode(root_element); 285 286 // free the document 287 xmlFreeDoc(doc);; 288 } 289 // Free the global variables that may have been allocated by the parser. 290 xmlCleanupParser(); 291 292 if(!configFileValid) 293 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: XML file seems not to be a valid osgVisual configuration file!" << std::endl; 294 295 } // IF configfile exists 296 } // IF -c END 285 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: could not parse osgVisual config file" << configFilename << std::endl; 286 } 287 else 288 { 289 // Get the root element node 290 root_element = xmlDocGetRootElement(doc); 291 292 // Parse the XML document. 293 checkXMLNode(root_element); 294 295 // free the document 296 xmlFreeDoc(doc);; 297 } 298 // Free the global variables that may have been allocated by the parser. 299 xmlCleanupParser(); 300 301 } // IF configfile exists 297 302 } 298 303 … … 305 310 { 306 311 OSG_DEBUG << "XML node osgvisualconfiguration found" << std::endl; 307 configFileValid = true; 312 308 313 // Iterate to the next nodes to configure modules and scenery. 309 314 checkXMLNode(cur_node->children); … … 352 357 enabled = false; 353 358 354 OSG_ALWAYS << "Module '" << name << "' found. Enabled = " << enabled << std::endl;355 356 359 attr = attr->next; 357 360 } 361 OSG_ALWAYS << "Module '" << name << "' found. Enabled = " << enabled << std::endl; 358 362 359 363 // Pass the nodes to the corresponding modules... … … 412 416 413 417 // Sky settings: 414 sky->setTime(1 2,00,23);418 sky->setTime(15,30,00); 415 419 sky->setVisibility(50000); 416 sky->addWindVolume( 0.0, 15000.0, 50.0, 90.0 );420 sky->addWindVolume( 0.0, 15000.0, 25.0, 90.0 ); 417 421 418 422 //sky->addCloudLayer( 0, 20000, 20000, 600.0, 1000.0, 0.5, CUMULONIMBUS_CAPPILATUS ); 419 423 //sky->addCloudLayer( 1, 5000000, 5000000, 600.0, 7351.0, 0.2, CIRRUS_FIBRATUS ); 420 424 //sky->addCloudLayer( 2, 50000, 50000, 600.0, 7351.0, 0.2, CIRROCUMULUS ); 421 //sky->addCloudLayer( 3, 50000, 50000, 1300.0, 700.0, 0.07, CUMULUS_CONGESTUS ); 422 sky->addCloudLayer( 1, 100000, 100000, 3500.0, 2000.0, 0.60, STRATOCUMULUS ); 425 ///sky->addCloudLayer( 2, 100000, 100000, 600.0, 2351.0, 0.75, STRATUS ); 426 sky->addCloudLayer( 3, 50000, 50000, 1300.0, 700.0, 0.07, CUMULUS_CONGESTUS ); 427 //sky->addCloudLayer( 1, 100000, 100000, 3500.0, 2000.0, 0.50, STRATOCUMULUS ); 423 428 424 429 //sky->setSlotPrecipitation( 1, 0.0, 0.0, 0.0, 25.0 );
Note: See TracChangeset
for help on using the changeset viewer.