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
7 #include "EMaterialTypes.h"
\r
8 #include "IMaterialRenderer.h"
\r
9 #include "IMaterialRendererServices.h"
\r
10 #include "IGPUProgrammingServices.h"
\r
11 #include "irrArray.h"
\r
12 #include "irrString.h"
\r
21 class COpenGL3DriverBase;
\r
23 class COpenGL3MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
\r
27 COpenGL3MaterialRenderer(
\r
28 COpenGL3DriverBase* driver,
\r
29 s32& outMaterialTypeNr,
\r
30 const c8* vertexShaderProgram = 0,
\r
31 const c8* pixelShaderProgram = 0,
\r
32 IShaderConstantSetCallBack* callback = 0,
\r
33 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
\r
36 virtual ~COpenGL3MaterialRenderer();
\r
38 GLuint getProgram() const;
\r
40 virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
\r
41 bool resetAllRenderstates, IMaterialRendererServices* services);
\r
43 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
\r
45 virtual void OnUnsetMaterial();
\r
47 virtual bool isTransparent() const;
\r
49 virtual s32 getRenderCapability() const;
\r
51 void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
\r
53 s32 getVertexShaderConstantID(const c8* name) override;
\r
54 s32 getPixelShaderConstantID(const c8* name) override;
\r
55 void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
\r
56 void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
\r
57 bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
\r
58 bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
\r
59 bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
\r
60 bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;
\r
61 bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;
\r
62 bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
\r
64 IVideoDriver* getVideoDriver() override;
\r
68 COpenGL3MaterialRenderer(COpenGL3DriverBase* driver,
\r
69 IShaderConstantSetCallBack* callback = 0,
\r
70 E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
\r
73 void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, bool addMaterial = true);
\r
75 bool createShader(GLenum shaderType, const char* shader);
\r
78 COpenGL3DriverBase* Driver;
\r
79 IShaderConstantSetCallBack* CallBack;
\r
93 core::array<SUniformInfo> UniformInfo;
\r