- Timestamp:
- Nov 8, 2010, 9:25:18 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/bin/osgVisualConfig.xml
r148 r149 12 12 window : renderImplementation = osg::Camera::SEPERATE_WINDOW 13 13 --> 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> 14 <distortion channelname="center" renderimplemmentation="fbo" width="2048" height="2048" useshader="yes" hdr="yes" usetexturerectangle="no"></distortion> 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 --> 18 17 </module> 19 18 <module name="sky_silverlining" enabled="yes"></module> -
osgVisual/src/distortion/visual_distortion.cpp
r148 r149 45 45 xmlDoc* tmpDoc; 46 46 xmlNode* config = util::getModuleXMLConfig( configFileName, "distortion", tmpDoc ); 47 48 // extract configuration values 47 49 if(config) 48 50 { 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 51 52 xmlNode* a_node = config->children; 53 54 for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) 55 { 56 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 59 // Check for distortion node 60 if(cur_node->type == XML_ELEMENT_NODE && node_name == "distortion") 61 { 62 xmlAttr *attr = cur_node->properties; 63 while ( attr ) 64 { 65 std::string attr_name=reinterpret_cast<const char*>(attr->name); 66 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 67 if( attr_name == "channelname" ) 68 channelname = attr_value; 69 if( attr_name == "renderimplemmentation" ) 70 { 71 if(attr_value=="fbo") 72 renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; 73 if(attr_value=="pbuffer") 74 renderImplementation = osg::Camera::PIXEL_BUFFER; 75 if(attr_value=="pbuffer-rtt") 76 renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; 77 if(attr_value=="fb") 78 renderImplementation = osg::Camera::FRAME_BUFFER; 79 if(attr_value=="window") 80 renderImplementation = osg::Camera::SEPERATE_WINDOW; 81 } 82 if( attr_name == "width" ) 83 { 84 std::stringstream sstr(attr_value); 85 sstr >> tex_width; 86 } 87 if( attr_name == "height" ) 88 { 89 std::stringstream sstr(attr_value); 90 sstr >> tex_height; 91 } 92 if( attr_name == "useshader" ) 93 useShaderDistortion = (attr_value == "yes") ? true : false; 94 if( attr_name == "hdr" ) 95 useHDR = (attr_value == "yes") ? true : false; 96 if( attr_name == "usetexturerectangle" ) 97 useTextureRectangle = (attr_value == "yes") ? true : false; 98 99 100 attr = attr->next; 101 } // WHILE attrib END 102 } // IF Node == distortion END 103 104 // Check for distortionmap node 105 if(cur_node->type == XML_ELEMENT_NODE && node_name == "distortionmap") 106 { 107 108 } 109 110 // Check for distortionmap node 111 if(cur_node->type == XML_ELEMENT_NODE && node_name == "blendmap") 112 { 113 114 } 115 } // FOR all nodes END 116 117 118 } // IF Config valid END 119 else 120 OSG_WARN << "ERROR: visual_distortion::processXMLConfiguration() - Invalid module configuration!" << std::endl; 121 122 72 123 73 124 // clean up … … 85 136 // Distortion files. 86 137 arguments.getApplicationUsage()->addCommandLineOption("-C <channelname>","Setup the channel name, this is the preset for blendmap, distortionmap and camera configuration file."); 87 arguments.getApplicationUsage()->addCommandLineOption("--distortionmap","Set a distortion map file name."); 138 139 arguments.getApplicationUsage()->addCommandLineOption("--distortionmap","Set a distortion map file name."); 88 140 arguments.getApplicationUsage()->addCommandLineOption("--blendmap","Set a blend map file name."); 89 90 // Render implementation.91 arguments.getApplicationUsage()->addCommandLineOption("--shaderDistortion","Use OpenGL shader for distortion and blending.");92 arguments.getApplicationUsage()->addCommandLineOption("--fbo","Use Frame Buffer Object for render to texture, where supported.");93 arguments.getApplicationUsage()->addCommandLineOption("--fb","Use FrameBuffer for render to texture.");94 arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Use Pixel Buffer for render to texture, where supported.");95 arguments.getApplicationUsage()->addCommandLineOption("--window","Use a seperate Window for render to texture.");96 97 // Texture98 arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture."); // used for all render implementations99 arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture."); // used for all render implementations100 101 // Texture Rectangle?102 arguments.getApplicationUsage()->addCommandLineOption("--texture-rectangle","Use osg::TextureRectangle for doing the render to texure to.");103 104 // HDR?105 arguments.getApplicationUsage()->addCommandLineOption("--hdr","Render distortion as HDR.");106 107 // Read out Distortion CMDLine arguments108 //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 141 123 142 //while (arguments.read("--distortionmap", distortMapFileName)) { } … … 170 189 blendMapFileName = "..\\resources\\distortion\\blend_distDisabled.bmp"; 171 190 172 173 191 // Process XML configuration 192 processXMLConfiguration(); 174 193 175 194 // Process Commandline arguments:
Note: See TracChangeset
for help on using the changeset viewer.