Revision: 8540
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8540&view=rev
Author:   natepak
Date:     2010-01-30 21:39:24 +0000 (Sat, 30 Jan 2010)

Log Message:
-----------
Added more lighting options

Modified Paths:
--------------
    code/gazebo/trunk/server/rendering/RTShaderSystem.cc

Modified: code/gazebo/trunk/server/rendering/RTShaderSystem.cc
===================================================================
--- code/gazebo/trunk/server/rendering/RTShaderSystem.cc        2010-01-30 
16:30:21 UTC (rev 8539)
+++ code/gazebo/trunk/server/rendering/RTShaderSystem.cc        2010-01-30 
21:39:24 UTC (rev 8540)
@@ -40,6 +40,7 @@
 #if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR >= 7
   World::Instance()->ConnectPerPixelLightingSignal( 
boost::bind(&RTShaderSystem::SetPerPixelLighting, this, _1) );
   this->curLightingModel = RTShaderSystem::SSLM_PerPixelLighting;
+  //this->curLightingModel = RTShaderSystem::SSLM_NormalMapLightingObjectSpace;
 #endif
 }
 
@@ -225,17 +226,6 @@
 
       Ogre::Pass* curPass = curMaterial->getTechnique(0)->getPass(0);
 
-      /*if (mSpecularEnable)
-      {
-        curPass->setSpecular(ColourValue::White);
-        curPass->setShininess(32.0);
-      }
-      else
-      {
-        curPass->setSpecular(ColourValue::Black);
-        curPass->setShininess(0.0);
-      }*/
-
       // Grab the first pass render state. 
       // NOTE: For more complicated samples iterate over the passes and build
       // each one of them as desired.
@@ -260,14 +250,37 @@
 
         renderState->addSubRenderState(perPixelLightModel);
       }
-    }
 
+      else if (this->curLightingModel == SSLM_NormalMapLightingObjectSpace)
+      {
+        Ogre::RTShader::SubRenderState* subRenderState = 
this->shaderGenerator->createSubRenderState(Ogre::RTShader::NormalMapLighting::Type);
+        Ogre::RTShader::NormalMapLighting* normalMapSubRS = 
static_cast<Ogre::RTShader::NormalMapLighting*>(subRenderState);
+        Ogre::UserObjectBindings* rtssBindings = 
Ogre::any_cast<Ogre::UserObjectBindings*>(curPass->getUserObjectBindings().getUserAny(Ogre::RTShader::ShaderGenerator::BINDING_OBJECT_KEY));
+
+        
normalMapSubRS->setNormalMapSpace(Ogre::RTShader::NormalMapLighting::NMS_OBJECT);
+        
rtssBindings->setUserAny(Ogre::RTShader::NormalMapLighting::NormalMapTextureNameKey,
 Ogre::Any(Ogre::String("skin.tga")));
+        renderState->addSubRenderState(normalMapSubRS);
+      }
+
+      else if (this->curLightingModel == SSLM_NormalMapLightingTangentSpace)
+      {
+        Ogre::RTShader::SubRenderState* subRenderState = 
this->shaderGenerator->createSubRenderState(Ogre::RTShader::NormalMapLighting::Type);
+        Ogre::RTShader::NormalMapLighting* normalMapSubRS = 
static_cast<Ogre::RTShader::NormalMapLighting*>(subRenderState);
+        Ogre::UserObjectBindings* rtssBindings = 
Ogre::any_cast<Ogre::UserObjectBindings*>(curPass->getUserObjectBindings().getUserAny(Ogre::RTShader::ShaderGenerator::BINDING_OBJECT_KEY));
+
+        
normalMapSubRS->setNormalMapSpace(Ogre::RTShader::NormalMapLighting::NMS_TANGENT);
+        
rtssBindings->setUserAny(Ogre::RTShader::NormalMapLighting::NormalMapTextureNameKey,
 Ogre::Any(Ogre::String("skin.tga")));
+
+        renderState->addSubRenderState(normalMapSubRS);
+      }
+#endif
+      }
+
     // Invalidate this material in order to re-generate its shaders.
     
this->shaderGenerator->invalidateMaterial(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME,
 curMaterialName);
 
 
   }
-#endif
 
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to