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
9 #ifdef _IRR_COMPILE_WITH_OGLES2_
\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
18 #include "COGLES2Common.h"
\r
25 class COGLES2Driver;
\r
27 class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
\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
40 virtual ~COGLES2MaterialRenderer();
\r
42 GLuint getProgram() const;
\r
44 virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
\r
45 bool resetAllRenderstates, IMaterialRendererServices* services);
\r
47 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
\r
49 virtual void OnUnsetMaterial();
\r
51 virtual bool isTransparent() const;
\r
53 virtual s32 getRenderCapability() const;
\r
55 void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
\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
68 IVideoDriver* getVideoDriver() override;
\r
72 COGLES2MaterialRenderer(COGLES2Driver* driver,
\r
73 IShaderConstantSetCallBack* callback = 0,
\r
74 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
\r
77 void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, bool addMaterial = true);
\r
79 bool createShader(GLenum shaderType, const char* shader);
\r
82 COGLES2Driver* Driver;
\r
83 IShaderConstantSetCallBack* CallBack;
\r
97 core::array<SUniformInfo> UniformInfo;
\r