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
5 #ifndef __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__
\r
6 #define __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
10 #ifdef _IRR_COMPILE_WITH_OGLES2_
\r
12 #include "EMaterialTypes.h"
\r
13 #include "IMaterialRenderer.h"
\r
14 #include "IMaterialRendererServices.h"
\r
15 #include "IGPUProgrammingServices.h"
\r
16 #include "irrArray.h"
\r
17 #include "irrString.h"
\r
19 #include "COGLES2Common.h"
\r
26 class COGLES2Driver;
\r
28 class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
\r
32 COGLES2MaterialRenderer(
\r
33 COGLES2Driver* driver,
\r
34 s32& outMaterialTypeNr,
\r
35 const c8* vertexShaderProgram = 0,
\r
36 const c8* pixelShaderProgram = 0,
\r
37 IShaderConstantSetCallBack* callback = 0,
\r
38 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
\r
41 virtual ~COGLES2MaterialRenderer();
\r
43 GLuint getProgram() const;
\r
45 virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
\r
46 bool resetAllRenderstates, IMaterialRendererServices* services);
\r
48 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
\r
50 virtual void OnUnsetMaterial();
\r
52 virtual bool isTransparent() const;
\r
54 virtual s32 getRenderCapability() const;
\r
56 void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
\r
58 s32 getVertexShaderConstantID(const c8* name) override;
\r
59 s32 getPixelShaderConstantID(const c8* name) override;
\r
60 void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
\r
61 void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
\r
62 bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
\r
63 bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
\r
64 bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
\r
65 bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;
\r
66 bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;
\r
67 bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
\r
69 IVideoDriver* getVideoDriver() override;
\r
73 COGLES2MaterialRenderer(COGLES2Driver* driver,
\r
74 IShaderConstantSetCallBack* callback = 0,
\r
75 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
\r
78 void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, bool addMaterial = true);
\r
80 bool createShader(GLenum shaderType, const char* shader);
\r
83 COGLES2Driver* Driver;
\r
84 IShaderConstantSetCallBack* CallBack;
\r
98 core::array<SUniformInfo> UniformInfo;
\r