]> git.lizzy.rs Git - irrlicht.git/blob - include/IVideoDriver.h
Prepare GUI for IME support
[irrlicht.git] / include / IVideoDriver.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\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
4 \r
5 #ifndef __IRR_I_VIDEO_DRIVER_H_INCLUDED__\r
6 #define __IRR_I_VIDEO_DRIVER_H_INCLUDED__\r
7 \r
8 #include "rect.h"\r
9 #include "SColor.h"\r
10 #include "ITexture.h"\r
11 #include "irrArray.h"\r
12 #include "matrix4.h"\r
13 #include "plane3d.h"\r
14 #include "dimension2d.h"\r
15 #include "position2d.h"\r
16 #include "IMeshBuffer.h"\r
17 #include "triangle3d.h"\r
18 #include "EDriverTypes.h"\r
19 #include "EDriverFeatures.h"\r
20 #include "SExposedVideoData.h"\r
21 #include "SOverrideMaterial.h"\r
22 \r
23 namespace irr\r
24 {\r
25 namespace io\r
26 {\r
27         class IAttributes;\r
28         struct SAttributeReadWriteOptions;\r
29         class IReadFile;\r
30         class IWriteFile;\r
31 } // end namespace io\r
32 namespace scene\r
33 {\r
34         class IMeshBuffer;\r
35         class IMesh;\r
36         class IMeshManipulator;\r
37         class ISceneNode;\r
38 } // end namespace scene\r
39 \r
40 namespace video\r
41 {\r
42         struct S3DVertex;\r
43         struct S3DVertex2TCoords;\r
44         struct S3DVertexTangents;\r
45         struct SLight;\r
46         class IImageLoader;\r
47         class IImageWriter;\r
48         class IMaterialRenderer;\r
49         class IGPUProgrammingServices;\r
50         class IRenderTarget;\r
51 \r
52         //! enumeration for geometry transformation states\r
53         enum E_TRANSFORMATION_STATE\r
54         {\r
55                 //! View transformation\r
56                 ETS_VIEW = 0,\r
57                 //! World transformation\r
58                 ETS_WORLD,\r
59                 //! Projection transformation\r
60                 ETS_PROJECTION,\r
61                 //! Texture transformation\r
62                 ETS_TEXTURE_0,\r
63                 //! Texture transformation\r
64                 ETS_TEXTURE_1,\r
65                 //! Texture transformation\r
66                 ETS_TEXTURE_2,\r
67                 //! Texture transformation\r
68                 ETS_TEXTURE_3,\r
69 #if _IRR_MATERIAL_MAX_TEXTURES_>4\r
70                 //! Texture transformation\r
71                 ETS_TEXTURE_4,\r
72 #if _IRR_MATERIAL_MAX_TEXTURES_>5\r
73                 //! Texture transformation\r
74                 ETS_TEXTURE_5,\r
75 #if _IRR_MATERIAL_MAX_TEXTURES_>6\r
76                 //! Texture transformation\r
77                 ETS_TEXTURE_6,\r
78 #if _IRR_MATERIAL_MAX_TEXTURES_>7\r
79                 //! Texture transformation\r
80                 ETS_TEXTURE_7,\r
81 #endif\r
82 #endif\r
83 #endif\r
84 #endif\r
85                 //! Only used internally\r
86                 ETS_COUNT = ETS_TEXTURE_0 + _IRR_MATERIAL_MAX_TEXTURES_\r
87         };\r
88 \r
89         //! Special render targets, which usually map to dedicated hardware\r
90         /** These render targets (besides 0 and 1) need not be supported by gfx cards */\r
91         enum E_RENDER_TARGET\r
92         {\r
93                 //! Render target is the main color frame buffer\r
94                 ERT_FRAME_BUFFER=0,\r
95                 //! Render target is a render texture\r
96                 ERT_RENDER_TEXTURE,\r
97                 //! Multi-Render target textures\r
98                 ERT_MULTI_RENDER_TEXTURES,\r
99                 //! Render target is the main color frame buffer\r
100                 ERT_STEREO_LEFT_BUFFER,\r
101                 //! Render target is the right color buffer (left is the main buffer)\r
102                 ERT_STEREO_RIGHT_BUFFER,\r
103                 //! Render to both stereo buffers at once\r
104                 ERT_STEREO_BOTH_BUFFERS,\r
105                 //! Auxiliary buffer 0\r
106                 ERT_AUX_BUFFER0,\r
107                 //! Auxiliary buffer 1\r
108                 ERT_AUX_BUFFER1,\r
109                 //! Auxiliary buffer 2\r
110                 ERT_AUX_BUFFER2,\r
111                 //! Auxiliary buffer 3\r
112                 ERT_AUX_BUFFER3,\r
113                 //! Auxiliary buffer 4\r
114                 ERT_AUX_BUFFER4\r
115         };\r
116 \r
117         //! Enum for the flags of clear buffer\r
118         enum E_CLEAR_BUFFER_FLAG\r
119         {\r
120                 ECBF_NONE = 0,\r
121                 ECBF_COLOR = 1,\r
122                 ECBF_DEPTH = 2,\r
123                 ECBF_STENCIL = 4,\r
124                 ECBF_ALL = ECBF_COLOR|ECBF_DEPTH|ECBF_STENCIL\r
125         };\r
126 \r
127         //! Enum for the types of fog distributions to choose from\r
128         enum E_FOG_TYPE\r
129         {\r
130                 EFT_FOG_EXP=0,\r
131                 EFT_FOG_LINEAR,\r
132                 EFT_FOG_EXP2\r
133         };\r
134 \r
135         const c8* const FogTypeNames[] =\r
136         {\r
137                 "FogExp",\r
138                 "FogLinear",\r
139                 "FogExp2",\r
140                 0\r
141         };\r
142 \r
143         //! Interface to driver which is able to perform 2d and 3d graphics functions.\r
144         /** This interface is one of the most important interfaces of\r
145         the Irrlicht Engine: All rendering and texture manipulation is done with\r
146         this interface. You are able to use the Irrlicht Engine by only\r
147         invoking methods of this interface if you like to, although the\r
148         irr::scene::ISceneManager interface provides a lot of powerful classes\r
149         and methods to make the programmer's life easier.\r
150         */\r
151         class IVideoDriver : public virtual IReferenceCounted\r
152         {\r
153         public:\r
154 \r
155                 //! Applications must call this method before performing any rendering.\r
156                 /** This method can clear the back- and the z-buffer.\r
157                 \param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.\r
158                 \param clearColor The clear color for the color buffer.\r
159                 \param clearDepth The clear value for the depth buffer.\r
160                 \param clearStencil The clear value for the stencil buffer.\r
161                 \param videoData Handle of another window, if you want the\r
162                 bitmap to be displayed on another window. If this is an empty\r
163                 element, everything will be displayed in the default window.\r
164                 Note: This feature is not fully implemented for all devices.\r
165                 \param sourceRect Pointer to a rectangle defining the source\r
166                 rectangle of the area to be presented. Set to null to present\r
167                 everything. Note: not implemented in all devices.\r
168                 \return False if failed. */\r
169                 virtual bool beginScene(u16 clearFlag=(u16)(ECBF_COLOR|ECBF_DEPTH), SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0,\r
170                         const SExposedVideoData& videoData=SExposedVideoData(), core::rect<s32>* sourceRect = 0) = 0;\r
171 \r
172                 //! Alternative beginScene implementation. Can't clear stencil buffer, but otherwise identical to other beginScene\r
173                 bool beginScene(bool backBuffer, bool zBuffer, SColor color = SColor(255,0,0,0),\r
174                         const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0)\r
175                 {\r
176                         u16 flag = 0;\r
177 \r
178                         if (backBuffer)\r
179                                 flag |= ECBF_COLOR;\r
180 \r
181                         if (zBuffer)\r
182                                 flag |= ECBF_DEPTH;\r
183 \r
184                         return beginScene(flag, color, 1.f, 0, videoData, sourceRect);\r
185                 }\r
186 \r
187                 //! Presents the rendered image to the screen.\r
188                 /** Applications must call this method after performing any\r
189                 rendering.\r
190                 \return False if failed and true if succeeded. */\r
191                 virtual bool endScene() = 0;\r
192 \r
193                 //! Queries the features of the driver.\r
194                 /** Returns true if a feature is available\r
195                 \param feature Feature to query.\r
196                 \return True if the feature is available, false if not. */\r
197                 virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const =0;\r
198 \r
199                 //! Disable a feature of the driver.\r
200                 /** Can also be used to enable the features again. It is not\r
201                 possible to enable unsupported features this way, though.\r
202                 \param feature Feature to disable.\r
203                 \param flag When true the feature is disabled, otherwise it is enabled. */\r
204                 virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true) =0;\r
205 \r
206                 //! Get attributes of the actual video driver\r
207                 /** The following names can be queried for the given types:\r
208                 MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number.\r
209                 MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower.\r
210                 MaxLights (int) Number of hardware lights supported in the fixed function pipeline of the driver, typically 6-8. Use light manager or deferred shading for more.\r
211                 MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32.\r
212                 MaxUserClipPlanes (int) Number of additional clip planes, which can be set by the user via dedicated driver methods.\r
213                 MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL\r
214                 MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders.\r
215                 MaxIndices (int) Number of indices which can be used in one render call (i.e. one mesh buffer).\r
216                 MaxTextureSize (int) Dimension that a texture may have, both in width and height.\r
217                 MaxGeometryVerticesOut (int) Number of vertices the geometry shader can output in one pass. Only OpenGL so far.\r
218                 MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems.\r
219                 Version (int) Version of the driver. Should be Major*100+Minor\r
220                 ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor.\r
221                 AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32\r
222                 */\r
223                 virtual const io::IAttributes& getDriverAttributes() const=0;\r
224 \r
225                 //! Check if the driver was recently reset.\r
226                 /** For d3d devices you will need to recreate the RTTs if the\r
227                 driver was reset. Should be queried right after beginScene().\r
228                 */\r
229                 virtual bool checkDriverReset() =0;\r
230 \r
231                 //! Sets transformation matrices.\r
232                 /** \param state Transformation type to be set, e.g. view,\r
233                 world, or projection.\r
234                 \param mat Matrix describing the transformation. */\r
235                 virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) =0;\r
236 \r
237                 //! Returns the transformation set by setTransform\r
238                 /** \param state Transformation type to query\r
239                 \return Matrix describing the transformation. */\r
240                 virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const =0;\r
241 \r
242                 //! Retrieve the number of image loaders\r
243                 /** \return Number of image loaders */\r
244                 virtual u32 getImageLoaderCount() const = 0;\r
245 \r
246                 //! Retrieve the given image loader\r
247                 /** \param n The index of the loader to retrieve. This parameter is an 0-based\r
248                 array index.\r
249                 \return A pointer to the specified loader, 0 if the index is incorrect. */\r
250                 virtual IImageLoader* getImageLoader(u32 n) = 0;\r
251 \r
252                 //! Retrieve the number of image writers\r
253                 /** \return Number of image writers */\r
254                 virtual u32 getImageWriterCount() const = 0;\r
255 \r
256                 //! Retrieve the given image writer\r
257                 /** \param n The index of the writer to retrieve. This parameter is an 0-based\r
258                 array index.\r
259                 \return A pointer to the specified writer, 0 if the index is incorrect. */\r
260                 virtual IImageWriter* getImageWriter(u32 n) = 0;\r
261 \r
262                 //! Sets a material.\r
263                 /** All 3d drawing functions will draw geometry using this material thereafter.\r
264                 \param material: Material to be used from now on. */\r
265                 virtual void setMaterial(const SMaterial& material) =0;\r
266 \r
267                 //! Get access to a named texture.\r
268                 /** Loads the texture from disk if it is not\r
269                 already loaded and generates mipmap levels if desired.\r
270                 Texture loading can be influenced using the\r
271                 setTextureCreationFlag() method. The texture can be in several\r
272                 imageformats, such as BMP, JPG, TGA, PCX, PNG, and PSD.\r
273                 \param filename Filename of the texture to be loaded.\r
274                 \return Pointer to the texture, or 0 if the texture\r
275                 could not be loaded. This pointer should not be dropped. See\r
276                 IReferenceCounted::drop() for more information. */\r
277                 virtual ITexture* getTexture(const io::path& filename) = 0;\r
278 \r
279                 //! Get access to a named texture.\r
280                 /** Loads the texture from disk if it is not\r
281                 already loaded and generates mipmap levels if desired.\r
282                 Texture loading can be influenced using the\r
283                 setTextureCreationFlag() method. The texture can be in several\r
284                 imageformats, such as BMP, JPG, TGA, PCX, PNG, and PSD.\r
285                 \param file Pointer to an already opened file.\r
286                 \return Pointer to the texture, or 0 if the texture\r
287                 could not be loaded. This pointer should not be dropped. See\r
288                 IReferenceCounted::drop() for more information. */\r
289                 virtual ITexture* getTexture(io::IReadFile* file) =0;\r
290 \r
291                 //! Returns a texture by index\r
292                 /** \param index: Index of the texture, must be smaller than\r
293                 getTextureCount() Please note that this index might change when\r
294                 adding or removing textures\r
295                 \return Pointer to the texture, or 0 if the texture was not\r
296                 set or index is out of bounds. This pointer should not be\r
297                 dropped. See IReferenceCounted::drop() for more information. */\r
298                 virtual ITexture* getTextureByIndex(u32 index) =0;\r
299 \r
300                 //! Returns amount of textures currently loaded\r
301                 /** \return Amount of textures currently loaded */\r
302                 virtual u32 getTextureCount() const = 0;\r
303 \r
304                 //! Renames a texture\r
305                 /** \param texture Pointer to the texture to rename.\r
306                 \param newName New name for the texture. This should be a unique name. */\r
307                 virtual void renameTexture(ITexture* texture, const io::path& newName) = 0;\r
308 \r
309                 //! Creates an empty texture of specified size.\r
310                 /** \param size: Size of the texture.\r
311                 \param name A name for the texture. Later calls to\r
312                 getTexture() with this name will return this texture.\r
313                 The name can _not_ be empty.\r
314                 \param format Desired color format of the texture. Please note\r
315                 that the driver may choose to create the texture in another\r
316                 color format.\r
317                 \return Pointer to the newly created texture. This pointer\r
318                 should not be dropped. See IReferenceCounted::drop() for more\r
319                 information. */\r
320                 virtual ITexture* addTexture(const core::dimension2d<u32>& size,\r
321                         const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;\r
322 \r
323                 //! Creates a texture from an IImage.\r
324                 /** \param name A name for the texture. Later calls of\r
325                 getTexture() with this name will return this texture.\r
326                 The name can _not_ be empty.\r
327                 \param image Image the texture is created from.\r
328                 \param mipmapData Optional pointer to a mipmaps data.\r
329                 If this parameter is not given, the mipmaps are derived from image.\r
330                 \return Pointer to the newly created texture. This pointer\r
331                 should not be dropped. See IReferenceCounted::drop() for more\r
332                 information. */\r
333                 _IRR_DEPRECATED_ ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData)\r
334                 {\r
335                         if (image)\r
336                                 image->setMipMapsData(mipmapData, false, true);\r
337 \r
338                         return addTexture(name, image);\r
339                 }\r
340 \r
341                 //! Creates a texture from an IImage.\r
342                 /** \param name A name for the texture. Later calls of\r
343                 getTexture() with this name will return this texture.\r
344                 The name can _not_ be empty.\r
345                 \param image Image the texture is created from.\r
346                 \return Pointer to the newly created texture. This pointer\r
347                 should not be dropped. See IReferenceCounted::drop() for more\r
348                 information. */\r
349                 virtual ITexture* addTexture(const io::path& name, IImage* image) = 0;\r
350 \r
351                 //! Creates a cubemap texture from loaded IImages.\r
352                 /** \param name A name for the texture. Later calls of getTexture() with this name will return this texture.\r
353                 The name can _not_ be empty.\r
354                 \param imagePosX Image (positive X) the texture is created from.\r
355                 \param imageNegX Image (negative X) the texture is created from.\r
356                 \param imagePosY Image (positive Y) the texture is created from.\r
357                 \param imageNegY Image (negative Y) the texture is created from.\r
358                 \param imagePosZ Image (positive Z) the texture is created from.\r
359                 \param imageNegZ Image (negative Z) the texture is created from.\r
360                 \return Pointer to the newly created texture. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
361                 virtual ITexture* addTextureCubemap(const io::path& name, IImage* imagePosX, IImage* imageNegX, IImage* imagePosY,\r
362                         IImage* imageNegY, IImage* imagePosZ, IImage* imageNegZ) = 0;\r
363 \r
364                 //! Creates an empty cubemap texture of specified size.\r
365                 /** \param sideLen diameter of one side of the cube\r
366                 \param name A name for the texture. Later calls of\r
367                 getTexture() with this name will return this texture.\r
368                 The name can _not_ be empty.\r
369                 \param format Desired color format of the texture. Please note\r
370                 that the driver may choose to create the texture in another\r
371                 color format.\r
372                 \return Pointer to the newly created texture.   */\r
373                 virtual ITexture* addTextureCubemap(const irr::u32 sideLen, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;\r
374 \r
375                 //! Adds a new render target texture to the texture cache.\r
376                 /** \param size Size of the texture, in pixels. Width and\r
377                 height should be a power of two (e.g. 64, 128, 256, 512, ...)\r
378                 and it should not be bigger than the backbuffer, because it\r
379                 shares the zbuffer with the screen buffer.\r
380                 \param name A name for the texture. Later calls of getTexture() with this name will return this texture.\r
381                 The name can _not_ be empty.\r
382                 \param format The color format of the render target. Floating point formats are supported.\r
383                 \return Pointer to the created texture or 0 if the texture\r
384                 could not be created. This pointer should not be dropped. See\r
385                 IReferenceCounted::drop() for more information.\r
386                 You may want to remove it from driver texture cache with removeTexture if you no longer need it.\r
387                 */\r
388                 virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,\r
389                                 const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;\r
390 \r
391                 //! Adds a new render target texture with 6 sides for a cubemap map to the texture cache.\r
392                 /** NOTE: Only supported on D3D9 so far.\r
393                 \param sideLen Length of one cubemap side.\r
394                 \param name A name for the texture. Later calls of getTexture() with this name will return this texture.\r
395                 The name can _not_ be empty.\r
396                 \param format The color format of the render target. Floating point formats are supported.\r
397                 \return Pointer to the created texture or 0 if the texture\r
398                 could not be created. This pointer should not be dropped. See\r
399                 IReferenceCounted::drop() for more information. */\r
400                 virtual ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,\r
401                                 const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;\r
402 \r
403                 //! Removes a texture from the texture cache and deletes it.\r
404                 /** This method can free a lot of memory!\r
405                 Please note that after calling this, the pointer to the\r
406                 ITexture may no longer be valid, if it was not grabbed before\r
407                 by other parts of the engine for storing it longer. So it is a\r
408                 good idea to set all materials which are using this texture to\r
409                 0 or another texture first.\r
410                 \param texture Texture to delete from the engine cache. */\r
411                 virtual void removeTexture(ITexture* texture) =0;\r
412 \r
413                 //! Removes all textures from the texture cache and deletes them.\r
414                 /** This method can free a lot of memory!\r
415                 Please note that after calling this, the pointer to the\r
416                 ITexture may no longer be valid, if it was not grabbed before\r
417                 by other parts of the engine for storing it longer. So it is a\r
418                 good idea to set all materials which are using this texture to\r
419                 0 or another texture first. */\r
420                 virtual void removeAllTextures() =0;\r
421 \r
422                 //! Remove hardware buffer\r
423                 virtual void removeHardwareBuffer(const scene::IMeshBuffer* mb) =0;\r
424 \r
425                 //! Remove all hardware buffers\r
426                 virtual void removeAllHardwareBuffers() =0;\r
427 \r
428                 //! Create occlusion query.\r
429                 /** Use node for identification and mesh for occlusion test. */\r
430                 virtual void addOcclusionQuery(scene::ISceneNode* node,\r
431                                 const scene::IMesh* mesh=0) =0;\r
432 \r
433                 //! Remove occlusion query.\r
434                 virtual void removeOcclusionQuery(scene::ISceneNode* node) =0;\r
435 \r
436                 //! Remove all occlusion queries.\r
437                 virtual void removeAllOcclusionQueries() =0;\r
438 \r
439                 //! Run occlusion query. Draws mesh stored in query.\r
440                 /** If the mesh shall not be rendered visible, use\r
441                 overrideMaterial to disable the color and depth buffer. */\r
442                 virtual void runOcclusionQuery(scene::ISceneNode* node, bool visible=false) =0;\r
443 \r
444                 //! Run all occlusion queries. Draws all meshes stored in queries.\r
445                 /** If the meshes shall not be rendered visible, use\r
446                 overrideMaterial to disable the color and depth buffer. */\r
447                 virtual void runAllOcclusionQueries(bool visible=false) =0;\r
448 \r
449                 //! Update occlusion query. Retrieves results from GPU.\r
450                 /** If the query shall not block, set the flag to false.\r
451                 Update might not occur in this case, though */\r
452                 virtual void updateOcclusionQuery(scene::ISceneNode* node, bool block=true) =0;\r
453 \r
454                 //! Update all occlusion queries. Retrieves results from GPU.\r
455                 /** If the query shall not block, set the flag to false.\r
456                 Update might not occur in this case, though */\r
457                 virtual void updateAllOcclusionQueries(bool block=true) =0;\r
458 \r
459                 //! Return query result.\r
460                 /** Return value is the number of visible pixels/fragments.\r
461                 The value is a safe approximation, i.e. can be larger than the\r
462                 actual value of pixels. */\r
463                 virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const =0;\r
464 \r
465                 //! Create render target.\r
466                 virtual IRenderTarget* addRenderTarget() = 0;\r
467 \r
468                 //! Remove render target.\r
469                 virtual void removeRenderTarget(IRenderTarget* renderTarget) = 0;\r
470 \r
471                 //! Remove all render targets.\r
472                 virtual void removeAllRenderTargets() = 0;\r
473 \r
474                 //! Sets a boolean alpha channel on the texture based on a color key.\r
475                 /** This makes the texture fully transparent at the texels where\r
476                 this color key can be found when using for example draw2DImage\r
477                 with useAlphachannel==true.  The alpha of other texels is not modified.\r
478                 \param texture Texture whose alpha channel is modified.\r
479                 \param color Color key color. Every texel with this color will\r
480                 become fully transparent as described above. Please note that the\r
481                 colors of a texture may be converted when loading it, so the\r
482                 color values may not be exactly the same in the engine and for\r
483                 example in picture edit programs. To avoid this problem, you\r
484                 could use the makeColorKeyTexture method, which takes the\r
485                 position of a pixel instead a color value.\r
486                 \param zeroTexels \deprecated If set to true, then any texels that match\r
487                 the color key will have their color, as well as their alpha, set to zero\r
488                 (i.e. black). This behavior matches the legacy (buggy) behavior prior\r
489                 to release 1.5 and is provided for backwards compatibility only.\r
490                 This parameter may be removed by Irrlicht 1.9. */\r
491                 virtual void makeColorKeyTexture(video::ITexture* texture,\r
492                                                 video::SColor color,\r
493                                                 bool zeroTexels = false) const =0;\r
494 \r
495                 //! Sets a boolean alpha channel on the texture based on the color at a position.\r
496                 /** This makes the texture fully transparent at the texels where\r
497                 the color key can be found when using for example draw2DImage\r
498                 with useAlphachannel==true.  The alpha of other texels is not modified.\r
499                 \param texture Texture whose alpha channel is modified.\r
500                 \param colorKeyPixelPos Position of a pixel with the color key\r
501                 color. Every texel with this color will become fully transparent as\r
502                 described above.\r
503                 \param zeroTexels \deprecated If set to true, then any texels that match\r
504                 the color key will have their color, as well as their alpha, set to zero\r
505                 (i.e. black). This behavior matches the legacy (buggy) behavior prior\r
506                 to release 1.5 and is provided for backwards compatibility only.\r
507                 This parameter may be removed by Irrlicht 1.9. */\r
508                 virtual void makeColorKeyTexture(video::ITexture* texture,\r
509                                 core::position2d<s32> colorKeyPixelPos,\r
510                                 bool zeroTexels = false) const =0;\r
511 \r
512                 //! Creates a normal map from a height map texture.\r
513                 /** As input is considered to be a height map the texture is read like:\r
514                 - For a 32-bit texture only the red channel is regarded\r
515                 - For a 16-bit texture the rgb-values are averaged.\r
516                 Output channels red/green for X/Y and blue for up (Z).\r
517                 For a 32-bit texture we store additionally the height value in the \r
518                 alpha channel. This value is used by the video::EMT_PARALLAX_MAP_SOLID \r
519                 material and similar materials.\r
520                 On the borders the texture is considered to repeat.\r
521                 \param texture Height map texture which is converted to a normal map.\r
522                 \param amplitude Constant value by which the height\r
523                 information is multiplied.*/\r
524                 virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const =0;\r
525 \r
526                 //! Set a render target.\r
527                 /** This will only work if the driver supports the\r
528                 EVDF_RENDER_TO_TARGET feature, which can be queried with\r
529                 queryFeature(). Please note that you cannot render 3D or 2D\r
530                 geometry with a render target as texture on it when you are rendering\r
531                 the scene into this render target at the same time. It is usually only\r
532                 possible to render into a texture between the\r
533                 IVideoDriver::beginScene() and endScene() method calls. If you need the\r
534                 best performance use this method instead of setRenderTarget.\r
535                 \param target Render target object.\r
536                 \param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.\r
537                 \param clearColor The clear color for the color buffer.\r
538                 \param clearDepth The clear value for the depth buffer.\r
539                 \param clearStencil The clear value for the stencil buffer.\r
540                 \return True if successful and false if not. */\r
541                 virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),\r
542                         f32 clearDepth = 1.f, u8 clearStencil = 0) = 0;\r
543 \r
544                 //! Sets a new render target.\r
545                 /** This will only work if the driver supports the\r
546                 EVDF_RENDER_TO_TARGET feature, which can be queried with\r
547                 queryFeature(). Usually, rendering to textures is done in this\r
548                 way:\r
549                 \code\r
550                 // create render target\r
551                 ITexture* target = driver->addRenderTargetTexture(core::dimension2d<u32>(128,128), "rtt1");\r
552 \r
553                 // ...\r
554 \r
555                 driver->setRenderTarget(target); // set render target\r
556                 // .. draw stuff here\r
557                 driver->setRenderTarget(0); // set previous render target\r
558                 \endcode\r
559                 Please note that you cannot render 3D or 2D geometry with a\r
560                 render target as texture on it when you are rendering the scene\r
561                 into this render target at the same time. It is usually only\r
562                 possible to render into a texture between the\r
563                 IVideoDriver::beginScene() and endScene() method calls.\r
564                 \param texture New render target. Must be a texture created with\r
565                 IVideoDriver::addRenderTargetTexture(). If set to 0, it sets\r
566                 the previous render target which was set before the last\r
567                 setRenderTarget() call.\r
568                 \param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.\r
569                 \param clearColor The clear color for the color buffer.\r
570                 \param clearDepth The clear value for the depth buffer.\r
571                 \param clearStencil The clear value for the stencil buffer.\r
572                 \return True if successful and false if not. */\r
573                 virtual bool setRenderTarget(ITexture* texture, u16 clearFlag=ECBF_COLOR|ECBF_DEPTH, SColor clearColor = SColor(255,0,0,0),\r
574                         f32 clearDepth = 1.f, u8 clearStencil = 0) = 0;\r
575 \r
576                 //! Sets a new render target.\r
577                 //! Prefer to use the setRenderTarget function taking flags as parameter as this one can't clear the stencil buffer.\r
578                 //! It's still offered for backward compatibility.\r
579                 bool setRenderTarget(ITexture* texture, bool clearBackBuffer, bool clearZBuffer, SColor color = SColor(255,0,0,0))\r
580                 {\r
581                         u16 flag = 0;\r
582 \r
583                         if (clearBackBuffer)\r
584                                 flag |= ECBF_COLOR;\r
585 \r
586                         if (clearZBuffer)\r
587                                 flag |= ECBF_DEPTH;\r
588 \r
589                         return setRenderTarget(texture, flag, color);\r
590                 }\r
591 \r
592                 //! Sets a new viewport.\r
593                 /** Every rendering operation is done into this new area.\r
594                 \param area: Rectangle defining the new area of rendering\r
595                 operations. */\r
596                 virtual void setViewPort(const core::rect<s32>& area) =0;\r
597 \r
598                 //! Gets the area of the current viewport.\r
599                 /** \return Rectangle of the current viewport. */\r
600                 virtual const core::rect<s32>& getViewPort() const =0;\r
601 \r
602                 //! Draws a vertex primitive list\r
603                 /** Note that, depending on the index type, some vertices might be not\r
604                 accessible through the index list. The limit is at 65535 vertices for 16bit\r
605                 indices. Please note that currently not all primitives are available for\r
606                 all drivers, and some might be emulated via triangle renders.\r
607                 \param vertices Pointer to array of vertices.\r
608                 \param vertexCount Amount of vertices in the array.\r
609                 \param indexList Pointer to array of indices. These define the vertices used\r
610                 for each primitive. Depending on the pType, indices are interpreted as single\r
611                 objects (for point like primitives), pairs (for lines), triplets (for\r
612                 triangles), or quads.\r
613                 \param primCount Amount of Primitives\r
614                 \param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex.\r
615                 \param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan.\r
616                 \param iType Index type, e.g. video::EIT_16BIT for 16bit indices. */\r
617                 virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,\r
618                                 const void* indexList, u32 primCount,\r
619                                 E_VERTEX_TYPE vType=EVT_STANDARD,\r
620                                 scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES,\r
621                                 E_INDEX_TYPE iType=EIT_16BIT) =0;\r
622 \r
623                 //! Draws a vertex primitive list in 2d\r
624                 /** Compared to the general (3d) version of this method, this\r
625                 one sets up a 2d render mode, and uses only x and y of vectors.\r
626                 Note that, depending on the index type, some vertices might be\r
627                 not accessible through the index list. The limit is at 65535\r
628                 vertices for 16bit indices. Please note that currently not all\r
629                 primitives are available for all drivers, and some might be\r
630                 emulated via triangle renders. This function is not available\r
631                 for the sw drivers.\r
632                 \param vertices Pointer to array of vertices.\r
633                 \param vertexCount Amount of vertices in the array.\r
634                 \param indexList Pointer to array of indices. These define the\r
635                 vertices used for each primitive. Depending on the pType,\r
636                 indices are interpreted as single objects (for point like\r
637                 primitives), pairs (for lines), triplets (for triangles), or\r
638                 quads.\r
639                 \param primCount Amount of Primitives\r
640                 \param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex.\r
641                 \param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan.\r
642                 \param iType Index type, e.g. video::EIT_16BIT for 16bit indices. */\r
643                 virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,\r
644                                 const void* indexList, u32 primCount,\r
645                                 E_VERTEX_TYPE vType=EVT_STANDARD,\r
646                                 scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES,\r
647                                 E_INDEX_TYPE iType=EIT_16BIT) =0;\r
648 \r
649                 //! Draws an indexed triangle list.\r
650                 /** Note that there may be at maximum 65536 vertices, because\r
651                 the index list is an array of 16 bit values each with a maximum\r
652                 value of 65536. If there are more than 65536 vertices in the\r
653                 list, results of this operation are not defined.\r
654                 \param vertices Pointer to array of vertices.\r
655                 \param vertexCount Amount of vertices in the array.\r
656                 \param indexList Pointer to array of indices.\r
657                 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */\r
658                 void drawIndexedTriangleList(const S3DVertex* vertices,\r
659                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
660                 {\r
661                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);\r
662                 }\r
663 \r
664                 //! Draws an indexed triangle list.\r
665                 /** Note that there may be at maximum 65536 vertices, because\r
666                 the index list is an array of 16 bit values each with a maximum\r
667                 value of 65536. If there are more than 65536 vertices in the\r
668                 list, results of this operation are not defined.\r
669                 \param vertices Pointer to array of vertices.\r
670                 \param vertexCount Amount of vertices in the array.\r
671                 \param indexList Pointer to array of indices.\r
672                 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */\r
673                 void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,\r
674                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
675                 {\r
676                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLES, EIT_16BIT);\r
677                 }\r
678 \r
679                 //! Draws an indexed triangle list.\r
680                 /** Note that there may be at maximum 65536 vertices, because\r
681                 the index list is an array of 16 bit values each with a maximum\r
682                 value of 65536. If there are more than 65536 vertices in the\r
683                 list, results of this operation are not defined.\r
684                 \param vertices Pointer to array of vertices.\r
685                 \param vertexCount Amount of vertices in the array.\r
686                 \param indexList Pointer to array of indices.\r
687                 \param triangleCount Amount of Triangles. Usually amount of indices / 3. */\r
688                 void drawIndexedTriangleList(const S3DVertexTangents* vertices,\r
689                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
690                 {\r
691                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLES, EIT_16BIT);\r
692                 }\r
693 \r
694                 //! Draws an indexed triangle fan.\r
695                 /** Note that there may be at maximum 65536 vertices, because\r
696                 the index list is an array of 16 bit values each with a maximum\r
697                 value of 65536. If there are more than 65536 vertices in the\r
698                 list, results of this operation are not defined.\r
699                 \param vertices Pointer to array of vertices.\r
700                 \param vertexCount Amount of vertices in the array.\r
701                 \param indexList Pointer to array of indices.\r
702                 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */\r
703                 void drawIndexedTriangleFan(const S3DVertex* vertices,\r
704                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
705                 {\r
706                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLE_FAN, EIT_16BIT);\r
707                 }\r
708 \r
709                 //! Draws an indexed triangle fan.\r
710                 /** Note that there may be at maximum 65536 vertices, because\r
711                 the index list is an array of 16 bit values each with a maximum\r
712                 value of 65536. If there are more than 65536 vertices in the\r
713                 list, results of this operation are not defined.\r
714                 \param vertices Pointer to array of vertices.\r
715                 \param vertexCount Amount of vertices in the array.\r
716                 \param indexList Pointer to array of indices.\r
717                 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */\r
718                 void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,\r
719                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
720                 {\r
721                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);\r
722                 }\r
723 \r
724                 //! Draws an indexed triangle fan.\r
725                 /** Note that there may be at maximum 65536 vertices, because\r
726                 the index list is an array of 16 bit values each with a maximum\r
727                 value of 65536. If there are more than 65536 vertices in the\r
728                 list, results of this operation are not defined.\r
729                 \param vertices Pointer to array of vertices.\r
730                 \param vertexCount Amount of vertices in the array.\r
731                 \param indexList Pointer to array of indices.\r
732                 \param triangleCount Amount of Triangles. Usually amount of indices - 2. */\r
733                 void drawIndexedTriangleFan(const S3DVertexTangents* vertices,\r
734                         u32 vertexCount, const u16* indexList, u32 triangleCount)\r
735                 {\r
736                         drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);\r
737                 }\r
738 \r
739                 //! Draws a 3d line.\r
740                 /** For some implementations, this method simply calls\r
741                 drawVertexPrimitiveList for some triangles.\r
742                 Note that the line is drawn using the current transformation\r
743                 matrix and material. So if you need to draw the 3D line\r
744                 independently of the current transformation, use\r
745                 \code\r
746                 driver->setMaterial(someMaterial);\r
747                 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);\r
748                 \endcode\r
749                 for some properly set up material before drawing the line.\r
750                 Some drivers support line thickness set in the material.\r
751                 \param start Start of the 3d line.\r
752                 \param end End of the 3d line.\r
753                 \param color Color of the line. */\r
754                 virtual void draw3DLine(const core::vector3df& start,\r
755                         const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;\r
756 \r
757                 //! Draws a 3d triangle.\r
758                 /** This method calls drawVertexPrimitiveList for some triangles.\r
759                 This method works with all drivers because it simply calls\r
760                 drawVertexPrimitiveList, but it is hence not very fast.\r
761                 Note that the triangle is drawn using the current\r
762                 transformation matrix and material. So if you need to draw it\r
763                 independently of the current transformation, use\r
764                 \code\r
765                 driver->setMaterial(someMaterial);\r
766                 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);\r
767                 \endcode\r
768                 for some properly set up material before drawing the triangle.\r
769                 \param triangle The triangle to draw.\r
770                 \param color Color of the line. */\r
771                 virtual void draw3DTriangle(const core::triangle3df& triangle,\r
772                         SColor color = SColor(255,255,255,255)) =0;\r
773 \r
774                 //! Draws a 3d axis aligned box.\r
775                 /** This method simply calls draw3DLine for the edges of the\r
776                 box. Note that the box is drawn using the current transformation\r
777                 matrix and material. So if you need to draw it independently of\r
778                 the current transformation, use\r
779                 \code\r
780                 driver->setMaterial(someMaterial);\r
781                 driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);\r
782                 \endcode\r
783                 for some properly set up material before drawing the box.\r
784                 \param box The axis aligned box to draw\r
785                 \param color Color to use while drawing the box. */\r
786                 virtual void draw3DBox(const core::aabbox3d<f32>& box,\r
787                         SColor color = SColor(255,255,255,255)) =0;\r
788 \r
789                 //! Draws a 2d image without any special effects\r
790                 /** \param texture Pointer to texture to use.\r
791                 \param destPos Upper left 2d destination position where the\r
792                 image will be drawn. \r
793                 \param useAlphaChannelOfTexture: If true, the alpha channel of\r
794                 the texture is used to draw the image.*/\r
795                 virtual void draw2DImage(const video::ITexture* texture,\r
796                         const core::position2d<s32>& destPos, bool useAlphaChannelOfTexture=false) =0;\r
797 \r
798                 //! Draws a 2d image using a color\r
799                 /** (if color is other than\r
800                 Color(255,255,255,255)) and the alpha channel of the texture.\r
801                 \param texture Texture to be drawn.\r
802                 \param destPos Upper left 2d destination position where the\r
803                 image will be drawn.\r
804                 \param sourceRect Source rectangle in the image.\r
805                 \param clipRect Pointer to rectangle on the screen where the\r
806                 image is clipped to.\r
807                 If this pointer is NULL the image is not clipped.\r
808                 \param color Color with which the image is drawn. If the color\r
809                 equals Color(255,255,255,255) it is ignored. Note that the\r
810                 alpha component is used: If alpha is other than 255, the image\r
811                 will be transparent.\r
812                 \param useAlphaChannelOfTexture: If true, the alpha channel of\r
813                 the texture is used to draw the image.*/\r
814                 virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,\r
815                         const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,\r
816                         SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) =0;\r
817 \r
818                 //! Draws a set of 2d images, using a color and the alpha channel of the texture.\r
819                 /** The images are drawn beginning at pos and concatenated in\r
820                 one line. All drawings are clipped against clipRect (if != 0).\r
821                 The subtextures are defined by the array of sourceRects and are\r
822                 chosen by the indices given.\r
823                 \param texture Texture to be drawn.\r
824                 \param pos Upper left 2d destination position where the image\r
825                 will be drawn.\r
826                 \param sourceRects Source rectangles of the image.\r
827                 \param indices List of indices which choose the actual\r
828                 rectangle used each time.\r
829                 \param kerningWidth Offset to Position on X\r
830                 \param clipRect Pointer to rectangle on the screen where the\r
831                 image is clipped to.\r
832                 If this pointer is 0 then the image is not clipped.\r
833                 \param color Color with which the image is drawn.\r
834                 Note that the alpha component is used. If alpha is other than\r
835                 255, the image will be transparent.\r
836                 \param useAlphaChannelOfTexture: If true, the alpha channel of\r
837                 the texture is used to draw the image. */\r
838                 virtual void draw2DImageBatch(const video::ITexture* texture,\r
839                                 const core::position2d<s32>& pos,\r
840                                 const core::array<core::rect<s32> >& sourceRects,\r
841                                 const core::array<s32>& indices,\r
842                                 s32 kerningWidth=0,\r
843                                 const core::rect<s32>* clipRect=0,\r
844                                 SColor color=SColor(255,255,255,255),\r
845                                 bool useAlphaChannelOfTexture=false) =0;\r
846 \r
847                 //! Draws a set of 2d images, using a color and the alpha channel of the texture.\r
848                 /** All drawings are clipped against clipRect (if != 0).\r
849                 The subtextures are defined by the array of sourceRects and are\r
850                 positioned using the array of positions.\r
851                 \param texture Texture to be drawn.\r
852                 \param positions Array of upper left 2d destinations where the\r
853                 images will be drawn.\r
854                 \param sourceRects Source rectangles of the image.\r
855                 \param clipRect Pointer to rectangle on the screen where the\r
856                 images are clipped to.\r
857                 If this pointer is 0 then the image is not clipped.\r
858                 \param color Color with which the image is drawn.\r
859                 Note that the alpha component is used. If alpha is other than\r
860                 255, the image will be transparent.\r
861                 \param useAlphaChannelOfTexture: If true, the alpha channel of\r
862                 the texture is used to draw the image. */\r
863                 virtual void draw2DImageBatch(const video::ITexture* texture,\r
864                                 const core::array<core::position2d<s32> >& positions,\r
865                                 const core::array<core::rect<s32> >& sourceRects,\r
866                                 const core::rect<s32>* clipRect=0,\r
867                                 SColor color=SColor(255,255,255,255),\r
868                                 bool useAlphaChannelOfTexture=false) =0;\r
869 \r
870                 //! Draws a part of the texture into the rectangle. Note that colors must be an array of 4 colors if used.\r
871                 /** Suggested and first implemented by zola.\r
872                 \param texture The texture to draw from\r
873                 \param destRect The rectangle to draw into\r
874                 \param sourceRect The rectangle denoting a part of the texture\r
875                 \param clipRect Clips the destination rectangle (may be 0)\r
876                 \param colors Array of 4 colors denoting the color values of\r
877                 the corners of the destRect\r
878                 \param useAlphaChannelOfTexture True if alpha channel will be\r
879                 blended. */\r
880                 virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,\r
881                         const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,\r
882                         const video::SColor * const colors=0, bool useAlphaChannelOfTexture=false) =0;\r
883 \r
884                 //! Draws a 2d rectangle.\r
885                 /** \param color Color of the rectangle to draw. The alpha\r
886                 component will not be ignored and specifies how transparent the\r
887                 rectangle will be.\r
888                 \param pos Position of the rectangle.\r
889                 \param clip Pointer to rectangle against which the rectangle\r
890                 will be clipped. If the pointer is null, no clipping will be\r
891                 performed. */\r
892                 virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,\r
893                         const core::rect<s32>* clip =0) =0;\r
894 \r
895                 //! Draws a 2d rectangle with a gradient.\r
896                 /** \param colorLeftUp Color of the upper left corner to draw.\r
897                 The alpha component will not be ignored and specifies how\r
898                 transparent the rectangle will be.\r
899                 \param colorRightUp Color of the upper right corner to draw.\r
900                 The alpha component will not be ignored and specifies how\r
901                 transparent the rectangle will be.\r
902                 \param colorLeftDown Color of the lower left corner to draw.\r
903                 The alpha component will not be ignored and specifies how\r
904                 transparent the rectangle will be.\r
905                 \param colorRightDown Color of the lower right corner to draw.\r
906                 The alpha component will not be ignored and specifies how\r
907                 transparent the rectangle will be.\r
908                 \param pos Position of the rectangle.\r
909                 \param clip Pointer to rectangle against which the rectangle\r
910                 will be clipped. If the pointer is null, no clipping will be\r
911                 performed. */\r
912                 virtual void draw2DRectangle(const core::rect<s32>& pos,\r
913                                 SColor colorLeftUp, SColor colorRightUp,\r
914                                 SColor colorLeftDown, SColor colorRightDown,\r
915                                 const core::rect<s32>* clip =0) =0;\r
916 \r
917                 //! Draws the outline of a 2D rectangle.\r
918                 /** \param pos Position of the rectangle.\r
919                 \param color Color of the rectangle to draw. The alpha component\r
920                 specifies how transparent the rectangle outline will be. */\r
921                 virtual void draw2DRectangleOutline(const core::recti& pos,\r
922                                 SColor color=SColor(255,255,255,255)) =0;\r
923 \r
924                 //! Draws a 2d line.\r
925                 /** In theory both start and end will be included in coloring.\r
926                 BUG: Currently d3d ignores the last pixel\r
927                 (it uses the so called "diamond exit rule" for drawing lines).\r
928                 \param start Screen coordinates of the start of the line\r
929                 in pixels.\r
930                 \param end Screen coordinates of the start of the line in\r
931                 pixels.\r
932                 \param color Color of the line to draw. */\r
933                 virtual void draw2DLine(const core::position2d<s32>& start,\r
934                                         const core::position2d<s32>& end,\r
935                                         SColor color=SColor(255,255,255,255)) =0;\r
936 \r
937                 //! Draws a pixel.\r
938                 /** \param x The x-position of the pixel.\r
939                 \param y The y-position of the pixel.\r
940                 \param color Color of the pixel to draw. */\r
941                 virtual void drawPixel(u32 x, u32 y, const SColor& color) =0;\r
942 \r
943                 //! Draws a non filled concyclic regular 2d polygon.\r
944                 /** This method can be used to draw circles, but also\r
945                 triangles, tetragons, pentagons, hexagons, heptagons, octagons,\r
946                 enneagons, decagons, hendecagons, dodecagon, triskaidecagons,\r
947                 etc. I think you'll got it now. And all this by simply\r
948                 specifying the vertex count. Welcome to the wonders of\r
949                 geometry.\r
950                 \param center Position of center of circle (pixels).\r
951                 \param radius Radius of circle in pixels.\r
952                 \param color Color of the circle.\r
953                 \param vertexCount Amount of vertices of the polygon. Specify 2\r
954                 to draw a line, 3 to draw a triangle, 4 for tetragons and a lot\r
955                 (>10) for nearly a circle. */\r
956                 virtual void draw2DPolygon(core::position2d<s32> center,\r
957                                 f32 radius,\r
958                                 video::SColor color=SColor(100,255,255,255),\r
959                                 s32 vertexCount=10) =0;\r
960 \r
961                 //! Draws a shadow volume into the stencil buffer.\r
962                 /** To draw a stencil shadow, do this: First, draw all geometry.\r
963                 Then use this method, to draw the shadow volume. Then, use\r
964                 IVideoDriver::drawStencilShadow() to visualize the shadow.\r
965                 Please note that the code for the opengl version of the method\r
966                 is based on free code sent in by Philipp Dortmann, lots of\r
967                 thanks go to him!\r
968                 \param triangles Array of 3d vectors, specifying the shadow\r
969                 volume.\r
970                 \param zfail If set to true, zfail method is used, otherwise\r
971                 zpass.\r
972                 \param debugDataVisible The debug data that is enabled for this\r
973                 shadow node\r
974                 */\r
975                 virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0) =0;\r
976 \r
977                 //! Fills the stencil shadow with color.\r
978                 /** After the shadow volume has been drawn into the stencil\r
979                 buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
980                 to draw the color of the shadow.\r
981                 Please note that the code for the opengl version of the method\r
982                 is based on free code sent in by Philipp Dortmann, lots of\r
983                 thanks go to him!\r
984                 \param clearStencilBuffer Set this to false, if you want to\r
985                 draw every shadow with the same color, and only want to call\r
986                 drawStencilShadow() once after all shadow volumes have been\r
987                 drawn. Set this to true, if you want to paint every shadow with\r
988                 its own color.\r
989                 \param leftUpEdge Color of the shadow in the upper left corner\r
990                 of screen.\r
991                 \param rightUpEdge Color of the shadow in the upper right\r
992                 corner of screen.\r
993                 \param leftDownEdge Color of the shadow in the lower left\r
994                 corner of screen.\r
995                 \param rightDownEdge Color of the shadow in the lower right\r
996                 corner of screen. */\r
997                 virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
998                         video::SColor leftUpEdge = video::SColor(255,0,0,0),\r
999                         video::SColor rightUpEdge = video::SColor(255,0,0,0),\r
1000                         video::SColor leftDownEdge = video::SColor(255,0,0,0),\r
1001                         video::SColor rightDownEdge = video::SColor(255,0,0,0)) =0;\r
1002 \r
1003                 //! Draws a mesh buffer\r
1004                 /** \param mb Buffer to draw */\r
1005                 virtual void drawMeshBuffer(const scene::IMeshBuffer* mb) =0;\r
1006 \r
1007                 //! Draws normals of a mesh buffer\r
1008                 /** \param mb Buffer to draw the normals of\r
1009                 \param length length scale factor of the normals\r
1010                 \param color Color the normals are rendered with\r
1011                 */\r
1012                 virtual void drawMeshBufferNormals(const scene::IMeshBuffer* mb, f32 length=10.f, SColor color=0xffffffff) =0;\r
1013 \r
1014                 //! Sets the fog mode.\r
1015                 /** These are global values attached to each 3d object rendered,\r
1016                 which has the fog flag enabled in its material.\r
1017                 \param color Color of the fog\r
1018                 \param fogType Type of fog used\r
1019                 \param start Only used in linear fog mode (linearFog=true).\r
1020                 Specifies where fog starts.\r
1021                 \param end Only used in linear fog mode (linearFog=true).\r
1022                 Specifies where fog ends.\r
1023                 \param density Only used in exponential fog mode\r
1024                 (linearFog=false). Must be a value between 0 and 1.\r
1025                 \param pixelFog Set this to false for vertex fog, and true if\r
1026                 you want per-pixel fog.\r
1027                 \param rangeFog Set this to true to enable range-based vertex\r
1028                 fog. The distance from the viewer is used to compute the fog,\r
1029                 not the z-coordinate. This is better, but slower. This might not\r
1030                 be available with all drivers and fog settings. */\r
1031                 virtual void setFog(SColor color=SColor(0,255,255,255),\r
1032                                 E_FOG_TYPE fogType=EFT_FOG_LINEAR,\r
1033                                 f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,\r
1034                                 bool pixelFog=false, bool rangeFog=false) =0;\r
1035 \r
1036                 //! Gets the fog mode.\r
1037                 virtual void getFog(SColor& color, E_FOG_TYPE& fogType,\r
1038                                 f32& start, f32& end, f32& density,\r
1039                                 bool& pixelFog, bool& rangeFog) = 0;\r
1040 \r
1041                 //! Get the current color format of the color buffer\r
1042                 /** \return Color format of the color buffer. */\r
1043                 virtual ECOLOR_FORMAT getColorFormat() const =0;\r
1044 \r
1045                 //! Get the size of the screen or render window.\r
1046                 /** \return Size of screen or render window. */\r
1047                 virtual const core::dimension2d<u32>& getScreenSize() const =0;\r
1048 \r
1049                 //! Get the size of the current render target\r
1050                 /** This method will return the screen size if the driver\r
1051                 doesn't support render to texture, or if the current render\r
1052                 target is the screen.\r
1053                 \return Size of render target or screen/window */\r
1054                 virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const =0;\r
1055 \r
1056                 //! Returns current frames per second value.\r
1057                 /** This value is updated approximately every 1.5 seconds and\r
1058                 is only intended to provide a rough guide to the average frame\r
1059                 rate. It is not suitable for use in performing timing\r
1060                 calculations or framerate independent movement.\r
1061                 \return Approximate amount of frames per second drawn. */\r
1062                 virtual s32 getFPS() const =0;\r
1063 \r
1064                 //! Returns amount of primitives (mostly triangles) which were drawn in the last frame.\r
1065                 /** Together with getFPS() very useful method for statistics.\r
1066                 \param mode Defines if the primitives drawn are accumulated or\r
1067                 counted per frame.\r
1068                 \return Amount of primitives drawn in the last frame. */\r
1069                 virtual u32 getPrimitiveCountDrawn( u32 mode =0 ) const =0;\r
1070 \r
1071                 //! Deletes all dynamic lights which were previously added with addDynamicLight().\r
1072                 virtual void deleteAllDynamicLights() =0;\r
1073 \r
1074                 //! adds a dynamic light, returning an index to the light\r
1075                 //! \param light: the light data to use to create the light\r
1076                 //! \return An index to the light, or -1 if an error occurs\r
1077                 virtual s32 addDynamicLight(const SLight& light) =0;\r
1078 \r
1079                 //! Returns the maximal amount of dynamic lights the device can handle\r
1080                 /** \return Maximal amount of dynamic lights. */\r
1081                 virtual u32 getMaximalDynamicLightAmount() const =0;\r
1082 \r
1083                 //! Returns amount of dynamic lights currently set\r
1084                 /** \return Amount of dynamic lights currently set */\r
1085                 virtual u32 getDynamicLightCount() const =0;\r
1086 \r
1087                 //! Returns light data which was previously set by IVideoDriver::addDynamicLight().\r
1088                 /** \param idx Zero based index of the light. Must be 0 or\r
1089                 greater and smaller than IVideoDriver::getDynamicLightCount.\r
1090                 \return Light data. */\r
1091                 virtual const SLight& getDynamicLight(u32 idx) const =0;\r
1092 \r
1093                 //! Turns a dynamic light on or off\r
1094                 //! \param lightIndex: the index returned by addDynamicLight\r
1095                 //! \param turnOn: true to turn the light on, false to turn it off\r
1096                 virtual void turnLightOn(s32 lightIndex, bool turnOn) =0;\r
1097 \r
1098                 //! Gets name of this video driver.\r
1099                 /** \return Returns the name of the video driver, e.g. in case\r
1100                 of the Direct3D8 driver, it would return "Direct3D 8.1". */\r
1101                 virtual const wchar_t* getName() const =0;\r
1102 \r
1103                 //! Adds an external image loader to the engine.\r
1104                 /** This is useful if the Irrlicht Engine should be able to load\r
1105                 textures of currently unsupported file formats (e.g. gif). The\r
1106                 IImageLoader only needs to be implemented for loading this file\r
1107                 format. A pointer to the implementation can be passed to the\r
1108                 engine using this method.\r
1109                 \param loader Pointer to the external loader created. */\r
1110                 virtual void addExternalImageLoader(IImageLoader* loader) =0;\r
1111 \r
1112                 //! Adds an external image writer to the engine.\r
1113                 /** This is useful if the Irrlicht Engine should be able to\r
1114                 write textures of currently unsupported file formats (e.g\r
1115                 .gif). The IImageWriter only needs to be implemented for\r
1116                 writing this file format. A pointer to the implementation can\r
1117                 be passed to the engine using this method.\r
1118                 \param writer: Pointer to the external writer created. */\r
1119                 virtual void addExternalImageWriter(IImageWriter* writer) =0;\r
1120 \r
1121                 //! Returns the maximum amount of primitives\r
1122                 /** (mostly vertices) which the device is able to render with\r
1123                 one drawVertexPrimitiveList call.\r
1124                 \return Maximum amount of primitives. */\r
1125                 virtual u32 getMaximalPrimitiveCount() const =0;\r
1126 \r
1127                 //! Enables or disables a texture creation flag.\r
1128                 /** These flags define how textures should be created. By\r
1129                 changing this value, you can influence for example the speed of\r
1130                 rendering a lot. But please note that the video drivers take\r
1131                 this value only as recommendation. It could happen that you\r
1132                 enable the ETCF_ALWAYS_16_BIT mode, but the driver still creates\r
1133                 32 bit textures.\r
1134                 \param flag Texture creation flag.\r
1135                 \param enabled Specifies if the given flag should be enabled or\r
1136                 disabled. */\r
1137                 virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled=true) =0;\r
1138 \r
1139                 //! Returns if a texture creation flag is enabled or disabled.\r
1140                 /** You can change this value using setTextureCreationFlag().\r
1141                 \param flag Texture creation flag.\r
1142                 \return The current texture creation flag enabled mode. */\r
1143                 virtual bool getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) const =0;\r
1144 \r
1145                 //! Creates a software images from a file.\r
1146                 /** No hardware texture will be created for those images. This\r
1147                 method is useful for example if you want to read a heightmap\r
1148                 for a terrain renderer.\r
1149                 \param filename Name of the file from which the images are created.\r
1150                 \param type Pointer to E_TEXTURE_TYPE where a recommended type of the texture will be stored.\r
1151                 \return The array of created images.\r
1152                 If you no longer need those images, you should call IImage::drop() on each of them.\r
1153                 See IReferenceCounted::drop() for more information. */\r
1154                 virtual core::array<IImage*> createImagesFromFile(const io::path& filename, E_TEXTURE_TYPE* type = 0) = 0;\r
1155 \r
1156                 //! Creates a software images from a file.\r
1157                 /** No hardware texture will be created for those images. This\r
1158                 method is useful for example if you want to read a heightmap\r
1159                 for a terrain renderer.\r
1160                 \param file File from which the image is created.\r
1161                 \param type Pointer to E_TEXTURE_TYPE where a recommended type of the texture will be stored.\r
1162                 \return The array of created images.\r
1163                 If you no longer need those images, you should call IImage::drop() on each of them.\r
1164                 See IReferenceCounted::drop() for more information. */\r
1165                 virtual core::array<IImage*> createImagesFromFile(io::IReadFile* file, E_TEXTURE_TYPE* type = 0) = 0;\r
1166 \r
1167                 //! Creates a software image from a file.\r
1168                 /** No hardware texture will be created for this image. This\r
1169                 method is useful for example if you want to read a heightmap\r
1170                 for a terrain renderer.\r
1171                 \param filename Name of the file from which the image is\r
1172                 created.\r
1173                 \return The created image.\r
1174                 If you no longer need the image, you should call IImage::drop().\r
1175                 See IReferenceCounted::drop() for more information. */\r
1176                 IImage* createImageFromFile(const io::path& filename)\r
1177                 {\r
1178                         core::array<IImage*> imageArray = createImagesFromFile(filename);\r
1179 \r
1180                         for (u32 i = 1; i < imageArray.size(); ++i)\r
1181                                 imageArray[i]->drop();\r
1182 \r
1183                         return (imageArray.size() > 0) ? imageArray[0] : 0;\r
1184                 }\r
1185 \r
1186                 //! Creates a software image from a file.\r
1187                 /** No hardware texture will be created for this image. This\r
1188                 method is useful for example if you want to read a heightmap\r
1189                 for a terrain renderer.\r
1190                 \param file File from which the image is created.\r
1191                 \return The created image.\r
1192                 If you no longer need the image, you should call IImage::drop().\r
1193                 See IReferenceCounted::drop() for more information. */\r
1194                 IImage* createImageFromFile(io::IReadFile* file)\r
1195                 {\r
1196                         core::array<IImage*> imageArray = createImagesFromFile(file);\r
1197 \r
1198                         for (u32 i = 1; i < imageArray.size(); ++i)\r
1199                                 imageArray[i]->drop();\r
1200 \r
1201                         return (imageArray.size() > 0) ? imageArray[0] : 0;\r
1202                 }\r
1203 \r
1204                 //! Writes the provided image to a file.\r
1205                 /** Requires that there is a suitable image writer registered\r
1206                 for writing the image.\r
1207                 \param image Image to write.\r
1208                 \param filename Name of the file to write.\r
1209                 \param param Control parameter for the backend (e.g. compression\r
1210                 level).\r
1211                 \return True on successful write. */\r
1212                 virtual bool writeImageToFile(IImage* image, const io::path& filename, u32 param = 0) = 0;\r
1213 \r
1214                 //! Writes the provided image to a file.\r
1215                 /** Requires that there is a suitable image writer registered\r
1216                 for writing the image.\r
1217                 \param image Image to write.\r
1218                 \param file  An already open io::IWriteFile object. The name\r
1219                 will be used to determine the appropriate image writer to use.\r
1220                 \param param Control parameter for the backend (e.g. compression\r
1221                 level).\r
1222                 \return True on successful write. */\r
1223                 virtual bool writeImageToFile(IImage* image, io::IWriteFile* file, u32 param =0) =0;\r
1224 \r
1225                 //! Creates a software image from a byte array.\r
1226                 /** No hardware texture will be created for this image. This\r
1227                 method is useful for example if you want to read a heightmap\r
1228                 for a terrain renderer.\r
1229                 \param format Desired color format of the texture\r
1230                 \param size Desired size of the image\r
1231                 \param data A byte array with pixel color information\r
1232                 \param ownForeignMemory If true, the image will use the data\r
1233                 pointer directly and own it afterward. If false, the memory\r
1234                 will by copied internally. \r
1235                 WARNING: Setting this to 'true' will not work across dll boundaries.\r
1236                 So unless you link Irrlicht statically you should keep this to 'false'.\r
1237                 The parameter is mainly for internal usage.\r
1238                 \param deleteMemory Whether the memory is deallocated upon\r
1239                 destruction.\r
1240                 \return The created image.\r
1241                 If you no longer need the image, you should call IImage::drop().\r
1242                 See IReferenceCounted::drop() for more information. */\r
1243                 virtual IImage* createImageFromData(ECOLOR_FORMAT format,\r
1244                         const core::dimension2d<u32>& size, void *data, bool ownForeignMemory = false,\r
1245                         bool deleteMemory = true) = 0;\r
1246 \r
1247                 //! Creates an empty software image.\r
1248                 /**\r
1249                 \param format Desired color format of the image.\r
1250                 \param size Size of the image to create.\r
1251                 \return The created image.\r
1252                 If you no longer need the image, you should call IImage::drop().\r
1253                 See IReferenceCounted::drop() for more information. */\r
1254                 virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0;\r
1255 \r
1256                 //! Creates a software image by converting it to given format from another image.\r
1257                 /** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.\r
1258                 \param format Desired color format of the image.\r
1259                 \param imageToCopy Image to copy to the new image.\r
1260                 \return The created image.\r
1261                 If you no longer need the image, you should call IImage::drop().\r
1262                 See IReferenceCounted::drop() for more information. */\r
1263                 _IRR_DEPRECATED_ virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0;\r
1264 \r
1265                 //! Creates a software image from a part of another image.\r
1266                 /** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.\r
1267                 \param imageToCopy Image to copy to the new image in part.\r
1268                 \param pos Position of rectangle to copy.\r
1269                 \param size Extents of rectangle to copy.\r
1270                 \return The created image.\r
1271                 If you no longer need the image, you should call IImage::drop().\r
1272                 See IReferenceCounted::drop() for more information. */\r
1273                 _IRR_DEPRECATED_ virtual IImage* createImage(IImage* imageToCopy,\r
1274                                 const core::position2d<s32>& pos,\r
1275                                 const core::dimension2d<u32>& size) =0;\r
1276 \r
1277                 //! Creates a software image from a part of a texture.\r
1278                 /**\r
1279                 \param texture Texture to copy to the new image in part.\r
1280                 \param pos Position of rectangle to copy.\r
1281                 \param size Extents of rectangle to copy.\r
1282                 \return The created image.\r
1283                 If you no longer need the image, you should call IImage::drop().\r
1284                 See IReferenceCounted::drop() for more information. */\r
1285                 virtual IImage* createImage(ITexture* texture,\r
1286                                 const core::position2d<s32>& pos,\r
1287                                 const core::dimension2d<u32>& size) =0;\r
1288 \r
1289                 //! Event handler for resize events. Only used by the engine internally.\r
1290                 /** Used to notify the driver that the window was resized.\r
1291                 Usually, there is no need to call this method. */\r
1292                 virtual void OnResize(const core::dimension2d<u32>& size) =0;\r
1293 \r
1294                 //! Adds a new material renderer to the video device.\r
1295                 /** Use this method to extend the VideoDriver with new material\r
1296                 types. To extend the engine using this method do the following:\r
1297                 Derive a class from IMaterialRenderer and override the methods\r
1298                 you need. For setting the right renderstates, you can try to\r
1299                 get a pointer to the real rendering device using\r
1300                 IVideoDriver::getExposedVideoData(). Add your class with\r
1301                 IVideoDriver::addMaterialRenderer(). To use an object being\r
1302                 displayed with your new material, set the MaterialType member of\r
1303                 the SMaterial struct to the value returned by this method.\r
1304                 If you simply want to create a new material using vertex and/or\r
1305                 pixel shaders it would be easier to use the\r
1306                 video::IGPUProgrammingServices interface which you can get\r
1307                 using the getGPUProgrammingServices() method.\r
1308                 \param renderer A pointer to the new renderer.\r
1309                 \param name Optional name for the material renderer entry.\r
1310                 \return The number of the material type which can be set in\r
1311                 SMaterial::MaterialType to use the renderer. -1 is returned if\r
1312                 an error occurred. For example if you tried to add an material\r
1313                 renderer to the software renderer or the null device, which do\r
1314                 not accept material renderers. */\r
1315                 virtual s32 addMaterialRenderer(IMaterialRenderer* renderer, const c8* name =0) =0;\r
1316 \r
1317                 //! Get access to a material renderer by index.\r
1318                 /** \param idx Id of the material renderer. Can be a value of\r
1319                 the E_MATERIAL_TYPE enum or a value which was returned by\r
1320                 addMaterialRenderer().\r
1321                 \return Pointer to material renderer or null if not existing. */\r
1322                 virtual IMaterialRenderer* getMaterialRenderer(u32 idx) const = 0;\r
1323 \r
1324                 //! Get amount of currently available material renderers.\r
1325                 /** \return Amount of currently available material renderers. */\r
1326                 virtual u32 getMaterialRendererCount() const =0;\r
1327 \r
1328                 //! Get name of a material renderer\r
1329                 /** This string can, e.g., be used to test if a specific\r
1330                 renderer already has been registered/created, or use this\r
1331                 string to store data about materials: This returned name will\r
1332                 be also used when serializing materials.\r
1333                 \param idx Id of the material renderer. Can be a value of the\r
1334                 E_MATERIAL_TYPE enum or a value which was returned by\r
1335                 addMaterialRenderer().\r
1336                 \return String with the name of the renderer, or 0 if not\r
1337                 exisiting */\r
1338                 virtual const c8* getMaterialRendererName(u32 idx) const =0;\r
1339 \r
1340                 //! Sets the name of a material renderer.\r
1341                 /** Will have no effect on built-in material renderers.\r
1342                 \param idx: Id of the material renderer. Can be a value of the\r
1343                 E_MATERIAL_TYPE enum or a value which was returned by\r
1344                 addMaterialRenderer().\r
1345                 \param name: New name of the material renderer. */\r
1346                 virtual void setMaterialRendererName(s32 idx, const c8* name) =0;\r
1347 \r
1348                 //! Swap the material renderers used for certain id's\r
1349                 /** Swap the IMaterialRenderers responsible for rendering specific\r
1350                  material-id's. This means every SMaterial using a MaterialType\r
1351                  with one of the indices involved here will now render differently.\r
1352                  \param idx1 First material index to swap. It must already exist or nothing happens.\r
1353                  \param idx2 Second material index to swap. It must already exist or nothing happens.\r
1354                  \param swapNames When true the renderer names also swap\r
1355                                   When false the names will stay at the original index */\r
1356                 virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames=true) = 0;\r
1357 \r
1358                 //! Creates material attributes list from a material\r
1359                 /** This method is useful for serialization and more.\r
1360                 Please note that the video driver will use the material\r
1361                 renderer names from getMaterialRendererName() to write out the\r
1362                 material type name, so they should be set before.\r
1363                 \param material The material to serialize.\r
1364                 \param options Additional options which might influence the\r
1365                 serialization.\r
1366                 \return The io::IAttributes container holding the material\r
1367                 properties. */\r
1368                 virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,\r
1369                         io::SAttributeReadWriteOptions* options=0) =0;\r
1370 \r
1371                 //! Fills an SMaterial structure from attributes.\r
1372                 /** Please note that for setting material types of the\r
1373                 material, the video driver will need to query the material\r
1374                 renderers for their names, so all non built-in materials must\r
1375                 have been created before calling this method.\r
1376                 \param outMaterial The material to set the properties for.\r
1377                 \param attributes The attributes to read from. */\r
1378                 virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) =0;\r
1379 \r
1380                 //! Returns driver and operating system specific data about the IVideoDriver.\r
1381                 /** This method should only be used if the engine should be\r
1382                 extended without having to modify the source of the engine.\r
1383                 \return Collection of device dependent pointers. */\r
1384                 virtual const SExposedVideoData& getExposedVideoData() =0;\r
1385 \r
1386                 //! Get type of video driver\r
1387                 /** \return Type of driver. */\r
1388                 virtual E_DRIVER_TYPE getDriverType() const =0;\r
1389 \r
1390                 //! Gets the IGPUProgrammingServices interface.\r
1391                 /** \return Pointer to the IGPUProgrammingServices. Returns 0\r
1392                 if the video driver does not support this. For example the\r
1393                 Software driver and the Null driver will always return 0. */\r
1394                 virtual IGPUProgrammingServices* getGPUProgrammingServices() =0;\r
1395 \r
1396                 //! Returns a pointer to the mesh manipulator.\r
1397                 virtual scene::IMeshManipulator* getMeshManipulator() =0;\r
1398 \r
1399                 //! Clear the color, depth and/or stencil buffers.\r
1400                 virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) = 0;\r
1401 \r
1402                 //! Clear the color, depth and/or stencil buffers.\r
1403                 _IRR_DEPRECATED_ void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color)\r
1404                 {\r
1405                         u16 flag = 0;\r
1406 \r
1407                         if (backBuffer)\r
1408                                 flag |= ECBF_COLOR;\r
1409 \r
1410                         if (depthBuffer)\r
1411                                 flag |= ECBF_DEPTH;\r
1412 \r
1413                         if (stencilBuffer)\r
1414                                 flag |= ECBF_STENCIL;\r
1415 \r
1416                         clearBuffers(flag, color);\r
1417                 }\r
1418 \r
1419                 //! Clears the ZBuffer.\r
1420                 /** Note that you usually need not to call this method, as it\r
1421                 is automatically done in IVideoDriver::beginScene() or\r
1422                 IVideoDriver::setRenderTarget() if you enable zBuffer. But if\r
1423                 you have to render some special things, you can clear the\r
1424                 zbuffer during the rendering process with this method any time.\r
1425                 */\r
1426                 _IRR_DEPRECATED_ void clearZBuffer()\r
1427                 {\r
1428                         clearBuffers(ECBF_DEPTH, SColor(255,0,0,0), 1.f, 0);\r
1429                 }\r
1430 \r
1431                 //! Make a screenshot of the last rendered frame.\r
1432                 /** \return An image created from the last rendered frame. */\r
1433                 virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) =0;\r
1434 \r
1435                 //! Check if the image is already loaded.\r
1436                 /** Works similar to getTexture(), but does not load the texture\r
1437                 if it is not currently loaded.\r
1438                 \param filename Name of the texture.\r
1439                 \return Pointer to loaded texture, or 0 if not found. */\r
1440                 virtual video::ITexture* findTexture(const io::path& filename) = 0;\r
1441 \r
1442                 //! Set or unset a clipping plane.\r
1443                 /** There are at least 6 clipping planes available for the user\r
1444                 to set at will.\r
1445                 \param index The plane index. Must be between 0 and\r
1446                 MaxUserClipPlanes.\r
1447                 \param plane The plane itself.\r
1448                 \param enable If true, enable the clipping plane else disable\r
1449                 it.\r
1450                 \return True if the clipping plane is usable. */\r
1451                 virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false) =0;\r
1452 \r
1453                 //! Enable or disable a clipping plane.\r
1454                 /** There are at least 6 clipping planes available for the user\r
1455                 to set at will.\r
1456                 \param index The plane index. Must be between 0 and\r
1457                 MaxUserClipPlanes.\r
1458                 \param enable If true, enable the clipping plane else disable\r
1459                 it. */\r
1460                 virtual void enableClipPlane(u32 index, bool enable) =0;\r
1461 \r
1462                 //! Set the minimum number of vertices for which a hw buffer will be created\r
1463                 /** \param count Number of vertices to set as minimum. */\r
1464                 virtual void setMinHardwareBufferVertexCount(u32 count) =0;\r
1465 \r
1466                 //! Get the global Material, which might override local materials.\r
1467                 /** Depending on the enable flags, values from this Material\r
1468                 are used to override those of local materials of some\r
1469                 meshbuffer being rendered.\r
1470                 \return Reference to the Override Material. */\r
1471                 virtual SOverrideMaterial& getOverrideMaterial() =0;\r
1472 \r
1473                 //! Get the 2d override material for altering its values\r
1474                 /** The 2d override material allows to alter certain render\r
1475                 states of the 2d methods. Not all members of SMaterial are\r
1476                 honored, especially not MaterialType and Textures. Moreover,\r
1477                 the zbuffer is always ignored, and lighting is always off. All\r
1478                 other flags can be changed, though some might have to effect\r
1479                 in most cases.\r
1480                 Please note that you have to enable/disable this effect with\r
1481                 enableMaterial2D(). This effect is costly, as it increases\r
1482                 the number of state changes considerably. Always reset the\r
1483                 values when done.\r
1484                 \return Material reference which should be altered to reflect\r
1485                 the new settings.\r
1486                 */\r
1487                 virtual SMaterial& getMaterial2D() =0;\r
1488 \r
1489                 //! Enable the 2d override material\r
1490                 /** \param enable Flag which tells whether the material shall be\r
1491                 enabled or disabled. */\r
1492                 virtual void enableMaterial2D(bool enable=true) =0;\r
1493 \r
1494                 //! Get the graphics card vendor name.\r
1495                 virtual core::stringc getVendorInfo() =0;\r
1496 \r
1497                 //! Only used by the engine internally.\r
1498                 /** The ambient color is set in the scene manager, see\r
1499                 scene::ISceneManager::setAmbientLight().\r
1500                 \param color New color of the ambient light. */\r
1501                 virtual void setAmbientLight(const SColorf& color) =0;\r
1502 \r
1503                 //! Get the global ambient light currently used by the driver\r
1504                 virtual const SColorf& getAmbientLight() const = 0;\r
1505 \r
1506                 //! Only used by the engine internally.\r
1507                 /** Passes the global material flag AllowZWriteOnTransparent.\r
1508                 Use the SceneManager attribute to set this value from your app.\r
1509                 \param flag Default behavior is to disable ZWrite, i.e. false. */\r
1510                 virtual void setAllowZWriteOnTransparent(bool flag) =0;\r
1511 \r
1512                 //! Get the maximum texture size supported.\r
1513                 virtual core::dimension2du getMaxTextureSize() const =0;\r
1514 \r
1515                 //! Color conversion convenience function\r
1516                 /** Convert an image (as array of pixels) from source to destination\r
1517                 array, thereby converting the color format. The pixel size is\r
1518                 determined by the color formats.\r
1519                 \param sP Pointer to source\r
1520                 \param sF Color format of source\r
1521                 \param sN Number of pixels to convert, both array must be large enough\r
1522                 \param dP Pointer to destination\r
1523                 \param dF Color format of destination\r
1524                 */\r
1525                 virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,\r
1526                                 void* dP, ECOLOR_FORMAT dF) const =0;\r
1527 \r
1528                 //! Check if the driver supports creating textures with the given color format\r
1529                 /**     \return True if the format is available, false if not. */\r
1530                 virtual bool queryTextureFormat(ECOLOR_FORMAT format) const = 0;\r
1531 \r
1532                 //! Used by some SceneNodes to check if a material should be rendered in the transparent render pass\r
1533                 virtual bool needsTransparentRenderPass(const irr::video::SMaterial& material) const = 0;\r
1534         };\r
1535 \r
1536 } // end namespace video\r
1537 } // end namespace irr\r
1538 \r
1539 \r
1540 #endif\r