python api for ID property access by Joseph Eager, copied from blender 2.4x.
[blender.git] / source / gameengine / Ketsji / BL_BlenderShader.h
1
2 #ifndef __BL_GPUSHADER_H__
3 #define __BL_GPUSHADER_H__
4
5 #include "GPU_material.h"
6
7 #include "MT_Matrix4x4.h"
8 #include "MT_Matrix3x3.h"
9 #include "MT_Tuple2.h"
10 #include "MT_Tuple3.h"
11 #include "MT_Tuple4.h"
12
13 #include "RAS_IPolygonMaterial.h"
14
15 #include "KX_Scene.h"
16
17 struct Material;
18 struct Scene;
19 class BL_Material;
20
21 #define BL_MAX_ATTRIB   16
22
23 /**
24  * BL_BlenderShader
25  *  Blender GPU shader material
26  */
27 class BL_BlenderShader
28 {
29 private:
30         KX_Scene                *mScene;
31         struct Scene    *mBlenderScene;
32         struct Material *mMat;
33         int                             mLightLayer;
34         int                             mBlendMode;
35         GPUMaterial     *mGPUMat;
36
37         bool                    VerifyShader() 
38         {
39                 return (NULL != mGPUMat);
40         }
41
42 public:
43         BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer);
44         virtual ~BL_BlenderShader();
45
46         bool                            Ok()
47         {
48                 // same as VerifyShared
49                 return (NULL != mGPUMat);
50         }
51         void                            SetProg(bool enable, double time=0.0);
52
53         int GetAttribNum();
54         void SetAttribs(class RAS_IRasterizer* ras, const BL_Material *mat);
55         void Update(const class RAS_MeshSlot & ms, class RAS_IRasterizer* rasty);
56         void ReloadMaterial();
57         int GetBlendMode();
58
59         bool Equals(BL_BlenderShader *blshader);
60         
61         
62 #ifdef WITH_CXX_GUARDEDALLOC
63 public:
64         void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderShader"); }
65         void operator delete( void *mem ) { MEM_freeN(mem); }
66 #endif
67 };
68
69 #endif//__BL_GPUSHADER_H__