Changeset 2299 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
- Timestamp:
- 03/29/07 13:27:53 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgrePathMapRenderTechnique.cpp
r2249 r2299 7 7 8 8 OgrePathMapRenderTechnique::OgrePathMapRenderTechnique( 9 SceneBlendFactor passBlendingSRC, 10 SceneBlendFactor passBlendingDEST, 9 11 Pass* pass, 10 12 OgreRenderable* parentRenderable, … … 13 15 OgreRenderTechnique(pass, parentRenderable, parentTechniqueGroup) 14 16 { 17 this->passBlendingSRC = passBlendingSRC; 18 this->passBlendingDEST = passBlendingDEST; 19 15 20 this->clusters = OgreIlluminationManager::getSingleton().getPathMapClusters(parentRenderable->getName()); 16 21 … … 81 86 st->setTextureName(pass->getTextureUnitState(0)->getTextureName()); 82 87 83 //newpass->setSceneBlending(SBT_MODULATE); 84 newpass->setSceneBlending(SBT_ADD); 85 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 88 newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 86 89 newpass->setDepthBias(1); 87 88 89 90 90 } 91 91 … … 158 158 } 159 159 160 namespace PathMapParsers 161 { 162 SceneBlendFactor convertBlendFactor(const String& param) 163 { 164 if (param == "one") 165 return SBF_ONE; 166 else if (param == "zero") 167 return SBF_ZERO; 168 else if (param == "dest_colour") 169 return SBF_DEST_COLOUR; 170 else if (param == "src_colour") 171 return SBF_SOURCE_COLOUR; 172 else if (param == "one_minus_dest_colour") 173 return SBF_ONE_MINUS_DEST_COLOUR; 174 else if (param == "one_minus_src_colour") 175 return SBF_ONE_MINUS_SOURCE_COLOUR; 176 else if (param == "dest_alpha") 177 return SBF_DEST_ALPHA; 178 else if (param == "src_alpha") 179 return SBF_SOURCE_ALPHA; 180 else if (param == "one_minus_dest_alpha") 181 return SBF_ONE_MINUS_DEST_ALPHA; 182 else if (param == "one_minus_src_alpha") 183 return SBF_ONE_MINUS_SOURCE_ALPHA; 184 } 185 186 void parsePassBlending(String& params, RenderTechniqueFactory* factory) 187 { 188 OgrePathMapRenderTechniqueFactory* f = (OgrePathMapRenderTechniqueFactory*) factory; 189 StringVector vecparams = StringUtil::split(params, " \t"); 190 if(vecparams.size() == 1) 191 { 192 if (vecparams[0] == "none") 193 { 194 f->passBlendingSRC = SBF_ONE; 195 f->passBlendingDEST = SBF_ZERO; 196 } 197 if (vecparams[0] == "add") 198 { 199 f->passBlendingSRC = SBF_ONE; 200 f->passBlendingDEST = SBF_ONE; 201 } 202 else if (vecparams[0] == "modulate") 203 { 204 f->passBlendingSRC = SBF_DEST_COLOUR; 205 f->passBlendingDEST = SBF_ZERO; 206 } 207 else if (vecparams[0] == "colour_blend") 208 { 209 f->passBlendingSRC = SBF_SOURCE_COLOUR; 210 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 211 } 212 else if (vecparams[0] == "alpha_blend") 213 { 214 f->passBlendingSRC = SBF_SOURCE_ALPHA; 215 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 216 } 217 } 218 else if (vecparams.size() == 2) 219 { 220 f->passBlendingSRC = convertBlendFactor(vecparams[0]); 221 f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 222 } 223 } 224 } 225 160 226 OgrePathMapRenderTechniqueFactory::OgrePathMapRenderTechniqueFactory() 161 227 { 162 228 typeName = "PathMap"; 229 using namespace PathMapParsers; 230 this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 163 231 } 164 232 … … 169 237 OgreTechniqueGroup* parentTechniqueGroup) 170 238 { 239 passBlendingSRC = SBF_ONE; 240 passBlendingDEST = SBF_ONE; 241 171 242 parseParams(params); 172 243 173 244 OgrePathMapRenderTechnique* result = new OgrePathMapRenderTechnique( 245 passBlendingSRC, 246 passBlendingDEST, 174 247 pass, 175 248 parentRenderable,
Note: See TracChangeset
for help on using the changeset viewer.