]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/COpenGLDriver.h
Add back lighting system
[irrlicht.git] / source / Irrlicht / COpenGLDriver.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 __C_VIDEO_OPEN_GL_H_INCLUDED__\r
6 #define __C_VIDEO_OPEN_GL_H_INCLUDED__\r
7 \r
8 \r
9 #include "SIrrCreationParameters.h"\r
10 \r
11 namespace irr\r
12 {\r
13         class CIrrDeviceWin32;\r
14         class CIrrDeviceLinux;\r
15         class CIrrDeviceSDL;\r
16         class CIrrDeviceMacOSX;\r
17 }\r
18 \r
19 #ifdef _IRR_COMPILE_WITH_OPENGL_\r
20 \r
21 #include "IMaterialRendererServices.h"\r
22 #include "CNullDriver.h"\r
23 \r
24 #include "COpenGLExtensionHandler.h"\r
25 #include "IContextManager.h"\r
26 \r
27 namespace irr\r
28 {\r
29 \r
30 namespace video\r
31 {\r
32         class IContextManager;\r
33 \r
34         class COpenGLDriver : public CNullDriver, public IMaterialRendererServices, public COpenGLExtensionHandler\r
35         {\r
36         public:\r
37                 // Information about state of fixed pipeline activity.\r
38                 enum E_OPENGL_FIXED_PIPELINE_STATE\r
39                 {\r
40                         EOFPS_ENABLE = 0, // fixed pipeline.\r
41                         EOFPS_DISABLE, // programmable pipeline.\r
42                         EOFPS_ENABLE_TO_DISABLE, // switch from fixed to programmable pipeline.\r
43                         EOFPS_DISABLE_TO_ENABLE // switch from programmable to fixed pipeline.\r
44                 };\r
45 \r
46                 COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
47 \r
48                 bool initDriver();\r
49 \r
50                 //! destructor\r
51                 virtual ~COpenGLDriver();\r
52 \r
53                 virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0,\r
54                         const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0) override;\r
55 \r
56                 bool endScene() override;\r
57 \r
58                 //! sets transformation\r
59                 void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) override;\r
60 \r
61 \r
62                 struct SHWBufferLink_opengl : public SHWBufferLink\r
63                 {\r
64                         SHWBufferLink_opengl(const scene::IMeshBuffer *_MeshBuffer): SHWBufferLink(_MeshBuffer), vbo_verticesID(0),vbo_indicesID(0){}\r
65 \r
66                         GLuint vbo_verticesID; //tmp\r
67                         GLuint vbo_indicesID; //tmp\r
68 \r
69                         GLuint vbo_verticesSize; //tmp\r
70                         GLuint vbo_indicesSize; //tmp\r
71                 };\r
72 \r
73                 //! updates hardware buffer if needed\r
74                 bool updateHardwareBuffer(SHWBufferLink *HWBuffer) override;\r
75 \r
76                 //! Create hardware buffer from mesh\r
77                 SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer* mb) override;\r
78 \r
79                 //! Delete hardware buffer (only some drivers can)\r
80                 void deleteHardwareBuffer(SHWBufferLink *HWBuffer) override;\r
81 \r
82                 //! Draw hardware buffer\r
83                 void drawHardwareBuffer(SHWBufferLink *HWBuffer) override;\r
84 \r
85                 //! Create occlusion query.\r
86                 /** Use node for identification and mesh for occlusion test. */\r
87                 virtual void addOcclusionQuery(scene::ISceneNode* node,\r
88                                 const scene::IMesh* mesh=0) override;\r
89 \r
90                 //! Remove occlusion query.\r
91                 void removeOcclusionQuery(scene::ISceneNode* node) override;\r
92 \r
93                 //! Run occlusion query. Draws mesh stored in query.\r
94                 /** If the mesh shall not be rendered visible, use\r
95                 overrideMaterial to disable the color and depth buffer. */\r
96                 void runOcclusionQuery(scene::ISceneNode* node, bool visible=false) override;\r
97 \r
98                 //! Update occlusion query. Retrieves results from GPU.\r
99                 /** If the query shall not block, set the flag to false.\r
100                 Update might not occur in this case, though */\r
101                 void updateOcclusionQuery(scene::ISceneNode* node, bool block=true) override;\r
102 \r
103                 //! Return query result.\r
104                 /** Return value is the number of visible pixels/fragments.\r
105                 The value is a safe approximation, i.e. can be larger then the\r
106                 actual value of pixels. */\r
107                 u32 getOcclusionQueryResult(scene::ISceneNode* node) const override;\r
108 \r
109                 //! Create render target.\r
110                 IRenderTarget* addRenderTarget() override;\r
111 \r
112                 //! draws a vertex primitive list\r
113                 virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,\r
114                                 const void* indexList, u32 primitiveCount,\r
115                                 E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;\r
116 \r
117                 //! draws a vertex primitive list in 2d\r
118                 virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,\r
119                                 const void* indexList, u32 primitiveCount,\r
120                                 E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;\r
121 \r
122                 //! queries the features of the driver, returns true if feature is available\r
123                 bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override\r
124                 {\r
125                         return FeatureEnabled[feature] && COpenGLExtensionHandler::queryFeature(feature);\r
126                 }\r
127 \r
128                 //! Disable a feature of the driver.\r
129                 void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true) override;\r
130 \r
131                 //! Sets a material. All 3d drawing functions draw geometry now\r
132                 //! using this material.\r
133                 //! \param material: Material to be used from now on.\r
134                 void setMaterial(const SMaterial& material) override;\r
135 \r
136                 virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,\r
137                         const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,\r
138                         SColor color = SColor(255, 255, 255, 255), bool useAlphaChannelOfTexture = false) override;\r
139 \r
140                 virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,\r
141                         const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,\r
142                         const video::SColor* const colors = 0, bool useAlphaChannelOfTexture = false) override;\r
143 \r
144                 // Explicitly bring in base class methods, otherwise\r
145                 // this overload would hide them.\r
146                 using CNullDriver::draw2DImage;\r
147                 virtual void draw2DImage(const video::ITexture* texture, u32 layer, bool flip);\r
148 \r
149                 //! draws a set of 2d images, using a color and the alpha channel of the\r
150                 //! texture if desired.\r
151                 void draw2DImageBatch(const video::ITexture* texture,\r
152                                 const core::array<core::position2d<s32> >& positions,\r
153                                 const core::array<core::rect<s32> >& sourceRects,\r
154                                 const core::rect<s32>* clipRect,\r
155                                 SColor color,\r
156                                 bool useAlphaChannelOfTexture) override;\r
157 \r
158                 //! draws a set of 2d images, using a color and the alpha\r
159                 /** channel of the texture if desired. The images are drawn\r
160                 beginning at pos and concatenated in one line. All drawings\r
161                 are clipped against clipRect (if != 0).\r
162                 The subtextures are defined by the array of sourceRects\r
163                 and are chosen by the indices given.\r
164                 \param texture: Texture to be drawn.\r
165                 \param pos: Upper left 2d destination position where the image will be drawn.\r
166                 \param sourceRects: Source rectangles of the image.\r
167                 \param indices: List of indices which choose the actual rectangle used each time.\r
168                 \param clipRect: Pointer to rectangle on the screen where the image is clipped to.\r
169                 This pointer can be 0. Then the image is not clipped.\r
170                 \param color: Color with which the image is colored.\r
171                 Note that the alpha component is used: If alpha is other than 255, the image will be transparent.\r
172                 \param useAlphaChannelOfTexture: If true, the alpha channel of the texture is\r
173                 used to draw the image. */\r
174                 virtual void draw2DImageBatch(const video::ITexture* texture,\r
175                                 const core::position2d<s32>& pos,\r
176                                 const core::array<core::rect<s32> >& sourceRects,\r
177                                 const core::array<s32>& indices,\r
178                                 s32 kerningWidth=0,\r
179                                 const core::rect<s32>* clipRect=0,\r
180                                 SColor color=SColor(255,255,255,255),\r
181                                 bool useAlphaChannelOfTexture=false) override;\r
182 \r
183                 //! draw an 2d rectangle\r
184                 virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,\r
185                         const core::rect<s32>* clip = 0) override;\r
186 \r
187                 //!Draws an 2d rectangle with a gradient.\r
188                 virtual void draw2DRectangle(const core::rect<s32>& pos,\r
189                         SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,\r
190                         const core::rect<s32>* clip = 0) override;\r
191 \r
192                 //! Draws a 2d line.\r
193                 virtual void draw2DLine(const core::position2d<s32>& start,\r
194                                         const core::position2d<s32>& end,\r
195                                         SColor color=SColor(255,255,255,255)) override;\r
196 \r
197                 //! Draws a single pixel\r
198                 void drawPixel(u32 x, u32 y, const SColor & color) override;\r
199 \r
200                 //! Draws a 3d box\r
201                 void draw3DBox( const core::aabbox3d<f32>& box, SColor color = SColor(255,255,255,255 ) ) override;\r
202 \r
203                 //! Draws a 3d line.\r
204                 virtual void draw3DLine(const core::vector3df& start,\r
205                                         const core::vector3df& end,\r
206                                         SColor color = SColor(255,255,255,255)) override;\r
207 \r
208                 //! \return Returns the name of the video driver. Example: In case of the Direct3D8\r
209                 //! driver, it would return "Direct3D8.1".\r
210                 const wchar_t* getName() const override;\r
211 \r
212                 //! deletes all dynamic lights there are\r
213                 virtual void deleteAllDynamicLights() override;\r
214 \r
215                 //! adds a dynamic light, returning an index to the light\r
216                 //! \param light: the light data to use to create the light\r
217                 //! \return An index to the light, or -1 if an error occurs\r
218                 virtual s32 addDynamicLight(const SLight& light) override;\r
219 \r
220                 //! Turns a dynamic light on or off\r
221                 //! \param lightIndex: the index returned by addDynamicLight\r
222                 //! \param turnOn: true to turn the light on, false to turn it off\r
223                 virtual void turnLightOn(s32 lightIndex, bool turnOn) override;\r
224 \r
225                 //! returns the maximal amount of dynamic lights the device can handle\r
226                 virtual u32 getMaximalDynamicLightAmount() const override;\r
227 \r
228                 //! Sets the dynamic ambient light color. The default color is\r
229                 //! (0,0,0,0) which means it is dark.\r
230                 //! \param color: New color of the ambient light.\r
231                 void setAmbientLight(const SColorf& color) override;\r
232 \r
233                 //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do\r
234                 //! this: First, draw all geometry. Then use this method, to draw the shadow\r
235                 //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.\r
236                 void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible=0) override;\r
237 \r
238                 //! Fills the stencil shadow with color. After the shadow volume has been drawn\r
239                 //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
240                 //! to draw the color of the shadow.\r
241                 virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
242                         video::SColor leftUpEdge = video::SColor(0,0,0,0),\r
243                         video::SColor rightUpEdge = video::SColor(0,0,0,0),\r
244                         video::SColor leftDownEdge = video::SColor(0,0,0,0),\r
245                         video::SColor rightDownEdge = video::SColor(0,0,0,0)) override;\r
246 \r
247                 //! sets a viewport\r
248                 void setViewPort(const core::rect<s32>& area) override;\r
249 \r
250                 //! Sets the fog mode.\r
251                 virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start,\r
252                         f32 end, f32 density, bool pixelFog, bool rangeFog) override;\r
253 \r
254                 //! Only used by the internal engine. Used to notify the driver that\r
255                 //! the window was resized.\r
256                 void OnResize(const core::dimension2d<u32>& size) override;\r
257 \r
258                 //! Returns type of video driver\r
259                 E_DRIVER_TYPE getDriverType() const override;\r
260 \r
261                 //! get color format of the current color buffer\r
262                 ECOLOR_FORMAT getColorFormat() const override;\r
263 \r
264                 //! Returns the transformation set by setTransform\r
265                 const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const override;\r
266 \r
267                 //! Can be called by an IMaterialRenderer to make its work easier.\r
268                 virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,\r
269                         bool resetAllRenderstates) override;\r
270 \r
271                 //! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.\r
272                 virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates);\r
273 \r
274                 //! Get a vertex shader constant index.\r
275                 s32 getVertexShaderConstantID(const c8* name) override;\r
276 \r
277                 //! Get a pixel shader constant index.\r
278                 s32 getPixelShaderConstantID(const c8* name) override;\r
279 \r
280                 //! Sets a vertex shader constant.\r
281                 void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;\r
282 \r
283                 //! Sets a pixel shader constant.\r
284                 void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;\r
285 \r
286                 //! Sets a constant for the vertex shader based on an index.\r
287                 bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;\r
288 \r
289                 //! Int interface for the above.\r
290                 bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;\r
291 \r
292                 //! Uint interface for the above.\r
293                 bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;\r
294 \r
295                 //! Sets a constant for the pixel shader based on an index.\r
296                 bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;\r
297 \r
298                 //! Int interface for the above.\r
299                 bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;\r
300 \r
301                 //! Uint interface for the above.\r
302                 bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;\r
303 \r
304                 //! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled.\r
305                 //! Returns whether disabling was successful or not.\r
306                 bool disableTextures(u32 fromStage=0);\r
307 \r
308                 //! Adds a new material renderer to the VideoDriver, using\r
309                 //! extGLGetObjectParameteriv(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status)\r
310                 //! pixel and/or vertex shaders to render geometry.\r
311                 virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram,\r
312                         IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData) override;\r
313 \r
314                 //! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.\r
315                 virtual s32 addHighLevelShaderMaterial(\r
316                                 const c8* vertexShaderProgram,\r
317                                 const c8* vertexShaderEntryPointName,\r
318                                 E_VERTEX_SHADER_TYPE vsCompileTarget,\r
319                                 const c8* pixelShaderProgram,\r
320                                 const c8* pixelShaderEntryPointName,\r
321                                 E_PIXEL_SHADER_TYPE psCompileTarget,\r
322                                 const c8* geometryShaderProgram,\r
323                                 const c8* geometryShaderEntryPointName = "main",\r
324                                 E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,\r
325                                 scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,\r
326                                 scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,\r
327                                 u32 verticesOut = 0,\r
328                                 IShaderConstantSetCallBack* callback = 0,\r
329                                 E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,\r
330                                 s32 userData = 0) override;\r
331 \r
332                 //! Returns a pointer to the IVideoDriver interface. (Implementation for\r
333                 //! IMaterialRendererServices)\r
334                 IVideoDriver* getVideoDriver() override;\r
335 \r
336                 //! Returns the maximum amount of primitives (mostly vertices) which\r
337                 //! the device is able to render with one drawIndexedTriangleList\r
338                 //! call.\r
339                 u32 getMaximalPrimitiveCount() const override;\r
340 \r
341                 virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,\r
342                                 const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) override;\r
343 \r
344                 //! Creates a render target texture for a cubemap\r
345                 ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,\r
346                                 const io::path& name, const ECOLOR_FORMAT format) override;\r
347 \r
348                 virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),\r
349                         f32 clearDepth = 1.f, u8 clearStencil = 0) override;\r
350 \r
351                 void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) override;\r
352 \r
353                 //! Returns an image created from the last rendered frame.\r
354                 IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) override;\r
355 \r
356                 //! checks if an OpenGL error has happened and prints it (+ some internal code which is usually the line number)\r
357                 //! for performance reasons only available in debug mode\r
358                 bool testGLError(int code=0);\r
359 \r
360                 //! Set/unset a clipping plane.\r
361                 //! There are at least 6 clipping planes available for the user to set at will.\r
362                 //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes.\r
363                 //! \param plane: The plane itself.\r
364                 //! \param enable: If true, enable the clipping plane else disable it.\r
365                 bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false) override;\r
366 \r
367                 //! Enable/disable a clipping plane.\r
368                 //! There are at least 6 clipping planes available for the user to set at will.\r
369                 //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes.\r
370                 //! \param enable: If true, enable the clipping plane else disable it.\r
371                 void enableClipPlane(u32 index, bool enable) override;\r
372 \r
373                 //! Enable the 2d override material\r
374                 void enableMaterial2D(bool enable=true) override;\r
375 \r
376                 //! Returns the graphics card vendor name.\r
377                 core::stringc getVendorInfo() override {return VendorName;}\r
378 \r
379                 //! Returns the maximum texture size supported.\r
380                 core::dimension2du getMaxTextureSize() const override;\r
381 \r
382                 //! Removes a texture from the texture cache and deletes it, freeing lot of memory.\r
383                 void removeTexture(ITexture* texture) override;\r
384 \r
385                 //! Check if the driver supports creating textures with the given color format\r
386                 bool queryTextureFormat(ECOLOR_FORMAT format) const override;\r
387 \r
388                 //! Used by some SceneNodes to check if a material should be rendered in the transparent render pass\r
389                 bool needsTransparentRenderPass(const irr::video::SMaterial& material) const override;\r
390 \r
391                 //! Convert E_PRIMITIVE_TYPE to OpenGL equivalent\r
392                 GLenum primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const;\r
393 \r
394                 //! Convert E_BLEND_FACTOR to OpenGL equivalent\r
395                 GLenum getGLBlend(E_BLEND_FACTOR factor) const;\r
396 \r
397                 //! Get ZBuffer bits.\r
398                 GLenum getZBufferBits() const;\r
399 \r
400                 bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,\r
401                         GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;\r
402 \r
403                 //! Return info about fixed pipeline state.\r
404                 E_OPENGL_FIXED_PIPELINE_STATE getFixedPipelineState() const;\r
405 \r
406                 //! Set info about fixed pipeline state.\r
407                 void setFixedPipelineState(E_OPENGL_FIXED_PIPELINE_STATE state);\r
408 \r
409                 //! Get current material.\r
410                 const SMaterial& getCurrentMaterial() const;\r
411 \r
412                 COpenGLCacheHandler* getCacheHandler() const;\r
413 \r
414         private:\r
415 \r
416                 bool updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);\r
417                 bool updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);\r
418 \r
419                 void uploadClipPlane(u32 index);\r
420 \r
421                 //! inits the parts of the open gl driver used on all platforms\r
422                 bool genericDriverInit();\r
423 \r
424                 ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) override;\r
425 \r
426                 ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image) override;\r
427 \r
428                 //! creates a transposed matrix in supplied GLfloat array to pass to OpenGL\r
429                 inline void getGLMatrix(GLfloat gl_matrix[16], const core::matrix4& m);\r
430                 inline void getGLTextureMatrix(GLfloat gl_matrix[16], const core::matrix4& m);\r
431 \r
432                 //! get native wrap mode value\r
433                 GLint getTextureWrapMode(const u8 clamp);\r
434 \r
435                 //! sets the needed renderstates\r
436                 void setRenderStates3DMode();\r
437 \r
438                 //! sets the needed renderstates\r
439                 void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel);\r
440 \r
441                 void createMaterialRenderers();\r
442 \r
443                 //! Assign a hardware light to the specified requested light, if any\r
444                 //! free hardware lights exist.\r
445                 //! \param[in] lightIndex: the index of the requesting light\r
446                 void assignHardwareLight(u32 lightIndex);\r
447 \r
448                 //! helper function for render setup.\r
449                 void getColorBuffer(const void* vertices, u32 vertexCount, E_VERTEX_TYPE vType);\r
450 \r
451                 //! helper function doing the actual rendering.\r
452                 void renderArray(const void* indexList, u32 primitiveCount,\r
453                                 scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);\r
454 \r
455                 //! Same as `CacheHandler->setViewport`, but also sets `ViewPort`\r
456                 virtual void setViewPortRaw(u32 width, u32 height);\r
457 \r
458                 COpenGLCacheHandler* CacheHandler;\r
459 \r
460                 core::stringw Name;\r
461                 core::matrix4 Matrices[ETS_COUNT];\r
462                 core::array<u8> ColorBuffer;\r
463 \r
464                 //! enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates.\r
465                 enum E_RENDER_MODE\r
466                 {\r
467                         ERM_NONE = 0,   // no render state has been set yet.\r
468                         ERM_2D,         // 2d drawing rendermode\r
469                         ERM_3D          // 3d rendering mode\r
470                 };\r
471 \r
472                 E_RENDER_MODE CurrentRenderMode;\r
473                 //! bool to make all renderstates reset if set to true.\r
474                 bool ResetRenderStates;\r
475                 bool Transformation3DChanged;\r
476                 u8 AntiAlias;\r
477 \r
478                 SMaterial Material, LastMaterial;\r
479 \r
480                 struct SUserClipPlane\r
481                 {\r
482                         SUserClipPlane() : Enabled(false) {}\r
483                         core::plane3df Plane;\r
484                         bool Enabled;\r
485                 };\r
486                 core::array<SUserClipPlane> UserClipPlanes;\r
487 \r
488                 core::stringc VendorName;\r
489 \r
490                 core::matrix4 TextureFlipMatrix;\r
491 \r
492                 //! Color buffer format\r
493                 ECOLOR_FORMAT ColorFormat;\r
494 \r
495                 E_OPENGL_FIXED_PIPELINE_STATE FixedPipelineState;\r
496 \r
497                 SIrrlichtCreationParameters Params;\r
498 \r
499                 //! All the lights that have been requested; a hardware limited\r
500                 //! number of them will be used at once.\r
501                 struct RequestedLight\r
502                 {\r
503                         RequestedLight(SLight const & lightData)\r
504                                 : LightData(lightData), HardwareLightIndex(-1), DesireToBeOn(true) { }\r
505 \r
506                         SLight  LightData;\r
507                         s32     HardwareLightIndex; // GL_LIGHT0 - GL_LIGHT7\r
508                         bool    DesireToBeOn;\r
509                 };\r
510                 core::array<RequestedLight> RequestedLights;\r
511 \r
512                 //! Built-in 2D quad for 2D rendering.\r
513                 S3DVertex Quad2DVertices[4];\r
514                 static const u16 Quad2DIndices[4];\r
515 \r
516                 IContextManager* ContextManager;\r
517         };\r
518 \r
519 } // end namespace video\r
520 } // end namespace irr\r
521 \r
522 \r
523 #endif // _IRR_COMPILE_WITH_OPENGL_\r
524 #endif\r
525 \r