diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CSoftwareDriver2.h | 290 |
1 files changed, 0 insertions, 290 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareDriver2.h b/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareDriver2.h deleted file mode 100644 index 2971c8b..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareDriver2.h +++ /dev/null | |||
@@ -1,290 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __C_VIDEO_2_SOFTWARE_H_INCLUDED__ | ||
6 | #define __C_VIDEO_2_SOFTWARE_H_INCLUDED__ | ||
7 | |||
8 | #include "SoftwareDriver2_compile_config.h" | ||
9 | #include "IBurningShader.h" | ||
10 | #include "CNullDriver.h" | ||
11 | #include "CImage.h" | ||
12 | #include "os.h" | ||
13 | #include "irrString.h" | ||
14 | #include "SIrrCreationParameters.h" | ||
15 | |||
16 | namespace irr | ||
17 | { | ||
18 | namespace video | ||
19 | { | ||
20 | class CBurningVideoDriver : public CNullDriver | ||
21 | { | ||
22 | public: | ||
23 | |||
24 | //! constructor | ||
25 | CBurningVideoDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io, video::IImagePresenter* presenter); | ||
26 | |||
27 | //! destructor | ||
28 | virtual ~CBurningVideoDriver(); | ||
29 | |||
30 | //! queries the features of the driver, returns true if feature is available | ||
31 | virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const; | ||
32 | |||
33 | //! sets transformation | ||
34 | virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat); | ||
35 | |||
36 | //! sets a material | ||
37 | virtual void setMaterial(const SMaterial& material); | ||
38 | |||
39 | virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer, | ||
40 | bool clearZBuffer, SColor color); | ||
41 | |||
42 | //! sets a viewport | ||
43 | virtual void setViewPort(const core::rect<s32>& area); | ||
44 | |||
45 | //! clears the zbuffer | ||
46 | virtual bool beginScene(bool backBuffer=true, bool zBuffer=true, | ||
47 | SColor color=SColor(255,0,0,0), | ||
48 | const SExposedVideoData& videoData=SExposedVideoData(), | ||
49 | core::rect<s32>* sourceRect=0); | ||
50 | |||
51 | //! presents the rendered scene on the screen, returns false if failed | ||
52 | virtual bool endScene(); | ||
53 | |||
54 | //! Only used by the internal engine. Used to notify the driver that | ||
55 | //! the window was resized. | ||
56 | virtual void OnResize(const core::dimension2d<u32>& size); | ||
57 | |||
58 | //! returns size of the current render target | ||
59 | virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const; | ||
60 | |||
61 | //! deletes all dynamic lights there are | ||
62 | virtual void deleteAllDynamicLights(); | ||
63 | |||
64 | //! adds a dynamic light, returning an index to the light | ||
65 | //! \param light: the light data to use to create the light | ||
66 | //! \return An index to the light, or -1 if an error occurs | ||
67 | virtual s32 addDynamicLight(const SLight& light); | ||
68 | |||
69 | //! Turns a dynamic light on or off | ||
70 | //! \param lightIndex: the index returned by addDynamicLight | ||
71 | //! \param turnOn: true to turn the light on, false to turn it off | ||
72 | virtual void turnLightOn(s32 lightIndex, bool turnOn); | ||
73 | |||
74 | //! returns the maximal amount of dynamic lights the device can handle | ||
75 | virtual u32 getMaximalDynamicLightAmount() const; | ||
76 | |||
77 | //! Sets the dynamic ambient light color. The default color is | ||
78 | //! (0,0,0,0) which means it is dark. | ||
79 | //! \param color: New color of the ambient light. | ||
80 | virtual void setAmbientLight(const SColorf& color); | ||
81 | |||
82 | //! draws a vertex primitive list | ||
83 | void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, | ||
84 | const void* indexList, u32 primitiveCount, | ||
85 | E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType); | ||
86 | |||
87 | //! 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. | ||
88 | virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, | ||
89 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | ||
90 | SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); | ||
91 | |||
92 | //! Draws a part of the texture into the rectangle. | ||
93 | virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, | ||
94 | const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, | ||
95 | const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); | ||
96 | |||
97 | //! Draws a 3d line. | ||
98 | virtual void draw3DLine(const core::vector3df& start, | ||
99 | const core::vector3df& end, SColor color = SColor(255,255,255,255)); | ||
100 | |||
101 | //! draw an 2d rectangle | ||
102 | virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, | ||
103 | const core::rect<s32>* clip = 0); | ||
104 | |||
105 | //!Draws an 2d rectangle with a gradient. | ||
106 | virtual void draw2DRectangle(const core::rect<s32>& pos, | ||
107 | SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, | ||
108 | const core::rect<s32>* clip = 0); | ||
109 | |||
110 | //! Draws a 2d line. | ||
111 | virtual void draw2DLine(const core::position2d<s32>& start, | ||
112 | const core::position2d<s32>& end, | ||
113 | SColor color=SColor(255,255,255,255)); | ||
114 | |||
115 | //! Draws a single pixel | ||
116 | virtual void drawPixel(u32 x, u32 y, const SColor & color); | ||
117 | |||
118 | //! \return Returns the name of the video driver. Example: In case of the DirectX8 | ||
119 | //! driver, it would return "Direct3D8.1". | ||
120 | virtual const wchar_t* getName() const; | ||
121 | |||
122 | //! Returns type of video driver | ||
123 | virtual E_DRIVER_TYPE getDriverType() const; | ||
124 | |||
125 | //! get color format of the current color buffer | ||
126 | virtual ECOLOR_FORMAT getColorFormat() const; | ||
127 | |||
128 | //! Returns the transformation set by setTransform | ||
129 | virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const; | ||
130 | |||
131 | //! Creates a render target texture. | ||
132 | virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size, | ||
133 | const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN); | ||
134 | |||
135 | //! Clears the DepthBuffer. | ||
136 | virtual void clearZBuffer(); | ||
137 | |||
138 | //! Returns an image created from the last rendered frame. | ||
139 | virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER); | ||
140 | |||
141 | //! Returns the maximum amount of primitives (mostly vertices) which | ||
142 | //! the device is able to render with one drawIndexedTriangleList | ||
143 | //! call. | ||
144 | virtual u32 getMaximalPrimitiveCount() const; | ||
145 | |||
146 | //! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do | ||
147 | //! this: First, draw all geometry. Then use this method, to draw the shadow | ||
148 | //! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. | ||
149 | virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0); | ||
150 | |||
151 | //! Fills the stencil shadow with color. After the shadow volume has been drawn | ||
152 | //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this | ||
153 | //! to draw the color of the shadow. | ||
154 | virtual void drawStencilShadow(bool clearStencilBuffer=false, | ||
155 | video::SColor leftUpEdge = video::SColor(0,0,0,0), | ||
156 | video::SColor rightUpEdge = video::SColor(0,0,0,0), | ||
157 | video::SColor leftDownEdge = video::SColor(0,0,0,0), | ||
158 | video::SColor rightDownEdge = video::SColor(0,0,0,0)); | ||
159 | |||
160 | //! Returns the graphics card vendor name. | ||
161 | virtual core::stringc getVendorInfo(); | ||
162 | |||
163 | //! Returns the maximum texture size supported. | ||
164 | virtual core::dimension2du getMaxTextureSize() const; | ||
165 | |||
166 | virtual IDepthBuffer * getDepthBuffer () { return DepthBuffer; } | ||
167 | virtual IStencilBuffer * getStencilBuffer () { return StencilBuffer; } | ||
168 | |||
169 | protected: | ||
170 | |||
171 | |||
172 | //! sets a render target | ||
173 | void setRenderTarget(video::CImage* image); | ||
174 | |||
175 | //! sets the current Texture | ||
176 | //bool setTexture(u32 stage, video::ITexture* texture); | ||
177 | |||
178 | //! returns a device dependent texture from a software surface (IImage) | ||
179 | //! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES | ||
180 | virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData=0); | ||
181 | |||
182 | video::CImage* BackBuffer; | ||
183 | video::IImagePresenter* Presenter; | ||
184 | |||
185 | void* WindowId; | ||
186 | core::rect<s32>* SceneSourceRect; | ||
187 | |||
188 | video::ITexture* RenderTargetTexture; | ||
189 | video::IImage* RenderTargetSurface; | ||
190 | core::dimension2d<u32> RenderTargetSize; | ||
191 | |||
192 | //! selects the right triangle renderer based on the render states. | ||
193 | void setCurrentShader(); | ||
194 | |||
195 | IBurningShader* CurrentShader; | ||
196 | IBurningShader* BurningShader[ETR2_COUNT]; | ||
197 | |||
198 | IDepthBuffer* DepthBuffer; | ||
199 | IStencilBuffer* StencilBuffer; | ||
200 | |||
201 | |||
202 | /* | ||
203 | extend Matrix Stack | ||
204 | -> combined CameraProjection | ||
205 | -> combined CameraProjectionWorld | ||
206 | -> ClipScale from NDC to DC Space | ||
207 | */ | ||
208 | enum E_TRANSFORMATION_STATE_BURNING_VIDEO | ||
209 | { | ||
210 | ETS_VIEW_PROJECTION = ETS_COUNT, | ||
211 | ETS_CURRENT, | ||
212 | ETS_CLIPSCALE, | ||
213 | ETS_VIEW_INVERSE, | ||
214 | ETS_WORLD_INVERSE, | ||
215 | |||
216 | ETS_COUNT_BURNING | ||
217 | }; | ||
218 | |||
219 | enum E_TRANSFORMATION_FLAG | ||
220 | { | ||
221 | ETF_IDENTITY = 1, | ||
222 | ETF_TEXGEN_CAMERA_NORMAL = 2, | ||
223 | ETF_TEXGEN_CAMERA_REFLECTION = 4, | ||
224 | }; | ||
225 | u32 TransformationFlag[ETS_COUNT_BURNING]; | ||
226 | core::matrix4 Transformation[ETS_COUNT_BURNING]; | ||
227 | |||
228 | void getCameraPosWorldSpace (); | ||
229 | void getLightPosObjectSpace (); | ||
230 | |||
231 | |||
232 | // Vertex Cache | ||
233 | static const SVSize vSize[]; | ||
234 | |||
235 | SVertexCache VertexCache; | ||
236 | |||
237 | void VertexCache_reset (const void* vertices, u32 vertexCount, | ||
238 | const void* indices, u32 indexCount, | ||
239 | E_VERTEX_TYPE vType,scene::E_PRIMITIVE_TYPE pType, | ||
240 | E_INDEX_TYPE iType); | ||
241 | void VertexCache_get ( const s4DVertex ** face ); | ||
242 | void VertexCache_getbypass ( s4DVertex ** face ); | ||
243 | |||
244 | void VertexCache_fill ( const u32 sourceIndex,const u32 destIndex ); | ||
245 | s4DVertex * VertexCache_getVertex ( const u32 sourceIndex ); | ||
246 | |||
247 | |||
248 | // culling & clipping | ||
249 | u32 clipToHyperPlane ( s4DVertex * dest, const s4DVertex * source, u32 inCount, const sVec4 &plane ); | ||
250 | u32 clipToFrustumTest ( const s4DVertex * v ) const; | ||
251 | u32 clipToFrustum ( s4DVertex *source, s4DVertex * temp, const u32 vIn ); | ||
252 | |||
253 | |||
254 | #ifdef SOFTWARE_DRIVER_2_LIGHTING | ||
255 | |||
256 | void lightVertex ( s4DVertex *dest, u32 vertexargb ); | ||
257 | //! Sets the fog mode. | ||
258 | virtual void setFog(SColor color, E_FOG_TYPE fogType, f32 start, | ||
259 | f32 end, f32 density, bool pixelFog, bool rangeFog); | ||
260 | #endif | ||
261 | |||
262 | |||
263 | // holds transformed, clipped vertices | ||
264 | SAlignedVertex CurrentOut; | ||
265 | SAlignedVertex Temp; | ||
266 | |||
267 | void ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const; | ||
268 | f32 screenarea ( const s4DVertex *v0 ) const; | ||
269 | void select_polygon_mipmap ( s4DVertex *source, u32 vIn, u32 tex, const core::dimension2du& texSize ) const; | ||
270 | f32 texelarea ( const s4DVertex *v0, int tex ) const; | ||
271 | |||
272 | |||
273 | void ndc_2_dc_and_project2 ( const s4DVertex **v, const u32 size ) const; | ||
274 | f32 screenarea2 ( const s4DVertex **v ) const; | ||
275 | f32 texelarea2 ( const s4DVertex **v, int tex ) const; | ||
276 | void select_polygon_mipmap2 ( s4DVertex **source, u32 tex, const core::dimension2du& texSize ) const; | ||
277 | |||
278 | |||
279 | SBurningShaderLightSpace LightSpace; | ||
280 | SBurningShaderMaterial Material; | ||
281 | |||
282 | static const sVec4 NDCPlane[6]; | ||
283 | }; | ||
284 | |||
285 | } // end namespace video | ||
286 | } // end namespace irr | ||
287 | |||
288 | |||
289 | #endif | ||
290 | |||