Changeset 125
- Timestamp:
- Sep 2, 2010, 10:29:58 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/include/core/visual_core.h
r98 r125 15 15 * OpenSceneGraph Public License for more details. 16 16 */ 17 18 // XML Parser 19 #include <stdio.h> 20 #include <libxml/parser.h> 21 #include <libxml/tree.h> 22 17 23 18 24 #include <osg/Referenced> … … 100 106 101 107 void addManipulators(); 108 void parseConfigFile(osg::ArgumentParser& arguments_); 109 void checkXMLNode(xmlNode * a_node); 110 void parseScenery(xmlNode * a_node); 102 111 bool loadTerrain(osg::ArgumentParser& arguments_); 103 112 bool checkCommandlineArgumentsForFinalErrors(); … … 126 135 */ 127 136 osg::ref_ptr<osgViewer::Viewer> viewer; 137 138 /** 139 * XML File valid? 140 */ 141 bool configFileValid; 128 142 129 143 #ifdef USE_SPACENAVIGATOR -
osgVisual/src/core/visual_core.cpp
r122 r125 251 251 } 252 252 253 void visual_core::parseConfigFile(osg::ArgumentParser& arguments_) 254 { 255 std::string filename; 256 if( arguments.read("-c", filename) || arguments.read("--config", filename) ) 257 { 258 if( osgDB::fileExists(filename) ) 259 { 260 configFileValid = false; 261 xmlDoc *doc = NULL; 262 xmlNode *root_element = NULL; 263 264 doc = xmlReadFile(filename.c_str(), NULL, 0); 265 if (doc == NULL) 266 { 267 configFileValid = false; 268 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: could not parse osgVisual config file" << filename << std::endl; 269 } 270 else 271 { 272 // Get the root element node 273 root_element = xmlDocGetRootElement(doc); 274 275 // Parse the XML document. 276 277 278 // free the document 279 xmlFreeDoc(doc);; 280 } 281 // Free the global variables that may have been allocated by the parser. 282 xmlCleanupParser(); 283 284 if(!configFileValid) 285 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: XML file seems not to be a valid osgVisual configuration file!" << std::endl; 286 287 } // IF configfile exists 288 } // IF -c END 289 } 290 291 void visual_core::checkXMLNode(xmlNode * a_node) 292 { 293 294 } 295 296 void visual_core::parseScenery(xmlNode * a_node) 297 { 298 299 } 253 300 254 301 bool visual_core::checkCommandlineArgumentsForFinalErrors() … … 301 348 //addWindVolume( 0.0, 15000.0, 300.0, 90.0 ); 302 349 303 //sky->addCloudLayer( 0, 300000, 300000, 600.0, 2351.0, 0.5, STRATUS );350 sky->addCloudLayer( 0, 300000, 300000, 600.0, 2351.0, 0.5, STRATUS ); 304 351 //sky->addCloudLayer( 0, 5000000, 5000000, 600.0, 7351.0, 0.2, CIRRUS_FIBRATUS ); 305 352 //sky->addCloudLayer( 0, 50000, 50000, 600.0, 7351.0, 0.2, CIRROCUMULUS );
Note: See TracChangeset
for help on using the changeset viewer.