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/CTRStencilShadow.cpp | |
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/CTRStencilShadow.cpp | 1860 |
1 files changed, 930 insertions, 930 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CTRStencilShadow.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CTRStencilShadow.cpp index be974b6..ef4123b 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CTRStencilShadow.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CTRStencilShadow.cpp | |||
@@ -1,930 +1,930 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten |
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 | #include "IrrCompileConfig.h" | 5 | #include "IrrCompileConfig.h" |
6 | #include "IBurningShader.h" | 6 | #include "IBurningShader.h" |
7 | 7 | ||
8 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 8 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
9 | 9 | ||
10 | // compile flag for this file | 10 | // compile flag for this file |
11 | #undef USE_ZBUFFER | 11 | #undef USE_ZBUFFER |
12 | #undef USE_SBUFFER | 12 | #undef USE_SBUFFER |
13 | #undef IPOL_Z | 13 | #undef IPOL_Z |
14 | #undef CMP_Z | 14 | #undef CMP_Z |
15 | #undef WRITE_Z | 15 | #undef WRITE_Z |
16 | 16 | ||
17 | #undef IPOL_W | 17 | #undef IPOL_W |
18 | #undef CMP_W | 18 | #undef CMP_W |
19 | #undef WRITE_W | 19 | #undef WRITE_W |
20 | 20 | ||
21 | #undef SUBTEXEL | 21 | #undef SUBTEXEL |
22 | #undef INVERSE_W | 22 | #undef INVERSE_W |
23 | 23 | ||
24 | #undef IPOL_C0 | 24 | #undef IPOL_C0 |
25 | #undef IPOL_T0 | 25 | #undef IPOL_T0 |
26 | #undef IPOL_T1 | 26 | #undef IPOL_T1 |
27 | #undef IPOL_T2 | 27 | #undef IPOL_T2 |
28 | #undef IPOL_L0 | 28 | #undef IPOL_L0 |
29 | 29 | ||
30 | // define render case | 30 | // define render case |
31 | #define SUBTEXEL | 31 | #define SUBTEXEL |
32 | //#define INVERSE_W | 32 | //#define INVERSE_W |
33 | 33 | ||
34 | #define USE_ZBUFFER | 34 | #define USE_ZBUFFER |
35 | #define USE_SBUFFER | 35 | #define USE_SBUFFER |
36 | #define IPOL_W | 36 | #define IPOL_W |
37 | #define CMP_W | 37 | #define CMP_W |
38 | //#define WRITE_W | 38 | //#define WRITE_W |
39 | 39 | ||
40 | 40 | ||
41 | // apply global override | 41 | // apply global override |
42 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT | 42 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT |
43 | #undef INVERSE_W | 43 | #undef INVERSE_W |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifndef SOFTWARE_DRIVER_2_SUBTEXEL | 46 | #ifndef SOFTWARE_DRIVER_2_SUBTEXEL |
47 | #undef SUBTEXEL | 47 | #undef SUBTEXEL |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 50 | #ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
51 | #undef IPOL_C0 | 51 | #undef IPOL_C0 |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #if !defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) && defined ( USE_ZBUFFER ) | 54 | #if !defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) && defined ( USE_ZBUFFER ) |
55 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT | 55 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT |
56 | #undef IPOL_W | 56 | #undef IPOL_W |
57 | #endif | 57 | #endif |
58 | #define IPOL_Z | 58 | #define IPOL_Z |
59 | 59 | ||
60 | #ifdef CMP_W | 60 | #ifdef CMP_W |
61 | #undef CMP_W | 61 | #undef CMP_W |
62 | #define CMP_Z | 62 | #define CMP_Z |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #ifdef WRITE_W | 65 | #ifdef WRITE_W |
66 | #undef WRITE_W | 66 | #undef WRITE_W |
67 | #define WRITE_Z | 67 | #define WRITE_Z |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | 72 | ||
73 | namespace irr | 73 | namespace irr |
74 | { | 74 | { |
75 | 75 | ||
76 | namespace video | 76 | namespace video |
77 | { | 77 | { |
78 | 78 | ||
79 | class CTRStencilShadow : public IBurningShader | 79 | class CTRStencilShadow : public IBurningShader |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | 82 | ||
83 | //! constructor | 83 | //! constructor |
84 | CTRStencilShadow(CBurningVideoDriver* driver); | 84 | CTRStencilShadow(CBurningVideoDriver* driver); |
85 | 85 | ||
86 | //! draws an indexed triangle list | 86 | //! draws an indexed triangle list |
87 | virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ); | 87 | virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ); |
88 | virtual void setParam ( u32 index, f32 value); | 88 | virtual void setParam ( u32 index, f32 value); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | // fragment shader | 91 | // fragment shader |
92 | typedef void (CTRStencilShadow::*tFragmentShader) (); | 92 | typedef void (CTRStencilShadow::*tFragmentShader) (); |
93 | void fragment_zfail_decr (); | 93 | void fragment_zfail_decr (); |
94 | void fragment_zfail_incr (); | 94 | void fragment_zfail_incr (); |
95 | 95 | ||
96 | tFragmentShader fragmentShader; | 96 | tFragmentShader fragmentShader; |
97 | 97 | ||
98 | sScanConvertData scan; | 98 | sScanConvertData scan; |
99 | sScanLineData line; | 99 | sScanLineData line; |
100 | 100 | ||
101 | }; | 101 | }; |
102 | 102 | ||
103 | //! constructor | 103 | //! constructor |
104 | CTRStencilShadow::CTRStencilShadow(CBurningVideoDriver* driver) | 104 | CTRStencilShadow::CTRStencilShadow(CBurningVideoDriver* driver) |
105 | : IBurningShader(driver) | 105 | : IBurningShader(driver) |
106 | { | 106 | { |
107 | #ifdef _DEBUG | 107 | #ifdef _DEBUG |
108 | setDebugName("CTRStencilShadow"); | 108 | setDebugName("CTRStencilShadow"); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | /*! | 113 | /*! |
114 | */ | 114 | */ |
115 | void CTRStencilShadow::setParam ( u32 index, f32 value) | 115 | void CTRStencilShadow::setParam ( u32 index, f32 value) |
116 | { | 116 | { |
117 | u32 val = (u32) value; | 117 | u32 val = (u32) value; |
118 | 118 | ||
119 | // glStencilOp (fail,zfail,zpass | 119 | // glStencilOp (fail,zfail,zpass |
120 | if ( index == 1 && val == 1 ) | 120 | if ( index == 1 && val == 1 ) |
121 | { | 121 | { |
122 | fragmentShader = &CTRStencilShadow::fragment_zfail_incr; | 122 | fragmentShader = &CTRStencilShadow::fragment_zfail_incr; |
123 | } | 123 | } |
124 | else | 124 | else |
125 | if ( index == 1 && val == 2 ) | 125 | if ( index == 1 && val == 2 ) |
126 | { | 126 | { |
127 | fragmentShader = &CTRStencilShadow::fragment_zfail_decr; | 127 | fragmentShader = &CTRStencilShadow::fragment_zfail_decr; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | /*! | 131 | /*! |
132 | */ | 132 | */ |
133 | void CTRStencilShadow::fragment_zfail_decr () | 133 | void CTRStencilShadow::fragment_zfail_decr () |
134 | { | 134 | { |
135 | if (!Stencil) | 135 | if (!Stencil) |
136 | return; | 136 | return; |
137 | //tVideoSample *dst; | 137 | //tVideoSample *dst; |
138 | 138 | ||
139 | #ifdef USE_ZBUFFER | 139 | #ifdef USE_ZBUFFER |
140 | fp24 *z; | 140 | fp24 *z; |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | #ifdef USE_SBUFFER | 143 | #ifdef USE_SBUFFER |
144 | u32 *stencil; | 144 | u32 *stencil; |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | s32 xStart; | 147 | s32 xStart; |
148 | s32 xEnd; | 148 | s32 xEnd; |
149 | s32 dx; | 149 | s32 dx; |
150 | 150 | ||
151 | #ifdef SUBTEXEL | 151 | #ifdef SUBTEXEL |
152 | f32 subPixel; | 152 | f32 subPixel; |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | #ifdef IPOL_Z | 155 | #ifdef IPOL_Z |
156 | f32 slopeZ; | 156 | f32 slopeZ; |
157 | #endif | 157 | #endif |
158 | #ifdef IPOL_W | 158 | #ifdef IPOL_W |
159 | fp24 slopeW; | 159 | fp24 slopeW; |
160 | #endif | 160 | #endif |
161 | #ifdef IPOL_C0 | 161 | #ifdef IPOL_C0 |
162 | sVec4 slopeC[MATERIAL_MAX_COLORS]; | 162 | sVec4 slopeC[MATERIAL_MAX_COLORS]; |
163 | #endif | 163 | #endif |
164 | #ifdef IPOL_T0 | 164 | #ifdef IPOL_T0 |
165 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; | 165 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; |
166 | #endif | 166 | #endif |
167 | #ifdef IPOL_L0 | 167 | #ifdef IPOL_L0 |
168 | sVec3 slopeL[BURNING_MATERIAL_MAX_TANGENT]; | 168 | sVec3 slopeL[BURNING_MATERIAL_MAX_TANGENT]; |
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | // apply top-left fill-convention, left | 171 | // apply top-left fill-convention, left |
172 | xStart = core::ceil32( line.x[0] ); | 172 | xStart = core::ceil32( line.x[0] ); |
173 | xEnd = core::ceil32( line.x[1] ) - 1; | 173 | xEnd = core::ceil32( line.x[1] ) - 1; |
174 | 174 | ||
175 | dx = xEnd - xStart; | 175 | dx = xEnd - xStart; |
176 | 176 | ||
177 | if ( dx < 0 ) | 177 | if ( dx < 0 ) |
178 | return; | 178 | return; |
179 | 179 | ||
180 | // slopes | 180 | // slopes |
181 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); | 181 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); |
182 | 182 | ||
183 | #ifdef IPOL_Z | 183 | #ifdef IPOL_Z |
184 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; | 184 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; |
185 | #endif | 185 | #endif |
186 | #ifdef IPOL_W | 186 | #ifdef IPOL_W |
187 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; | 187 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; |
188 | #endif | 188 | #endif |
189 | #ifdef IPOL_C0 | 189 | #ifdef IPOL_C0 |
190 | slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX; | 190 | slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX; |
191 | #endif | 191 | #endif |
192 | #ifdef IPOL_T0 | 192 | #ifdef IPOL_T0 |
193 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; | 193 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; |
194 | #endif | 194 | #endif |
195 | #ifdef IPOL_T1 | 195 | #ifdef IPOL_T1 |
196 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; | 196 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; |
197 | #endif | 197 | #endif |
198 | #ifdef IPOL_T2 | 198 | #ifdef IPOL_T2 |
199 | slopeT[2] = (line.t[2][1] - line.t[2][0]) * invDeltaX; | 199 | slopeT[2] = (line.t[2][1] - line.t[2][0]) * invDeltaX; |
200 | #endif | 200 | #endif |
201 | #ifdef IPOL_L0 | 201 | #ifdef IPOL_L0 |
202 | slopeL[0] = (line.l[0][1] - line.l[0][0]) * invDeltaX; | 202 | slopeL[0] = (line.l[0][1] - line.l[0][0]) * invDeltaX; |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #ifdef SUBTEXEL | 205 | #ifdef SUBTEXEL |
206 | subPixel = ( (f32) xStart ) - line.x[0]; | 206 | subPixel = ( (f32) xStart ) - line.x[0]; |
207 | #ifdef IPOL_Z | 207 | #ifdef IPOL_Z |
208 | line.z[0] += slopeZ * subPixel; | 208 | line.z[0] += slopeZ * subPixel; |
209 | #endif | 209 | #endif |
210 | #ifdef IPOL_W | 210 | #ifdef IPOL_W |
211 | line.w[0] += slopeW * subPixel; | 211 | line.w[0] += slopeW * subPixel; |
212 | #endif | 212 | #endif |
213 | #ifdef IPOL_C0 | 213 | #ifdef IPOL_C0 |
214 | line.c[0][0] += slopeC[0] * subPixel; | 214 | line.c[0][0] += slopeC[0] * subPixel; |
215 | #endif | 215 | #endif |
216 | #ifdef IPOL_T0 | 216 | #ifdef IPOL_T0 |
217 | line.t[0][0] += slopeT[0] * subPixel; | 217 | line.t[0][0] += slopeT[0] * subPixel; |
218 | #endif | 218 | #endif |
219 | #ifdef IPOL_T1 | 219 | #ifdef IPOL_T1 |
220 | line.t[1][0] += slopeT[1] * subPixel; | 220 | line.t[1][0] += slopeT[1] * subPixel; |
221 | #endif | 221 | #endif |
222 | #ifdef IPOL_T2 | 222 | #ifdef IPOL_T2 |
223 | line.t[2][0] += slopeT[2] * subPixel; | 223 | line.t[2][0] += slopeT[2] * subPixel; |
224 | #endif | 224 | #endif |
225 | #ifdef IPOL_L0 | 225 | #ifdef IPOL_L0 |
226 | line.l[0][0] += slopeL[0] * subPixel; | 226 | line.l[0][0] += slopeL[0] * subPixel; |
227 | #endif | 227 | #endif |
228 | #endif | 228 | #endif |
229 | 229 | ||
230 | //dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 230 | //dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
231 | 231 | ||
232 | #ifdef USE_ZBUFFER | 232 | #ifdef USE_ZBUFFER |
233 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 233 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | #ifdef USE_SBUFFER | 236 | #ifdef USE_SBUFFER |
237 | stencil = (u32*) Stencil->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 237 | stencil = (u32*) Stencil->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | 240 | ||
241 | #ifdef INVERSE_W | 241 | #ifdef INVERSE_W |
242 | f32 inversew; | 242 | f32 inversew; |
243 | #endif | 243 | #endif |
244 | 244 | ||
245 | 245 | ||
246 | #ifdef IPOL_C0 | 246 | #ifdef IPOL_C0 |
247 | tFixPoint r3, g3, b3; | 247 | tFixPoint r3, g3, b3; |
248 | #endif | 248 | #endif |
249 | 249 | ||
250 | for ( s32 i = 0; i <= dx; i++ ) | 250 | for ( s32 i = 0; i <= dx; i++ ) |
251 | { | 251 | { |
252 | #ifdef CMP_Z | 252 | #ifdef CMP_Z |
253 | if ( line.z[0] < z[i] ) | 253 | if ( line.z[0] < z[i] ) |
254 | #endif | 254 | #endif |
255 | #ifdef CMP_W | 255 | #ifdef CMP_W |
256 | if ( line.w[0] < z[i] ) | 256 | if ( line.w[0] < z[i] ) |
257 | #endif | 257 | #endif |
258 | { | 258 | { |
259 | // zfail | 259 | // zfail |
260 | stencil[i] -= 1; | 260 | stencil[i] -= 1; |
261 | } | 261 | } |
262 | 262 | ||
263 | #ifdef IPOL_Z | 263 | #ifdef IPOL_Z |
264 | line.z[0] += slopeZ; | 264 | line.z[0] += slopeZ; |
265 | #endif | 265 | #endif |
266 | #ifdef IPOL_W | 266 | #ifdef IPOL_W |
267 | line.w[0] += slopeW; | 267 | line.w[0] += slopeW; |
268 | #endif | 268 | #endif |
269 | #ifdef IPOL_C0 | 269 | #ifdef IPOL_C0 |
270 | line.c[0][0] += slopeC[0]; | 270 | line.c[0][0] += slopeC[0]; |
271 | #endif | 271 | #endif |
272 | #ifdef IPOL_T0 | 272 | #ifdef IPOL_T0 |
273 | line.t[0][0] += slopeT[0]; | 273 | line.t[0][0] += slopeT[0]; |
274 | #endif | 274 | #endif |
275 | #ifdef IPOL_T1 | 275 | #ifdef IPOL_T1 |
276 | line.t[1][0] += slopeT[1]; | 276 | line.t[1][0] += slopeT[1]; |
277 | #endif | 277 | #endif |
278 | #ifdef IPOL_T2 | 278 | #ifdef IPOL_T2 |
279 | line.t[2][0] += slopeT[2]; | 279 | line.t[2][0] += slopeT[2]; |
280 | #endif | 280 | #endif |
281 | #ifdef IPOL_L0 | 281 | #ifdef IPOL_L0 |
282 | line.l[0][0] += slopeL[0]; | 282 | line.l[0][0] += slopeL[0]; |
283 | #endif | 283 | #endif |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | /*! | 287 | /*! |
288 | */ | 288 | */ |
289 | void CTRStencilShadow::fragment_zfail_incr() | 289 | void CTRStencilShadow::fragment_zfail_incr() |
290 | { | 290 | { |
291 | if (!Stencil) | 291 | if (!Stencil) |
292 | return; | 292 | return; |
293 | //tVideoSample *dst; | 293 | //tVideoSample *dst; |
294 | 294 | ||
295 | #ifdef USE_ZBUFFER | 295 | #ifdef USE_ZBUFFER |
296 | fp24 *z; | 296 | fp24 *z; |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | #ifdef USE_SBUFFER | 299 | #ifdef USE_SBUFFER |
300 | u32 *stencil; | 300 | u32 *stencil; |
301 | #endif | 301 | #endif |
302 | 302 | ||
303 | s32 xStart; | 303 | s32 xStart; |
304 | s32 xEnd; | 304 | s32 xEnd; |
305 | s32 dx; | 305 | s32 dx; |
306 | 306 | ||
307 | 307 | ||
308 | #ifdef SUBTEXEL | 308 | #ifdef SUBTEXEL |
309 | f32 subPixel; | 309 | f32 subPixel; |
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | #ifdef IPOL_Z | 312 | #ifdef IPOL_Z |
313 | f32 slopeZ; | 313 | f32 slopeZ; |
314 | #endif | 314 | #endif |
315 | #ifdef IPOL_W | 315 | #ifdef IPOL_W |
316 | fp24 slopeW; | 316 | fp24 slopeW; |
317 | #endif | 317 | #endif |
318 | #ifdef IPOL_C0 | 318 | #ifdef IPOL_C0 |
319 | sVec4 slopeC[MATERIAL_MAX_COLORS]; | 319 | sVec4 slopeC[MATERIAL_MAX_COLORS]; |
320 | #endif | 320 | #endif |
321 | #ifdef IPOL_T0 | 321 | #ifdef IPOL_T0 |
322 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; | 322 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; |
323 | #endif | 323 | #endif |
324 | #ifdef IPOL_L0 | 324 | #ifdef IPOL_L0 |
325 | sVec3 slopeL[BURNING_MATERIAL_MAX_TANGENT]; | 325 | sVec3 slopeL[BURNING_MATERIAL_MAX_TANGENT]; |
326 | #endif | 326 | #endif |
327 | 327 | ||
328 | // apply top-left fill-convention, left | 328 | // apply top-left fill-convention, left |
329 | xStart = core::ceil32( line.x[0] ); | 329 | xStart = core::ceil32( line.x[0] ); |
330 | xEnd = core::ceil32( line.x[1] ) - 1; | 330 | xEnd = core::ceil32( line.x[1] ) - 1; |
331 | 331 | ||
332 | dx = xEnd - xStart; | 332 | dx = xEnd - xStart; |
333 | 333 | ||
334 | if ( dx < 0 ) | 334 | if ( dx < 0 ) |
335 | return; | 335 | return; |
336 | 336 | ||
337 | // slopes | 337 | // slopes |
338 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); | 338 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); |
339 | 339 | ||
340 | #ifdef IPOL_Z | 340 | #ifdef IPOL_Z |
341 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; | 341 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; |
342 | #endif | 342 | #endif |
343 | #ifdef IPOL_W | 343 | #ifdef IPOL_W |
344 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; | 344 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; |
345 | #endif | 345 | #endif |
346 | #ifdef IPOL_C0 | 346 | #ifdef IPOL_C0 |
347 | slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX; | 347 | slopeC[0] = (line.c[0][1] - line.c[0][0]) * invDeltaX; |
348 | #endif | 348 | #endif |
349 | #ifdef IPOL_T0 | 349 | #ifdef IPOL_T0 |
350 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; | 350 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; |
351 | #endif | 351 | #endif |
352 | #ifdef IPOL_T1 | 352 | #ifdef IPOL_T1 |
353 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; | 353 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; |
354 | #endif | 354 | #endif |
355 | #ifdef IPOL_T2 | 355 | #ifdef IPOL_T2 |
356 | slopeT[2] = (line.t[2][1] - line.t[2][0]) * invDeltaX; | 356 | slopeT[2] = (line.t[2][1] - line.t[2][0]) * invDeltaX; |
357 | #endif | 357 | #endif |
358 | #ifdef IPOL_L0 | 358 | #ifdef IPOL_L0 |
359 | slopeL[0] = (line.l[0][1] - line.l[0][0]) * invDeltaX; | 359 | slopeL[0] = (line.l[0][1] - line.l[0][0]) * invDeltaX; |
360 | #endif | 360 | #endif |
361 | 361 | ||
362 | #ifdef SUBTEXEL | 362 | #ifdef SUBTEXEL |
363 | subPixel = ( (f32) xStart ) - line.x[0]; | 363 | subPixel = ( (f32) xStart ) - line.x[0]; |
364 | #ifdef IPOL_Z | 364 | #ifdef IPOL_Z |
365 | line.z[0] += slopeZ * subPixel; | 365 | line.z[0] += slopeZ * subPixel; |
366 | #endif | 366 | #endif |
367 | #ifdef IPOL_W | 367 | #ifdef IPOL_W |
368 | line.w[0] += slopeW * subPixel; | 368 | line.w[0] += slopeW * subPixel; |
369 | #endif | 369 | #endif |
370 | #ifdef IPOL_C0 | 370 | #ifdef IPOL_C0 |
371 | line.c[0][0] += slopeC[0] * subPixel; | 371 | line.c[0][0] += slopeC[0] * subPixel; |
372 | #endif | 372 | #endif |
373 | #ifdef IPOL_T0 | 373 | #ifdef IPOL_T0 |
374 | line.t[0][0] += slopeT[0] * subPixel; | 374 | line.t[0][0] += slopeT[0] * subPixel; |
375 | #endif | 375 | #endif |
376 | #ifdef IPOL_T1 | 376 | #ifdef IPOL_T1 |
377 | line.t[1][0] += slopeT[1] * subPixel; | 377 | line.t[1][0] += slopeT[1] * subPixel; |
378 | #endif | 378 | #endif |
379 | #ifdef IPOL_T2 | 379 | #ifdef IPOL_T2 |
380 | line.t[2][0] += slopeT[2] * subPixel; | 380 | line.t[2][0] += slopeT[2] * subPixel; |
381 | #endif | 381 | #endif |
382 | #ifdef IPOL_L0 | 382 | #ifdef IPOL_L0 |
383 | line.l[0][0] += slopeL[0] * subPixel; | 383 | line.l[0][0] += slopeL[0] * subPixel; |
384 | #endif | 384 | #endif |
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | //dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 387 | //dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
388 | 388 | ||
389 | #ifdef USE_ZBUFFER | 389 | #ifdef USE_ZBUFFER |
390 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 390 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | #ifdef USE_SBUFFER | 393 | #ifdef USE_SBUFFER |
394 | stencil = (u32*) Stencil->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 394 | stencil = (u32*) Stencil->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
395 | #endif | 395 | #endif |
396 | 396 | ||
397 | #ifdef INVERSE_W | 397 | #ifdef INVERSE_W |
398 | f32 inversew; | 398 | f32 inversew; |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | #ifdef IPOL_C0 | 401 | #ifdef IPOL_C0 |
402 | tFixPoint r3, g3, b3; | 402 | tFixPoint r3, g3, b3; |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | for ( s32 i = 0; i <= dx; i++ ) | 405 | for ( s32 i = 0; i <= dx; i++ ) |
406 | { | 406 | { |
407 | #ifdef CMP_Z | 407 | #ifdef CMP_Z |
408 | if ( line.z[0] < z[i] ) | 408 | if ( line.z[0] < z[i] ) |
409 | #endif | 409 | #endif |
410 | #ifdef CMP_W | 410 | #ifdef CMP_W |
411 | if ( line.w[0] < z[i] ) | 411 | if ( line.w[0] < z[i] ) |
412 | #endif | 412 | #endif |
413 | { | 413 | { |
414 | // zfail | 414 | // zfail |
415 | stencil[i] += 1; | 415 | stencil[i] += 1; |
416 | } | 416 | } |
417 | 417 | ||
418 | #ifdef IPOL_Z | 418 | #ifdef IPOL_Z |
419 | line.z[0] += slopeZ; | 419 | line.z[0] += slopeZ; |
420 | #endif | 420 | #endif |
421 | #ifdef IPOL_W | 421 | #ifdef IPOL_W |
422 | line.w[0] += slopeW; | 422 | line.w[0] += slopeW; |
423 | #endif | 423 | #endif |
424 | #ifdef IPOL_C0 | 424 | #ifdef IPOL_C0 |
425 | line.c[0][0] += slopeC[0]; | 425 | line.c[0][0] += slopeC[0]; |
426 | #endif | 426 | #endif |
427 | #ifdef IPOL_T0 | 427 | #ifdef IPOL_T0 |
428 | line.t[0][0] += slopeT[0]; | 428 | line.t[0][0] += slopeT[0]; |
429 | #endif | 429 | #endif |
430 | #ifdef IPOL_T1 | 430 | #ifdef IPOL_T1 |
431 | line.t[1][0] += slopeT[1]; | 431 | line.t[1][0] += slopeT[1]; |
432 | #endif | 432 | #endif |
433 | #ifdef IPOL_T2 | 433 | #ifdef IPOL_T2 |
434 | line.t[2][0] += slopeT[2]; | 434 | line.t[2][0] += slopeT[2]; |
435 | #endif | 435 | #endif |
436 | #ifdef IPOL_L0 | 436 | #ifdef IPOL_L0 |
437 | line.l[0][0] += slopeL[0]; | 437 | line.l[0][0] += slopeL[0]; |
438 | #endif | 438 | #endif |
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | void CTRStencilShadow::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) | 442 | void CTRStencilShadow::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) |
443 | { | 443 | { |
444 | // sort on height, y | 444 | // sort on height, y |
445 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); | 445 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); |
446 | if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c); | 446 | if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c); |
447 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); | 447 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); |
448 | 448 | ||
449 | const f32 ca = c->Pos.y - a->Pos.y; | 449 | const f32 ca = c->Pos.y - a->Pos.y; |
450 | const f32 ba = b->Pos.y - a->Pos.y; | 450 | const f32 ba = b->Pos.y - a->Pos.y; |
451 | const f32 cb = c->Pos.y - b->Pos.y; | 451 | const f32 cb = c->Pos.y - b->Pos.y; |
452 | // calculate delta y of the edges | 452 | // calculate delta y of the edges |
453 | scan.invDeltaY[0] = core::reciprocal( ca ); | 453 | scan.invDeltaY[0] = core::reciprocal( ca ); |
454 | scan.invDeltaY[1] = core::reciprocal( ba ); | 454 | scan.invDeltaY[1] = core::reciprocal( ba ); |
455 | scan.invDeltaY[2] = core::reciprocal( cb ); | 455 | scan.invDeltaY[2] = core::reciprocal( cb ); |
456 | 456 | ||
457 | if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) ) | 457 | if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) ) |
458 | return; | 458 | return; |
459 | 459 | ||
460 | // find if the major edge is left or right aligned | 460 | // find if the major edge is left or right aligned |
461 | f32 temp[4]; | 461 | f32 temp[4]; |
462 | 462 | ||
463 | temp[0] = a->Pos.x - c->Pos.x; | 463 | temp[0] = a->Pos.x - c->Pos.x; |
464 | temp[1] = -ca; | 464 | temp[1] = -ca; |
465 | temp[2] = b->Pos.x - a->Pos.x; | 465 | temp[2] = b->Pos.x - a->Pos.x; |
466 | temp[3] = ba; | 466 | temp[3] = ba; |
467 | 467 | ||
468 | scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1; | 468 | scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1; |
469 | scan.right = 1 - scan.left; | 469 | scan.right = 1 - scan.left; |
470 | 470 | ||
471 | // calculate slopes for the major edge | 471 | // calculate slopes for the major edge |
472 | scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0]; | 472 | scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0]; |
473 | scan.x[0] = a->Pos.x; | 473 | scan.x[0] = a->Pos.x; |
474 | 474 | ||
475 | #ifdef IPOL_Z | 475 | #ifdef IPOL_Z |
476 | scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0]; | 476 | scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0]; |
477 | scan.z[0] = a->Pos.z; | 477 | scan.z[0] = a->Pos.z; |
478 | #endif | 478 | #endif |
479 | 479 | ||
480 | #ifdef IPOL_W | 480 | #ifdef IPOL_W |
481 | scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0]; | 481 | scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0]; |
482 | scan.w[0] = a->Pos.w; | 482 | scan.w[0] = a->Pos.w; |
483 | #endif | 483 | #endif |
484 | 484 | ||
485 | #ifdef IPOL_C0 | 485 | #ifdef IPOL_C0 |
486 | scan.slopeC[0][0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0]; | 486 | scan.slopeC[0][0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0]; |
487 | scan.c[0][0] = a->Color[0]; | 487 | scan.c[0][0] = a->Color[0]; |
488 | #endif | 488 | #endif |
489 | 489 | ||
490 | #ifdef IPOL_T0 | 490 | #ifdef IPOL_T0 |
491 | scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0]; | 491 | scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0]; |
492 | scan.t[0][0] = a->Tex[0]; | 492 | scan.t[0][0] = a->Tex[0]; |
493 | #endif | 493 | #endif |
494 | 494 | ||
495 | #ifdef IPOL_T1 | 495 | #ifdef IPOL_T1 |
496 | scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0]; | 496 | scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0]; |
497 | scan.t[1][0] = a->Tex[1]; | 497 | scan.t[1][0] = a->Tex[1]; |
498 | #endif | 498 | #endif |
499 | 499 | ||
500 | #ifdef IPOL_T2 | 500 | #ifdef IPOL_T2 |
501 | scan.slopeT[2][0] = (c->Tex[2] - a->Tex[2]) * scan.invDeltaY[0]; | 501 | scan.slopeT[2][0] = (c->Tex[2] - a->Tex[2]) * scan.invDeltaY[0]; |
502 | scan.t[2][0] = a->Tex[2]; | 502 | scan.t[2][0] = a->Tex[2]; |
503 | #endif | 503 | #endif |
504 | 504 | ||
505 | #ifdef IPOL_L0 | 505 | #ifdef IPOL_L0 |
506 | scan.slopeL[0][0] = (c->LightTangent[0] - a->LightTangent[0]) * scan.invDeltaY[0]; | 506 | scan.slopeL[0][0] = (c->LightTangent[0] - a->LightTangent[0]) * scan.invDeltaY[0]; |
507 | scan.l[0][0] = a->LightTangent[0]; | 507 | scan.l[0][0] = a->LightTangent[0]; |
508 | #endif | 508 | #endif |
509 | 509 | ||
510 | // top left fill convention y run | 510 | // top left fill convention y run |
511 | s32 yStart; | 511 | s32 yStart; |
512 | s32 yEnd; | 512 | s32 yEnd; |
513 | 513 | ||
514 | #ifdef SUBTEXEL | 514 | #ifdef SUBTEXEL |
515 | f32 subPixel; | 515 | f32 subPixel; |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | // rasterize upper sub-triangle | 518 | // rasterize upper sub-triangle |
519 | //if ( (f32) 0.0 != scan.invDeltaY[1] ) | 519 | //if ( (f32) 0.0 != scan.invDeltaY[1] ) |
520 | if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) | 520 | if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) |
521 | { | 521 | { |
522 | // calculate slopes for top edge | 522 | // calculate slopes for top edge |
523 | scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1]; | 523 | scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1]; |
524 | scan.x[1] = a->Pos.x; | 524 | scan.x[1] = a->Pos.x; |
525 | 525 | ||
526 | #ifdef IPOL_Z | 526 | #ifdef IPOL_Z |
527 | scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1]; | 527 | scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1]; |
528 | scan.z[1] = a->Pos.z; | 528 | scan.z[1] = a->Pos.z; |
529 | #endif | 529 | #endif |
530 | 530 | ||
531 | #ifdef IPOL_W | 531 | #ifdef IPOL_W |
532 | scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1]; | 532 | scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1]; |
533 | scan.w[1] = a->Pos.w; | 533 | scan.w[1] = a->Pos.w; |
534 | #endif | 534 | #endif |
535 | 535 | ||
536 | #ifdef IPOL_C0 | 536 | #ifdef IPOL_C0 |
537 | scan.slopeC[0][1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1]; | 537 | scan.slopeC[0][1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1]; |
538 | scan.c[0][1] = a->Color[0]; | 538 | scan.c[0][1] = a->Color[0]; |
539 | #endif | 539 | #endif |
540 | 540 | ||
541 | #ifdef IPOL_T0 | 541 | #ifdef IPOL_T0 |
542 | scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1]; | 542 | scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1]; |
543 | scan.t[0][1] = a->Tex[0]; | 543 | scan.t[0][1] = a->Tex[0]; |
544 | #endif | 544 | #endif |
545 | 545 | ||
546 | #ifdef IPOL_T1 | 546 | #ifdef IPOL_T1 |
547 | scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1]; | 547 | scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1]; |
548 | scan.t[1][1] = a->Tex[1]; | 548 | scan.t[1][1] = a->Tex[1]; |
549 | #endif | 549 | #endif |
550 | 550 | ||
551 | #ifdef IPOL_T2 | 551 | #ifdef IPOL_T2 |
552 | scan.slopeT[2][1] = (b->Tex[2] - a->Tex[2]) * scan.invDeltaY[1]; | 552 | scan.slopeT[2][1] = (b->Tex[2] - a->Tex[2]) * scan.invDeltaY[1]; |
553 | scan.t[2][1] = a->Tex[2]; | 553 | scan.t[2][1] = a->Tex[2]; |
554 | #endif | 554 | #endif |
555 | 555 | ||
556 | #ifdef IPOL_L0 | 556 | #ifdef IPOL_L0 |
557 | scan.slopeL[0][1] = (b->LightTangent[0] - a->LightTangent[0]) * scan.invDeltaY[1]; | 557 | scan.slopeL[0][1] = (b->LightTangent[0] - a->LightTangent[0]) * scan.invDeltaY[1]; |
558 | scan.l[0][1] = a->LightTangent[0]; | 558 | scan.l[0][1] = a->LightTangent[0]; |
559 | #endif | 559 | #endif |
560 | 560 | ||
561 | // apply top-left fill convention, top part | 561 | // apply top-left fill convention, top part |
562 | yStart = core::ceil32( a->Pos.y ); | 562 | yStart = core::ceil32( a->Pos.y ); |
563 | yEnd = core::ceil32( b->Pos.y ) - 1; | 563 | yEnd = core::ceil32( b->Pos.y ) - 1; |
564 | 564 | ||
565 | #ifdef SUBTEXEL | 565 | #ifdef SUBTEXEL |
566 | subPixel = ( (f32) yStart ) - a->Pos.y; | 566 | subPixel = ( (f32) yStart ) - a->Pos.y; |
567 | 567 | ||
568 | // correct to pixel center | 568 | // correct to pixel center |
569 | scan.x[0] += scan.slopeX[0] * subPixel; | 569 | scan.x[0] += scan.slopeX[0] * subPixel; |
570 | scan.x[1] += scan.slopeX[1] * subPixel; | 570 | scan.x[1] += scan.slopeX[1] * subPixel; |
571 | 571 | ||
572 | #ifdef IPOL_Z | 572 | #ifdef IPOL_Z |
573 | scan.z[0] += scan.slopeZ[0] * subPixel; | 573 | scan.z[0] += scan.slopeZ[0] * subPixel; |
574 | scan.z[1] += scan.slopeZ[1] * subPixel; | 574 | scan.z[1] += scan.slopeZ[1] * subPixel; |
575 | #endif | 575 | #endif |
576 | 576 | ||
577 | #ifdef IPOL_W | 577 | #ifdef IPOL_W |
578 | scan.w[0] += scan.slopeW[0] * subPixel; | 578 | scan.w[0] += scan.slopeW[0] * subPixel; |
579 | scan.w[1] += scan.slopeW[1] * subPixel; | 579 | scan.w[1] += scan.slopeW[1] * subPixel; |
580 | #endif | 580 | #endif |
581 | 581 | ||
582 | #ifdef IPOL_C0 | 582 | #ifdef IPOL_C0 |
583 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; | 583 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; |
584 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; | 584 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; |
585 | #endif | 585 | #endif |
586 | 586 | ||
587 | #ifdef IPOL_T0 | 587 | #ifdef IPOL_T0 |
588 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; | 588 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; |
589 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; | 589 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | #ifdef IPOL_T1 | 592 | #ifdef IPOL_T1 |
593 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; | 593 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; |
594 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; | 594 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; |
595 | #endif | 595 | #endif |
596 | 596 | ||
597 | #ifdef IPOL_T2 | 597 | #ifdef IPOL_T2 |
598 | scan.t[2][0] += scan.slopeT[2][0] * subPixel; | 598 | scan.t[2][0] += scan.slopeT[2][0] * subPixel; |
599 | scan.t[2][1] += scan.slopeT[2][1] * subPixel; | 599 | scan.t[2][1] += scan.slopeT[2][1] * subPixel; |
600 | #endif | 600 | #endif |
601 | 601 | ||
602 | #ifdef IPOL_L0 | 602 | #ifdef IPOL_L0 |
603 | scan.l[0][0] += scan.slopeL[0][0] * subPixel; | 603 | scan.l[0][0] += scan.slopeL[0][0] * subPixel; |
604 | scan.l[0][1] += scan.slopeL[0][1] * subPixel; | 604 | scan.l[0][1] += scan.slopeL[0][1] * subPixel; |
605 | #endif | 605 | #endif |
606 | 606 | ||
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | // rasterize the edge scanlines | 609 | // rasterize the edge scanlines |
610 | for( line.y = yStart; line.y <= yEnd; ++line.y) | 610 | for( line.y = yStart; line.y <= yEnd; ++line.y) |
611 | { | 611 | { |
612 | line.x[scan.left] = scan.x[0]; | 612 | line.x[scan.left] = scan.x[0]; |
613 | line.x[scan.right] = scan.x[1]; | 613 | line.x[scan.right] = scan.x[1]; |
614 | 614 | ||
615 | #ifdef IPOL_Z | 615 | #ifdef IPOL_Z |
616 | line.z[scan.left] = scan.z[0]; | 616 | line.z[scan.left] = scan.z[0]; |
617 | line.z[scan.right] = scan.z[1]; | 617 | line.z[scan.right] = scan.z[1]; |
618 | #endif | 618 | #endif |
619 | 619 | ||
620 | #ifdef IPOL_W | 620 | #ifdef IPOL_W |
621 | line.w[scan.left] = scan.w[0]; | 621 | line.w[scan.left] = scan.w[0]; |
622 | line.w[scan.right] = scan.w[1]; | 622 | line.w[scan.right] = scan.w[1]; |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | #ifdef IPOL_C0 | 625 | #ifdef IPOL_C0 |
626 | line.c[0][scan.left] = scan.c[0][0]; | 626 | line.c[0][scan.left] = scan.c[0][0]; |
627 | line.c[0][scan.right] = scan.c[0][1]; | 627 | line.c[0][scan.right] = scan.c[0][1]; |
628 | #endif | 628 | #endif |
629 | 629 | ||
630 | #ifdef IPOL_T0 | 630 | #ifdef IPOL_T0 |
631 | line.t[0][scan.left] = scan.t[0][0]; | 631 | line.t[0][scan.left] = scan.t[0][0]; |
632 | line.t[0][scan.right] = scan.t[0][1]; | 632 | line.t[0][scan.right] = scan.t[0][1]; |
633 | #endif | 633 | #endif |
634 | 634 | ||
635 | #ifdef IPOL_T1 | 635 | #ifdef IPOL_T1 |
636 | line.t[1][scan.left] = scan.t[1][0]; | 636 | line.t[1][scan.left] = scan.t[1][0]; |
637 | line.t[1][scan.right] = scan.t[1][1]; | 637 | line.t[1][scan.right] = scan.t[1][1]; |
638 | #endif | 638 | #endif |
639 | 639 | ||
640 | #ifdef IPOL_T2 | 640 | #ifdef IPOL_T2 |
641 | line.t[2][scan.left] = scan.t[2][0]; | 641 | line.t[2][scan.left] = scan.t[2][0]; |
642 | line.t[2][scan.right] = scan.t[2][1]; | 642 | line.t[2][scan.right] = scan.t[2][1]; |
643 | #endif | 643 | #endif |
644 | 644 | ||
645 | #ifdef IPOL_L0 | 645 | #ifdef IPOL_L0 |
646 | line.l[0][scan.left] = scan.l[0][0]; | 646 | line.l[0][scan.left] = scan.l[0][0]; |
647 | line.l[0][scan.right] = scan.l[0][1]; | 647 | line.l[0][scan.right] = scan.l[0][1]; |
648 | #endif | 648 | #endif |
649 | 649 | ||
650 | // render a scanline | 650 | // render a scanline |
651 | (this->*fragmentShader) (); | 651 | (this->*fragmentShader) (); |
652 | 652 | ||
653 | scan.x[0] += scan.slopeX[0]; | 653 | scan.x[0] += scan.slopeX[0]; |
654 | scan.x[1] += scan.slopeX[1]; | 654 | scan.x[1] += scan.slopeX[1]; |
655 | 655 | ||
656 | #ifdef IPOL_Z | 656 | #ifdef IPOL_Z |
657 | scan.z[0] += scan.slopeZ[0]; | 657 | scan.z[0] += scan.slopeZ[0]; |
658 | scan.z[1] += scan.slopeZ[1]; | 658 | scan.z[1] += scan.slopeZ[1]; |
659 | #endif | 659 | #endif |
660 | 660 | ||
661 | #ifdef IPOL_W | 661 | #ifdef IPOL_W |
662 | scan.w[0] += scan.slopeW[0]; | 662 | scan.w[0] += scan.slopeW[0]; |
663 | scan.w[1] += scan.slopeW[1]; | 663 | scan.w[1] += scan.slopeW[1]; |
664 | #endif | 664 | #endif |
665 | 665 | ||
666 | #ifdef IPOL_C0 | 666 | #ifdef IPOL_C0 |
667 | scan.c[0][0] += scan.slopeC[0][0]; | 667 | scan.c[0][0] += scan.slopeC[0][0]; |
668 | scan.c[0][1] += scan.slopeC[0][1]; | 668 | scan.c[0][1] += scan.slopeC[0][1]; |
669 | #endif | 669 | #endif |
670 | 670 | ||
671 | #ifdef IPOL_T0 | 671 | #ifdef IPOL_T0 |
672 | scan.t[0][0] += scan.slopeT[0][0]; | 672 | scan.t[0][0] += scan.slopeT[0][0]; |
673 | scan.t[0][1] += scan.slopeT[0][1]; | 673 | scan.t[0][1] += scan.slopeT[0][1]; |
674 | #endif | 674 | #endif |
675 | 675 | ||
676 | #ifdef IPOL_T1 | 676 | #ifdef IPOL_T1 |
677 | scan.t[1][0] += scan.slopeT[1][0]; | 677 | scan.t[1][0] += scan.slopeT[1][0]; |
678 | scan.t[1][1] += scan.slopeT[1][1]; | 678 | scan.t[1][1] += scan.slopeT[1][1]; |
679 | #endif | 679 | #endif |
680 | 680 | ||
681 | #ifdef IPOL_T2 | 681 | #ifdef IPOL_T2 |
682 | scan.t[2][0] += scan.slopeT[2][0]; | 682 | scan.t[2][0] += scan.slopeT[2][0]; |
683 | scan.t[2][1] += scan.slopeT[2][1]; | 683 | scan.t[2][1] += scan.slopeT[2][1]; |
684 | #endif | 684 | #endif |
685 | 685 | ||
686 | #ifdef IPOL_L0 | 686 | #ifdef IPOL_L0 |
687 | scan.l[0][0] += scan.slopeL[0][0]; | 687 | scan.l[0][0] += scan.slopeL[0][0]; |
688 | scan.l[0][1] += scan.slopeL[0][1]; | 688 | scan.l[0][1] += scan.slopeL[0][1]; |
689 | #endif | 689 | #endif |
690 | 690 | ||
691 | } | 691 | } |
692 | } | 692 | } |
693 | 693 | ||
694 | // rasterize lower sub-triangle | 694 | // rasterize lower sub-triangle |
695 | //if ( (f32) 0.0 != scan.invDeltaY[2] ) | 695 | //if ( (f32) 0.0 != scan.invDeltaY[2] ) |
696 | if ( F32_GREATER_0 ( scan.invDeltaY[2] ) ) | 696 | if ( F32_GREATER_0 ( scan.invDeltaY[2] ) ) |
697 | { | 697 | { |
698 | // advance to middle point | 698 | // advance to middle point |
699 | //if( (f32) 0.0 != scan.invDeltaY[1] ) | 699 | //if( (f32) 0.0 != scan.invDeltaY[1] ) |
700 | if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) | 700 | if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) |
701 | { | 701 | { |
702 | temp[0] = b->Pos.y - a->Pos.y; // dy | 702 | temp[0] = b->Pos.y - a->Pos.y; // dy |
703 | 703 | ||
704 | scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0]; | 704 | scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0]; |
705 | #ifdef IPOL_Z | 705 | #ifdef IPOL_Z |
706 | scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0]; | 706 | scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0]; |
707 | #endif | 707 | #endif |
708 | #ifdef IPOL_W | 708 | #ifdef IPOL_W |
709 | scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0]; | 709 | scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0]; |
710 | #endif | 710 | #endif |
711 | #ifdef IPOL_C0 | 711 | #ifdef IPOL_C0 |
712 | scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0]; | 712 | scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0]; |
713 | #endif | 713 | #endif |
714 | #ifdef IPOL_T0 | 714 | #ifdef IPOL_T0 |
715 | scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0]; | 715 | scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0]; |
716 | #endif | 716 | #endif |
717 | #ifdef IPOL_T1 | 717 | #ifdef IPOL_T1 |
718 | scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0]; | 718 | scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0]; |
719 | #endif | 719 | #endif |
720 | #ifdef IPOL_T2 | 720 | #ifdef IPOL_T2 |
721 | scan.t[2][0] = a->Tex[2] + scan.slopeT[2][0] * temp[0]; | 721 | scan.t[2][0] = a->Tex[2] + scan.slopeT[2][0] * temp[0]; |
722 | #endif | 722 | #endif |
723 | #ifdef IPOL_L0 | 723 | #ifdef IPOL_L0 |
724 | scan.l[0][0] = a->LightTangent[0] + scan.slopeL[0][0] * temp[0]; | 724 | scan.l[0][0] = a->LightTangent[0] + scan.slopeL[0][0] * temp[0]; |
725 | #endif | 725 | #endif |
726 | 726 | ||
727 | } | 727 | } |
728 | 728 | ||
729 | // calculate slopes for bottom edge | 729 | // calculate slopes for bottom edge |
730 | scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2]; | 730 | scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2]; |
731 | scan.x[1] = b->Pos.x; | 731 | scan.x[1] = b->Pos.x; |
732 | 732 | ||
733 | #ifdef IPOL_Z | 733 | #ifdef IPOL_Z |
734 | scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2]; | 734 | scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2]; |
735 | scan.z[1] = b->Pos.z; | 735 | scan.z[1] = b->Pos.z; |
736 | #endif | 736 | #endif |
737 | 737 | ||
738 | #ifdef IPOL_W | 738 | #ifdef IPOL_W |
739 | scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2]; | 739 | scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2]; |
740 | scan.w[1] = b->Pos.w; | 740 | scan.w[1] = b->Pos.w; |
741 | #endif | 741 | #endif |
742 | 742 | ||
743 | #ifdef IPOL_C0 | 743 | #ifdef IPOL_C0 |
744 | scan.slopeC[0][1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2]; | 744 | scan.slopeC[0][1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2]; |
745 | scan.c[0][1] = b->Color[0]; | 745 | scan.c[0][1] = b->Color[0]; |
746 | #endif | 746 | #endif |
747 | 747 | ||
748 | #ifdef IPOL_T0 | 748 | #ifdef IPOL_T0 |
749 | scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2]; | 749 | scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2]; |
750 | scan.t[0][1] = b->Tex[0]; | 750 | scan.t[0][1] = b->Tex[0]; |
751 | #endif | 751 | #endif |
752 | 752 | ||
753 | #ifdef IPOL_T1 | 753 | #ifdef IPOL_T1 |
754 | scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2]; | 754 | scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2]; |
755 | scan.t[1][1] = b->Tex[1]; | 755 | scan.t[1][1] = b->Tex[1]; |
756 | #endif | 756 | #endif |
757 | 757 | ||
758 | #ifdef IPOL_T2 | 758 | #ifdef IPOL_T2 |
759 | scan.slopeT[2][1] = (c->Tex[2] - b->Tex[2]) * scan.invDeltaY[2]; | 759 | scan.slopeT[2][1] = (c->Tex[2] - b->Tex[2]) * scan.invDeltaY[2]; |
760 | scan.t[2][1] = b->Tex[2]; | 760 | scan.t[2][1] = b->Tex[2]; |
761 | #endif | 761 | #endif |
762 | 762 | ||
763 | #ifdef IPOL_L0 | 763 | #ifdef IPOL_L0 |
764 | scan.slopeL[0][1] = (c->LightTangent[0] - b->LightTangent[0]) * scan.invDeltaY[2]; | 764 | scan.slopeL[0][1] = (c->LightTangent[0] - b->LightTangent[0]) * scan.invDeltaY[2]; |
765 | scan.l[0][1] = b->LightTangent[0]; | 765 | scan.l[0][1] = b->LightTangent[0]; |
766 | #endif | 766 | #endif |
767 | 767 | ||
768 | // apply top-left fill convention, top part | 768 | // apply top-left fill convention, top part |
769 | yStart = core::ceil32( b->Pos.y ); | 769 | yStart = core::ceil32( b->Pos.y ); |
770 | yEnd = core::ceil32( c->Pos.y ) - 1; | 770 | yEnd = core::ceil32( c->Pos.y ) - 1; |
771 | 771 | ||
772 | #ifdef SUBTEXEL | 772 | #ifdef SUBTEXEL |
773 | 773 | ||
774 | subPixel = ( (f32) yStart ) - b->Pos.y; | 774 | subPixel = ( (f32) yStart ) - b->Pos.y; |
775 | 775 | ||
776 | // correct to pixel center | 776 | // correct to pixel center |
777 | scan.x[0] += scan.slopeX[0] * subPixel; | 777 | scan.x[0] += scan.slopeX[0] * subPixel; |
778 | scan.x[1] += scan.slopeX[1] * subPixel; | 778 | scan.x[1] += scan.slopeX[1] * subPixel; |
779 | 779 | ||
780 | #ifdef IPOL_Z | 780 | #ifdef IPOL_Z |
781 | scan.z[0] += scan.slopeZ[0] * subPixel; | 781 | scan.z[0] += scan.slopeZ[0] * subPixel; |
782 | scan.z[1] += scan.slopeZ[1] * subPixel; | 782 | scan.z[1] += scan.slopeZ[1] * subPixel; |
783 | #endif | 783 | #endif |
784 | 784 | ||
785 | #ifdef IPOL_W | 785 | #ifdef IPOL_W |
786 | scan.w[0] += scan.slopeW[0] * subPixel; | 786 | scan.w[0] += scan.slopeW[0] * subPixel; |
787 | scan.w[1] += scan.slopeW[1] * subPixel; | 787 | scan.w[1] += scan.slopeW[1] * subPixel; |
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | #ifdef IPOL_C0 | 790 | #ifdef IPOL_C0 |
791 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; | 791 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; |
792 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; | 792 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; |
793 | #endif | 793 | #endif |
794 | 794 | ||
795 | #ifdef IPOL_T0 | 795 | #ifdef IPOL_T0 |
796 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; | 796 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; |
797 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; | 797 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; |
798 | #endif | 798 | #endif |
799 | 799 | ||
800 | #ifdef IPOL_T1 | 800 | #ifdef IPOL_T1 |
801 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; | 801 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; |
802 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; | 802 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; |
803 | #endif | 803 | #endif |
804 | 804 | ||
805 | #ifdef IPOL_T2 | 805 | #ifdef IPOL_T2 |
806 | scan.t[2][0] += scan.slopeT[2][0] * subPixel; | 806 | scan.t[2][0] += scan.slopeT[2][0] * subPixel; |
807 | scan.t[2][1] += scan.slopeT[2][1] * subPixel; | 807 | scan.t[2][1] += scan.slopeT[2][1] * subPixel; |
808 | #endif | 808 | #endif |
809 | 809 | ||
810 | #ifdef IPOL_L0 | 810 | #ifdef IPOL_L0 |
811 | scan.l[0][0] += scan.slopeL[0][0] * subPixel; | 811 | scan.l[0][0] += scan.slopeL[0][0] * subPixel; |
812 | scan.l[0][1] += scan.slopeL[0][1] * subPixel; | 812 | scan.l[0][1] += scan.slopeL[0][1] * subPixel; |
813 | #endif | 813 | #endif |
814 | 814 | ||
815 | #endif | 815 | #endif |
816 | 816 | ||
817 | // rasterize the edge scanlines | 817 | // rasterize the edge scanlines |
818 | for( line.y = yStart; line.y <= yEnd; ++line.y) | 818 | for( line.y = yStart; line.y <= yEnd; ++line.y) |
819 | { | 819 | { |
820 | line.x[scan.left] = scan.x[0]; | 820 | line.x[scan.left] = scan.x[0]; |
821 | line.x[scan.right] = scan.x[1]; | 821 | line.x[scan.right] = scan.x[1]; |
822 | 822 | ||
823 | #ifdef IPOL_Z | 823 | #ifdef IPOL_Z |
824 | line.z[scan.left] = scan.z[0]; | 824 | line.z[scan.left] = scan.z[0]; |
825 | line.z[scan.right] = scan.z[1]; | 825 | line.z[scan.right] = scan.z[1]; |
826 | #endif | 826 | #endif |
827 | 827 | ||
828 | #ifdef IPOL_W | 828 | #ifdef IPOL_W |
829 | line.w[scan.left] = scan.w[0]; | 829 | line.w[scan.left] = scan.w[0]; |
830 | line.w[scan.right] = scan.w[1]; | 830 | line.w[scan.right] = scan.w[1]; |
831 | #endif | 831 | #endif |
832 | 832 | ||
833 | #ifdef IPOL_C0 | 833 | #ifdef IPOL_C0 |
834 | line.c[0][scan.left] = scan.c[0][0]; | 834 | line.c[0][scan.left] = scan.c[0][0]; |
835 | line.c[0][scan.right] = scan.c[0][1]; | 835 | line.c[0][scan.right] = scan.c[0][1]; |
836 | #endif | 836 | #endif |
837 | 837 | ||
838 | #ifdef IPOL_T0 | 838 | #ifdef IPOL_T0 |
839 | line.t[0][scan.left] = scan.t[0][0]; | 839 | line.t[0][scan.left] = scan.t[0][0]; |
840 | line.t[0][scan.right] = scan.t[0][1]; | 840 | line.t[0][scan.right] = scan.t[0][1]; |
841 | #endif | 841 | #endif |
842 | 842 | ||
843 | #ifdef IPOL_T1 | 843 | #ifdef IPOL_T1 |
844 | line.t[1][scan.left] = scan.t[1][0]; | 844 | line.t[1][scan.left] = scan.t[1][0]; |
845 | line.t[1][scan.right] = scan.t[1][1]; | 845 | line.t[1][scan.right] = scan.t[1][1]; |
846 | #endif | 846 | #endif |
847 | 847 | ||
848 | #ifdef IPOL_T2 | 848 | #ifdef IPOL_T2 |
849 | line.t[2][scan.left] = scan.t[2][0]; | 849 | line.t[2][scan.left] = scan.t[2][0]; |
850 | line.t[2][scan.right] = scan.t[2][1]; | 850 | line.t[2][scan.right] = scan.t[2][1]; |
851 | #endif | 851 | #endif |
852 | 852 | ||
853 | #ifdef IPOL_L0 | 853 | #ifdef IPOL_L0 |
854 | line.l[0][scan.left] = scan.l[0][0]; | 854 | line.l[0][scan.left] = scan.l[0][0]; |
855 | line.l[0][scan.right] = scan.l[0][1]; | 855 | line.l[0][scan.right] = scan.l[0][1]; |
856 | #endif | 856 | #endif |
857 | 857 | ||
858 | // render a scanline | 858 | // render a scanline |
859 | (this->*fragmentShader) (); | 859 | (this->*fragmentShader) (); |
860 | 860 | ||
861 | scan.x[0] += scan.slopeX[0]; | 861 | scan.x[0] += scan.slopeX[0]; |
862 | scan.x[1] += scan.slopeX[1]; | 862 | scan.x[1] += scan.slopeX[1]; |
863 | 863 | ||
864 | #ifdef IPOL_Z | 864 | #ifdef IPOL_Z |
865 | scan.z[0] += scan.slopeZ[0]; | 865 | scan.z[0] += scan.slopeZ[0]; |
866 | scan.z[1] += scan.slopeZ[1]; | 866 | scan.z[1] += scan.slopeZ[1]; |
867 | #endif | 867 | #endif |
868 | 868 | ||
869 | #ifdef IPOL_W | 869 | #ifdef IPOL_W |
870 | scan.w[0] += scan.slopeW[0]; | 870 | scan.w[0] += scan.slopeW[0]; |
871 | scan.w[1] += scan.slopeW[1]; | 871 | scan.w[1] += scan.slopeW[1]; |
872 | #endif | 872 | #endif |
873 | 873 | ||
874 | #ifdef IPOL_C0 | 874 | #ifdef IPOL_C0 |
875 | scan.c[0][0] += scan.slopeC[0][0]; | 875 | scan.c[0][0] += scan.slopeC[0][0]; |
876 | scan.c[0][1] += scan.slopeC[0][1]; | 876 | scan.c[0][1] += scan.slopeC[0][1]; |
877 | #endif | 877 | #endif |
878 | 878 | ||
879 | #ifdef IPOL_T0 | 879 | #ifdef IPOL_T0 |
880 | scan.t[0][0] += scan.slopeT[0][0]; | 880 | scan.t[0][0] += scan.slopeT[0][0]; |
881 | scan.t[0][1] += scan.slopeT[0][1]; | 881 | scan.t[0][1] += scan.slopeT[0][1]; |
882 | #endif | 882 | #endif |
883 | 883 | ||
884 | #ifdef IPOL_T1 | 884 | #ifdef IPOL_T1 |
885 | scan.t[1][0] += scan.slopeT[1][0]; | 885 | scan.t[1][0] += scan.slopeT[1][0]; |
886 | scan.t[1][1] += scan.slopeT[1][1]; | 886 | scan.t[1][1] += scan.slopeT[1][1]; |
887 | #endif | 887 | #endif |
888 | #ifdef IPOL_T2 | 888 | #ifdef IPOL_T2 |
889 | scan.t[2][0] += scan.slopeT[2][0]; | 889 | scan.t[2][0] += scan.slopeT[2][0]; |
890 | scan.t[2][1] += scan.slopeT[2][1]; | 890 | scan.t[2][1] += scan.slopeT[2][1]; |
891 | #endif | 891 | #endif |
892 | 892 | ||
893 | #ifdef IPOL_L0 | 893 | #ifdef IPOL_L0 |
894 | scan.l[0][0] += scan.slopeL[0][0]; | 894 | scan.l[0][0] += scan.slopeL[0][0]; |
895 | scan.l[0][1] += scan.slopeL[0][1]; | 895 | scan.l[0][1] += scan.slopeL[0][1]; |
896 | #endif | 896 | #endif |
897 | 897 | ||
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | } | 901 | } |
902 | 902 | ||
903 | 903 | ||
904 | } // end namespace video | 904 | } // end namespace video |
905 | } // end namespace irr | 905 | } // end namespace irr |
906 | 906 | ||
907 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 907 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
908 | 908 | ||
909 | namespace irr | 909 | namespace irr |
910 | { | 910 | { |
911 | namespace video | 911 | namespace video |
912 | { | 912 | { |
913 | 913 | ||
914 | 914 | ||
915 | //! creates a triangle renderer | 915 | //! creates a triangle renderer |
916 | IBurningShader* createTRStencilShadow(CBurningVideoDriver* driver) | 916 | IBurningShader* createTRStencilShadow(CBurningVideoDriver* driver) |
917 | { | 917 | { |
918 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 918 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
919 | return new CTRStencilShadow(driver); | 919 | return new CTRStencilShadow(driver); |
920 | #else | 920 | #else |
921 | return 0; | 921 | return 0; |
922 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 922 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
923 | } | 923 | } |
924 | 924 | ||
925 | 925 | ||
926 | } // end namespace video | 926 | } // end namespace video |
927 | } // end namespace irr | 927 | } // end namespace irr |
928 | 928 | ||
929 | 929 | ||
930 | 930 | ||