Changeset 148


Ignore:
Timestamp:
Nov 7, 2010, 8:02:38 PM (14 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
osgVisual
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/bin/osgVisualConfig.xml

    r147 r148  
    1212          window : renderImplementation = osg::Camera::SEPERATE_WINDOW
    1313    -->
    14     <distortion channelname="center" renderimplemmentation="fbo" hdr="yes">
    15       <!-- optional: <distortionmap filename="distmap.png"></distortionmap> -->
    16       <!-- optional: <blendmap filename="blendmap.png"></blendmap> -->
    17   </distortion>
     14    <distortion channelname="center" renderimplemmentation="fbo" width="2048" height="2048" useshader="yes" hdr="yes" usetexturerectangle="no">
     15      <!-- optional: <distortionmap filename="distmap.png"></distortionmap> to set distortionmap independend from channel map-->
     16      <!-- optional: <blendmap filename="blendmap.png"></blendmap> to set blendmap independend from channel map -->
     17    </distortion>
    1818  </module>
    1919  <module name="sky_silverlining" enabled="yes"></module>
  • osgVisual/include/distortion/visual_distortion.h

    r145 r148  
    3333#include <osgGA/GUIActionAdapter>
    3434
     35#include <visual_util.h>
     36
    3537#include <string>
    3638#include <iostream>
    3739#include <fstream>
     40
     41// XML Parser
     42#include <stdio.h>
     43#include <libxml/parser.h>
     44#include <libxml/tree.h>
    3845
    3946
     
    6875        virtual ~visual_distortion(void);
    6976
     77        bool processXMLConfiguration();
     78
    7079        /**
    7180         * \brief This function parses the arguments for distortion relevant parameters.
     
    469478
    470479        /**
     480         * XML config filename
     481         */
     482        std::string configFileName;
     483
     484        /**
    471485         * Target implementation which should be used to distort.
    472486         */
  • osgVisual/src/core/visual_core.cpp

    r144 r148  
    363363        // Pass the nodes to the corresponding modules...
    364364        if(name == "core") this->config(a_node);
    365 
    366365}
    367366
  • osgVisual/src/distortion/visual_distortion.cpp

    r147 r148  
    2323        OSG_NOTIFY (osg::ALWAYS ) << "visual_distortion instantiated." << std::endl;
    2424
     25        this->configFileName = configFileName;
    2526        initialized = false;
    2627        distortionEnabled = false;
     
    3738{
    3839        OSG_NOTIFY (osg::ALWAYS ) << "visual_distortion destroyed." << std::endl;
     40}
     41
     42bool visual_distortion::processXMLConfiguration()
     43{
     44        // Init XML
     45        xmlDoc* tmpDoc;
     46        xmlNode* config = util::getModuleXMLConfig( configFileName, "distortion", tmpDoc );
     47        if(config)
     48        {
     49                xmlNode* a_node = config;
     50                // Extract infos
     51                std::string name = "";
     52                bool enabled = false;
     53
     54                xmlAttr  *attr = a_node->properties;
     55                while ( attr )
     56                {
     57                        std::string attr_name=reinterpret_cast<const char*>(attr->name);
     58                        std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     59                        if( attr_name == "name" )
     60                                name = reinterpret_cast<const char*>(attr->children->content);
     61                        if( attr_name == "enabled" && attr_value== "yes" )
     62                                enabled = true;
     63                        if( attr_name == "enabled" && attr_value== "no" )
     64                                enabled = false;
     65
     66                        attr = attr->next;
     67                }
     68                OSG_ALWAYS << "Module '" << name << "' found. Enabled = " << enabled << std::endl;
     69        }
     70
     71        // extract configuration values
     72
     73        // clean up
     74        if(tmpDoc)
     75        {
     76                xmlFreeDoc(tmpDoc); xmlCleanupParser();
     77                return true;
     78        }
     79
     80        return true;
    3981}
    4082
     
    64106
    65107        // Read out Distortion CMDLine arguments
    66         while (arguments.read("--width", tex_width)) {}
    67     while (arguments.read("--height", tex_height)) {}
    68 
    69         while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; }
    70     while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; }
    71     while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; }
    72     while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; }
    73     while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
    74 
    75     while (arguments.read("--texture-rectangle")) { useTextureRectangle = true; }
    76 
    77     while (arguments.read("--shaderDistortion")) { useShaderDistortion = true; }
    78 
    79     while (arguments.read("--hdr")) { useHDR = true; }
    80 
    81         while (arguments.read("--distortionmap", distortMapFileName)) { }
    82     while (arguments.read("--blendmap", blendMapFileName)) { }
     108        //while (arguments.read("--width", tex_width)) {}
     109    //while (arguments.read("--height", tex_height)) {}
     110
     111        //while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; }
     112        //while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; }
     113        //while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; }
     114        //while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; }
     115        //while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
     116
     117    //while (arguments.read("--texture-rectangle")) { useTextureRectangle = true; }
     118
     119    //while (arguments.read("--shaderDistortion")) { useShaderDistortion = true; }
     120
     121    //while (arguments.read("--hdr")) { useHDR = true; }
     122
     123        //while (arguments.read("--distortionmap", distortMapFileName)) { }
     124    //while (arguments.read("--blendmap", blendMapFileName)) { }
    83125
    84126        std::string pre_cfg("..\\resources\\distortion\\view_");
Note: See TracChangeset for help on using the changeset viewer.