Changeset 2299 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Timestamp:
- 03/29/07 13:27:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticReceiverRenderTechnique.cpp
r2285 r2299 9 9 String causticVertexProgram, 10 10 String causticFragmentProgram, 11 SceneBlendFactor passBlendingSRC, 12 SceneBlendFactor passBlendingDEST, 11 13 Pass* pass, 12 14 OgreRenderable* parentRenderable, … … 16 18 CausticReceiverRenderTechnique(parentRenderable, parentTechniqueGroup) 17 19 { 20 this->passBlendingSRC = passBlendingSRC; 21 this->passBlendingDEST = passBlendingDEST; 18 22 this->maxcasters = maxcasters; 19 23 this->causticVertexProgram = causticVertexProgram; … … 57 61 st2->setTextureFiltering(TFO_BILINEAR); 58 62 59 newpass->setSceneBlending(SBF_DEST_COLOUR, SBF_ONE); 60 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 61 newpass->setDepthBias(1); 62 //newpass->setSceneBlending(SBT_ADD); 63 newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 64 newpass->setDepthBias(1); 63 65 64 66 techn->movePass(lastpass, index); … … 138 140 } 139 141 142 SceneBlendFactor convertBlendFactor(const String& param) 143 { 144 if (param == "one") 145 return SBF_ONE; 146 else if (param == "zero") 147 return SBF_ZERO; 148 else if (param == "dest_colour") 149 return SBF_DEST_COLOUR; 150 else if (param == "src_colour") 151 return SBF_SOURCE_COLOUR; 152 else if (param == "one_minus_dest_colour") 153 return SBF_ONE_MINUS_DEST_COLOUR; 154 else if (param == "one_minus_src_colour") 155 return SBF_ONE_MINUS_SOURCE_COLOUR; 156 else if (param == "dest_alpha") 157 return SBF_DEST_ALPHA; 158 else if (param == "src_alpha") 159 return SBF_SOURCE_ALPHA; 160 else if (param == "one_minus_dest_alpha") 161 return SBF_ONE_MINUS_DEST_ALPHA; 162 else if (param == "one_minus_src_alpha") 163 return SBF_ONE_MINUS_SOURCE_ALPHA; 164 } 165 166 void parsePassBlending(String& params, RenderTechniqueFactory* factory) 167 { 168 OgreCausticReceiverRenderTechniqueFactory* f = (OgreCausticReceiverRenderTechniqueFactory*) factory; 169 StringVector vecparams = StringUtil::split(params, " \t"); 170 if(vecparams.size() == 1) 171 { 172 if (vecparams[0] == "none") 173 { 174 f->passBlendingSRC = SBF_ONE; 175 f->passBlendingDEST = SBF_ZERO; 176 } 177 if (vecparams[0] == "add") 178 { 179 f->passBlendingSRC = SBF_ONE; 180 f->passBlendingDEST = SBF_ONE; 181 } 182 else if (vecparams[0] == "modulate") 183 { 184 f->passBlendingSRC = SBF_DEST_COLOUR; 185 f->passBlendingDEST = SBF_ZERO; 186 } 187 else if (vecparams[0] == "colour_blend") 188 { 189 f->passBlendingSRC = SBF_SOURCE_COLOUR; 190 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 191 } 192 else if (vecparams[0] == "alpha_blend") 193 { 194 f->passBlendingSRC = SBF_SOURCE_ALPHA; 195 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 196 } 197 } 198 else if (vecparams.size() == 2) 199 { 200 f->passBlendingSRC = convertBlendFactor(vecparams[0]); 201 f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 202 } 203 } 140 204 } 141 205 OgreCausticReceiverRenderTechniqueFactory::OgreCausticReceiverRenderTechniqueFactory() … … 148 212 this->attributeParsers.insert(AttribParserList::value_type("vertex_program_name", (ILLUM_ATTRIBUTE_PARSER) parseVertexProgram)); 149 213 this->attributeParsers.insert(AttribParserList::value_type("fragment_program_name", (ILLUM_ATTRIBUTE_PARSER) parseFragmentProgram)); 214 this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 150 215 151 216 } … … 161 226 causticVertexProgram = "GTP/Basic/Shaded_VS"; 162 227 causticFragmentProgram = "GTP/Caustic/GatherCaustic_Cube_PS"; 228 passBlendingSRC = SBF_DEST_COLOUR; 229 passBlendingDEST = SBF_ONE; 163 230 164 231 parseParams(params); … … 168 235 causticVertexProgram, 169 236 causticFragmentProgram, 237 passBlendingSRC, 238 passBlendingDEST, 170 239 pass, 171 240 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowReceiverRenderTechnique.cpp
r2297 r2299 16 16 String lightViewParamName, 17 17 String lightFarPlaneParamName, 18 SceneBlendFactor passBlendingSRC, 19 SceneBlendFactor passBlendingDEST, 18 20 Pass* pass, 19 21 OgreRenderable* parentRenderable, … … 23 25 DepthShadowReceiverRenderTechnique(parentRenderable, parentTechniqueGroup) 24 26 { 27 this->passBlendingSRC = passBlendingSRC; 28 this->passBlendingDEST = passBlendingDEST; 25 29 this->maxlights = maxlights; 26 30 this->shadowVertexProgram = shadowVertexProgram ; … … 70 74 st->setTextureBorderColour(ColourValue::White); 71 75 72 newpass->setSceneBlending(SBT_MODULATE); 73 //newpass->setSceneBlending(SBF_ONE, SBF_ZERO); 74 76 newpass->setSceneBlending(passBlendingSRC, passBlendingDEST); 77 75 78 newpass->setDepthBias(1); 76 79 techn->movePass(lastpass, index); … … 219 222 f->lightFarPlaneParamName = params; 220 223 } 224 225 SceneBlendFactor convertBlendFactor(const String& param) 226 { 227 if (param == "one") 228 return SBF_ONE; 229 else if (param == "zero") 230 return SBF_ZERO; 231 else if (param == "dest_colour") 232 return SBF_DEST_COLOUR; 233 else if (param == "src_colour") 234 return SBF_SOURCE_COLOUR; 235 else if (param == "one_minus_dest_colour") 236 return SBF_ONE_MINUS_DEST_COLOUR; 237 else if (param == "one_minus_src_colour") 238 return SBF_ONE_MINUS_SOURCE_COLOUR; 239 else if (param == "dest_alpha") 240 return SBF_DEST_ALPHA; 241 else if (param == "src_alpha") 242 return SBF_SOURCE_ALPHA; 243 else if (param == "one_minus_dest_alpha") 244 return SBF_ONE_MINUS_DEST_ALPHA; 245 else if (param == "one_minus_src_alpha") 246 return SBF_ONE_MINUS_SOURCE_ALPHA; 247 } 248 249 void parsePassBlending(String& params, RenderTechniqueFactory* factory) 250 { 251 OgreDepthShadowReceiverRenderTechniqueFactory* f = (OgreDepthShadowReceiverRenderTechniqueFactory*) factory; 252 StringVector vecparams = StringUtil::split(params, " \t"); 253 if(vecparams.size() == 1) 254 { 255 if (vecparams[0] == "none") 256 { 257 f->passBlendingSRC = SBF_ONE; 258 f->passBlendingDEST = SBF_ZERO; 259 } 260 if (vecparams[0] == "add") 261 { 262 f->passBlendingSRC = SBF_ONE; 263 f->passBlendingDEST = SBF_ONE; 264 } 265 else if (vecparams[0] == "modulate") 266 { 267 f->passBlendingSRC = SBF_DEST_COLOUR; 268 f->passBlendingDEST = SBF_ZERO; 269 } 270 else if (vecparams[0] == "colour_blend") 271 { 272 f->passBlendingSRC = SBF_SOURCE_COLOUR; 273 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_COLOUR; 274 } 275 else if (vecparams[0] == "alpha_blend") 276 { 277 f->passBlendingSRC = SBF_SOURCE_ALPHA; 278 f->passBlendingDEST = SBF_ONE_MINUS_SOURCE_ALPHA; 279 } 280 } 281 else if (vecparams.size() == 2) 282 { 283 f->passBlendingSRC = convertBlendFactor(vecparams[0]); 284 f->passBlendingDEST = convertBlendFactor(vecparams[1]) ; 285 } 286 } 221 287 } 222 288 … … 238 304 this->attributeParsers.insert(AttribParserList::value_type("world_param_name", (ILLUM_ATTRIBUTE_PARSER) parseWorldParamName)); 239 305 this->attributeParsers.insert(AttribParserList::value_type("light_farplane_param_name", (ILLUM_ATTRIBUTE_PARSER) parseLightFarPlaneParamName)); 306 this->attributeParsers.insert(AttribParserList::value_type("pass_blending", (ILLUM_ATTRIBUTE_PARSER) parsePassBlending)); 240 307 } 241 308 … … 258 325 WorldViewProjParamName = "WorldViewProj"; 259 326 WorldParamName = "World"; 327 passBlendingSRC = SBF_DEST_COLOUR; 328 passBlendingDEST = SBF_ZERO; 260 329 261 330 parseParams(params); … … 273 342 lightViewParamName, 274 343 lightFarPlaneParamName, 344 passBlendingSRC, 345 passBlendingDEST, 275 346 pass, 276 347 parentRenderable, -
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.