Changeset 151


Ignore:
Timestamp:
Nov 9, 2010, 10:37:40 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
osgVisual
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/CMakeLists.txt

    r126 r151  
    387387        SET(USERFILE_COMMAND_DEBUG "$(TargetPath)" CACHE STRING "Command to execute on debugging (VS Project settings)" )
    388388        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)" )
    390390        SET(USERFILE_REMOTE_MACHINE_DEBUG ${USER_NAME} CACHE STRING "Remote Debugging Machine (VS Project settings)")
    391391        IF (DESTINATION_ARCH STREQUAL "x64")
  • osgVisual/bin/osgVisualConfig.xml

    r149 r151  
    11<?xml version="1.0" encoding="ISO-8859-1" ?>
    22<osgvisualconfiguration>
    3   <module name="distortion" enabled="yes">
     3  <module name="distortion" enabled="no">
    44    <!-- XML configuration of the module "distortion"
    55      channelname = name of he channel, used to load the distortion- and blendmaps
     
    1717  </module>
    1818  <module name="sky_silverlining" enabled="yes"></module>
     19  <module name="vista2d" enabled="yes">
     20    <vista2d filename="hud.view"></vista2d>
     21  </module>
    1922 
    2023  <scenery>
  • osgVisual/include/distortion/visual_distortion.h

    r150 r151  
    8787         * @param subgraph : Undistorted scene graph.
    8888         * @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 ).
    9090         */
    9191        osg::Group* initialize(osg::Group* subgraph, const osg::Vec4& clearColor );
  • osgVisual/include/util/visual_util.h

    r146 r151  
    231231         *  xmlNode* yourNode = util::getModuleXMLConfig( configFilename, "core", tmpDoc );
    232232         *  // use yourNode
    233          *  if(tmpDoc)
     233         *  if(yourNode)
    234234         *  {
    235235         *     xmlFreeDoc(tmpDoc); xmlCleanupParser();
  • osgVisual/src/core/visual_core.cpp

    r148 r151  
    4343        }
    4444
    45 xmlDoc* tmpDoc;
    46 util::getModuleXMLConfig( configFilename, "core", tmpDoc );
    47 if(tmpDoc)
    48 {
    49         xmlFreeDoc(tmpDoc); xmlCleanupParser();
    50 }
    51 
    52 
    5345        // Configure osg to use KdTrees
    5446        osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
     
    7971#ifdef USE_DISTORTION
    8072        // Initialize distortion
    81         OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl;
    8273        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() );
    8575#endif
    8676
  • osgVisual/src/distortion/visual_distortion.cpp

    r150 r151  
    4949        if(config)
    5050        {
    51        
     51                OSG_NOTIFY( osg::ALWAYS ) << "Using distortion." << std::endl;
     52
    5253                xmlNode* a_node = config->children;
    5354
     
    5556                {
    5657                        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;
    5859
    5960                        // Check for distortion node
     
    6869                                        {
    6970                                                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;
    7172
    7273                                                std::string pre_cfg("..\\resources\\distortion\\view_");
     
    136137                                                distortMapFileName = attr_value;
    137138                                        }
    138 
    139139                                        attr = attr->next;
    140140                                }
     
    153153                                                blendMapFileName = attr_value;
    154154                                        }
    155 
    156155                                        attr = attr->next;
    157156                                }
     
    159158                }       // FOR all nodes END
    160159
    161 
     160                // clean up
     161                xmlFreeDoc(tmpDoc); xmlCleanupParser();
     162                return true;
    162163        }       // IF Config valid END
    163164        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;
    173168        }
     169
     170
    174171
    175172        return true;
     
    191188
    192189        // Process XML configuration
    193         processXMLConfiguration();
     190        if(!processXMLConfiguration())
     191                return NULL;    // Abort distortion initialization.
    194192
    195193        // Add this node to the scenegraph to get updated during update traversal.
  • osgVisual/src/util/visual_util.cpp

    r146 r151  
    146146                if (cur_node->type == XML_ELEMENT_NODE)
    147147                {
    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)
    150163                        {
    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                                }
    153182                        }
    154183                        else    // Otherwise: check its children..
Note: See TracChangeset for help on using the changeset viewer.