Changeset 1053 for OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/src
- Timestamp:
- 06/26/06 09:33:12 (18 years ago)
- Location:
- OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/src/OgreMaterialSerializer.cpp
r812 r1053 248 248 249 249 } 250 251 #ifdef GAMETOOLS_ILLUMINATION_MODULE 252 253 SceneBlendOperation convertBlendOperation(const String& param) 254 { 255 if (param == "add") 256 return SBOP_ADD; 257 else if (param == "subtract") 258 return SBOP_SUBTRACT; 259 else if (param == "rev_subtract") 260 return SBOP_REVSUBTRACT; 261 else if (param == "min") 262 return SBOP_MIN; 263 else if (param == "max") 264 return SBOP_MAX; 265 else 266 { 267 OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Invalid blend operation.", "convertBlendOperation"); 268 } 269 } 270 271 bool parseSceneColorBlendOperation(String& params, MaterialScriptContext& context) 272 { 273 SceneBlendOperation op; 274 op = convertBlendOperation(params); 275 context.pass->setSceneBlendOperation(op); 276 277 return false; 278 } 279 bool parseSceneAlphaBlendOperation(String& params, MaterialScriptContext& context) 280 { 281 SceneBlendOperation op; 282 op = convertBlendOperation(params); 283 context.pass->setSceneAlphaBlendOperation(op); 284 context.pass->setSeparateAlphaBlend(true); 285 286 return false; 287 } 288 bool parseSceneAlphaBlend(String& params, MaterialScriptContext& context) 289 { 290 StringUtil::toLowerCase(params); 291 StringVector vecparams = StringUtil::split(params, " \t"); 292 // Should be 1 or 2 params 293 if (vecparams.size() == 1) 294 { 295 //simple 296 SceneBlendType stype; 297 if (vecparams[0] == "add") 298 stype = SBT_ADD; 299 else if (vecparams[0] == "modulate") 300 stype = SBT_MODULATE; 301 else if (vecparams[0] == "colour_blend") 302 stype = SBT_TRANSPARENT_COLOUR; 303 else if (vecparams[0] == "alpha_blend") 304 stype = SBT_TRANSPARENT_ALPHA; 305 else 306 { 307 logParseError( 308 "Bad scene_blend_alpha attribute, unrecognised parameter '" + vecparams[0] + "'", 309 context); 310 return false; 311 } 312 context.pass->setAlphaSceneBlending(stype); 313 context.pass->setSeparateAlphaBlend(true); 314 315 } 316 else if (vecparams.size() == 2) 317 { 318 //src/dest 319 SceneBlendFactor src, dest; 320 321 try { 322 src = convertBlendFactor(vecparams[0]); 323 dest = convertBlendFactor(vecparams[1]); 324 context.pass->setAlphaSceneBlending(src, dest); 325 context.pass->setSeparateAlphaBlend(true); 326 } 327 catch (Exception& e) 328 { 329 logParseError("Bad scene_blend_alpha attribute, " + e.getFullDescription(), context); 330 } 331 332 } 333 else 334 { 335 logParseError( 336 "Bad scene_blend_alpha attribute, wrong number of parameters (expected 1 or 2)", 337 context); 338 } 339 340 return false; 341 } 342 343 #endif 250 344 //----------------------------------------------------------------------- 251 345 bool parseSceneBlend(String& params, MaterialScriptContext& context) … … 2552 2646 2553 2647 mPassAttribParsers.insert(AttribParserList::value_type("IllumTechniques", (ATTRIBUTE_PARSER)parseIllumTechniques)); 2648 mPassAttribParsers.insert(AttribParserList::value_type("scene_blend_op", (ATTRIBUTE_PARSER)parseSceneColorBlendOperation)); 2649 mPassAttribParsers.insert(AttribParserList::value_type("scene_blend_op_alpha", (ATTRIBUTE_PARSER)parseSceneAlphaBlendOperation)); 2650 mPassAttribParsers.insert(AttribParserList::value_type("scene_blend_alpha", (ATTRIBUTE_PARSER)parseSceneAlphaBlend)); 2554 2651 mIllumTechniqueParsers.insert(AttribParserList::value_type("RenderTechnique", (ATTRIBUTE_PARSER)parseIllumTechniqueParams)); 2555 2652 #endif -
OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/src/OgrePass.cpp
r923 r1053 43 43 #ifdef GAMETOOLS_ILLUMINATION_MODULE 44 44 mActive = true; 45 46 mSeparateAlpha = false; 47 mAlphaSourceBlendFactor = SBF_ONE; 48 mAlphaDestBlendFactor = SBF_ZERO; 49 mBlendOperation = SBOP_ADD; 50 mAlphaBlendOperation = SBOP_ADD; 45 51 #endif 46 52 // Default to white ambient & diffuse, no specular / emissive … … 107 113 #ifdef GAMETOOLS_ILLUMINATION_MODULE 108 114 mActive = true; 115 116 mSeparateAlpha = false; 117 mAlphaSourceBlendFactor = SBF_ONE; 118 mAlphaDestBlendFactor = SBF_ZERO; 119 mBlendOperation = SBOP_ADD; 120 mAlphaBlendOperation = SBOP_ADD; 109 121 #endif 110 122 *this = oth; … … 124 136 #ifdef GAMETOOLS_ILLUMINATION_MODULE 125 137 mActive = oth.mActive; 138 mSeparateAlpha = oth.mSeparateAlpha; 139 mAlphaSourceBlendFactor = oth.mAlphaSourceBlendFactor; 140 mAlphaDestBlendFactor = oth.mAlphaDestBlendFactor; 141 mBlendOperation = oth.mBlendOperation; 142 mAlphaBlendOperation = oth.mAlphaBlendOperation; 126 143 127 144 for(int i = 0; i < oth.illumTechniques.size(); i++ ) … … 633 650 mDestBlendFactor = destFactor; 634 651 } 652 653 #ifdef GAMETOOLS_ILLUMINATION_MODULE 654 void Pass::setAlphaSceneBlending(SceneBlendType sbt) 655 { 656 // Turn predefined type into blending factors 657 switch (sbt) 658 { 659 case SBT_TRANSPARENT_ALPHA: 660 setAlphaSceneBlending(SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA); 661 break; 662 case SBT_TRANSPARENT_COLOUR: 663 setAlphaSceneBlending(SBF_SOURCE_COLOUR, SBF_ONE_MINUS_SOURCE_COLOUR); 664 break; 665 case SBT_MODULATE: 666 setAlphaSceneBlending(SBF_DEST_COLOUR, SBF_ZERO); 667 break; 668 case SBT_ADD: 669 setAlphaSceneBlending(SBF_ONE, SBF_ONE); 670 break; 671 case SBT_REPLACE: 672 setAlphaSceneBlending(SBF_ONE, SBF_ZERO); 673 break; 674 // TODO: more 675 } 676 677 } 678 //----------------------------------------------------------------------- 679 void Pass::setAlphaSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor) 680 { 681 mAlphaSourceBlendFactor = sourceFactor; 682 mAlphaDestBlendFactor = destFactor; 683 } 684 #endif 685 635 686 //----------------------------------------------------------------------- 636 687 SceneBlendFactor Pass::getSourceBlendFactor(void) const -
OGRE/trunk/ogre_changes/Ogre1.2/OgreMain/src/OgreSceneManager.cpp
r948 r1053 809 809 810 810 // The rest of the settings are the same no matter whether we use programs or not 811 812 // Set scene blending 811 // Set scene blending 812 #ifdef GAMETOOLS_ILLUMINATION_MODULE 813 mDestRenderSystem->_setSceneBlending( 814 pass->getSourceBlendFactor(), 815 pass->getDestBlendFactor(), 816 pass->getSceneBlendOperation(), 817 pass->getSeparateAlphaBlend(), 818 pass->getAlphaSceneBlendingSrcFactor(), 819 pass->getAlphaSceneBlendingDestFactor(), 820 pass->getSceneBlendOperationAlpha()); 821 #else 813 822 mDestRenderSystem->_setSceneBlending( 814 823 pass->getSourceBlendFactor(), pass->getDestBlendFactor()); 824 #endif 815 825 816 826 // Set point parameters
Note: See TracChangeset
for help on using the changeset viewer.