Game Engine: alpha blending and sorting
[blender.git] / source / gameengine / Ketsji / BL_BlenderShader.h
1
2 #ifndef __BL_GPUSHADER_H__
3 #define __BL_GPUSHADER_H__
4
5 #ifdef BLENDER_GLSL
6 #include "GPU_material.h"
7 #endif
8
9 #include "MT_Matrix4x4.h"
10 #include "MT_Matrix3x3.h"
11 #include "MT_Tuple2.h"
12 #include "MT_Tuple3.h"
13 #include "MT_Tuple4.h"
14
15 #include "RAS_IPolygonMaterial.h"
16
17 #include "KX_Scene.h"
18
19 struct Material;
20 struct Scene;
21 class BL_Material;
22
23 #define BL_MAX_ATTRIB   16
24
25 /**
26  * BL_BlenderShader
27  *  Blender GPU shader material
28  */
29 class BL_BlenderShader
30 {
31 private:
32 #ifdef BLENDER_GLSL
33         KX_Scene                *mScene;
34         struct Scene    *mBlenderScene;
35         struct Material *mMat;
36         GPUMaterial             *mGPUMat;
37 #endif
38         bool                    mBound;
39         int                             mLightLayer;
40         int                             mBlendMode;
41
42         bool                    VerifyShader();
43
44 public:
45         BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer);
46         virtual ~BL_BlenderShader();
47
48         bool                            Ok();
49         void                            SetProg(bool enable);
50
51         int GetAttribNum();
52         void SetAttribs(class RAS_IRasterizer* ras, const BL_Material *mat);
53         void Update(const class KX_MeshSlot & ms, class RAS_IRasterizer* rasty);
54         int GetBlendMode();
55
56         bool Equals(BL_BlenderShader *blshader);
57 };
58
59 #endif//__BL_GPUSHADER_H__