aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/IGPUProgrammingServices.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/include/IGPUProgrammingServices.h')
-rw-r--r--libraries/irrlicht-1.8/include/IGPUProgrammingServices.h948
1 files changed, 474 insertions, 474 deletions
diff --git a/libraries/irrlicht-1.8/include/IGPUProgrammingServices.h b/libraries/irrlicht-1.8/include/IGPUProgrammingServices.h
index 596f094..28717d5 100644
--- a/libraries/irrlicht-1.8/include/IGPUProgrammingServices.h
+++ b/libraries/irrlicht-1.8/include/IGPUProgrammingServices.h
@@ -1,474 +1,474 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__ 5#ifndef __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
6#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__ 6#define __I_GPU_PROGRAMMING_SERVICES_H_INCLUDED__
7 7
8#include "EShaderTypes.h" 8#include "EShaderTypes.h"
9#include "EMaterialTypes.h" 9#include "EMaterialTypes.h"
10#include "EPrimitiveTypes.h" 10#include "EPrimitiveTypes.h"
11#include "path.h" 11#include "path.h"
12 12
13namespace irr 13namespace irr
14{ 14{
15 15
16namespace io 16namespace io
17{ 17{
18 class IReadFile; 18 class IReadFile;
19} // end namespace io 19} // end namespace io
20 20
21namespace video 21namespace video
22{ 22{
23 23
24class IVideoDriver; 24class IVideoDriver;
25class IShaderConstantSetCallBack; 25class IShaderConstantSetCallBack;
26 26
27//! Enumeration for different types of shading languages 27//! Enumeration for different types of shading languages
28enum E_GPU_SHADING_LANGUAGE 28enum E_GPU_SHADING_LANGUAGE
29{ 29{
30 //! The default language, so HLSL for Direct3D and GLSL for OpenGL. 30 //! The default language, so HLSL for Direct3D and GLSL for OpenGL.
31 EGSL_DEFAULT = 0, 31 EGSL_DEFAULT = 0,
32 32
33 //! Cg shading language.*/ 33 //! Cg shading language.*/
34 EGSL_CG 34 EGSL_CG
35}; 35};
36 36
37//! Interface making it possible to create and use programs running on the GPU. 37//! Interface making it possible to create and use programs running on the GPU.
38class IGPUProgrammingServices 38class IGPUProgrammingServices
39{ 39{
40public: 40public:
41 41
42 //! Destructor 42 //! Destructor
43 virtual ~IGPUProgrammingServices() {} 43 virtual ~IGPUProgrammingServices() {}
44 44
45 //! Adds a new high-level shading material renderer to the VideoDriver. 45 //! Adds a new high-level shading material renderer to the VideoDriver.
46 /** Currently only HLSL/D3D9 and GLSL/OpenGL are supported. 46 /** Currently only HLSL/D3D9 and GLSL/OpenGL are supported.
47 \param vertexShaderProgram String containing the source of the vertex 47 \param vertexShaderProgram String containing the source of the vertex
48 shader program. This can be 0 if no vertex program shall be used. 48 shader program. This can be 0 if no vertex program shall be used.
49 \param vertexShaderEntryPointName Name of the entry function of the 49 \param vertexShaderEntryPointName Name of the entry function of the
50 vertexShaderProgram (p.e. "main") 50 vertexShaderProgram (p.e. "main")
51 \param vsCompileTarget Vertex shader version the high level shader 51 \param vsCompileTarget Vertex shader version the high level shader
52 shall be compiled to. 52 shall be compiled to.
53 \param pixelShaderProgram String containing the source of the pixel 53 \param pixelShaderProgram String containing the source of the pixel
54 shader program. This can be 0 if no pixel shader shall be used. 54 shader program. This can be 0 if no pixel shader shall be used.
55 \param pixelShaderEntryPointName Entry name of the function of the 55 \param pixelShaderEntryPointName Entry name of the function of the
56 pixelShaderProgram (p.e. "main") 56 pixelShaderProgram (p.e. "main")
57 \param psCompileTarget Pixel shader version the high level shader 57 \param psCompileTarget Pixel shader version the high level shader
58 shall be compiled to. 58 shall be compiled to.
59 \param geometryShaderProgram String containing the source of the 59 \param geometryShaderProgram String containing the source of the
60 geometry shader program. This can be 0 if no geometry shader shall be 60 geometry shader program. This can be 0 if no geometry shader shall be
61 used. 61 used.
62 \param geometryShaderEntryPointName Entry name of the function of the 62 \param geometryShaderEntryPointName Entry name of the function of the
63 geometryShaderProgram (p.e. "main") 63 geometryShaderProgram (p.e. "main")
64 \param gsCompileTarget Geometry shader version the high level shader 64 \param gsCompileTarget Geometry shader version the high level shader
65 shall be compiled to. 65 shall be compiled to.
66 \param inType Type of vertices passed to geometry shader 66 \param inType Type of vertices passed to geometry shader
67 \param outType Type of vertices created by geometry shader 67 \param outType Type of vertices created by geometry shader
68 \param verticesOut Maximal number of vertices created by geometry 68 \param verticesOut Maximal number of vertices created by geometry
69 shader. If 0, maximal number supported is assumed. 69 shader. If 0, maximal number supported is assumed.
70 \param callback Pointer to an implementation of 70 \param callback Pointer to an implementation of
71 IShaderConstantSetCallBack in which you can set the needed vertex, 71 IShaderConstantSetCallBack in which you can set the needed vertex,
72 pixel, and geometry shader program constants. Set this to 0 if you 72 pixel, and geometry shader program constants. Set this to 0 if you
73 don't need this. 73 don't need this.
74 \param baseMaterial Base material which renderstates will be used to 74 \param baseMaterial Base material which renderstates will be used to
75 shade the material. 75 shade the material.
76 \param userData a user data int. This int can be set to any value and 76 \param userData a user data int. This int can be set to any value and
77 will be set as parameter in the callback method when calling 77 will be set as parameter in the callback method when calling
78 OnSetConstants(). In this way it is easily possible to use the same 78 OnSetConstants(). In this way it is easily possible to use the same
79 callback method for multiple materials and distinguish between them 79 callback method for multiple materials and distinguish between them
80 during the call. 80 during the call.
81 \param shaderLang a type of shading language used in current shader. 81 \param shaderLang a type of shading language used in current shader.
82 \return Number of the material type which can be set in 82 \return Number of the material type which can be set in
83 SMaterial::MaterialType to use the renderer. -1 is returned if an error 83 SMaterial::MaterialType to use the renderer. -1 is returned if an error
84 occured, e.g. if a shader program could not be compiled or a compile 84 occured, e.g. if a shader program could not be compiled or a compile
85 target is not reachable. The error strings are then printed to the 85 target is not reachable. The error strings are then printed to the
86 error log and can be catched with a custom event receiver. */ 86 error log and can be catched with a custom event receiver. */
87 virtual s32 addHighLevelShaderMaterial( 87 virtual s32 addHighLevelShaderMaterial(
88 const c8* vertexShaderProgram, 88 const c8* vertexShaderProgram,
89 const c8* vertexShaderEntryPointName, 89 const c8* vertexShaderEntryPointName,
90 E_VERTEX_SHADER_TYPE vsCompileTarget, 90 E_VERTEX_SHADER_TYPE vsCompileTarget,
91 const c8* pixelShaderProgram, 91 const c8* pixelShaderProgram,
92 const c8* pixelShaderEntryPointName, 92 const c8* pixelShaderEntryPointName,
93 E_PIXEL_SHADER_TYPE psCompileTarget, 93 E_PIXEL_SHADER_TYPE psCompileTarget,
94 const c8* geometryShaderProgram, 94 const c8* geometryShaderProgram,
95 const c8* geometryShaderEntryPointName = "main", 95 const c8* geometryShaderEntryPointName = "main",
96 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, 96 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
97 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, 97 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
98 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, 98 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
99 u32 verticesOut = 0, 99 u32 verticesOut = 0,
100 IShaderConstantSetCallBack* callback = 0, 100 IShaderConstantSetCallBack* callback = 0,
101 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 101 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
102 s32 userData = 0, 102 s32 userData = 0,
103 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0; 103 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
104 104
105 //! convenience function for use without geometry shaders 105 //! convenience function for use without geometry shaders
106 s32 addHighLevelShaderMaterial( 106 s32 addHighLevelShaderMaterial(
107 const c8* vertexShaderProgram, 107 const c8* vertexShaderProgram,
108 const c8* vertexShaderEntryPointName="main", 108 const c8* vertexShaderEntryPointName="main",
109 E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1, 109 E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1,
110 const c8* pixelShaderProgram=0, 110 const c8* pixelShaderProgram=0,
111 const c8* pixelShaderEntryPointName="main", 111 const c8* pixelShaderEntryPointName="main",
112 E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1, 112 E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1,
113 IShaderConstantSetCallBack* callback=0, 113 IShaderConstantSetCallBack* callback=0,
114 E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, 114 E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID,
115 s32 userData=0, 115 s32 userData=0,
116 E_GPU_SHADING_LANGUAGE shadingLang=EGSL_DEFAULT) 116 E_GPU_SHADING_LANGUAGE shadingLang=EGSL_DEFAULT)
117 { 117 {
118 return addHighLevelShaderMaterial( 118 return addHighLevelShaderMaterial(
119 vertexShaderProgram, vertexShaderEntryPointName, 119 vertexShaderProgram, vertexShaderEntryPointName,
120 vsCompileTarget, pixelShaderProgram, 120 vsCompileTarget, pixelShaderProgram,
121 pixelShaderEntryPointName, psCompileTarget, 121 pixelShaderEntryPointName, psCompileTarget,
122 0, "main", EGST_GS_4_0, 122 0, "main", EGST_GS_4_0,
123 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, 123 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
124 callback, baseMaterial, userData, shadingLang); 124 callback, baseMaterial, userData, shadingLang);
125 } 125 }
126 126
127 //! convenience function for use with many defaults, without geometry shader 127 //! convenience function for use with many defaults, without geometry shader
128 /** All shader names are set to "main" and compile targets are shader 128 /** All shader names are set to "main" and compile targets are shader
129 type 1.1. 129 type 1.1.
130 */ 130 */
131 s32 addHighLevelShaderMaterial( 131 s32 addHighLevelShaderMaterial(
132 const c8* vertexShaderProgram, 132 const c8* vertexShaderProgram,
133 const c8* pixelShaderProgram=0, 133 const c8* pixelShaderProgram=0,
134 IShaderConstantSetCallBack* callback=0, 134 IShaderConstantSetCallBack* callback=0,
135 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 135 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
136 s32 userData=0) 136 s32 userData=0)
137 { 137 {
138 return addHighLevelShaderMaterial( 138 return addHighLevelShaderMaterial(
139 vertexShaderProgram, "main", 139 vertexShaderProgram, "main",
140 EVST_VS_1_1, pixelShaderProgram, 140 EVST_VS_1_1, pixelShaderProgram,
141 "main", EPST_PS_1_1, 141 "main", EPST_PS_1_1,
142 0, "main", EGST_GS_4_0, 142 0, "main", EGST_GS_4_0,
143 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, 143 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
144 callback, baseMaterial, userData); 144 callback, baseMaterial, userData);
145 } 145 }
146 146
147 //! convenience function for use with many defaults, with geometry shader 147 //! convenience function for use with many defaults, with geometry shader
148 /** All shader names are set to "main" and compile targets are shader 148 /** All shader names are set to "main" and compile targets are shader
149 type 1.1 and geometry shader 4.0. 149 type 1.1 and geometry shader 4.0.
150 */ 150 */
151 s32 addHighLevelShaderMaterial( 151 s32 addHighLevelShaderMaterial(
152 const c8* vertexShaderProgram, 152 const c8* vertexShaderProgram,
153 const c8* pixelShaderProgram = 0, 153 const c8* pixelShaderProgram = 0,
154 const c8* geometryShaderProgram = 0, 154 const c8* geometryShaderProgram = 0,
155 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, 155 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
156 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, 156 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
157 u32 verticesOut = 0, 157 u32 verticesOut = 0,
158 IShaderConstantSetCallBack* callback = 0, 158 IShaderConstantSetCallBack* callback = 0,
159 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 159 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
160 s32 userData = 0 ) 160 s32 userData = 0 )
161 { 161 {
162 return addHighLevelShaderMaterial( 162 return addHighLevelShaderMaterial(
163 vertexShaderProgram, "main", 163 vertexShaderProgram, "main",
164 EVST_VS_1_1, pixelShaderProgram, 164 EVST_VS_1_1, pixelShaderProgram,
165 "main", EPST_PS_1_1, 165 "main", EPST_PS_1_1,
166 geometryShaderProgram, "main", EGST_GS_4_0, 166 geometryShaderProgram, "main", EGST_GS_4_0,
167 inType, outType, verticesOut, 167 inType, outType, verticesOut,
168 callback, baseMaterial, userData); 168 callback, baseMaterial, userData);
169 } 169 }
170 170
171 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. 171 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
172 /** \param vertexShaderProgramFileName Text file containing the source 172 /** \param vertexShaderProgramFileName Text file containing the source
173 of the vertex shader program. Set to empty string if no vertex shader 173 of the vertex shader program. Set to empty string if no vertex shader
174 shall be created. 174 shall be created.
175 \param vertexShaderEntryPointName Name of the entry function of the 175 \param vertexShaderEntryPointName Name of the entry function of the
176 vertexShaderProgram (p.e. "main") 176 vertexShaderProgram (p.e. "main")
177 \param vsCompileTarget Vertex shader version the high level shader 177 \param vsCompileTarget Vertex shader version the high level shader
178 shall be compiled to. 178 shall be compiled to.
179 \param pixelShaderProgramFileName Text file containing the source of 179 \param pixelShaderProgramFileName Text file containing the source of
180 the pixel shader program. Set to empty string if no pixel shader shall 180 the pixel shader program. Set to empty string if no pixel shader shall
181 be created. 181 be created.
182 \param pixelShaderEntryPointName Entry name of the function of the 182 \param pixelShaderEntryPointName Entry name of the function of the
183 pixelShaderProgram (p.e. "main") 183 pixelShaderProgram (p.e. "main")
184 \param psCompileTarget Pixel shader version the high level shader 184 \param psCompileTarget Pixel shader version the high level shader
185 shall be compiled to. 185 shall be compiled to.
186 \param geometryShaderProgramFileName Name of the source of 186 \param geometryShaderProgramFileName Name of the source of
187 the geometry shader program. Set to empty string if no geometry shader 187 the geometry shader program. Set to empty string if no geometry shader
188 shall be created. 188 shall be created.
189 \param geometryShaderEntryPointName Entry name of the function of the 189 \param geometryShaderEntryPointName Entry name of the function of the
190 geometryShaderProgram (p.e. "main") 190 geometryShaderProgram (p.e. "main")
191 \param gsCompileTarget Geometry shader version the high level shader 191 \param gsCompileTarget Geometry shader version the high level shader
192 shall be compiled to. 192 shall be compiled to.
193 \param inType Type of vertices passed to geometry shader 193 \param inType Type of vertices passed to geometry shader
194 \param outType Type of vertices created by geometry shader 194 \param outType Type of vertices created by geometry shader
195 \param verticesOut Maximal number of vertices created by geometry 195 \param verticesOut Maximal number of vertices created by geometry
196 shader. If 0, maximal number supported is assumed. 196 shader. If 0, maximal number supported is assumed.
197 \param callback Pointer to an implementation of 197 \param callback Pointer to an implementation of
198 IShaderConstantSetCallBack in which you can set the needed vertex, 198 IShaderConstantSetCallBack in which you can set the needed vertex,
199 pixel, and geometry shader program constants. Set this to 0 if you 199 pixel, and geometry shader program constants. Set this to 0 if you
200 don't need this. 200 don't need this.
201 \param baseMaterial Base material which renderstates will be used to 201 \param baseMaterial Base material which renderstates will be used to
202 shade the material. 202 shade the material.
203 \param userData a user data int. This int can be set to any value and 203 \param userData a user data int. This int can be set to any value and
204 will be set as parameter in the callback method when calling 204 will be set as parameter in the callback method when calling
205 OnSetConstants(). In this way it is easily possible to use the same 205 OnSetConstants(). In this way it is easily possible to use the same
206 callback method for multiple materials and distinguish between them 206 callback method for multiple materials and distinguish between them
207 during the call. 207 during the call.
208 \param shaderLang a type of shading language used in current shader. 208 \param shaderLang a type of shading language used in current shader.
209 \return Number of the material type which can be set in 209 \return Number of the material type which can be set in
210 SMaterial::MaterialType to use the renderer. -1 is returned if an error 210 SMaterial::MaterialType to use the renderer. -1 is returned if an error
211 occured, e.g. if a shader program could not be compiled or a compile 211 occured, e.g. if a shader program could not be compiled or a compile
212 target is not reachable. The error strings are then printed to the 212 target is not reachable. The error strings are then printed to the
213 error log and can be catched with a custom event receiver. */ 213 error log and can be catched with a custom event receiver. */
214 virtual s32 addHighLevelShaderMaterialFromFiles( 214 virtual s32 addHighLevelShaderMaterialFromFiles(
215 const io::path& vertexShaderProgramFileName, 215 const io::path& vertexShaderProgramFileName,
216 const c8* vertexShaderEntryPointName, 216 const c8* vertexShaderEntryPointName,
217 E_VERTEX_SHADER_TYPE vsCompileTarget, 217 E_VERTEX_SHADER_TYPE vsCompileTarget,
218 const io::path& pixelShaderProgramFileName, 218 const io::path& pixelShaderProgramFileName,
219 const c8* pixelShaderEntryPointName, 219 const c8* pixelShaderEntryPointName,
220 E_PIXEL_SHADER_TYPE psCompileTarget, 220 E_PIXEL_SHADER_TYPE psCompileTarget,
221 const io::path& geometryShaderProgramFileName, 221 const io::path& geometryShaderProgramFileName,
222 const c8* geometryShaderEntryPointName = "main", 222 const c8* geometryShaderEntryPointName = "main",
223 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, 223 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
224 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, 224 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
225 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, 225 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
226 u32 verticesOut = 0, 226 u32 verticesOut = 0,
227 IShaderConstantSetCallBack* callback = 0, 227 IShaderConstantSetCallBack* callback = 0,
228 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 228 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
229 s32 userData = 0, 229 s32 userData = 0,
230 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0; 230 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
231 231
232 //! convenience function for use without geometry shaders 232 //! convenience function for use without geometry shaders
233 s32 addHighLevelShaderMaterialFromFiles( 233 s32 addHighLevelShaderMaterialFromFiles(
234 const io::path& vertexShaderProgramFileName, 234 const io::path& vertexShaderProgramFileName,
235 const c8* vertexShaderEntryPointName = "main", 235 const c8* vertexShaderEntryPointName = "main",
236 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, 236 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
237 const io::path& pixelShaderProgramFileName = "", 237 const io::path& pixelShaderProgramFileName = "",
238 const c8* pixelShaderEntryPointName = "main", 238 const c8* pixelShaderEntryPointName = "main",
239 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, 239 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
240 IShaderConstantSetCallBack* callback = 0, 240 IShaderConstantSetCallBack* callback = 0,
241 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 241 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
242 s32 userData = 0, 242 s32 userData = 0,
243 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) 243 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
244 { 244 {
245 return addHighLevelShaderMaterialFromFiles( 245 return addHighLevelShaderMaterialFromFiles(
246 vertexShaderProgramFileName, vertexShaderEntryPointName, 246 vertexShaderProgramFileName, vertexShaderEntryPointName,
247 vsCompileTarget, pixelShaderProgramFileName, 247 vsCompileTarget, pixelShaderProgramFileName,
248 pixelShaderEntryPointName, psCompileTarget, 248 pixelShaderEntryPointName, psCompileTarget,
249 "", "main", EGST_GS_4_0, 249 "", "main", EGST_GS_4_0,
250 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, 250 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
251 callback, baseMaterial, userData, shadingLang); 251 callback, baseMaterial, userData, shadingLang);
252 } 252 }
253 253
254 //! convenience function for use with many defaults, without geometry shader 254 //! convenience function for use with many defaults, without geometry shader
255 /** All shader names are set to "main" and compile targets are shader 255 /** All shader names are set to "main" and compile targets are shader
256 type 1.1. 256 type 1.1.
257 */ 257 */
258 s32 addHighLevelShaderMaterialFromFiles( 258 s32 addHighLevelShaderMaterialFromFiles(
259 const io::path& vertexShaderProgramFileName, 259 const io::path& vertexShaderProgramFileName,
260 const io::path& pixelShaderProgramFileName = "", 260 const io::path& pixelShaderProgramFileName = "",
261 IShaderConstantSetCallBack* callback = 0, 261 IShaderConstantSetCallBack* callback = 0,
262 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 262 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
263 s32 userData = 0 ) 263 s32 userData = 0 )
264 { 264 {
265 return addHighLevelShaderMaterialFromFiles( 265 return addHighLevelShaderMaterialFromFiles(
266 vertexShaderProgramFileName, "main", 266 vertexShaderProgramFileName, "main",
267 EVST_VS_1_1, pixelShaderProgramFileName, 267 EVST_VS_1_1, pixelShaderProgramFileName,
268 "main", EPST_PS_1_1, 268 "main", EPST_PS_1_1,
269 "", "main", EGST_GS_4_0, 269 "", "main", EGST_GS_4_0,
270 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, 270 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
271 callback, baseMaterial, userData); 271 callback, baseMaterial, userData);
272 } 272 }
273 273
274 //! convenience function for use with many defaults, with geometry shader 274 //! convenience function for use with many defaults, with geometry shader
275 /** All shader names are set to "main" and compile targets are shader 275 /** All shader names are set to "main" and compile targets are shader
276 type 1.1 and geometry shader 4.0. 276 type 1.1 and geometry shader 4.0.
277 */ 277 */
278 s32 addHighLevelShaderMaterialFromFiles( 278 s32 addHighLevelShaderMaterialFromFiles(
279 const io::path& vertexShaderProgramFileName, 279 const io::path& vertexShaderProgramFileName,
280 const io::path& pixelShaderProgramFileName = "", 280 const io::path& pixelShaderProgramFileName = "",
281 const io::path& geometryShaderProgramFileName = "", 281 const io::path& geometryShaderProgramFileName = "",
282 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, 282 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
283 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, 283 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
284 u32 verticesOut = 0, 284 u32 verticesOut = 0,
285 IShaderConstantSetCallBack* callback = 0, 285 IShaderConstantSetCallBack* callback = 0,
286 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 286 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
287 s32 userData = 0 ) 287 s32 userData = 0 )
288 { 288 {
289 return addHighLevelShaderMaterialFromFiles( 289 return addHighLevelShaderMaterialFromFiles(
290 vertexShaderProgramFileName, "main", 290 vertexShaderProgramFileName, "main",
291 EVST_VS_1_1, pixelShaderProgramFileName, 291 EVST_VS_1_1, pixelShaderProgramFileName,
292 "main", EPST_PS_1_1, 292 "main", EPST_PS_1_1,
293 geometryShaderProgramFileName, "main", EGST_GS_4_0, 293 geometryShaderProgramFileName, "main", EGST_GS_4_0,
294 inType, outType, verticesOut, 294 inType, outType, verticesOut,
295 callback, baseMaterial, userData); 295 callback, baseMaterial, userData);
296 } 296 }
297 297
298 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. 298 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
299 /** \param vertexShaderProgram Text file handle containing the source 299 /** \param vertexShaderProgram Text file handle containing the source
300 of the vertex shader program. Set to 0 if no vertex shader shall be 300 of the vertex shader program. Set to 0 if no vertex shader shall be
301 created. 301 created.
302 \param vertexShaderEntryPointName Name of the entry function of the 302 \param vertexShaderEntryPointName Name of the entry function of the
303 vertexShaderProgram 303 vertexShaderProgram
304 \param vsCompileTarget Vertex shader version the high level shader 304 \param vsCompileTarget Vertex shader version the high level shader
305 shall be compiled to. 305 shall be compiled to.
306 \param pixelShaderProgram Text file handle containing the source of 306 \param pixelShaderProgram Text file handle containing the source of
307 the pixel shader program. Set to 0 if no pixel shader shall be created. 307 the pixel shader program. Set to 0 if no pixel shader shall be created.
308 \param pixelShaderEntryPointName Entry name of the function of the 308 \param pixelShaderEntryPointName Entry name of the function of the
309 pixelShaderProgram (p.e. "main") 309 pixelShaderProgram (p.e. "main")
310 \param psCompileTarget Pixel shader version the high level shader 310 \param psCompileTarget Pixel shader version the high level shader
311 shall be compiled to. 311 shall be compiled to.
312 \param geometryShaderProgram Text file handle containing the source of 312 \param geometryShaderProgram Text file handle containing the source of
313 the geometry shader program. Set to 0 if no geometry shader shall be 313 the geometry shader program. Set to 0 if no geometry shader shall be
314 created. 314 created.
315 \param geometryShaderEntryPointName Entry name of the function of the 315 \param geometryShaderEntryPointName Entry name of the function of the
316 geometryShaderProgram (p.e. "main") 316 geometryShaderProgram (p.e. "main")
317 \param gsCompileTarget Geometry shader version the high level shader 317 \param gsCompileTarget Geometry shader version the high level shader
318 shall be compiled to. 318 shall be compiled to.
319 \param inType Type of vertices passed to geometry shader 319 \param inType Type of vertices passed to geometry shader
320 \param outType Type of vertices created by geometry shader 320 \param outType Type of vertices created by geometry shader
321 \param verticesOut Maximal number of vertices created by geometry 321 \param verticesOut Maximal number of vertices created by geometry
322 shader. If 0, maximal number supported is assumed. 322 shader. If 0, maximal number supported is assumed.
323 \param callback Pointer to an implementation of 323 \param callback Pointer to an implementation of
324 IShaderConstantSetCallBack in which you can set the needed vertex and 324 IShaderConstantSetCallBack in which you can set the needed vertex and
325 pixel shader program constants. Set this to 0 if you don't need this. 325 pixel shader program constants. Set this to 0 if you don't need this.
326 \param baseMaterial Base material which renderstates will be used to 326 \param baseMaterial Base material which renderstates will be used to
327 shade the material. 327 shade the material.
328 \param userData a user data int. This int can be set to any value and 328 \param userData a user data int. This int can be set to any value and
329 will be set as parameter in the callback method when calling 329 will be set as parameter in the callback method when calling
330 OnSetConstants(). In this way it is easily possible to use the same 330 OnSetConstants(). In this way it is easily possible to use the same
331 callback method for multiple materials and distinguish between them 331 callback method for multiple materials and distinguish between them
332 during the call. 332 during the call.
333 \param shaderLang a type of shading language used in current shader. 333 \param shaderLang a type of shading language used in current shader.
334 \return Number of the material type which can be set in 334 \return Number of the material type which can be set in
335 SMaterial::MaterialType to use the renderer. -1 is returned if an 335 SMaterial::MaterialType to use the renderer. -1 is returned if an
336 error occured, e.g. if a shader program could not be compiled or a 336 error occured, e.g. if a shader program could not be compiled or a
337 compile target is not reachable. The error strings are then printed to 337 compile target is not reachable. The error strings are then printed to
338 the error log and can be catched with a custom event receiver. */ 338 the error log and can be catched with a custom event receiver. */
339 virtual s32 addHighLevelShaderMaterialFromFiles( 339 virtual s32 addHighLevelShaderMaterialFromFiles(
340 io::IReadFile* vertexShaderProgram, 340 io::IReadFile* vertexShaderProgram,
341 const c8* vertexShaderEntryPointName, 341 const c8* vertexShaderEntryPointName,
342 E_VERTEX_SHADER_TYPE vsCompileTarget, 342 E_VERTEX_SHADER_TYPE vsCompileTarget,
343 io::IReadFile* pixelShaderProgram, 343 io::IReadFile* pixelShaderProgram,
344 const c8* pixelShaderEntryPointName, 344 const c8* pixelShaderEntryPointName,
345 E_PIXEL_SHADER_TYPE psCompileTarget, 345 E_PIXEL_SHADER_TYPE psCompileTarget,
346 io::IReadFile* geometryShaderProgram, 346 io::IReadFile* geometryShaderProgram,
347 const c8* geometryShaderEntryPointName = "main", 347 const c8* geometryShaderEntryPointName = "main",
348 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, 348 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
349 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, 349 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
350 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, 350 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
351 u32 verticesOut = 0, 351 u32 verticesOut = 0,
352 IShaderConstantSetCallBack* callback = 0, 352 IShaderConstantSetCallBack* callback = 0,
353 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 353 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
354 s32 userData = 0, 354 s32 userData = 0,
355 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0; 355 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) = 0;
356 356
357 //! convenience function for use without geometry shaders 357 //! convenience function for use without geometry shaders
358 s32 addHighLevelShaderMaterialFromFiles( 358 s32 addHighLevelShaderMaterialFromFiles(
359 io::IReadFile* vertexShaderProgram, 359 io::IReadFile* vertexShaderProgram,
360 const c8* vertexShaderEntryPointName = "main", 360 const c8* vertexShaderEntryPointName = "main",
361 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, 361 E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
362 io::IReadFile* pixelShaderProgram = 0, 362 io::IReadFile* pixelShaderProgram = 0,
363 const c8* pixelShaderEntryPointName = "main", 363 const c8* pixelShaderEntryPointName = "main",
364 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, 364 E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
365 IShaderConstantSetCallBack* callback = 0, 365 IShaderConstantSetCallBack* callback = 0,
366 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 366 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
367 s32 userData = 0, 367 s32 userData = 0,
368 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT) 368 E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT)
369 { 369 {
370 return addHighLevelShaderMaterialFromFiles( 370 return addHighLevelShaderMaterialFromFiles(
371 vertexShaderProgram, vertexShaderEntryPointName, 371 vertexShaderProgram, vertexShaderEntryPointName,
372 vsCompileTarget, pixelShaderProgram, 372 vsCompileTarget, pixelShaderProgram,
373 pixelShaderEntryPointName, psCompileTarget, 373 pixelShaderEntryPointName, psCompileTarget,
374 0, "main", EGST_GS_4_0, 374 0, "main", EGST_GS_4_0,
375 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, 375 scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0,
376 callback, baseMaterial, userData, shadingLang); 376 callback, baseMaterial, userData, shadingLang);
377 } 377 }
378 378
379 //! Adds a new ASM shader material renderer to the VideoDriver 379 //! Adds a new ASM shader material renderer to the VideoDriver
380 /** Note that it is a good idea to call IVideoDriver::queryFeature() in 380 /** Note that it is a good idea to call IVideoDriver::queryFeature() in
381 advance to check if the IVideoDriver supports the vertex and/or pixel 381 advance to check if the IVideoDriver supports the vertex and/or pixel
382 shader version your are using. 382 shader version your are using.
383 383
384 The material is added to the VideoDriver like with 384 The material is added to the VideoDriver like with
385 IVideoDriver::addMaterialRenderer() and can be used like it had been 385 IVideoDriver::addMaterialRenderer() and can be used like it had been
386 added with that method. 386 added with that method.
387 \param vertexShaderProgram String containing the source of the vertex 387 \param vertexShaderProgram String containing the source of the vertex
388 shader program. This can be 0 if no vertex program shall be used. 388 shader program. This can be 0 if no vertex program shall be used.
389 389
390 For DX8 programs, the will always input registers look like this: v0: 390 For DX8 programs, the will always input registers look like this: v0:
391 position, v1: normal, v2: color, v3: texture cooridnates, v4: texture 391 position, v1: normal, v2: color, v3: texture cooridnates, v4: texture
392 coordinates 2 if available. 392 coordinates 2 if available.
393 393
394 For DX9 programs, you can manually set the registers using the dcl_ 394 For DX9 programs, you can manually set the registers using the dcl_
395 statements. 395 statements.
396 \param pixelShaderProgram String containing the source of the pixel 396 \param pixelShaderProgram String containing the source of the pixel
397 shader program. This can be 0 if you don't want to use a pixel shader. 397 shader program. This can be 0 if you don't want to use a pixel shader.
398 \param callback Pointer to an implementation of 398 \param callback Pointer to an implementation of
399 IShaderConstantSetCallBack in which you can set the needed vertex and 399 IShaderConstantSetCallBack in which you can set the needed vertex and
400 pixel shader program constants. Set this to 0 if you don't need this. 400 pixel shader program constants. Set this to 0 if you don't need this.
401 \param baseMaterial Base material which renderstates will be used to 401 \param baseMaterial Base material which renderstates will be used to
402 shade the material. 402 shade the material.
403 \param userData a user data int. This int can be set to any value and 403 \param userData a user data int. This int can be set to any value and
404 will be set as parameter in the callback method when calling 404 will be set as parameter in the callback method when calling
405 OnSetConstants(). In this way it is easily possible to use the same 405 OnSetConstants(). In this way it is easily possible to use the same
406 callback method for multiple materials and distinguish between them 406 callback method for multiple materials and distinguish between them
407 during the call. 407 during the call.
408 \return Returns the number of the material type which can be set in 408 \return Returns the number of the material type which can be set in
409 SMaterial::MaterialType to use the renderer. -1 is returned if an 409 SMaterial::MaterialType to use the renderer. -1 is returned if an
410 error occured. -1 is returned for example if a vertex or pixel shader 410 error occured. -1 is returned for example if a vertex or pixel shader
411 program could not be compiled, the error strings are then printed out 411 program could not be compiled, the error strings are then printed out
412 into the error log, and can be catched with a custom event receiver. */ 412 into the error log, and can be catched with a custom event receiver. */
413 virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0, 413 virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
414 const c8* pixelShaderProgram = 0, 414 const c8* pixelShaderProgram = 0,
415 IShaderConstantSetCallBack* callback = 0, 415 IShaderConstantSetCallBack* callback = 0,
416 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 416 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
417 s32 userData = 0) = 0; 417 s32 userData = 0) = 0;
418 418
419 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. 419 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
420 /** \param vertexShaderProgram Text file containing the source of the 420 /** \param vertexShaderProgram Text file containing the source of the
421 vertex shader program. Set to 0 if no shader shall be created. 421 vertex shader program. Set to 0 if no shader shall be created.
422 \param pixelShaderProgram Text file containing the source of the pixel 422 \param pixelShaderProgram Text file containing the source of the pixel
423 shader program. Set to 0 if no shader shall be created. 423 shader program. Set to 0 if no shader shall be created.
424 \param callback Pointer to an IShaderConstantSetCallback object to 424 \param callback Pointer to an IShaderConstantSetCallback object to
425 which the OnSetConstants function is called. 425 which the OnSetConstants function is called.
426 \param baseMaterial baseMaterial 426 \param baseMaterial baseMaterial
427 \param userData a user data int. This int can be set to any value and 427 \param userData a user data int. This int can be set to any value and
428 will be set as parameter in the callback method when calling 428 will be set as parameter in the callback method when calling
429 OnSetConstants(). In this way it is easily possible to use the same 429 OnSetConstants(). In this way it is easily possible to use the same
430 callback method for multiple materials and distinguish between them 430 callback method for multiple materials and distinguish between them
431 during the call. 431 during the call.
432 \return Returns the number of the material type which can be set in 432 \return Returns the number of the material type which can be set in
433 SMaterial::MaterialType to use the renderer. -1 is returned if an 433 SMaterial::MaterialType to use the renderer. -1 is returned if an
434 error occured. -1 is returned for example if a vertex or pixel shader 434 error occured. -1 is returned for example if a vertex or pixel shader
435 program could not be compiled, the error strings are then printed out 435 program could not be compiled, the error strings are then printed out
436 into the error log, and can be catched with a custom event receiver. */ 436 into the error log, and can be catched with a custom event receiver. */
437 virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, 437 virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
438 io::IReadFile* pixelShaderProgram, 438 io::IReadFile* pixelShaderProgram,
439 IShaderConstantSetCallBack* callback = 0, 439 IShaderConstantSetCallBack* callback = 0,
440 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 440 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
441 s32 userData = 0) = 0; 441 s32 userData = 0) = 0;
442 442
443 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files. 443 //! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
444 /** \param vertexShaderProgramFileName Text file name containing the 444 /** \param vertexShaderProgramFileName Text file name containing the
445 source of the vertex shader program. Set to 0 if no shader shall be 445 source of the vertex shader program. Set to 0 if no shader shall be
446 created. 446 created.
447 \param pixelShaderProgramFileName Text file name containing the source 447 \param pixelShaderProgramFileName Text file name containing the source
448 of the pixel shader program. Set to 0 if no shader shall be created. 448 of the pixel shader program. Set to 0 if no shader shall be created.
449 \param callback Pointer to an IShaderConstantSetCallback object on 449 \param callback Pointer to an IShaderConstantSetCallback object on
450 which the OnSetConstants function is called. 450 which the OnSetConstants function is called.
451 \param baseMaterial baseMaterial 451 \param baseMaterial baseMaterial
452 \param userData a user data int. This int can be set to any value and 452 \param userData a user data int. This int can be set to any value and
453 will be set as parameter in the callback method when calling 453 will be set as parameter in the callback method when calling
454 OnSetConstants(). In this way it is easily possible to use the same 454 OnSetConstants(). In this way it is easily possible to use the same
455 callback method for multiple materials and distinguish between them 455 callback method for multiple materials and distinguish between them
456 during the call. 456 during the call.
457 \return Returns the number of the material type which can be set in 457 \return Returns the number of the material type which can be set in
458 SMaterial::MaterialType to use the renderer. -1 is returned if an 458 SMaterial::MaterialType to use the renderer. -1 is returned if an
459 error occured. -1 is returned for example if a vertex or pixel shader 459 error occured. -1 is returned for example if a vertex or pixel shader
460 program could not be compiled, the error strings are then printed out 460 program could not be compiled, the error strings are then printed out
461 into the error log, and can be catched with a custom event receiver. */ 461 into the error log, and can be catched with a custom event receiver. */
462 virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName, 462 virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
463 const io::path& pixelShaderProgramFileName, 463 const io::path& pixelShaderProgramFileName,
464 IShaderConstantSetCallBack* callback = 0, 464 IShaderConstantSetCallBack* callback = 0,
465 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, 465 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
466 s32 userData = 0) = 0; 466 s32 userData = 0) = 0;
467}; 467};
468 468
469 469
470} // end namespace video 470} // end namespace video
471} // end namespace irr 471} // end namespace irr
472 472
473#endif 473#endif
474 474