diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/COpenGLCgMaterialRenderer.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/COpenGLCgMaterialRenderer.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/COpenGLCgMaterialRenderer.h b/libraries/irrlicht-1.8/source/Irrlicht/COpenGLCgMaterialRenderer.h new file mode 100644 index 0000000..74c43c5 --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/COpenGLCgMaterialRenderer.h | |||
@@ -0,0 +1,99 @@ | |||
1 | // Copyright (C) 2012-2012 Patryk Nadrowski | ||
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_CG_MATERIAL_RENDERER_H_INCLUDED__ | ||
6 | #define __C_OPENGL_CG_MATERIAL_RENDERER_H_INCLUDED__ | ||
7 | |||
8 | #include "IrrCompileConfig.h" | ||
9 | #if defined(_IRR_COMPILE_WITH_OPENGL_) && defined(_IRR_COMPILE_WITH_CG_) | ||
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 | #include "CCgMaterialRenderer.h" | ||
33 | #include "Cg/cgGL.h" | ||
34 | |||
35 | #ifdef _MSC_VER | ||
36 | #pragma comment(lib, "cgGL.lib") | ||
37 | #endif | ||
38 | |||
39 | namespace irr | ||
40 | { | ||
41 | namespace video | ||
42 | { | ||
43 | |||
44 | class COpenGLDriver; | ||
45 | class IShaderConstantSetCallBack; | ||
46 | |||
47 | class COpenGLCgUniformSampler2D : public CCgUniform | ||
48 | { | ||
49 | public: | ||
50 | COpenGLCgUniformSampler2D(const CGparameter& parameter, bool global); | ||
51 | |||
52 | void update(const void* data, const SMaterial& material) const; | ||
53 | }; | ||
54 | |||
55 | class COpenGLCgMaterialRenderer : public CCgMaterialRenderer | ||
56 | { | ||
57 | public: | ||
58 | COpenGLCgMaterialRenderer(COpenGLDriver* driver, s32& materialType, | ||
59 | const c8* vertexProgram = 0, const c8* vertexEntry = "main", | ||
60 | E_VERTEX_SHADER_TYPE vertexProfile = video::EVST_VS_1_1, | ||
61 | const c8* fragmentProgram = 0, const c8* fragmentEntry = "main", | ||
62 | E_PIXEL_SHADER_TYPE fragmentProfile = video::EPST_PS_1_1, | ||
63 | const c8* geometryProgram = 0, const c8* geometryEntry = "main", | ||
64 | E_GEOMETRY_SHADER_TYPE geometryProfile = video::EGST_GS_4_0, | ||
65 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | ||
66 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | ||
67 | u32 vertices = 0, IShaderConstantSetCallBack* callback = 0, | ||
68 | IMaterialRenderer* baseMaterial = 0, s32 userData = 0); | ||
69 | |||
70 | virtual ~COpenGLCgMaterialRenderer(); | ||
71 | |||
72 | virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services); | ||
73 | virtual bool OnRender(IMaterialRendererServices* services, E_VERTEX_TYPE vtxtype); | ||
74 | virtual void OnUnsetMaterial(); | ||
75 | |||
76 | virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates); | ||
77 | virtual IVideoDriver* getVideoDriver(); | ||
78 | |||
79 | protected: | ||
80 | void init(s32& materialType, | ||
81 | const c8* vertexProgram = 0, const c8* vertexEntry = "main", | ||
82 | E_VERTEX_SHADER_TYPE vertexProfile = video::EVST_VS_1_1, | ||
83 | const c8* fragmentProgram = 0, const c8* fragmentEntry = "main", | ||
84 | E_PIXEL_SHADER_TYPE fragmentProfile = video::EPST_PS_1_1, | ||
85 | const c8* geometryProgram = 0, const c8* geometryEntry = "main", | ||
86 | E_GEOMETRY_SHADER_TYPE geometryProfile = video::EGST_GS_4_0, | ||
87 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | ||
88 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | ||
89 | u32 vertices = 0); | ||
90 | |||
91 | COpenGLDriver* Driver; | ||
92 | }; | ||
93 | |||
94 | } | ||
95 | } | ||
96 | |||
97 | #endif | ||
98 | #endif | ||
99 | |||