diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h | 1698 |
1 files changed, 849 insertions, 849 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h b/libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h index ead4776..8fddbee 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CNullDriver.h | |||
@@ -1,849 +1,849 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_VIDEO_NULL_H_INCLUDED__ | 5 | #ifndef __C_VIDEO_NULL_H_INCLUDED__ |
6 | #define __C_VIDEO_NULL_H_INCLUDED__ | 6 | #define __C_VIDEO_NULL_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IVideoDriver.h" | 8 | #include "IVideoDriver.h" |
9 | #include "IFileSystem.h" | 9 | #include "IFileSystem.h" |
10 | #include "IImagePresenter.h" | 10 | #include "IImagePresenter.h" |
11 | #include "IGPUProgrammingServices.h" | 11 | #include "IGPUProgrammingServices.h" |
12 | #include "irrArray.h" | 12 | #include "irrArray.h" |
13 | #include "irrString.h" | 13 | #include "irrString.h" |
14 | #include "irrMap.h" | 14 | #include "irrMap.h" |
15 | #include "IAttributes.h" | 15 | #include "IAttributes.h" |
16 | #include "IMesh.h" | 16 | #include "IMesh.h" |
17 | #include "IMeshBuffer.h" | 17 | #include "IMeshBuffer.h" |
18 | #include "IMeshSceneNode.h" | 18 | #include "IMeshSceneNode.h" |
19 | #include "CFPSCounter.h" | 19 | #include "CFPSCounter.h" |
20 | #include "S3DVertex.h" | 20 | #include "S3DVertex.h" |
21 | #include "SVertexIndex.h" | 21 | #include "SVertexIndex.h" |
22 | #include "SLight.h" | 22 | #include "SLight.h" |
23 | #include "SExposedVideoData.h" | 23 | #include "SExposedVideoData.h" |
24 | 24 | ||
25 | #ifdef _MSC_VER | 25 | #ifdef _MSC_VER |
26 | #pragma warning( disable: 4996) | 26 | #pragma warning( disable: 4996) |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | namespace irr | 29 | namespace irr |
30 | { | 30 | { |
31 | namespace io | 31 | namespace io |
32 | { | 32 | { |
33 | class IWriteFile; | 33 | class IWriteFile; |
34 | class IReadFile; | 34 | class IReadFile; |
35 | } // end namespace io | 35 | } // end namespace io |
36 | namespace video | 36 | namespace video |
37 | { | 37 | { |
38 | class IImageLoader; | 38 | class IImageLoader; |
39 | class IImageWriter; | 39 | class IImageWriter; |
40 | 40 | ||
41 | class CNullDriver : public IVideoDriver, public IGPUProgrammingServices | 41 | class CNullDriver : public IVideoDriver, public IGPUProgrammingServices |
42 | { | 42 | { |
43 | public: | 43 | public: |
44 | 44 | ||
45 | //! constructor | 45 | //! constructor |
46 | CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize); | 46 | CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize); |
47 | 47 | ||
48 | //! destructor | 48 | //! destructor |
49 | virtual ~CNullDriver(); | 49 | virtual ~CNullDriver(); |
50 | 50 | ||
51 | virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, | 51 | virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, |
52 | SColor color=SColor(255,0,0,0), | 52 | SColor color=SColor(255,0,0,0), |
53 | const SExposedVideoData& videoData=SExposedVideoData(), | 53 | const SExposedVideoData& videoData=SExposedVideoData(), |
54 | core::rect<s32>* sourceRect=0); | 54 | core::rect<s32>* sourceRect=0); |
55 | 55 | ||
56 | virtual bool endScene(); | 56 | virtual bool endScene(); |
57 | 57 | ||
58 | //! Disable a feature of the driver. | 58 | //! Disable a feature of the driver. |
59 | virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true); | 59 | virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true); |
60 | 60 | ||
61 | //! queries the features of the driver, returns true if feature is available | 61 | //! queries the features of the driver, returns true if feature is available |
62 | virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; | 62 | virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; |
63 | 63 | ||
64 | //! Get attributes of the actual video driver | 64 | //! Get attributes of the actual video driver |
65 | const io::IAttributes& getDriverAttributes() const; | 65 | const io::IAttributes& getDriverAttributes() const; |
66 | 66 | ||
67 | //! sets transformation | 67 | //! sets transformation |
68 | virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); | 68 | virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); |
69 | 69 | ||
70 | //! Retrieve the number of image loaders | 70 | //! Retrieve the number of image loaders |
71 | virtual u32 getImageLoaderCount() const; | 71 | virtual u32 getImageLoaderCount() const; |
72 | 72 | ||
73 | //! Retrieve the given image loader | 73 | //! Retrieve the given image loader |
74 | virtual IImageLoader* getImageLoader(u32 n); | 74 | virtual IImageLoader* getImageLoader(u32 n); |
75 | 75 | ||
76 | //! Retrieve the number of image writers | 76 | //! Retrieve the number of image writers |
77 | virtual u32 getImageWriterCount() const; | 77 | virtual u32 getImageWriterCount() const; |
78 | 78 | ||
79 | //! Retrieve the given image writer | 79 | //! Retrieve the given image writer |
80 | virtual IImageWriter* getImageWriter(u32 n); | 80 | virtual IImageWriter* getImageWriter(u32 n); |
81 | 81 | ||
82 | //! sets a material | 82 | //! sets a material |
83 | virtual void setMaterial(const SMaterial& material); | 83 | virtual void setMaterial(const SMaterial& material); |
84 | 84 | ||
85 | //! loads a Texture | 85 | //! loads a Texture |
86 | virtual ITexture* getTexture(const io::path& filename); | 86 | virtual ITexture* getTexture(const io::path& filename); |
87 | 87 | ||
88 | //! loads a Texture | 88 | //! loads a Texture |
89 | virtual ITexture* getTexture(io::IReadFile* file); | 89 | virtual ITexture* getTexture(io::IReadFile* file); |
90 | 90 | ||
91 | //! Returns a texture by index | 91 | //! Returns a texture by index |
92 | virtual ITexture* getTextureByIndex(u32 index); | 92 | virtual ITexture* getTextureByIndex(u32 index); |
93 | 93 | ||
94 | //! Returns amount of textures currently loaded | 94 | //! Returns amount of textures currently loaded |
95 | virtual u32 getTextureCount() const; | 95 | virtual u32 getTextureCount() const; |
96 | 96 | ||
97 | //! Renames a texture | 97 | //! Renames a texture |
98 | virtual void renameTexture(ITexture* texture, const io::path& newName); | 98 | virtual void renameTexture(ITexture* texture, const io::path& newName); |
99 | 99 | ||
100 | //! creates a Texture | 100 | //! creates a Texture |
101 | virtual ITexture* addTexture(const core::dimension2d<u32>& size, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8); | 101 | virtual ITexture* addTexture(const core::dimension2d<u32>& size, const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8); |
102 | 102 | ||
103 | //! sets a render target | 103 | //! sets a render target |
104 | virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer, | 104 | virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer, |
105 | bool clearZBuffer, SColor color); | 105 | bool clearZBuffer, SColor color); |
106 | 106 | ||
107 | //! set or reset special render targets | 107 | //! set or reset special render targets |
108 | virtual bool setRenderTarget(video::E_RENDER_TARGET target, bool clearTarget, | 108 | virtual bool setRenderTarget(video::E_RENDER_TARGET target, bool clearTarget, |
109 | bool clearZBuffer, SColor color); | 109 | bool clearZBuffer, SColor color); |
110 | 110 | ||
111 | //! Sets multiple render targets | 111 | //! Sets multiple render targets |
112 | virtual bool setRenderTarget(const core::array<video::IRenderTarget>& texture, | 112 | virtual bool setRenderTarget(const core::array<video::IRenderTarget>& texture, |
113 | bool clearBackBuffer=true, bool clearZBuffer=true, SColor color=SColor(0,0,0,0)); | 113 | bool clearBackBuffer=true, bool clearZBuffer=true, SColor color=SColor(0,0,0,0)); |
114 | 114 | ||
115 | //! sets a viewport | 115 | //! sets a viewport |
116 | virtual void setViewPort(const core::rect<s32>& area); | 116 | virtual void setViewPort(const core::rect<s32>& area); |
117 | 117 | ||
118 | //! gets the area of the current viewport | 118 | //! gets the area of the current viewport |
119 | virtual const core::rect<s32>& getViewPort() const; | 119 | virtual const core::rect<s32>& getViewPort() const; |
120 | 120 | ||
121 | //! draws a vertex primitive list | 121 | //! draws a vertex primitive list |
122 | virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, | 122 | virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, |
123 | const void* indexList, u32 primitiveCount, | 123 | const void* indexList, u32 primitiveCount, |
124 | E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT); | 124 | E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT); |
125 | 125 | ||
126 | //! draws a vertex primitive list in 2d | 126 | //! draws a vertex primitive list in 2d |
127 | virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount, | 127 | virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount, |
128 | const void* indexList, u32 primitiveCount, | 128 | const void* indexList, u32 primitiveCount, |
129 | E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT); | 129 | E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT); |
130 | 130 | ||
131 | //! Draws a 3d line. | 131 | //! Draws a 3d line. |
132 | virtual void draw3DLine(const core::vector3df& start, | 132 | virtual void draw3DLine(const core::vector3df& start, |
133 | const core::vector3df& end, SColor color = SColor(255,255,255,255)); | 133 | const core::vector3df& end, SColor color = SColor(255,255,255,255)); |
134 | 134 | ||
135 | //! Draws a 3d triangle. | 135 | //! Draws a 3d triangle. |
136 | virtual void draw3DTriangle(const core::triangle3df& triangle, | 136 | virtual void draw3DTriangle(const core::triangle3df& triangle, |
137 | SColor color = SColor(255,255,255,255)); | 137 | SColor color = SColor(255,255,255,255)); |
138 | 138 | ||
139 | //! Draws a 3d axis aligned box. | 139 | //! Draws a 3d axis aligned box. |
140 | virtual void draw3DBox(const core::aabbox3d<f32>& box, | 140 | virtual void draw3DBox(const core::aabbox3d<f32>& box, |
141 | SColor color = SColor(255,255,255,255)); | 141 | SColor color = SColor(255,255,255,255)); |
142 | 142 | ||
143 | //! draws an 2d image | 143 | //! draws an 2d image |
144 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos); | 144 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos); |
145 | 145 | ||
146 | //! draws a set of 2d images, using a color and the alpha | 146 | //! draws a set of 2d images, using a color and the alpha |
147 | /** channel of the texture if desired. The images are drawn | 147 | /** channel of the texture if desired. The images are drawn |
148 | beginning at pos and concatenated in one line. All drawings | 148 | beginning at pos and concatenated in one line. All drawings |
149 | are clipped against clipRect (if != 0). | 149 | are clipped against clipRect (if != 0). |
150 | The subtextures are defined by the array of sourceRects | 150 | The subtextures are defined by the array of sourceRects |
151 | and are chosen by the indices given. | 151 | and are chosen by the indices given. |
152 | \param texture: Texture to be drawn. | 152 | \param texture: Texture to be drawn. |
153 | \param pos: Upper left 2d destination position where the image will be drawn. | 153 | \param pos: Upper left 2d destination position where the image will be drawn. |
154 | \param sourceRects: Source rectangles of the image. | 154 | \param sourceRects: Source rectangles of the image. |
155 | \param indices: List of indices which choose the actual rectangle used each time. | 155 | \param indices: List of indices which choose the actual rectangle used each time. |
156 | \param kerningWidth: offset on position | 156 | \param kerningWidth: offset on position |
157 | \param clipRect: Pointer to rectangle on the screen where the image is clipped to. | 157 | \param clipRect: Pointer to rectangle on the screen where the image is clipped to. |
158 | This pointer can be 0. Then the image is not clipped. | 158 | This pointer can be 0. Then the image is not clipped. |
159 | \param color: Color with which the image is colored. | 159 | \param color: Color with which the image is colored. |
160 | Note that the alpha component is used: If alpha is other than 255, the image will be transparent. | 160 | Note that the alpha component is used: If alpha is other than 255, the image will be transparent. |
161 | \param useAlphaChannelOfTexture: If true, the alpha channel of the texture is | 161 | \param useAlphaChannelOfTexture: If true, the alpha channel of the texture is |
162 | used to draw the image. */ | 162 | used to draw the image. */ |
163 | virtual void draw2DImageBatch(const video::ITexture* texture, | 163 | virtual void draw2DImageBatch(const video::ITexture* texture, |
164 | const core::position2d<s32>& pos, | 164 | const core::position2d<s32>& pos, |
165 | const core::array<core::rect<s32> >& sourceRects, | 165 | const core::array<core::rect<s32> >& sourceRects, |
166 | const core::array<s32>& indices, | 166 | const core::array<s32>& indices, |
167 | s32 kerningWidth = 0, | 167 | s32 kerningWidth = 0, |
168 | const core::rect<s32>* clipRect = 0, | 168 | const core::rect<s32>* clipRect = 0, |
169 | SColor color=SColor(255,255,255,255), | 169 | SColor color=SColor(255,255,255,255), |
170 | bool useAlphaChannelOfTexture=false); | 170 | bool useAlphaChannelOfTexture=false); |
171 | 171 | ||
172 | //! Draws a set of 2d images, using a color and the alpha channel of the texture. | 172 | //! Draws a set of 2d images, using a color and the alpha channel of the texture. |
173 | /** All drawings are clipped against clipRect (if != 0). | 173 | /** All drawings are clipped against clipRect (if != 0). |
174 | The subtextures are defined by the array of sourceRects and are | 174 | The subtextures are defined by the array of sourceRects and are |
175 | positioned using the array of positions. | 175 | positioned using the array of positions. |
176 | \param texture Texture to be drawn. | 176 | \param texture Texture to be drawn. |
177 | \param pos Array of upper left 2d destinations where the images | 177 | \param pos Array of upper left 2d destinations where the images |
178 | will be drawn. | 178 | will be drawn. |
179 | \param sourceRects Source rectangles of the image. | 179 | \param sourceRects Source rectangles of the image. |
180 | \param clipRect Pointer to rectangle on the screen where the | 180 | \param clipRect Pointer to rectangle on the screen where the |
181 | images are clipped to. | 181 | images are clipped to. |
182 | If this pointer is 0 then the image is not clipped. | 182 | If this pointer is 0 then the image is not clipped. |
183 | \param color Color with which the image is drawn. | 183 | \param color Color with which the image is drawn. |
184 | Note that the alpha component is used. If alpha is other than | 184 | Note that the alpha component is used. If alpha is other than |
185 | 255, the image will be transparent. | 185 | 255, the image will be transparent. |
186 | \param useAlphaChannelOfTexture: If true, the alpha channel of | 186 | \param useAlphaChannelOfTexture: If true, the alpha channel of |
187 | the texture is used to draw the image. */ | 187 | the texture is used to draw the image. */ |
188 | virtual void draw2DImageBatch(const video::ITexture* texture, | 188 | virtual void draw2DImageBatch(const video::ITexture* texture, |
189 | const core::array<core::position2d<s32> >& positions, | 189 | const core::array<core::position2d<s32> >& positions, |
190 | const core::array<core::rect<s32> >& sourceRects, | 190 | const core::array<core::rect<s32> >& sourceRects, |
191 | const core::rect<s32>* clipRect=0, | 191 | const core::rect<s32>* clipRect=0, |
192 | SColor color=SColor(255,255,255,255), | 192 | SColor color=SColor(255,255,255,255), |
193 | bool useAlphaChannelOfTexture=false); | 193 | bool useAlphaChannelOfTexture=false); |
194 | 194 | ||
195 | //! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. | 195 | //! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. |
196 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, | 196 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, |
197 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | 197 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, |
198 | SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); | 198 | SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); |
199 | 199 | ||
200 | //! Draws a part of the texture into the rectangle. | 200 | //! Draws a part of the texture into the rectangle. |
201 | virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, | 201 | virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, |
202 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | 202 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, |
203 | const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); | 203 | const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); |
204 | 204 | ||
205 | //! Draws a 2d rectangle | 205 | //! Draws a 2d rectangle |
206 | virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip = 0); | 206 | virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip = 0); |
207 | 207 | ||
208 | //! Draws a 2d rectangle with a gradient. | 208 | //! Draws a 2d rectangle with a gradient. |
209 | virtual void draw2DRectangle(const core::rect<s32>& pos, | 209 | virtual void draw2DRectangle(const core::rect<s32>& pos, |
210 | SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, | 210 | SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, |
211 | const core::rect<s32>* clip = 0); | 211 | const core::rect<s32>* clip = 0); |
212 | 212 | ||
213 | //! Draws the outline of a 2d rectangle | 213 | //! Draws the outline of a 2d rectangle |
214 | virtual void draw2DRectangleOutline(const core::recti& pos, SColor color=SColor(255,255,255,255)); | 214 | virtual void draw2DRectangleOutline(const core::recti& pos, SColor color=SColor(255,255,255,255)); |
215 | 215 | ||
216 | //! Draws a 2d line. | 216 | //! Draws a 2d line. |
217 | virtual void draw2DLine(const core::position2d<s32>& start, | 217 | virtual void draw2DLine(const core::position2d<s32>& start, |
218 | const core::position2d<s32>& end, | 218 | const core::position2d<s32>& end, |
219 | SColor color=SColor(255,255,255,255)); | 219 | SColor color=SColor(255,255,255,255)); |
220 | 220 | ||
221 | //! Draws a pixel | 221 | //! Draws a pixel |
222 | virtual void drawPixel(u32 x, u32 y, const SColor & color); | 222 | virtual void drawPixel(u32 x, u32 y, const SColor & color); |
223 | 223 | ||
224 | //! Draws a non filled concyclic reqular 2d polyon. | 224 | //! Draws a non filled concyclic reqular 2d polyon. |
225 | virtual void draw2DPolygon(core::position2d<s32> center, | 225 | virtual void draw2DPolygon(core::position2d<s32> center, |
226 | f32 radius, video::SColor Color, s32 vertexCount); | 226 | f32 radius, video::SColor Color, s32 vertexCount); |
227 | 227 | ||
228 | virtual void setFog(SColor color=SColor(0,255,255,255), | 228 | virtual void setFog(SColor color=SColor(0,255,255,255), |
229 | E_FOG_TYPE fogType=EFT_FOG_LINEAR, | 229 | E_FOG_TYPE fogType=EFT_FOG_LINEAR, |
230 | f32 start=50.0f, f32 end=100.0f, f32 density=0.01f, | 230 | f32 start=50.0f, f32 end=100.0f, f32 density=0.01f, |
231 | bool pixelFog=false, bool rangeFog=false); | 231 | bool pixelFog=false, bool rangeFog=false); |
232 | 232 | ||
233 | virtual void getFog(SColor& color, E_FOG_TYPE& fogType, | 233 | virtual void getFog(SColor& color, E_FOG_TYPE& fogType, |
234 | f32& start, f32& end, f32& density, | 234 | f32& start, f32& end, f32& density, |
235 | bool& pixelFog, bool& rangeFog); | 235 | bool& pixelFog, bool& rangeFog); |
236 | 236 | ||
237 | //! get color format of the current color buffer | 237 | //! get color format of the current color buffer |
238 | virtual ECOLOR_FORMAT getColorFormat() const; | 238 | virtual ECOLOR_FORMAT getColorFormat() const; |
239 | 239 | ||
240 | //! get screen size | 240 | //! get screen size |
241 | virtual const core::dimension2d<u32>& getScreenSize() const; | 241 | virtual const core::dimension2d<u32>& getScreenSize() const; |
242 | 242 | ||
243 | //! get render target size | 243 | //! get render target size |
244 | virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const; | 244 | virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const; |
245 | 245 | ||
246 | // get current frames per second value | 246 | // get current frames per second value |
247 | virtual s32 getFPS() const; | 247 | virtual s32 getFPS() const; |
248 | 248 | ||
249 | //! returns amount of primitives (mostly triangles) were drawn in the last frame. | 249 | //! returns amount of primitives (mostly triangles) were drawn in the last frame. |
250 | //! very useful method for statistics. | 250 | //! very useful method for statistics. |
251 | virtual u32 getPrimitiveCountDrawn( u32 param = 0 ) const; | 251 | virtual u32 getPrimitiveCountDrawn( u32 param = 0 ) const; |
252 | 252 | ||
253 | //! deletes all dynamic lights there are | 253 | //! deletes all dynamic lights there are |
254 | virtual void deleteAllDynamicLights(); | 254 | virtual void deleteAllDynamicLights(); |
255 | 255 | ||
256 | //! adds a dynamic light, returning an index to the light | 256 | //! adds a dynamic light, returning an index to the light |
257 | //! \param light: the light data to use to create the light | 257 | //! \param light: the light data to use to create the light |
258 | //! \return An index to the light, or -1 if an error occurs | 258 | //! \return An index to the light, or -1 if an error occurs |
259 | virtual s32 addDynamicLight(const SLight& light); | 259 | virtual s32 addDynamicLight(const SLight& light); |
260 | 260 | ||
261 | //! Turns a dynamic light on or off | 261 | //! Turns a dynamic light on or off |
262 | //! \param lightIndex: the index returned by addDynamicLight | 262 | //! \param lightIndex: the index returned by addDynamicLight |
263 | //! \param turnOn: true to turn the light on, false to turn it off | 263 | //! \param turnOn: true to turn the light on, false to turn it off |
264 | virtual void turnLightOn(s32 lightIndex, bool turnOn); | 264 | virtual void turnLightOn(s32 lightIndex, bool turnOn); |
265 | 265 | ||
266 | //! returns the maximal amount of dynamic lights the device can handle | 266 | //! returns the maximal amount of dynamic lights the device can handle |
267 | virtual u32 getMaximalDynamicLightAmount() const; | 267 | virtual u32 getMaximalDynamicLightAmount() const; |
268 | 268 | ||
269 | //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 | 269 | //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 |
270 | //! driver, it would return "Direct3D8.1". | 270 | //! driver, it would return "Direct3D8.1". |
271 | virtual const wchar_t* getName() const; | 271 | virtual const wchar_t* getName() const; |
272 | 272 | ||
273 | //! Sets the dynamic ambient light color. The default color is | 273 | //! Sets the dynamic ambient light color. The default color is |
274 | //! (0,0,0,0) which means it is dark. | 274 | //! (0,0,0,0) which means it is dark. |
275 | //! \param color: New color of the ambient light. | 275 | //! \param color: New color of the ambient light. |
276 | virtual void setAmbientLight(const SColorf& color); | 276 | virtual void setAmbientLight(const SColorf& color); |
277 | 277 | ||
278 | //! Adds an external image loader to the engine. | 278 | //! Adds an external image loader to the engine. |
279 | virtual void addExternalImageLoader(IImageLoader* loader); | 279 | virtual void addExternalImageLoader(IImageLoader* loader); |
280 | 280 | ||
281 | //! Adds an external image writer to the engine. | 281 | //! Adds an external image writer to the engine. |
282 | virtual void addExternalImageWriter(IImageWriter* writer); | 282 | virtual void addExternalImageWriter(IImageWriter* writer); |
283 | 283 | ||
284 | //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do | 284 | //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do |
285 | //! this: Frist, draw all geometry. Then use this method, to draw the shadow | 285 | //! this: Frist, draw all geometry. Then use this method, to draw the shadow |
286 | //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. | 286 | //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. |
287 | virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0); | 287 | virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0); |
288 | 288 | ||
289 | //! Fills the stencil shadow with color. After the shadow volume has been drawn | 289 | //! Fills the stencil shadow with color. After the shadow volume has been drawn |
290 | //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this | 290 | //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this |
291 | //! to draw the color of the shadow. | 291 | //! to draw the color of the shadow. |
292 | virtual void drawStencilShadow(bool clearStencilBuffer=false, | 292 | virtual void drawStencilShadow(bool clearStencilBuffer=false, |
293 | video::SColor leftUpEdge = video::SColor(0,0,0,0), | 293 | video::SColor leftUpEdge = video::SColor(0,0,0,0), |
294 | video::SColor rightUpEdge = video::SColor(0,0,0,0), | 294 | video::SColor rightUpEdge = video::SColor(0,0,0,0), |
295 | video::SColor leftDownEdge = video::SColor(0,0,0,0), | 295 | video::SColor leftDownEdge = video::SColor(0,0,0,0), |
296 | video::SColor rightDownEdge = video::SColor(0,0,0,0)); | 296 | video::SColor rightDownEdge = video::SColor(0,0,0,0)); |
297 | 297 | ||
298 | //! Returns current amount of dynamic lights set | 298 | //! Returns current amount of dynamic lights set |
299 | //! \return Current amount of dynamic lights set | 299 | //! \return Current amount of dynamic lights set |
300 | virtual u32 getDynamicLightCount() const; | 300 | virtual u32 getDynamicLightCount() const; |
301 | 301 | ||
302 | //! Returns light data which was previously set with IVideDriver::addDynamicLight(). | 302 | //! Returns light data which was previously set with IVideDriver::addDynamicLight(). |
303 | //! \param idx: Zero based index of the light. Must be greater than 0 and smaller | 303 | //! \param idx: Zero based index of the light. Must be greater than 0 and smaller |
304 | //! than IVideoDriver()::getDynamicLightCount. | 304 | //! than IVideoDriver()::getDynamicLightCount. |
305 | //! \return Light data. | 305 | //! \return Light data. |
306 | virtual const SLight& getDynamicLight(u32 idx) const; | 306 | virtual const SLight& getDynamicLight(u32 idx) const; |
307 | 307 | ||
308 | //! Removes a texture from the texture cache and deletes it, freeing lot of | 308 | //! Removes a texture from the texture cache and deletes it, freeing lot of |
309 | //! memory. | 309 | //! memory. |
310 | virtual void removeTexture(ITexture* texture); | 310 | virtual void removeTexture(ITexture* texture); |
311 | 311 | ||
312 | //! Removes all texture from the texture cache and deletes them, freeing lot of | 312 | //! Removes all texture from the texture cache and deletes them, freeing lot of |
313 | //! memory. | 313 | //! memory. |
314 | virtual void removeAllTextures(); | 314 | virtual void removeAllTextures(); |
315 | 315 | ||
316 | //! Creates a render target texture. | 316 | //! Creates a render target texture. |
317 | virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, | 317 | virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, |
318 | const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN); | 318 | const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN); |
319 | 319 | ||
320 | //! Creates an 1bit alpha channel of the texture based of an color key. | 320 | //! Creates an 1bit alpha channel of the texture based of an color key. |
321 | virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color, bool zeroTexels) const; | 321 | virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color, bool zeroTexels) const; |
322 | 322 | ||
323 | //! Creates an 1bit alpha channel of the texture based of an color key position. | 323 | //! Creates an 1bit alpha channel of the texture based of an color key position. |
324 | virtual void makeColorKeyTexture(video::ITexture* texture, core::position2d<s32> colorKeyPixelPos, bool zeroTexels) const; | 324 | virtual void makeColorKeyTexture(video::ITexture* texture, core::position2d<s32> colorKeyPixelPos, bool zeroTexels) const; |
325 | 325 | ||
326 | //! Creates a normal map from a height map texture. | 326 | //! Creates a normal map from a height map texture. |
327 | //! \param amplitude: Constant value by which the height information is multiplied. | 327 | //! \param amplitude: Constant value by which the height information is multiplied. |
328 | virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const; | 328 | virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const; |
329 | 329 | ||
330 | //! Returns the maximum amount of primitives (mostly vertices) which | 330 | //! Returns the maximum amount of primitives (mostly vertices) which |
331 | //! the device is able to render with one drawIndexedTriangleList | 331 | //! the device is able to render with one drawIndexedTriangleList |
332 | //! call. | 332 | //! call. |
333 | virtual u32 getMaximalPrimitiveCount() const; | 333 | virtual u32 getMaximalPrimitiveCount() const; |
334 | 334 | ||
335 | //! Enables or disables a texture creation flag. | 335 | //! Enables or disables a texture creation flag. |
336 | virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled); | 336 | virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled); |
337 | 337 | ||
338 | //! Returns if a texture creation flag is enabled or disabled. | 338 | //! Returns if a texture creation flag is enabled or disabled. |
339 | virtual bool getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) const; | 339 | virtual bool getTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag) const; |
340 | 340 | ||
341 | //! Creates a software image from a file. | 341 | //! Creates a software image from a file. |
342 | virtual IImage* createImageFromFile(const io::path& filename); | 342 | virtual IImage* createImageFromFile(const io::path& filename); |
343 | 343 | ||
344 | //! Creates a software image from a file. | 344 | //! Creates a software image from a file. |
345 | virtual IImage* createImageFromFile(io::IReadFile* file); | 345 | virtual IImage* createImageFromFile(io::IReadFile* file); |
346 | 346 | ||
347 | //! Creates a software image from a byte array. | 347 | //! Creates a software image from a byte array. |
348 | /** \param useForeignMemory: If true, the image will use the data pointer | 348 | /** \param useForeignMemory: If true, the image will use the data pointer |
349 | directly and own it from now on, which means it will also try to delete [] the | 349 | directly and own it from now on, which means it will also try to delete [] the |
350 | data when the image will be destructed. If false, the memory will by copied. */ | 350 | data when the image will be destructed. If false, the memory will by copied. */ |
351 | virtual IImage* createImageFromData(ECOLOR_FORMAT format, | 351 | virtual IImage* createImageFromData(ECOLOR_FORMAT format, |
352 | const core::dimension2d<u32>& size, void *data, | 352 | const core::dimension2d<u32>& size, void *data, |
353 | bool ownForeignMemory=true, bool deleteForeignMemory = true); | 353 | bool ownForeignMemory=true, bool deleteForeignMemory = true); |
354 | 354 | ||
355 | //! Creates an empty software image. | 355 | //! Creates an empty software image. |
356 | virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size); | 356 | virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size); |
357 | 357 | ||
358 | 358 | ||
359 | //! Creates a software image from another image. | 359 | //! Creates a software image from another image. |
360 | virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy); | 360 | virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy); |
361 | 361 | ||
362 | //! Creates a software image from part of another image. | 362 | //! Creates a software image from part of another image. |
363 | virtual IImage* createImage(IImage* imageToCopy, | 363 | virtual IImage* createImage(IImage* imageToCopy, |
364 | const core::position2d<s32>& pos, | 364 | const core::position2d<s32>& pos, |
365 | const core::dimension2d<u32>& size); | 365 | const core::dimension2d<u32>& size); |
366 | 366 | ||
367 | //! Creates a software image from part of a texture. | 367 | //! Creates a software image from part of a texture. |
368 | virtual IImage* createImage(ITexture* texture, | 368 | virtual IImage* createImage(ITexture* texture, |
369 | const core::position2d<s32>& pos, | 369 | const core::position2d<s32>& pos, |
370 | const core::dimension2d<u32>& size); | 370 | const core::dimension2d<u32>& size); |
371 | 371 | ||
372 | //! Draws a mesh buffer | 372 | //! Draws a mesh buffer |
373 | virtual void drawMeshBuffer(const scene::IMeshBuffer* mb); | 373 | virtual void drawMeshBuffer(const scene::IMeshBuffer* mb); |
374 | 374 | ||
375 | //! Draws the normals of a mesh buffer | 375 | //! Draws the normals of a mesh buffer |
376 | virtual void drawMeshBufferNormals(const scene::IMeshBuffer* mb, f32 length=10.f, SColor color=0xffffffff); | 376 | virtual void drawMeshBufferNormals(const scene::IMeshBuffer* mb, f32 length=10.f, SColor color=0xffffffff); |
377 | 377 | ||
378 | protected: | 378 | protected: |
379 | struct SHWBufferLink | 379 | struct SHWBufferLink |
380 | { | 380 | { |
381 | SHWBufferLink(const scene::IMeshBuffer *_MeshBuffer) | 381 | SHWBufferLink(const scene::IMeshBuffer *_MeshBuffer) |
382 | :MeshBuffer(_MeshBuffer), | 382 | :MeshBuffer(_MeshBuffer), |
383 | ChangedID_Vertex(0),ChangedID_Index(0),LastUsed(0), | 383 | ChangedID_Vertex(0),ChangedID_Index(0),LastUsed(0), |
384 | Mapped_Vertex(scene::EHM_NEVER),Mapped_Index(scene::EHM_NEVER) | 384 | Mapped_Vertex(scene::EHM_NEVER),Mapped_Index(scene::EHM_NEVER) |
385 | { | 385 | { |
386 | if (MeshBuffer) | 386 | if (MeshBuffer) |
387 | MeshBuffer->grab(); | 387 | MeshBuffer->grab(); |
388 | } | 388 | } |
389 | 389 | ||
390 | virtual ~SHWBufferLink() | 390 | virtual ~SHWBufferLink() |
391 | { | 391 | { |
392 | if (MeshBuffer) | 392 | if (MeshBuffer) |
393 | MeshBuffer->drop(); | 393 | MeshBuffer->drop(); |
394 | } | 394 | } |
395 | 395 | ||
396 | const scene::IMeshBuffer *MeshBuffer; | 396 | const scene::IMeshBuffer *MeshBuffer; |
397 | u32 ChangedID_Vertex; | 397 | u32 ChangedID_Vertex; |
398 | u32 ChangedID_Index; | 398 | u32 ChangedID_Index; |
399 | u32 LastUsed; | 399 | u32 LastUsed; |
400 | scene::E_HARDWARE_MAPPING Mapped_Vertex; | 400 | scene::E_HARDWARE_MAPPING Mapped_Vertex; |
401 | scene::E_HARDWARE_MAPPING Mapped_Index; | 401 | scene::E_HARDWARE_MAPPING Mapped_Index; |
402 | }; | 402 | }; |
403 | 403 | ||
404 | //! Gets hardware buffer link from a meshbuffer (may create or update buffer) | 404 | //! Gets hardware buffer link from a meshbuffer (may create or update buffer) |
405 | virtual SHWBufferLink *getBufferLink(const scene::IMeshBuffer* mb); | 405 | virtual SHWBufferLink *getBufferLink(const scene::IMeshBuffer* mb); |
406 | 406 | ||
407 | //! updates hardware buffer if needed (only some drivers can) | 407 | //! updates hardware buffer if needed (only some drivers can) |
408 | virtual bool updateHardwareBuffer(SHWBufferLink *HWBuffer) {return false;} | 408 | virtual bool updateHardwareBuffer(SHWBufferLink *HWBuffer) {return false;} |
409 | 409 | ||
410 | //! Draw hardware buffer (only some drivers can) | 410 | //! Draw hardware buffer (only some drivers can) |
411 | virtual void drawHardwareBuffer(SHWBufferLink *HWBuffer) {} | 411 | virtual void drawHardwareBuffer(SHWBufferLink *HWBuffer) {} |
412 | 412 | ||
413 | //! Delete hardware buffer | 413 | //! Delete hardware buffer |
414 | virtual void deleteHardwareBuffer(SHWBufferLink *HWBuffer); | 414 | virtual void deleteHardwareBuffer(SHWBufferLink *HWBuffer); |
415 | 415 | ||
416 | //! Create hardware buffer from mesh (only some drivers can) | 416 | //! Create hardware buffer from mesh (only some drivers can) |
417 | virtual SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer* mb) {return 0;} | 417 | virtual SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer* mb) {return 0;} |
418 | 418 | ||
419 | public: | 419 | public: |
420 | //! Update all hardware buffers, remove unused ones | 420 | //! Update all hardware buffers, remove unused ones |
421 | virtual void updateAllHardwareBuffers(); | 421 | virtual void updateAllHardwareBuffers(); |
422 | 422 | ||
423 | //! Remove hardware buffer | 423 | //! Remove hardware buffer |
424 | virtual void removeHardwareBuffer(const scene::IMeshBuffer* mb); | 424 | virtual void removeHardwareBuffer(const scene::IMeshBuffer* mb); |
425 | 425 | ||
426 | //! Remove all hardware buffers | 426 | //! Remove all hardware buffers |
427 | virtual void removeAllHardwareBuffers(); | 427 | virtual void removeAllHardwareBuffers(); |
428 | 428 | ||
429 | //! is vbo recommended on this mesh? | 429 | //! is vbo recommended on this mesh? |
430 | virtual bool isHardwareBufferRecommend(const scene::IMeshBuffer* mb); | 430 | virtual bool isHardwareBufferRecommend(const scene::IMeshBuffer* mb); |
431 | 431 | ||
432 | //! Create occlusion query. | 432 | //! Create occlusion query. |
433 | /** Use node for identification and mesh for occlusion test. */ | 433 | /** Use node for identification and mesh for occlusion test. */ |
434 | virtual void addOcclusionQuery(scene::ISceneNode* node, | 434 | virtual void addOcclusionQuery(scene::ISceneNode* node, |
435 | const scene::IMesh* mesh=0); | 435 | const scene::IMesh* mesh=0); |
436 | 436 | ||
437 | //! Remove occlusion query. | 437 | //! Remove occlusion query. |
438 | virtual void removeOcclusionQuery(scene::ISceneNode* node); | 438 | virtual void removeOcclusionQuery(scene::ISceneNode* node); |
439 | 439 | ||
440 | //! Remove all occlusion queries. | 440 | //! Remove all occlusion queries. |
441 | virtual void removeAllOcclusionQueries(); | 441 | virtual void removeAllOcclusionQueries(); |
442 | 442 | ||
443 | //! Run occlusion query. Draws mesh stored in query. | 443 | //! Run occlusion query. Draws mesh stored in query. |
444 | /** If the mesh shall not be rendered visible, use | 444 | /** If the mesh shall not be rendered visible, use |
445 | overrideMaterial to disable the color and depth buffer. */ | 445 | overrideMaterial to disable the color and depth buffer. */ |
446 | virtual void runOcclusionQuery(scene::ISceneNode* node, bool visible=false); | 446 | virtual void runOcclusionQuery(scene::ISceneNode* node, bool visible=false); |
447 | 447 | ||
448 | //! Run all occlusion queries. Draws all meshes stored in queries. | 448 | //! Run all occlusion queries. Draws all meshes stored in queries. |
449 | /** If the meshes shall not be rendered visible, use | 449 | /** If the meshes shall not be rendered visible, use |
450 | overrideMaterial to disable the color and depth buffer. */ | 450 | overrideMaterial to disable the color and depth buffer. */ |
451 | virtual void runAllOcclusionQueries(bool visible=false); | 451 | virtual void runAllOcclusionQueries(bool visible=false); |
452 | 452 | ||
453 | //! Update occlusion query. Retrieves results from GPU. | 453 | //! Update occlusion query. Retrieves results from GPU. |
454 | /** If the query shall not block, set the flag to false. | 454 | /** If the query shall not block, set the flag to false. |
455 | Update might not occur in this case, though */ | 455 | Update might not occur in this case, though */ |
456 | virtual void updateOcclusionQuery(scene::ISceneNode* node, bool block=true); | 456 | virtual void updateOcclusionQuery(scene::ISceneNode* node, bool block=true); |
457 | 457 | ||
458 | //! Update all occlusion queries. Retrieves results from GPU. | 458 | //! Update all occlusion queries. Retrieves results from GPU. |
459 | /** If the query shall not block, set the flag to false. | 459 | /** If the query shall not block, set the flag to false. |
460 | Update might not occur in this case, though */ | 460 | Update might not occur in this case, though */ |
461 | virtual void updateAllOcclusionQueries(bool block=true); | 461 | virtual void updateAllOcclusionQueries(bool block=true); |
462 | 462 | ||
463 | //! Return query result. | 463 | //! Return query result. |
464 | /** Return value is the number of visible pixels/fragments. | 464 | /** Return value is the number of visible pixels/fragments. |
465 | The value is a safe approximation, i.e. can be larger than the | 465 | The value is a safe approximation, i.e. can be larger than the |
466 | actual value of pixels. */ | 466 | actual value of pixels. */ |
467 | virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const; | 467 | virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const; |
468 | 468 | ||
469 | //! Only used by the engine internally. | 469 | //! Only used by the engine internally. |
470 | /** Used to notify the driver that the window was resized. */ | 470 | /** Used to notify the driver that the window was resized. */ |
471 | virtual void OnResize(const core::dimension2d<u32>& size); | 471 | virtual void OnResize(const core::dimension2d<u32>& size); |
472 | 472 | ||
473 | //! Adds a new material renderer to the video device. | 473 | //! Adds a new material renderer to the video device. |
474 | virtual s32 addMaterialRenderer(IMaterialRenderer* renderer, | 474 | virtual s32 addMaterialRenderer(IMaterialRenderer* renderer, |
475 | const char* name = 0); | 475 | const char* name = 0); |
476 | 476 | ||
477 | //! Returns driver and operating system specific data about the IVideoDriver. | 477 | //! Returns driver and operating system specific data about the IVideoDriver. |
478 | virtual const SExposedVideoData& getExposedVideoData(); | 478 | virtual const SExposedVideoData& getExposedVideoData(); |
479 | 479 | ||
480 | //! Returns type of video driver | 480 | //! Returns type of video driver |
481 | virtual E_DRIVER_TYPE getDriverType() const; | 481 | virtual E_DRIVER_TYPE getDriverType() const; |
482 | 482 | ||
483 | //! Returns the transformation set by setTransform | 483 | //! Returns the transformation set by setTransform |
484 | virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; | 484 | virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; |
485 | 485 | ||
486 | //! Returns pointer to the IGPUProgrammingServices interface. | 486 | //! Returns pointer to the IGPUProgrammingServices interface. |
487 | virtual IGPUProgrammingServices* getGPUProgrammingServices(); | 487 | virtual IGPUProgrammingServices* getGPUProgrammingServices(); |
488 | 488 | ||
489 | //! Adds a new material renderer to the VideoDriver, using pixel and/or | 489 | //! Adds a new material renderer to the VideoDriver, using pixel and/or |
490 | //! vertex shaders to render geometry. | 490 | //! vertex shaders to render geometry. |
491 | virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0, | 491 | virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0, |
492 | const c8* pixelShaderProgram = 0, | 492 | const c8* pixelShaderProgram = 0, |
493 | IShaderConstantSetCallBack* callback = 0, | 493 | IShaderConstantSetCallBack* callback = 0, |
494 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 494 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
495 | s32 userData=0); | 495 | s32 userData=0); |
496 | 496 | ||
497 | //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the | 497 | //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the |
498 | //! programs from files. | 498 | //! programs from files. |
499 | virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram = 0, | 499 | virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram = 0, |
500 | io::IReadFile* pixelShaderProgram = 0, | 500 | io::IReadFile* pixelShaderProgram = 0, |
501 | IShaderConstantSetCallBack* callback = 0, | 501 | IShaderConstantSetCallBack* callback = 0, |
502 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 502 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
503 | s32 userData=0); | 503 | s32 userData=0); |
504 | 504 | ||
505 | //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the | 505 | //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the |
506 | //! programs from files. | 506 | //! programs from files. |
507 | virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName, | 507 | virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName, |
508 | const io::path& pixelShaderProgramFileName, | 508 | const io::path& pixelShaderProgramFileName, |
509 | IShaderConstantSetCallBack* callback = 0, | 509 | IShaderConstantSetCallBack* callback = 0, |
510 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 510 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
511 | s32 userData=0); | 511 | s32 userData=0); |
512 | 512 | ||
513 | //! Returns pointer to material renderer or null | 513 | //! Returns pointer to material renderer or null |
514 | virtual IMaterialRenderer* getMaterialRenderer(u32 idx); | 514 | virtual IMaterialRenderer* getMaterialRenderer(u32 idx); |
515 | 515 | ||
516 | //! Returns amount of currently available material renderers. | 516 | //! Returns amount of currently available material renderers. |
517 | virtual u32 getMaterialRendererCount() const; | 517 | virtual u32 getMaterialRendererCount() const; |
518 | 518 | ||
519 | //! Returns name of the material renderer | 519 | //! Returns name of the material renderer |
520 | virtual const char* getMaterialRendererName(u32 idx) const; | 520 | virtual const char* getMaterialRendererName(u32 idx) const; |
521 | 521 | ||
522 | //! Adds a new material renderer to the VideoDriver, based on a high level shading | 522 | //! Adds a new material renderer to the VideoDriver, based on a high level shading |
523 | //! language. Currently only HLSL in D3D9 is supported. | 523 | //! language. Currently only HLSL in D3D9 is supported. |
524 | virtual s32 addHighLevelShaderMaterial( | 524 | virtual s32 addHighLevelShaderMaterial( |
525 | const c8* vertexShaderProgram, | 525 | const c8* vertexShaderProgram, |
526 | const c8* vertexShaderEntryPointName = 0, | 526 | const c8* vertexShaderEntryPointName = 0, |
527 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, | 527 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, |
528 | const c8* pixelShaderProgram = 0, | 528 | const c8* pixelShaderProgram = 0, |
529 | const c8* pixelShaderEntryPointName = 0, | 529 | const c8* pixelShaderEntryPointName = 0, |
530 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, | 530 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, |
531 | const c8* geometryShaderProgram = 0, | 531 | const c8* geometryShaderProgram = 0, |
532 | const c8* geometryShaderEntryPointName = "main", | 532 | const c8* geometryShaderEntryPointName = "main", |
533 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, | 533 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, |
534 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | 534 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, |
535 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | 535 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, |
536 | u32 verticesOut = 0, | 536 | u32 verticesOut = 0, |
537 | IShaderConstantSetCallBack* callback = 0, | 537 | IShaderConstantSetCallBack* callback = 0, |
538 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 538 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
539 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); | 539 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); |
540 | 540 | ||
541 | //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), | 541 | //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), |
542 | //! but tries to load the programs from files. | 542 | //! but tries to load the programs from files. |
543 | virtual s32 addHighLevelShaderMaterialFromFiles( | 543 | virtual s32 addHighLevelShaderMaterialFromFiles( |
544 | const io::path& vertexShaderProgramFile, | 544 | const io::path& vertexShaderProgramFile, |
545 | const c8* vertexShaderEntryPointName = "main", | 545 | const c8* vertexShaderEntryPointName = "main", |
546 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, | 546 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, |
547 | const io::path& pixelShaderProgramFile = "", | 547 | const io::path& pixelShaderProgramFile = "", |
548 | const c8* pixelShaderEntryPointName = "main", | 548 | const c8* pixelShaderEntryPointName = "main", |
549 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, | 549 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, |
550 | const io::path& geometryShaderProgramFileName="", | 550 | const io::path& geometryShaderProgramFileName="", |
551 | const c8* geometryShaderEntryPointName = "main", | 551 | const c8* geometryShaderEntryPointName = "main", |
552 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, | 552 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, |
553 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | 553 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, |
554 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | 554 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, |
555 | u32 verticesOut = 0, | 555 | u32 verticesOut = 0, |
556 | IShaderConstantSetCallBack* callback = 0, | 556 | IShaderConstantSetCallBack* callback = 0, |
557 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 557 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
558 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); | 558 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); |
559 | 559 | ||
560 | //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), | 560 | //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), |
561 | //! but tries to load the programs from files. | 561 | //! but tries to load the programs from files. |
562 | virtual s32 addHighLevelShaderMaterialFromFiles( | 562 | virtual s32 addHighLevelShaderMaterialFromFiles( |
563 | io::IReadFile* vertexShaderProgram, | 563 | io::IReadFile* vertexShaderProgram, |
564 | const c8* vertexShaderEntryPointName = "main", | 564 | const c8* vertexShaderEntryPointName = "main", |
565 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, | 565 | E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1, |
566 | io::IReadFile* pixelShaderProgram = 0, | 566 | io::IReadFile* pixelShaderProgram = 0, |
567 | const c8* pixelShaderEntryPointName = "main", | 567 | const c8* pixelShaderEntryPointName = "main", |
568 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, | 568 | E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1, |
569 | io::IReadFile* geometryShaderProgram= 0, | 569 | io::IReadFile* geometryShaderProgram= 0, |
570 | const c8* geometryShaderEntryPointName = "main", | 570 | const c8* geometryShaderEntryPointName = "main", |
571 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, | 571 | E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0, |
572 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, | 572 | scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES, |
573 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, | 573 | scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP, |
574 | u32 verticesOut = 0, | 574 | u32 verticesOut = 0, |
575 | IShaderConstantSetCallBack* callback = 0, | 575 | IShaderConstantSetCallBack* callback = 0, |
576 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, | 576 | E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, |
577 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); | 577 | s32 userData = 0, E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT); |
578 | 578 | ||
579 | //! Returns a pointer to the mesh manipulator. | 579 | //! Returns a pointer to the mesh manipulator. |
580 | virtual scene::IMeshManipulator* getMeshManipulator(); | 580 | virtual scene::IMeshManipulator* getMeshManipulator(); |
581 | 581 | ||
582 | //! Clears the ZBuffer. | 582 | //! Clears the ZBuffer. |
583 | virtual void clearZBuffer(); | 583 | virtual void clearZBuffer(); |
584 | 584 | ||
585 | //! Returns an image created from the last rendered frame. | 585 | //! Returns an image created from the last rendered frame. |
586 | virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); | 586 | virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); |
587 | 587 | ||
588 | //! Writes the provided image to disk file | 588 | //! Writes the provided image to disk file |
589 | virtual bool writeImageToFile(IImage* image, const io::path& filename, u32 param = 0); | 589 | virtual bool writeImageToFile(IImage* image, const io::path& filename, u32 param = 0); |
590 | 590 | ||
591 | //! Writes the provided image to a file. | 591 | //! Writes the provided image to a file. |
592 | virtual bool writeImageToFile(IImage* image, io::IWriteFile * file, u32 param = 0); | 592 | virtual bool writeImageToFile(IImage* image, io::IWriteFile * file, u32 param = 0); |
593 | 593 | ||
594 | //! Sets the name of a material renderer. | 594 | //! Sets the name of a material renderer. |
595 | virtual void setMaterialRendererName(s32 idx, const char* name); | 595 | virtual void setMaterialRendererName(s32 idx, const char* name); |
596 | 596 | ||
597 | //! Creates material attributes list from a material, usable for serialization and more. | 597 | //! Creates material attributes list from a material, usable for serialization and more. |
598 | virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material, | 598 | virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material, |
599 | io::SAttributeReadWriteOptions* options=0); | 599 | io::SAttributeReadWriteOptions* options=0); |
600 | 600 | ||
601 | //! Fills an SMaterial structure from attributes. | 601 | //! Fills an SMaterial structure from attributes. |
602 | virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes); | 602 | virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes); |
603 | 603 | ||
604 | //! looks if the image is already loaded | 604 | //! looks if the image is already loaded |
605 | virtual video::ITexture* findTexture(const io::path& filename); | 605 | virtual video::ITexture* findTexture(const io::path& filename); |
606 | 606 | ||
607 | //! Set/unset a clipping plane. | 607 | //! Set/unset a clipping plane. |
608 | //! There are at least 6 clipping planes available for the user to set at will. | 608 | //! There are at least 6 clipping planes available for the user to set at will. |
609 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. | 609 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. |
610 | //! \param plane: The plane itself. | 610 | //! \param plane: The plane itself. |
611 | //! \param enable: If true, enable the clipping plane else disable it. | 611 | //! \param enable: If true, enable the clipping plane else disable it. |
612 | virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false); | 612 | virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false); |
613 | 613 | ||
614 | //! Enable/disable a clipping plane. | 614 | //! Enable/disable a clipping plane. |
615 | //! There are at least 6 clipping planes available for the user to set at will. | 615 | //! There are at least 6 clipping planes available for the user to set at will. |
616 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. | 616 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. |
617 | //! \param enable: If true, enable the clipping plane else disable it. | 617 | //! \param enable: If true, enable the clipping plane else disable it. |
618 | virtual void enableClipPlane(u32 index, bool enable); | 618 | virtual void enableClipPlane(u32 index, bool enable); |
619 | 619 | ||
620 | //! Returns the graphics card vendor name. | 620 | //! Returns the graphics card vendor name. |
621 | virtual core::stringc getVendorInfo() {return "Not available on this driver.";} | 621 | virtual core::stringc getVendorInfo() {return "Not available on this driver.";} |
622 | 622 | ||
623 | //! Set the minimum number of vertices for which a hw buffer will be created | 623 | //! Set the minimum number of vertices for which a hw buffer will be created |
624 | /** \param count Number of vertices to set as minimum. */ | 624 | /** \param count Number of vertices to set as minimum. */ |
625 | virtual void setMinHardwareBufferVertexCount(u32 count); | 625 | virtual void setMinHardwareBufferVertexCount(u32 count); |
626 | 626 | ||
627 | //! Get the global Material, which might override local materials. | 627 | //! Get the global Material, which might override local materials. |
628 | /** Depending on the enable flags, values from this Material | 628 | /** Depending on the enable flags, values from this Material |
629 | are used to override those of local materials of some | 629 | are used to override those of local materials of some |
630 | meshbuffer being rendered. */ | 630 | meshbuffer being rendered. */ |
631 | virtual SOverrideMaterial& getOverrideMaterial(); | 631 | virtual SOverrideMaterial& getOverrideMaterial(); |
632 | 632 | ||
633 | //! Get the 2d override material for altering its values | 633 | //! Get the 2d override material for altering its values |
634 | virtual SMaterial& getMaterial2D(); | 634 | virtual SMaterial& getMaterial2D(); |
635 | 635 | ||
636 | //! Enable the 2d override material | 636 | //! Enable the 2d override material |
637 | virtual void enableMaterial2D(bool enable=true); | 637 | virtual void enableMaterial2D(bool enable=true); |
638 | 638 | ||
639 | //! Only used by the engine internally. | 639 | //! Only used by the engine internally. |
640 | virtual void setAllowZWriteOnTransparent(bool flag) | 640 | virtual void setAllowZWriteOnTransparent(bool flag) |
641 | { AllowZWriteOnTransparent=flag; } | 641 | { AllowZWriteOnTransparent=flag; } |
642 | 642 | ||
643 | //! Returns the maximum texture size supported. | 643 | //! Returns the maximum texture size supported. |
644 | virtual core::dimension2du getMaxTextureSize() const; | 644 | virtual core::dimension2du getMaxTextureSize() const; |
645 | 645 | ||
646 | //! Color conversion convenience function | 646 | //! Color conversion convenience function |
647 | /** Convert an image (as array of pixels) from source to destination | 647 | /** Convert an image (as array of pixels) from source to destination |
648 | array, thereby converting the color format. The pixel size is | 648 | array, thereby converting the color format. The pixel size is |
649 | determined by the color formats. | 649 | determined by the color formats. |
650 | \param sP Pointer to source | 650 | \param sP Pointer to source |
651 | \param sF Color format of source | 651 | \param sF Color format of source |
652 | \param sN Number of pixels to convert, both array must be large enough | 652 | \param sN Number of pixels to convert, both array must be large enough |
653 | \param dP Pointer to destination | 653 | \param dP Pointer to destination |
654 | \param dF Color format of destination | 654 | \param dF Color format of destination |
655 | */ | 655 | */ |
656 | virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN, | 656 | virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN, |
657 | void* dP, ECOLOR_FORMAT dF) const; | 657 | void* dP, ECOLOR_FORMAT dF) const; |
658 | 658 | ||
659 | //! deprecated method | 659 | //! deprecated method |
660 | virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size, | 660 | virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size, |
661 | const c8* name=0); | 661 | const c8* name=0); |
662 | 662 | ||
663 | virtual bool checkDriverReset() {return false;} | 663 | virtual bool checkDriverReset() {return false;} |
664 | protected: | 664 | protected: |
665 | 665 | ||
666 | //! deletes all textures | 666 | //! deletes all textures |
667 | void deleteAllTextures(); | 667 | void deleteAllTextures(); |
668 | 668 | ||
669 | //! opens the file and loads it into the surface | 669 | //! opens the file and loads it into the surface |
670 | video::ITexture* loadTextureFromFile(io::IReadFile* file, const io::path& hashName = ""); | 670 | video::ITexture* loadTextureFromFile(io::IReadFile* file, const io::path& hashName = ""); |
671 | 671 | ||
672 | //! adds a surface, not loaded or created by the Irrlicht Engine | 672 | //! adds a surface, not loaded or created by the Irrlicht Engine |
673 | void addTexture(video::ITexture* surface); | 673 | void addTexture(video::ITexture* surface); |
674 | 674 | ||
675 | //! Creates a texture from a loaded IImage. | 675 | //! Creates a texture from a loaded IImage. |
676 | virtual ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData=0); | 676 | virtual ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData=0); |
677 | 677 | ||
678 | //! returns a device dependent texture from a software surface (IImage) | 678 | //! returns a device dependent texture from a software surface (IImage) |
679 | //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES | 679 | //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES |
680 | virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData=0); | 680 | virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData=0); |
681 | 681 | ||
682 | //! checks triangle count and print warning if wrong | 682 | //! checks triangle count and print warning if wrong |
683 | bool checkPrimitiveCount(u32 prmcnt) const; | 683 | bool checkPrimitiveCount(u32 prmcnt) const; |
684 | 684 | ||
685 | // adds a material renderer and drops it afterwards. To be used for internal creation | 685 | // adds a material renderer and drops it afterwards. To be used for internal creation |
686 | s32 addAndDropMaterialRenderer(IMaterialRenderer* m); | 686 | s32 addAndDropMaterialRenderer(IMaterialRenderer* m); |
687 | 687 | ||
688 | //! deletes all material renderers | 688 | //! deletes all material renderers |
689 | void deleteMaterialRenders(); | 689 | void deleteMaterialRenders(); |
690 | 690 | ||
691 | // prints renderer version | 691 | // prints renderer version |
692 | void printVersion(); | 692 | void printVersion(); |
693 | 693 | ||
694 | //! normal map lookup 32 bit version | 694 | //! normal map lookup 32 bit version |
695 | inline f32 nml32(int x, int y, int pitch, int height, s32 *p) const | 695 | inline f32 nml32(int x, int y, int pitch, int height, s32 *p) const |
696 | { | 696 | { |
697 | if (x < 0) x = pitch-1; if (x >= pitch) x = 0; | 697 | if (x < 0) x = pitch-1; if (x >= pitch) x = 0; |
698 | if (y < 0) y = height-1; if (y >= height) y = 0; | 698 | if (y < 0) y = height-1; if (y >= height) y = 0; |
699 | return (f32)(((p[(y * pitch) + x])>>16) & 0xff); | 699 | return (f32)(((p[(y * pitch) + x])>>16) & 0xff); |
700 | } | 700 | } |
701 | 701 | ||
702 | //! normal map lookup 16 bit version | 702 | //! normal map lookup 16 bit version |
703 | inline f32 nml16(int x, int y, int pitch, int height, s16 *p) const | 703 | inline f32 nml16(int x, int y, int pitch, int height, s16 *p) const |
704 | { | 704 | { |
705 | if (x < 0) x = pitch-1; if (x >= pitch) x = 0; | 705 | if (x < 0) x = pitch-1; if (x >= pitch) x = 0; |
706 | if (y < 0) y = height-1; if (y >= height) y = 0; | 706 | if (y < 0) y = height-1; if (y >= height) y = 0; |
707 | 707 | ||
708 | return (f32) getAverage ( p[(y * pitch) + x] ); | 708 | return (f32) getAverage ( p[(y * pitch) + x] ); |
709 | } | 709 | } |
710 | 710 | ||
711 | struct SSurface | 711 | struct SSurface |
712 | { | 712 | { |
713 | video::ITexture* Surface; | 713 | video::ITexture* Surface; |
714 | 714 | ||
715 | bool operator < (const SSurface& other) const | 715 | bool operator < (const SSurface& other) const |
716 | { | 716 | { |
717 | return Surface->getName() < other.Surface->getName(); | 717 | return Surface->getName() < other.Surface->getName(); |
718 | } | 718 | } |
719 | }; | 719 | }; |
720 | 720 | ||
721 | struct SMaterialRenderer | 721 | struct SMaterialRenderer |
722 | { | 722 | { |
723 | core::stringc Name; | 723 | core::stringc Name; |
724 | IMaterialRenderer* Renderer; | 724 | IMaterialRenderer* Renderer; |
725 | }; | 725 | }; |
726 | 726 | ||
727 | struct SDummyTexture : public ITexture | 727 | struct SDummyTexture : public ITexture |
728 | { | 728 | { |
729 | SDummyTexture(const io::path& name) : ITexture(name), size(0,0) {}; | 729 | SDummyTexture(const io::path& name) : ITexture(name), size(0,0) {}; |
730 | 730 | ||
731 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) { return 0; }; | 731 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) { return 0; }; |
732 | virtual void unlock(){} | 732 | virtual void unlock(){} |
733 | virtual const core::dimension2d<u32>& getOriginalSize() const { return size; } | 733 | virtual const core::dimension2d<u32>& getOriginalSize() const { return size; } |
734 | virtual const core::dimension2d<u32>& getSize() const { return size; } | 734 | virtual const core::dimension2d<u32>& getSize() const { return size; } |
735 | virtual E_DRIVER_TYPE getDriverType() const { return video::EDT_NULL; } | 735 | virtual E_DRIVER_TYPE getDriverType() const { return video::EDT_NULL; } |
736 | virtual ECOLOR_FORMAT getColorFormat() const { return video::ECF_A1R5G5B5; }; | 736 | virtual ECOLOR_FORMAT getColorFormat() const { return video::ECF_A1R5G5B5; }; |
737 | virtual u32 getPitch() const { return 0; } | 737 | virtual u32 getPitch() const { return 0; } |
738 | virtual void regenerateMipMapLevels(void* mipmapData=0) {}; | 738 | virtual void regenerateMipMapLevels(void* mipmapData=0) {}; |
739 | core::dimension2d<u32> size; | 739 | core::dimension2d<u32> size; |
740 | }; | 740 | }; |
741 | core::array<SSurface> Textures; | 741 | core::array<SSurface> Textures; |
742 | 742 | ||
743 | struct SOccQuery | 743 | struct SOccQuery |
744 | { | 744 | { |
745 | SOccQuery(scene::ISceneNode* node, const scene::IMesh* mesh=0) : Node(node), Mesh(mesh), PID(0), Result(~0), Run(~0) | 745 | SOccQuery(scene::ISceneNode* node, const scene::IMesh* mesh=0) : Node(node), Mesh(mesh), PID(0), Result(~0), Run(~0) |
746 | { | 746 | { |
747 | if (Node) | 747 | if (Node) |
748 | Node->grab(); | 748 | Node->grab(); |
749 | if (Mesh) | 749 | if (Mesh) |
750 | Mesh->grab(); | 750 | Mesh->grab(); |
751 | } | 751 | } |
752 | 752 | ||
753 | SOccQuery(const SOccQuery& other) : Node(other.Node), Mesh(other.Mesh), PID(other.PID), Result(other.Result), Run(other.Run) | 753 | SOccQuery(const SOccQuery& other) : Node(other.Node), Mesh(other.Mesh), PID(other.PID), Result(other.Result), Run(other.Run) |
754 | { | 754 | { |
755 | if (Node) | 755 | if (Node) |
756 | Node->grab(); | 756 | Node->grab(); |
757 | if (Mesh) | 757 | if (Mesh) |
758 | Mesh->grab(); | 758 | Mesh->grab(); |
759 | } | 759 | } |
760 | 760 | ||
761 | ~SOccQuery() | 761 | ~SOccQuery() |
762 | { | 762 | { |
763 | if (Node) | 763 | if (Node) |
764 | Node->drop(); | 764 | Node->drop(); |
765 | if (Mesh) | 765 | if (Mesh) |
766 | Mesh->drop(); | 766 | Mesh->drop(); |
767 | } | 767 | } |
768 | 768 | ||
769 | SOccQuery& operator=(const SOccQuery& other) | 769 | SOccQuery& operator=(const SOccQuery& other) |
770 | { | 770 | { |
771 | Node=other.Node; | 771 | Node=other.Node; |
772 | Mesh=other.Mesh; | 772 | Mesh=other.Mesh; |
773 | PID=other.PID; | 773 | PID=other.PID; |
774 | Result=other.Result; | 774 | Result=other.Result; |
775 | Run=other.Run; | 775 | Run=other.Run; |
776 | if (Node) | 776 | if (Node) |
777 | Node->grab(); | 777 | Node->grab(); |
778 | if (Mesh) | 778 | if (Mesh) |
779 | Mesh->grab(); | 779 | Mesh->grab(); |
780 | return *this; | 780 | return *this; |
781 | } | 781 | } |
782 | 782 | ||
783 | bool operator==(const SOccQuery& other) const | 783 | bool operator==(const SOccQuery& other) const |
784 | { | 784 | { |
785 | return other.Node==Node; | 785 | return other.Node==Node; |
786 | } | 786 | } |
787 | 787 | ||
788 | scene::ISceneNode* Node; | 788 | scene::ISceneNode* Node; |
789 | const scene::IMesh* Mesh; | 789 | const scene::IMesh* Mesh; |
790 | union | 790 | union |
791 | { | 791 | { |
792 | void* PID; | 792 | void* PID; |
793 | unsigned int UID; | 793 | unsigned int UID; |
794 | }; | 794 | }; |
795 | u32 Result; | 795 | u32 Result; |
796 | u32 Run; | 796 | u32 Run; |
797 | }; | 797 | }; |
798 | core::array<SOccQuery> OcclusionQueries; | 798 | core::array<SOccQuery> OcclusionQueries; |
799 | 799 | ||
800 | core::array<video::IImageLoader*> SurfaceLoader; | 800 | core::array<video::IImageLoader*> SurfaceLoader; |
801 | core::array<video::IImageWriter*> SurfaceWriter; | 801 | core::array<video::IImageWriter*> SurfaceWriter; |
802 | core::array<SLight> Lights; | 802 | core::array<SLight> Lights; |
803 | core::array<SMaterialRenderer> MaterialRenderers; | 803 | core::array<SMaterialRenderer> MaterialRenderers; |
804 | 804 | ||
805 | //core::array<SHWBufferLink*> HWBufferLinks; | 805 | //core::array<SHWBufferLink*> HWBufferLinks; |
806 | core::map< const scene::IMeshBuffer* , SHWBufferLink* > HWBufferMap; | 806 | core::map< const scene::IMeshBuffer* , SHWBufferLink* > HWBufferMap; |
807 | 807 | ||
808 | io::IFileSystem* FileSystem; | 808 | io::IFileSystem* FileSystem; |
809 | 809 | ||
810 | //! mesh manipulator | 810 | //! mesh manipulator |
811 | scene::IMeshManipulator* MeshManipulator; | 811 | scene::IMeshManipulator* MeshManipulator; |
812 | 812 | ||
813 | core::rect<s32> ViewPort; | 813 | core::rect<s32> ViewPort; |
814 | core::dimension2d<u32> ScreenSize; | 814 | core::dimension2d<u32> ScreenSize; |
815 | core::matrix4 TransformationMatrix; | 815 | core::matrix4 TransformationMatrix; |
816 | 816 | ||
817 | CFPSCounter FPSCounter; | 817 | CFPSCounter FPSCounter; |
818 | 818 | ||
819 | u32 PrimitivesDrawn; | 819 | u32 PrimitivesDrawn; |
820 | u32 MinVertexCountForVBO; | 820 | u32 MinVertexCountForVBO; |
821 | 821 | ||
822 | u32 TextureCreationFlags; | 822 | u32 TextureCreationFlags; |
823 | 823 | ||
824 | f32 FogStart; | 824 | f32 FogStart; |
825 | f32 FogEnd; | 825 | f32 FogEnd; |
826 | f32 FogDensity; | 826 | f32 FogDensity; |
827 | SColor FogColor; | 827 | SColor FogColor; |
828 | SExposedVideoData ExposedData; | 828 | SExposedVideoData ExposedData; |
829 | 829 | ||
830 | io::IAttributes* DriverAttributes; | 830 | io::IAttributes* DriverAttributes; |
831 | 831 | ||
832 | SOverrideMaterial OverrideMaterial; | 832 | SOverrideMaterial OverrideMaterial; |
833 | SMaterial OverrideMaterial2D; | 833 | SMaterial OverrideMaterial2D; |
834 | SMaterial InitMaterial2D; | 834 | SMaterial InitMaterial2D; |
835 | bool OverrideMaterial2DEnabled; | 835 | bool OverrideMaterial2DEnabled; |
836 | 836 | ||
837 | E_FOG_TYPE FogType; | 837 | E_FOG_TYPE FogType; |
838 | bool PixelFog; | 838 | bool PixelFog; |
839 | bool RangeFog; | 839 | bool RangeFog; |
840 | bool AllowZWriteOnTransparent; | 840 | bool AllowZWriteOnTransparent; |
841 | 841 | ||
842 | bool FeatureEnabled[video::EVDF_COUNT]; | 842 | bool FeatureEnabled[video::EVDF_COUNT]; |
843 | }; | 843 | }; |
844 | 844 | ||
845 | } // end namespace video | 845 | } // end namespace video |
846 | } // end namespace irr | 846 | } // end namespace irr |
847 | 847 | ||
848 | 848 | ||
849 | #endif | 849 | #endif |