- Timestamp:
- Nov 9, 2010, 10:37:40 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/CMakeLists.txt
r126 r151 387 387 SET(USERFILE_COMMAND_DEBUG "$(TargetPath)" CACHE STRING "Command to execute on debugging (VS Project settings)" ) 388 388 SET(USERFILE_WORKING_DIRECTORY_DEBUG "bin" CACHE STRING "Working directory on debugging (VS Project settings)" ) 389 SET(USERFILE_COMMAND_ARGUMENTS_DEBUG " -C center--window 100 100 800 600 -m D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path --config osgVisualConfig.xml" CACHE STRING "Command arguments (VS Project settings)" )389 SET(USERFILE_COMMAND_ARGUMENTS_DEBUG " --window 100 100 800 600 -m D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path --config osgVisualConfig.xml" CACHE STRING "Command arguments (VS Project settings)" ) 390 390 SET(USERFILE_REMOTE_MACHINE_DEBUG ${USER_NAME} CACHE STRING "Remote Debugging Machine (VS Project settings)") 391 391 IF (DESTINATION_ARCH STREQUAL "x64") -
osgVisual/bin/osgVisualConfig.xml
r149 r151 1 1 <?xml version="1.0" encoding="ISO-8859-1" ?> 2 2 <osgvisualconfiguration> 3 <module name="distortion" enabled=" yes">3 <module name="distortion" enabled="no"> 4 4 <!-- XML configuration of the module "distortion" 5 5 channelname = name of he channel, used to load the distortion- and blendmaps … … 17 17 </module> 18 18 <module name="sky_silverlining" enabled="yes"></module> 19 <module name="vista2d" enabled="yes"> 20 <vista2d filename="hud.view"></vista2d> 21 </module> 19 22 20 23 <scenery> -
osgVisual/include/distortion/visual_distortion.h
r150 r151 87 87 * @param subgraph : Undistorted scene graph. 88 88 * @param clearColor : Clear color for distortion. 89 * @return : Group node which contains the distortion and the undistorted scene graph .89 * @return : Group node which contains the distortion and the undistorted scene graph ( distortedGraph ). 90 90 */ 91 91 osg::Group* initialize(osg::Group* subgraph, const osg::Vec4& clearColor ); -
osgVisual/include/util/visual_util.h
r146 r151 231 231 * xmlNode* yourNode = util::getModuleXMLConfig( configFilename, "core", tmpDoc ); 232 232 * // use yourNode 233 * if( tmpDoc)233 * if(yourNode) 234 234 * { 235 235 * xmlFreeDoc(tmpDoc); xmlCleanupParser(); -
osgVisual/src/core/visual_core.cpp
r148 r151 43 43 } 44 44 45 xmlDoc* tmpDoc;46 util::getModuleXMLConfig( configFilename, "core", tmpDoc );47 if(tmpDoc)48 {49 xmlFreeDoc(tmpDoc); xmlCleanupParser();50 }51 52 53 45 // Configure osg to use KdTrees 54 46 osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); … … 79 71 #ifdef USE_DISTORTION 80 72 // Initialize distortion 81 OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl;82 73 distortion = new visual_distortion( viewer, arguments, configFilename ); 83 distortion->initialize( rootNode, viewer->getCamera()->getClearColor() ); 84 distortedSceneGraph = distortion->getDistortedSceneGraph(); 74 distortedSceneGraph = distortion->initialize( rootNode, viewer->getCamera()->getClearColor() ); 85 75 #endif 86 76 -
osgVisual/src/distortion/visual_distortion.cpp
r150 r151 49 49 if(config) 50 50 { 51 51 OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl; 52 52 53 xmlNode* a_node = config->children; 53 54 … … 55 56 { 56 57 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 57 OSG_ALWAYS << "----visual_distortion::processXMLConfiguration() - node type="<< cur_node->type <<", name=" << cur_node->name << std::endl;58 //OSG_ALWAYS << "----visual_distortion::processXMLConfiguration() - node type="<< cur_node->type <<", name=" << cur_node->name << std::endl; 58 59 59 60 // Check for distortion node … … 68 69 { 69 70 std::string channelname = attr_value; 70 OSG_NOTIFY(osg::ALWAYS) << " channelname:" << channelname << std::endl;71 OSG_NOTIFY(osg::ALWAYS) << "visual_distortion: Channelname:" << channelname << std::endl; 71 72 72 73 std::string pre_cfg("..\\resources\\distortion\\view_"); … … 136 137 distortMapFileName = attr_value; 137 138 } 138 139 139 attr = attr->next; 140 140 } … … 153 153 blendMapFileName = attr_value; 154 154 } 155 156 155 attr = attr->next; 157 156 } … … 159 158 } // FOR all nodes END 160 159 161 160 // clean up 161 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 162 return true; 162 163 } // IF Config valid END 163 164 else 164 OSG_WARN << "ERROR: visual_distortion::processXMLConfiguration() - Invalid module configuration!" << std::endl; 165 166 167 168 // clean up 169 if(tmpDoc) 170 { 171 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 172 return true; 165 { 166 OSG_WARN << "WARNING: visual_distortion::processXMLConfiguration() - Module configuration not found or module disabled!" << std::endl; 167 return false; 173 168 } 169 170 174 171 175 172 return true; … … 191 188 192 189 // Process XML configuration 193 processXMLConfiguration(); 190 if(!processXMLConfiguration()) 191 return NULL; // Abort distortion initialization. 194 192 195 193 // Add this node to the scenegraph to get updated during update traversal. -
osgVisual/src/util/visual_util.cpp
r146 r151 146 146 if (cur_node->type == XML_ELEMENT_NODE) 147 147 { 148 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 149 if (node_name == "module") 148 // Extract Node Name and the first attribute: "module name" 149 std::string node_name = reinterpret_cast<const char*>(cur_node->name); 150 std::string modName = ""; 151 xmlAttr *attr = cur_node->properties; 152 while ( attr ) 153 { 154 std::string attr_name=reinterpret_cast<const char*>(attr->name); 155 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 156 if( attr_name == "name" ) 157 modName = attr_value; 158 attr = attr->next; 159 } 160 161 // Check each node for the searched module 162 if (node_name == "module" && modName == moduleName) 150 163 { 151 OSG_DEBUG << "XML node module found" << std::endl; 152 return cur_node; 164 // Check if the module is active 165 xmlAttr *attr = cur_node->properties; 166 while ( attr ) 167 { 168 std::string attr_name=reinterpret_cast<const char*>(attr->name); 169 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 170 if( attr_name == "enabled" && attr_value == "yes" ) 171 { 172 OSG_ALWAYS << "Found XML module configuration for " << moduleName << std::endl; 173 return cur_node; 174 } 175 if( attr_name == "enabled" && attr_value == "no" ) 176 { 177 OSG_ALWAYS << "Found XML module configuration for " << moduleName << ", but it is DISABLED." << std::endl; 178 return NULL; 179 } 180 attr = attr->next; 181 } 153 182 } 154 183 else // Otherwise: check its children..
Note: See TracChangeset
for help on using the changeset viewer.