Changeset 11089
- Timestamp:
- Jan 24, 2016, 2:25:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/GlowMaterialListener.h
r11085 r11089 17 17 mBlackMat->getTechnique(0)->getPass(0)->setAmbient(0,0,0); 18 18 mBlackMat->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,0); 19 20 mTransparentMat = Ogre::MaterialManager::getSingleton().create("mGlowTransparent", "Internal"); 21 mTransparentMat->getTechnique(0)->getPass(0)->setDiffuse(0,0,0,0); 22 mTransparentMat->getTechnique(0)->getPass(0)->setSpecular(0,0,0,0); 23 mTransparentMat->getTechnique(0)->getPass(0)->setAmbient(0,0,0); 24 mTransparentMat->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,0); 25 mTransparentMat->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_ADD); 26 mTransparentMat->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); 19 27 } 20 28 21 Ogre::Technique* handleSchemeNotFound(unsigned short, const Ogre::String& schemeName, Ogre::Material* mat, unsigned short, const Ogre::Renderable*)29 Ogre::Technique* handleSchemeNotFound(unsigned short, const Ogre::String& schemeName, Ogre::Material* mat, unsigned short, const Ogre::Renderable*) 22 30 { 23 31 if (schemeName == "glow") 24 32 { 25 //LogManager::getSingleton().logMessage(">> adding glow to material: "+mat->getName()); 26 return mBlackMat->getTechnique(0); 33 // try to figure out if the original material is transparent. if yes, use a black transparent material, otherwise a black opaque one. 34 if (mat != nullptr && mat->getTechnique(0) != nullptr && mat->getTechnique(0)->getPass(0) != nullptr) 35 { 36 Ogre::Pass* pass = mat->getTechnique(0)->getPass(0); 37 if (pass->getDepthWriteEnabled()) 38 return mBlackMat->getTechnique(0); 39 else 40 return mTransparentMat->getTechnique(0); 41 } 42 else 43 return mBlackMat->getTechnique(0); 27 44 } 28 45 return NULL; … … 31 48 private: 32 49 Ogre::MaterialPtr mBlackMat; 50 Ogre::MaterialPtr mTransparentMat; 33 51 }; 34 52 }
Note: See TracChangeset
for help on using the changeset viewer.