diff options
author | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
commit | f9158592e1478b2013afc7041d9ed041cf2d2f4a (patch) | |
tree | b16e389d7988700e21b4c9741044cefa536dcbae /libraries/irrlicht-1.8.1/source/Irrlicht/COpenGLSLMaterialRenderer.h | |
parent | Libraries readme updated with change markers and more of the Irrlicht changes. (diff) | |
download | SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.zip SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.gz SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.bz2 SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.xz |
Update Irrlicht to 1.8.1. Include actual change markers this time. lol
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8.1/source/Irrlicht/COpenGLSLMaterialRenderer.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8.1/source/Irrlicht/COpenGLSLMaterialRenderer.h b/libraries/irrlicht-1.8.1/source/Irrlicht/COpenGLSLMaterialRenderer.h new file mode 100644 index 0000000..ff71150 --- /dev/null +++ b/libraries/irrlicht-1.8.1/source/Irrlicht/COpenGLSLMaterialRenderer.h | |||
@@ -0,0 +1,141 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __C_OPENGL_SHADER_LANGUAGE_MATERIAL_RENDERER_H_INCLUDED__ | ||
6 | #define __C_OPENGL_SHADER_LANGUAGE_MATERIAL_RENDERER_H_INCLUDED__ | ||
7 | |||
8 | #include "IrrCompileConfig.h" | ||
9 | #ifdef _IRR_COMPILE_WITH_OPENGL_ | ||
10 | |||
11 | #ifdef _IRR_WINDOWS_API_ | ||
12 | #define WIN32_LEAN_AND_MEAN | ||
13 | #include <windows.h> | ||
14 | #include <GL/gl.h> | ||
15 | #include "glext.h" | ||
16 | #else | ||
17 | #if defined(_IRR_OPENGL_USE_EXTPOINTER_) | ||
18 | #define GL_GLEXT_LEGACY 1 | ||
19 | #else | ||
20 | #define GL_GLEXT_PROTOTYPES 1 | ||
21 | #endif | ||
22 | #if defined(_IRR_OSX_PLATFORM_) | ||
23 | #include <OpenGL/gl.h> | ||
24 | #else | ||
25 | #include <GL/gl.h> | ||
26 | #endif | ||
27 | #if defined(_IRR_OPENGL_USE_EXTPOINTER_) | ||
28 | #include "glext.h" | ||
29 | #endif | ||
30 | #endif | ||
31 | |||
32 | |||
33 | #include "IMaterialRenderer.h" | ||
34 | #include "IMaterialRendererServices.h" | ||
35 | #include "IGPUProgrammingServices.h" | ||
36 | #include "irrArray.h" | ||
37 | #include "irrString.h" | ||
38 | |||
39 | namespace irr | ||
40 | { | ||
41 | namespace video | ||
42 | { | ||
43 | |||
44 | class COpenGLDriver; | ||
45 | class IShaderConstantSetCallBack; | ||
46 | |||
47 | //! Class for using GLSL shaders with OpenGL | ||
48 | //! Please note: This renderer implements its own IMaterialRendererServices | ||
49 | class COpenGLSLMaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices | ||
50 | { | ||
51 | public: | ||
52 | |||
53 | //! Constructor | ||
54 | COpenGLSLMaterialRenderer( | ||
55 | COpenGLDriver* driver, | ||
56 | s32& outMaterialTypeNr, | ||
57 | const c8* vertexShaderProgram = 0, | ||
58 | const c8* vertexShaderEntryPointName = 0, | ||
59 | E_VERTEX_SHADER_TYPE vsCompileTarget = video::EVST_VS_1_1, | ||
60 | const c8* pixelShaderProgram = 0, | ||
61 | const c8* pixelShaderEntryPointName = 0, | ||
62 | E_PIXEL_SHADER_TYPE psCompileTarget = video::EPST_PS_1_1, | ||
63 | const c8* geometryShaderProgram = 0, | ||
64 | const c8* geometryShaderEntryPointName = "main", | ||
65 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, | ||
66 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | ||
67 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | ||
68 | u32 verticesOut = 0, | ||
69 | IShaderConstantSetCallBack* callback = 0, | ||
70 | IMaterialRenderer* baseMaterial = 0, | ||
71 | s32 userData = 0); | ||
72 | |||
73 | //! Destructor | ||
74 | virtual ~COpenGLSLMaterialRenderer(); | ||
75 | |||
76 | virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, | ||
77 | bool resetAllRenderstates, IMaterialRendererServices* services); | ||
78 | |||
79 | virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); | ||
80 | |||
81 | virtual void OnUnsetMaterial(); | ||
82 | |||
83 | //! Returns if the material is transparent. | ||
84 | virtual bool isTransparent() const; | ||
85 | |||
86 | // implementations for the render services | ||
87 | virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates); | ||
88 | virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); | ||
89 | virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count); | ||
90 | virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); | ||
91 | virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); | ||
92 | virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); | ||
93 | virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count); | ||
94 | virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); | ||
95 | virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); | ||
96 | virtual IVideoDriver* getVideoDriver(); | ||
97 | |||
98 | protected: | ||
99 | |||
100 | //! constructor only for use by derived classes who want to | ||
101 | //! create a fall back material for example. | ||
102 | COpenGLSLMaterialRenderer(COpenGLDriver* driver, | ||
103 | IShaderConstantSetCallBack* callback, | ||
104 | IMaterialRenderer* baseMaterial, | ||
105 | s32 userData=0); | ||
106 | |||
107 | void init(s32& outMaterialTypeNr, | ||
108 | const c8* vertexShaderProgram, | ||
109 | const c8* pixelShaderProgram, | ||
110 | const c8* geometryShaderProgram, | ||
111 | scene::E_PRIMITIVE_TYPE inType=scene::EPT_TRIANGLES, | ||
112 | scene::E_PRIMITIVE_TYPE outType=scene::EPT_TRIANGLE_STRIP, | ||
113 | u32 verticesOut=0); | ||
114 | |||
115 | bool createProgram(); | ||
116 | bool createShader(GLenum shaderType, const char* shader); | ||
117 | bool linkProgram(); | ||
118 | |||
119 | COpenGLDriver* Driver; | ||
120 | IShaderConstantSetCallBack* CallBack; | ||
121 | IMaterialRenderer* BaseMaterial; | ||
122 | |||
123 | struct SUniformInfo | ||
124 | { | ||
125 | core::stringc name; | ||
126 | GLenum type; | ||
127 | }; | ||
128 | |||
129 | GLhandleARB Program; | ||
130 | GLuint Program2; | ||
131 | core::array<SUniformInfo> UniformInfo; | ||
132 | s32 UserData; | ||
133 | }; | ||
134 | |||
135 | |||
136 | } // end namespace video | ||
137 | } // end namespace irr | ||
138 | |||
139 | #endif // compile with OpenGL | ||
140 | #endif // if included | ||
141 | |||