Merge from trunk 16122-16307
[blender.git] / source / gameengine / Ketsji / KX_BlenderMaterial.h
index 2b1264154d0c5b7a094fc30d0b731784ea98ef67..0d7657b8cdbaf7d1e388bb68d925bc7e1ff55e9a 100644 (file)
@@ -8,6 +8,7 @@
 #include "BL_Material.h"
 #include "BL_Texture.h"
 #include "BL_Shader.h"
+#include "BL_BlenderShader.h"
 
 #include "PyObjectPlus.h"
 
@@ -60,6 +61,10 @@ public:
                TCachingInfo& cachingInfo
        )const;
 
+       void ActivateBlenderShaders(
+               RAS_IRasterizer* rasty, 
+               TCachingInfo& cachingInfo
+       )const;
 
        MTFace* GetMTFace(void) const;
        unsigned int* GetMCol(void) const;
@@ -85,24 +90,32 @@ public:
        // --------------------------------
        // pre calculate to avoid pops/lag at startup
        virtual void OnConstruction( );
+
+       static void     EndFrame();
+
 private:
-       BL_Material*    mMaterial;
-       BL_Shader*              mShader;
+       BL_Material*            mMaterial;
+       BL_Shader*                      mShader;
+       BL_BlenderShader*       mBlenderShader;
        KX_Scene*               mScene;
        BL_Texture              mTextures[MAXTEX];              // texture array
        bool                    mUserDefBlend;
        unsigned int    mBlendFunc[2];
        bool                    mModified;
+       bool                    mConstructed;                   // if false, don't clean on exit
+
+       void SetBlenderGLSLShader();
 
        void ActivatGLMaterials( RAS_IRasterizer* rasty )const;
        void ActivateTexGen( RAS_IRasterizer *ras ) const;
 
+       bool UsesLighting(RAS_IRasterizer *rasty) const;
 
        // message centers
        void    setTexData( bool enable,RAS_IRasterizer *ras);
+       void    setBlenderShaderData( bool enable, RAS_IRasterizer *ras);
        void    setShaderData( bool enable, RAS_IRasterizer *ras);
 
-       bool    setDefaultBlending();
        void    setObjectMatrixData(int i, RAS_IRasterizer *ras);
        void    setTexMatrixData(int i);
 
@@ -111,6 +124,10 @@ private:
        // cleanup stuff
        void    OnExit();
 
+       // shader chacing
+       static BL_BlenderShader *mLastBlenderShader;
+       static BL_Shader                *mLastShader;
+
        mutable int     mPass;
 };