Changeset 150 for osgVisual/src
- Timestamp:
- Nov 9, 2010, 7:40:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/distortion/visual_distortion.cpp
r149 r150 66 66 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 67 67 if( attr_name == "channelname" ) 68 channelname = attr_value; 68 { 69 std::string channelname = attr_value; 70 OSG_NOTIFY(osg::ALWAYS) << "channelname:" << channelname << std::endl; 71 72 std::string pre_cfg("..\\resources\\distortion\\view_"); 73 std::string pre_distortion("..\\resources\\distortion\\distort_"); 74 std::string pre_blend("..\\resources\\distortion\\blend_"); 75 std::string post_cfg(".cfg"); 76 std::string post_distortion(".bmp"); 77 std::string post_blend(".bmp"); 78 79 // load channel config 80 parser->parseConfigFile((pre_cfg+channelname+post_cfg).data()); 81 // load channel blendmap 82 blendMapFileName = (pre_blend+channelname+post_blend).data(); 83 // load channel distortionmap 84 distortMapFileName = (pre_distortion+channelname+post_distortion).data(); 85 // set channel frustum 86 if( parser->isConfigParsed()) 87 viewer->getCamera()->setProjectionMatrixAsFrustum((parser->getFrustumDataset())[0], (parser->getFrustumDataset())[1], (parser->getFrustumDataset())[2], (parser->getFrustumDataset())[3], (parser->getFrustumDataset())[4], (parser->getFrustumDataset())[5]); 88 else 89 OSG_NOTIFY(osg::WARN) << "WARNING: Unable to parse Frustum values from '" << pre_cfg<<channelname<<post_cfg << "' -- continue without valid frustum values." << std::endl; 90 } 69 91 if( attr_name == "renderimplemmentation" ) 70 92 { … … 105 127 if(cur_node->type == XML_ELEMENT_NODE && node_name == "distortionmap") 106 128 { 107 129 xmlAttr *attr = cur_node->properties; 130 while ( attr ) 131 { 132 std::string attr_name=reinterpret_cast<const char*>(attr->name); 133 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 134 if( attr_name == "filename" ) 135 { 136 distortMapFileName = attr_value; 137 } 138 139 attr = attr->next; 140 } 108 141 } 109 142 … … 111 144 if(cur_node->type == XML_ELEMENT_NODE && node_name == "blendmap") 112 145 { 113 146 xmlAttr *attr = cur_node->properties; 147 while ( attr ) 148 { 149 std::string attr_name=reinterpret_cast<const char*>(attr->name); 150 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 151 if( attr_name == "filename" ) 152 { 153 blendMapFileName = attr_value; 154 } 155 156 attr = attr->next; 157 } 114 158 } 115 159 } // FOR all nodes END … … 129 173 } 130 174 131 return true;132 }133 134 bool visual_distortion::processCommandlineparameters()135 {136 // Distortion files.137 arguments.getApplicationUsage()->addCommandLineOption("-C <channelname>","Setup the channel name, this is the preset for blendmap, distortionmap and camera configuration file.");138 139 arguments.getApplicationUsage()->addCommandLineOption("--distortionmap","Set a distortion map file name.");140 arguments.getApplicationUsage()->addCommandLineOption("--blendmap","Set a blend map file name.");141 142 //while (arguments.read("--distortionmap", distortMapFileName)) { }143 //while (arguments.read("--blendmap", blendMapFileName)) { }144 145 std::string pre_cfg("..\\resources\\distortion\\view_");146 std::string pre_distortion("..\\resources\\distortion\\distort_");147 std::string pre_blend("..\\resources\\distortion\\blend_");148 std::string post_cfg(".cfg");149 std::string post_distortion(".bmp");150 std::string post_blend(".bmp");151 std::string channelname;152 while (arguments.read("-C",channelname))153 {154 OSG_NOTIFY(osg::INFO) << "channelname:" << channelname << std::endl;155 // load channel config156 parser->parseConfigFile((pre_cfg+channelname+post_cfg).data());157 // load channel blendmap158 blendMapFileName = (pre_blend+channelname+post_blend).data();159 // load channel distortionmap160 distortMapFileName = (pre_distortion+channelname+post_distortion).data();161 // set channel frustum162 if( parser->isConfigParsed())163 viewer->getCamera()->setProjectionMatrixAsFrustum((parser->getFrustumDataset())[0], (parser->getFrustumDataset())[1], (parser->getFrustumDataset())[2], (parser->getFrustumDataset())[3], (parser->getFrustumDataset())[4], (parser->getFrustumDataset())[5]);164 else165 OSG_NOTIFY(osg::WARN) << "WARNING: Unable to parse Frustum values from '" << pre_cfg<<channelname<<post_cfg << "' -- continue without valid frustum values." << std::endl;166 }167 168 // report any errors if they have occurred when parsing the program arguments.169 if (arguments.errors())170 {171 arguments.writeErrorMessages(std::cout);172 exit(1);173 }174 175 return true; 175 176 } … … 191 192 // Process XML configuration 192 193 processXMLConfiguration(); 193 194 // Process Commandline arguments:195 processCommandlineparameters();196 194 197 195 // Add this node to the scenegraph to get updated during update traversal.
Note: See TracChangeset
for help on using the changeset viewer.