]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/COGLES2MaterialRenderer.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / COGLES2MaterialRenderer.h
1 // Copyright (C) 2014 Patryk Nadrowski\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__\r
6 #define __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__\r
7 \r
8 \r
9 #ifdef _IRR_COMPILE_WITH_OGLES2_\r
10 \r
11 #include "EMaterialTypes.h"\r
12 #include "IMaterialRenderer.h"\r
13 #include "IMaterialRendererServices.h"\r
14 #include "IGPUProgrammingServices.h"\r
15 #include "irrArray.h"\r
16 #include "irrString.h"\r
17 \r
18 #include "COGLES2Common.h"\r
19 \r
20 namespace irr\r
21 {\r
22 namespace video\r
23 {\r
24 \r
25 class COGLES2Driver;\r
26 \r
27 class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices\r
28 {\r
29 public:\r
30 \r
31         COGLES2MaterialRenderer(\r
32                 COGLES2Driver* driver,\r
33                 s32& outMaterialTypeNr,\r
34                 const c8* vertexShaderProgram = 0,\r
35                 const c8* pixelShaderProgram = 0,\r
36                 IShaderConstantSetCallBack* callback = 0,\r
37                 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,\r
38                 s32 userData = 0);\r
39 \r
40         virtual ~COGLES2MaterialRenderer();\r
41 \r
42         GLuint getProgram() const;\r
43 \r
44         virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,\r
45                 bool resetAllRenderstates, IMaterialRendererServices* services);\r
46 \r
47         virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);\r
48 \r
49         virtual void OnUnsetMaterial();\r
50 \r
51         virtual bool isTransparent() const;\r
52 \r
53         virtual s32 getRenderCapability() const;\r
54 \r
55         void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;\r
56 \r
57         s32 getVertexShaderConstantID(const c8* name) override;\r
58         s32 getPixelShaderConstantID(const c8* name) override;\r
59         void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;\r
60         void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;\r
61         bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;\r
62         bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;\r
63         bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;\r
64         bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;\r
65         bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;\r
66         bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;\r
67 \r
68         IVideoDriver* getVideoDriver() override;\r
69 \r
70 protected:\r
71 \r
72         COGLES2MaterialRenderer(COGLES2Driver* driver,\r
73                                         IShaderConstantSetCallBack* callback = 0,\r
74                                         E_MATERIAL_TYPE baseMaterial = EMT_SOLID,\r
75                                         s32 userData = 0);\r
76 \r
77         void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, bool addMaterial = true);\r
78 \r
79         bool createShader(GLenum shaderType, const char* shader);\r
80         bool linkProgram();\r
81 \r
82         COGLES2Driver* Driver;\r
83         IShaderConstantSetCallBack* CallBack;\r
84 \r
85         bool Alpha;\r
86         bool Blending;\r
87         bool FixedBlending;\r
88 \r
89         struct SUniformInfo\r
90         {\r
91                 core::stringc name;\r
92                 GLenum type;\r
93                 GLint location;\r
94         };\r
95 \r
96         GLuint Program;\r
97         core::array<SUniformInfo> UniformInfo;\r
98         s32 UserData;\r
99 };\r
100 \r
101 \r
102 }\r
103 }\r
104 \r
105 #endif\r
106 #endif\r
107 \r