diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h | 682 |
1 files changed, 341 insertions, 341 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h b/libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h index e9428a9..b950538 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CD3D8Driver.h | |||
@@ -1,341 +1,341 @@ | |||
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_DIRECTX_8_H_INCLUDED__ | 5 | #ifndef __C_VIDEO_DIRECTX_8_H_INCLUDED__ |
6 | #define __C_VIDEO_DIRECTX_8_H_INCLUDED__ | 6 | #define __C_VIDEO_DIRECTX_8_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IrrCompileConfig.h" | 8 | #include "IrrCompileConfig.h" |
9 | 9 | ||
10 | #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ | 10 | #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ |
11 | 11 | ||
12 | #ifdef _IRR_WINDOWS_ | 12 | #ifdef _IRR_WINDOWS_ |
13 | #define WIN32_LEAN_AND_MEAN | 13 | #define WIN32_LEAN_AND_MEAN |
14 | #include <windows.h> | 14 | #include <windows.h> |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #include "SIrrCreationParameters.h" | 17 | #include "SIrrCreationParameters.h" |
18 | // always included for static createDriver function | 18 | // always included for static createDriver function |
19 | #include "CNullDriver.h" | 19 | #include "CNullDriver.h" |
20 | #include "IMaterialRendererServices.h" | 20 | #include "IMaterialRendererServices.h" |
21 | 21 | ||
22 | #include <d3d8.h> | 22 | #include <d3d8.h> |
23 | 23 | ||
24 | namespace irr | 24 | namespace irr |
25 | { | 25 | { |
26 | namespace video | 26 | namespace video |
27 | { | 27 | { |
28 | class CD3D8Driver : public CNullDriver, IMaterialRendererServices | 28 | class CD3D8Driver : public CNullDriver, IMaterialRendererServices |
29 | { | 29 | { |
30 | friend class CD3D8Texture; | 30 | friend class CD3D8Texture; |
31 | 31 | ||
32 | public: | 32 | public: |
33 | 33 | ||
34 | //! constructor | 34 | //! constructor |
35 | CD3D8Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io); | 35 | CD3D8Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io); |
36 | 36 | ||
37 | //! destructor | 37 | //! destructor |
38 | virtual ~CD3D8Driver(); | 38 | virtual ~CD3D8Driver(); |
39 | 39 | ||
40 | //! applications must call this method before performing any rendering. returns false if failed. | 40 | //! applications must call this method before performing any rendering. returns false if failed. |
41 | virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, | 41 | virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, |
42 | SColor color=SColor(255,0,0,0), | 42 | SColor color=SColor(255,0,0,0), |
43 | const SExposedVideoData& videoData=SExposedVideoData(), | 43 | const SExposedVideoData& videoData=SExposedVideoData(), |
44 | core::rect<s32>* sourceRect=0); | 44 | core::rect<s32>* sourceRect=0); |
45 | 45 | ||
46 | //! applications must call this method after performing any rendering. returns false if failed. | 46 | //! applications must call this method after performing any rendering. returns false if failed. |
47 | virtual bool endScene(); | 47 | virtual bool endScene(); |
48 | 48 | ||
49 | //! queries the features of the driver, returns true if feature is available | 49 | //! queries the features of the driver, returns true if feature is available |
50 | virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; | 50 | virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; |
51 | 51 | ||
52 | //! sets transformation | 52 | //! sets transformation |
53 | virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); | 53 | virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); |
54 | 54 | ||
55 | //! sets a material | 55 | //! sets a material |
56 | virtual void setMaterial(const SMaterial& material); | 56 | virtual void setMaterial(const SMaterial& material); |
57 | 57 | ||
58 | //! sets a render target | 58 | //! sets a render target |
59 | virtual bool setRenderTarget(video::ITexture* texture, | 59 | virtual bool setRenderTarget(video::ITexture* texture, |
60 | bool clearBackBuffer=true, bool clearZBuffer=true, | 60 | bool clearBackBuffer=true, bool clearZBuffer=true, |
61 | SColor color=video::SColor(0,0,0,0)); | 61 | SColor color=video::SColor(0,0,0,0)); |
62 | 62 | ||
63 | //! sets a viewport | 63 | //! sets a viewport |
64 | virtual void setViewPort(const core::rect<s32>& area); | 64 | virtual void setViewPort(const core::rect<s32>& area); |
65 | 65 | ||
66 | //! gets the area of the current viewport | 66 | //! gets the area of the current viewport |
67 | virtual const core::rect<s32>& getViewPort() const; | 67 | virtual const core::rect<s32>& getViewPort() const; |
68 | 68 | ||
69 | //! draws a vertex primitive list | 69 | //! draws a vertex primitive list |
70 | virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, | 70 | virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, |
71 | const void* indexList, u32 primitiveCount, | 71 | const void* indexList, u32 primitiveCount, |
72 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, | 72 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, |
73 | E_INDEX_TYPE iType); | 73 | E_INDEX_TYPE iType); |
74 | 74 | ||
75 | //! draws a vertex primitive list in 2d | 75 | //! draws a vertex primitive list in 2d |
76 | virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount, | 76 | virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount, |
77 | const void* indexList, u32 primitiveCount, | 77 | const void* indexList, u32 primitiveCount, |
78 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, | 78 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, |
79 | E_INDEX_TYPE iType); | 79 | E_INDEX_TYPE iType); |
80 | 80 | ||
81 | //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. | 81 | //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. |
82 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, | 82 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, |
83 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | 83 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, |
84 | SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); | 84 | SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); |
85 | 85 | ||
86 | //! Draws a part of the texture into the rectangle. | 86 | //! Draws a part of the texture into the rectangle. |
87 | virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, | 87 | virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, |
88 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | 88 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, |
89 | const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); | 89 | const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); |
90 | 90 | ||
91 | //!Draws an 2d rectangle with a gradient. | 91 | //!Draws an 2d rectangle with a gradient. |
92 | virtual void draw2DRectangle(const core::rect<s32>& pos, | 92 | virtual void draw2DRectangle(const core::rect<s32>& pos, |
93 | SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, | 93 | SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, |
94 | const core::rect<s32>* clip = 0); | 94 | const core::rect<s32>* clip = 0); |
95 | 95 | ||
96 | //! Draws a 2d line. | 96 | //! Draws a 2d line. |
97 | virtual void draw2DLine(const core::position2d<s32>& start, | 97 | virtual void draw2DLine(const core::position2d<s32>& start, |
98 | const core::position2d<s32>& end, | 98 | const core::position2d<s32>& end, |
99 | SColor color=SColor(255,255,255,255)); | 99 | SColor color=SColor(255,255,255,255)); |
100 | 100 | ||
101 | //! Draws a pixel. | 101 | //! Draws a pixel. |
102 | virtual void drawPixel(u32 x, u32 y, const SColor & color); | 102 | virtual void drawPixel(u32 x, u32 y, const SColor & color); |
103 | 103 | ||
104 | //! Draws a 3d line. | 104 | //! Draws a 3d line. |
105 | virtual void draw3DLine(const core::vector3df& start, | 105 | virtual void draw3DLine(const core::vector3df& start, |
106 | const core::vector3df& end, SColor color = SColor(255,255,255,255)); | 106 | const core::vector3df& end, SColor color = SColor(255,255,255,255)); |
107 | 107 | ||
108 | //! initialises the Direct3D API | 108 | //! initialises the Direct3D API |
109 | bool initDriver(HWND hwnd, bool pureSoftware); | 109 | bool initDriver(HWND hwnd, bool pureSoftware); |
110 | 110 | ||
111 | //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 | 111 | //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 |
112 | //! driver, it would return "Direct3D8.1". | 112 | //! driver, it would return "Direct3D8.1". |
113 | virtual const wchar_t* getName() const; | 113 | virtual const wchar_t* getName() const; |
114 | 114 | ||
115 | //! deletes all dynamic lights there are | 115 | //! deletes all dynamic lights there are |
116 | virtual void deleteAllDynamicLights(); | 116 | virtual void deleteAllDynamicLights(); |
117 | 117 | ||
118 | //! adds a dynamic light, returning an index to the light | 118 | //! adds a dynamic light, returning an index to the light |
119 | //! \param light: the light data to use to create the light | 119 | //! \param light: the light data to use to create the light |
120 | //! \return An index to the light, or -1 if an error occurs | 120 | //! \return An index to the light, or -1 if an error occurs |
121 | virtual s32 addDynamicLight(const SLight& light); | 121 | virtual s32 addDynamicLight(const SLight& light); |
122 | 122 | ||
123 | //! Turns a dynamic light on or off | 123 | //! Turns a dynamic light on or off |
124 | //! \param lightIndex: the index returned by addDynamicLight | 124 | //! \param lightIndex: the index returned by addDynamicLight |
125 | //! \param turnOn: true to turn the light on, false to turn it off | 125 | //! \param turnOn: true to turn the light on, false to turn it off |
126 | virtual void turnLightOn(s32 lightIndex, bool turnOn); | 126 | virtual void turnLightOn(s32 lightIndex, bool turnOn); |
127 | 127 | ||
128 | //! returns the maximal amount of dynamic lights the device can handle | 128 | //! returns the maximal amount of dynamic lights the device can handle |
129 | virtual u32 getMaximalDynamicLightAmount() const; | 129 | virtual u32 getMaximalDynamicLightAmount() const; |
130 | 130 | ||
131 | //! Sets the dynamic ambient light color. The default color is | 131 | //! Sets the dynamic ambient light color. The default color is |
132 | //! (0,0,0,0) which means it is dark. | 132 | //! (0,0,0,0) which means it is dark. |
133 | //! \param color: New color of the ambient light. | 133 | //! \param color: New color of the ambient light. |
134 | virtual void setAmbientLight(const SColorf& color); | 134 | virtual void setAmbientLight(const SColorf& color); |
135 | 135 | ||
136 | //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do | 136 | //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do |
137 | //! this: Frist, draw all geometry. Then use this method, to draw the shadow | 137 | //! this: Frist, draw all geometry. Then use this method, to draw the shadow |
138 | //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. | 138 | //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. |
139 | virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0); | 139 | virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0); |
140 | 140 | ||
141 | //! Fills the stencil shadow with color. After the shadow volume has been drawn | 141 | //! Fills the stencil shadow with color. After the shadow volume has been drawn |
142 | //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this | 142 | //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this |
143 | //! to draw the color of the shadow. | 143 | //! to draw the color of the shadow. |
144 | virtual void drawStencilShadow(bool clearStencilBuffer=false, | 144 | virtual void drawStencilShadow(bool clearStencilBuffer=false, |
145 | video::SColor leftUpEdge = video::SColor(0,0,0,0), | 145 | video::SColor leftUpEdge = video::SColor(0,0,0,0), |
146 | video::SColor rightUpEdge = video::SColor(0,0,0,0), | 146 | video::SColor rightUpEdge = video::SColor(0,0,0,0), |
147 | video::SColor leftDownEdge = video::SColor(0,0,0,0), | 147 | video::SColor leftDownEdge = video::SColor(0,0,0,0), |
148 | video::SColor rightDownEdge = video::SColor(0,0,0,0)); | 148 | video::SColor rightDownEdge = video::SColor(0,0,0,0)); |
149 | 149 | ||
150 | //! Returns the maximum amount of primitives (mostly vertices) which | 150 | //! Returns the maximum amount of primitives (mostly vertices) which |
151 | //! the device is able to render with one drawIndexedTriangleList | 151 | //! the device is able to render with one drawIndexedTriangleList |
152 | //! call. | 152 | //! call. |
153 | virtual u32 getMaximalPrimitiveCount() const; | 153 | virtual u32 getMaximalPrimitiveCount() const; |
154 | 154 | ||
155 | //! Enables or disables a texture creation flag. | 155 | //! Enables or disables a texture creation flag. |
156 | virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled); | 156 | virtual void setTextureCreationFlag(E_TEXTURE_CREATION_FLAG flag, bool enabled); |
157 | 157 | ||
158 | //! Sets the fog mode. | 158 | //! Sets the fog mode. |
159 | virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start, | 159 | virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start, |
160 | f32 end, f32 density, bool pixelFog, bool rangeFog); | 160 | f32 end, f32 density, bool pixelFog, bool rangeFog); |
161 | 161 | ||
162 | //! Only used by the internal engine. Used to notify the driver that | 162 | //! Only used by the internal engine. Used to notify the driver that |
163 | //! the window was resized. | 163 | //! the window was resized. |
164 | virtual void OnResize(const core::dimension2d<u32>& size); | 164 | virtual void OnResize(const core::dimension2d<u32>& size); |
165 | 165 | ||
166 | //! Returns type of video driver | 166 | //! Returns type of video driver |
167 | virtual E_DRIVER_TYPE getDriverType() const; | 167 | virtual E_DRIVER_TYPE getDriverType() const; |
168 | 168 | ||
169 | //! Returns the transformation set by setTransform | 169 | //! Returns the transformation set by setTransform |
170 | virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; | 170 | virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; |
171 | 171 | ||
172 | //! Can be called by an IMaterialRenderer to make its work easier. | 172 | //! Can be called by an IMaterialRenderer to make its work easier. |
173 | virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, | 173 | virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, |
174 | bool resetAllRenderstates); | 174 | bool resetAllRenderstates); |
175 | 175 | ||
176 | //! Sets a vertex shader constant. | 176 | //! Sets a vertex shader constant. |
177 | virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); | 177 | virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); |
178 | 178 | ||
179 | //! Sets a pixel shader constant. | 179 | //! Sets a pixel shader constant. |
180 | virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); | 180 | virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); |
181 | 181 | ||
182 | //! Sets a constant for the vertex shader based on a name. | 182 | //! Sets a constant for the vertex shader based on a name. |
183 | virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); | 183 | virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); |
184 | 184 | ||
185 | //! Bool interface for the above. | 185 | //! Bool interface for the above. |
186 | virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count); | 186 | virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count); |
187 | 187 | ||
188 | //! Int interface for the above. | 188 | //! Int interface for the above. |
189 | virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); | 189 | virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); |
190 | 190 | ||
191 | //! Sets a constant for the pixel shader based on a name. | 191 | //! Sets a constant for the pixel shader based on a name. |
192 | virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); | 192 | virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); |
193 | 193 | ||
194 | //! Bool interface for the above. | 194 | //! Bool interface for the above. |
195 | virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count); | 195 | virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count); |
196 | 196 | ||
197 | //! Int interface for the above. | 197 | //! Int interface for the above. |
198 | virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); | 198 | virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); |
199 | 199 | ||
200 | //! Returns a pointer to the IVideoDriver interface. (Implementation for | 200 | //! Returns a pointer to the IVideoDriver interface. (Implementation for |
201 | //! IMaterialRendererServices) | 201 | //! IMaterialRendererServices) |
202 | virtual IVideoDriver* getVideoDriver(); | 202 | virtual IVideoDriver* getVideoDriver(); |
203 | 203 | ||
204 | //! Creates a render target texture. | 204 | //! Creates a render target texture. |
205 | virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, | 205 | virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, |
206 | const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN); | 206 | const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN); |
207 | 207 | ||
208 | //! Clears the ZBuffer. | 208 | //! Clears the ZBuffer. |
209 | virtual void clearZBuffer(); | 209 | virtual void clearZBuffer(); |
210 | 210 | ||
211 | //! Returns an image created from the last rendered frame. | 211 | //! Returns an image created from the last rendered frame. |
212 | virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); | 212 | virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); |
213 | 213 | ||
214 | //! Set/unset a clipping plane. | 214 | //! Set/unset a clipping plane. |
215 | //! There are at least 6 clipping planes available for the user to set at will. | 215 | //! There are at least 6 clipping planes available for the user to set at will. |
216 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. | 216 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. |
217 | //! \param plane: The plane itself. | 217 | //! \param plane: The plane itself. |
218 | //! \param enable: If true, enable the clipping plane else disable it. | 218 | //! \param enable: If true, enable the clipping plane else disable it. |
219 | virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false); | 219 | virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable=false); |
220 | 220 | ||
221 | //! Enable/disable a clipping plane. | 221 | //! Enable/disable a clipping plane. |
222 | //! There are at least 6 clipping planes available for the user to set at will. | 222 | //! There are at least 6 clipping planes available for the user to set at will. |
223 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. | 223 | //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. |
224 | //! \param enable: If true, enable the clipping plane else disable it. | 224 | //! \param enable: If true, enable the clipping plane else disable it. |
225 | virtual void enableClipPlane(u32 index, bool enable); | 225 | virtual void enableClipPlane(u32 index, bool enable); |
226 | 226 | ||
227 | //! Returns the maximum texture size supported. | 227 | //! Returns the maximum texture size supported. |
228 | virtual core::dimension2du getMaxTextureSize() const; | 228 | virtual core::dimension2du getMaxTextureSize() const; |
229 | 229 | ||
230 | virtual bool checkDriverReset() {return DriverWasReset;} | 230 | virtual bool checkDriverReset() {return DriverWasReset;} |
231 | private: | 231 | private: |
232 | 232 | ||
233 | // enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates. | 233 | // enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates. |
234 | enum E_RENDER_MODE | 234 | enum E_RENDER_MODE |
235 | { | 235 | { |
236 | ERM_NONE = 0, // no render state has been set yet. | 236 | ERM_NONE = 0, // no render state has been set yet. |
237 | ERM_2D, // 2d drawing rendermode | 237 | ERM_2D, // 2d drawing rendermode |
238 | ERM_3D, // 3d rendering mode | 238 | ERM_3D, // 3d rendering mode |
239 | ERM_STENCIL_FILL, // stencil fill mode | 239 | ERM_STENCIL_FILL, // stencil fill mode |
240 | ERM_SHADOW_VOLUME_ZFAIL, // stencil volume draw mode | 240 | ERM_SHADOW_VOLUME_ZFAIL, // stencil volume draw mode |
241 | ERM_SHADOW_VOLUME_ZPASS // stencil volume draw mode | 241 | ERM_SHADOW_VOLUME_ZPASS // stencil volume draw mode |
242 | }; | 242 | }; |
243 | 243 | ||
244 | //! sets right vertex shader | 244 | //! sets right vertex shader |
245 | void setVertexShader(video::E_VERTEX_TYPE newType); | 245 | void setVertexShader(video::E_VERTEX_TYPE newType); |
246 | 246 | ||
247 | //! sets the needed renderstates | 247 | //! sets the needed renderstates |
248 | bool setRenderStates3DMode(); | 248 | bool setRenderStates3DMode(); |
249 | 249 | ||
250 | //! sets the needed renderstates | 250 | //! sets the needed renderstates |
251 | void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel); | 251 | void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel); |
252 | 252 | ||
253 | //! sets the needed renderstates | 253 | //! sets the needed renderstates |
254 | void setRenderStatesStencilFillMode(bool alpha); | 254 | void setRenderStatesStencilFillMode(bool alpha); |
255 | 255 | ||
256 | //! sets the needed renderstates | 256 | //! sets the needed renderstates |
257 | void setRenderStatesStencilShadowMode(bool zfail, u32 debugDataVisible); | 257 | void setRenderStatesStencilShadowMode(bool zfail, u32 debugDataVisible); |
258 | 258 | ||
259 | //! sets the current Texture | 259 | //! sets the current Texture |
260 | bool setActiveTexture(u32 stage, const video::ITexture* texture); | 260 | bool setActiveTexture(u32 stage, const video::ITexture* texture); |
261 | 261 | ||
262 | //! resets the device | 262 | //! resets the device |
263 | bool reset(); | 263 | bool reset(); |
264 | 264 | ||
265 | //! returns a device dependent texture from a software surface (IImage) | 265 | //! returns a device dependent texture from a software surface (IImage) |
266 | //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES | 266 | //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES |
267 | virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData=0); | 267 | virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData=0); |
268 | 268 | ||
269 | // returns the current size of the screen or rendertarget | 269 | // returns the current size of the screen or rendertarget |
270 | virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const; | 270 | virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const; |
271 | 271 | ||
272 | //! Adds a new material renderer to the VideoDriver, using pixel and/or | 272 | //! Adds a new material renderer to the VideoDriver, using pixel and/or |
273 | //! vertex shaders to render geometry. | 273 | //! vertex shaders to render geometry. |
274 | s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram, | 274 | s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram, |
275 | IShaderConstantSetCallBack* callback, | 275 | IShaderConstantSetCallBack* callback, |
276 | E_MATERIAL_TYPE baseMaterial, s32 userData); | 276 | E_MATERIAL_TYPE baseMaterial, s32 userData); |
277 | 277 | ||
278 | void createMaterialRenderers(); | 278 | void createMaterialRenderers(); |
279 | 279 | ||
280 | void draw2D3DVertexPrimitiveList(const void* vertices, | 280 | void draw2D3DVertexPrimitiveList(const void* vertices, |
281 | u32 vertexCount, const void* indexList, u32 primitiveCount, | 281 | u32 vertexCount, const void* indexList, u32 primitiveCount, |
282 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, | 282 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, |
283 | E_INDEX_TYPE iType, bool is3D); | 283 | E_INDEX_TYPE iType, bool is3D); |
284 | 284 | ||
285 | D3DTEXTUREADDRESS getTextureWrapMode(const u8 clamp); | 285 | D3DTEXTUREADDRESS getTextureWrapMode(const u8 clamp); |
286 | 286 | ||
287 | inline D3DCOLORVALUE colorToD3D(const SColor& col) | 287 | inline D3DCOLORVALUE colorToD3D(const SColor& col) |
288 | { | 288 | { |
289 | const f32 f = 1.0f / 255.0f; | 289 | const f32 f = 1.0f / 255.0f; |
290 | D3DCOLORVALUE v; | 290 | D3DCOLORVALUE v; |
291 | v.r = col.getRed() * f; | 291 | v.r = col.getRed() * f; |
292 | v.g = col.getGreen() * f; | 292 | v.g = col.getGreen() * f; |
293 | v.b = col.getBlue() * f; | 293 | v.b = col.getBlue() * f; |
294 | v.a = col.getAlpha() * f; | 294 | v.a = col.getAlpha() * f; |
295 | return v; | 295 | return v; |
296 | } | 296 | } |
297 | 297 | ||
298 | E_RENDER_MODE CurrentRenderMode; | 298 | E_RENDER_MODE CurrentRenderMode; |
299 | D3DPRESENT_PARAMETERS present; | 299 | D3DPRESENT_PARAMETERS present; |
300 | 300 | ||
301 | SMaterial Material, LastMaterial; | 301 | SMaterial Material, LastMaterial; |
302 | bool ResetRenderStates; // bool to make all renderstates be reseted if set. | 302 | bool ResetRenderStates; // bool to make all renderstates be reseted if set. |
303 | bool Transformation3DChanged; | 303 | bool Transformation3DChanged; |
304 | const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES]; | 304 | const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES]; |
305 | core::matrix4 Matrices[ETS_COUNT]; // matrices of the 3d mode we need to restore when we switch back from the 2d mode. | 305 | core::matrix4 Matrices[ETS_COUNT]; // matrices of the 3d mode we need to restore when we switch back from the 2d mode. |
306 | 306 | ||
307 | HINSTANCE D3DLibrary; | 307 | HINSTANCE D3DLibrary; |
308 | IDirect3D8* pID3D; | 308 | IDirect3D8* pID3D; |
309 | IDirect3DDevice8* pID3DDevice; | 309 | IDirect3DDevice8* pID3DDevice; |
310 | 310 | ||
311 | IDirect3DSurface8* PrevRenderTarget; | 311 | IDirect3DSurface8* PrevRenderTarget; |
312 | core::dimension2d<u32> CurrentRendertargetSize; | 312 | core::dimension2d<u32> CurrentRendertargetSize; |
313 | 313 | ||
314 | HWND WindowId; | 314 | HWND WindowId; |
315 | core::rect<s32>* SceneSourceRect; | 315 | core::rect<s32>* SceneSourceRect; |
316 | 316 | ||
317 | D3DCAPS8 Caps; | 317 | D3DCAPS8 Caps; |
318 | 318 | ||
319 | E_VERTEX_TYPE LastVertexType; | 319 | E_VERTEX_TYPE LastVertexType; |
320 | 320 | ||
321 | D3DMATRIX UnitMatrix; | 321 | D3DMATRIX UnitMatrix; |
322 | 322 | ||
323 | u32 MaxTextureUnits; | 323 | u32 MaxTextureUnits; |
324 | u32 MaxUserClipPlanes; | 324 | u32 MaxUserClipPlanes; |
325 | f32 MaxLightDistance; | 325 | f32 MaxLightDistance; |
326 | s32 LastSetLight; | 326 | s32 LastSetLight; |
327 | bool DeviceLost; | 327 | bool DeviceLost; |
328 | bool DriverWasReset; | 328 | bool DriverWasReset; |
329 | 329 | ||
330 | SColorf AmbientLight; | 330 | SColorf AmbientLight; |
331 | 331 | ||
332 | SIrrlichtCreationParameters Params; | 332 | SIrrlichtCreationParameters Params; |
333 | }; | 333 | }; |
334 | 334 | ||
335 | } // end namespace video | 335 | } // end namespace video |
336 | } // end namespace irr | 336 | } // end namespace irr |
337 | 337 | ||
338 | #endif // _IRR_COMPILE_WITH_DIRECT3D_8_ | 338 | #endif // _IRR_COMPILE_WITH_DIRECT3D_8_ |
339 | 339 | ||
340 | #endif // __C_VIDEO_DIRECTX_8_H_INCLUDED__ | 340 | #endif // __C_VIDEO_DIRECTX_8_H_INCLUDED__ |
341 | 341 | ||