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/CTRTextureDetailMap2.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/CTRTextureDetailMap2.cpp | 1318 |
1 files changed, 659 insertions, 659 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CTRTextureDetailMap2.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CTRTextureDetailMap2.cpp index 514383f..dc5d6ba 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CTRTextureDetailMap2.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CTRTextureDetailMap2.cpp | |||
@@ -1,659 +1,659 @@ | |||
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 IPOL_Z | 12 | #undef IPOL_Z |
13 | #undef CMP_Z | 13 | #undef CMP_Z |
14 | #undef WRITE_Z | 14 | #undef WRITE_Z |
15 | 15 | ||
16 | #undef IPOL_W | 16 | #undef IPOL_W |
17 | #undef CMP_W | 17 | #undef CMP_W |
18 | #undef WRITE_W | 18 | #undef WRITE_W |
19 | 19 | ||
20 | #undef SUBTEXEL | 20 | #undef SUBTEXEL |
21 | #undef INVERSE_W | 21 | #undef INVERSE_W |
22 | 22 | ||
23 | #undef IPOL_C0 | 23 | #undef IPOL_C0 |
24 | #undef IPOL_T0 | 24 | #undef IPOL_T0 |
25 | #undef IPOL_T1 | 25 | #undef IPOL_T1 |
26 | 26 | ||
27 | // define render case | 27 | // define render case |
28 | #define SUBTEXEL | 28 | #define SUBTEXEL |
29 | #define INVERSE_W | 29 | #define INVERSE_W |
30 | 30 | ||
31 | #define USE_ZBUFFER | 31 | #define USE_ZBUFFER |
32 | #define IPOL_W | 32 | #define IPOL_W |
33 | #define CMP_W | 33 | #define CMP_W |
34 | #define WRITE_W | 34 | #define WRITE_W |
35 | 35 | ||
36 | #define IPOL_C0 | 36 | #define IPOL_C0 |
37 | #define IPOL_T0 | 37 | #define IPOL_T0 |
38 | #define IPOL_T1 | 38 | #define IPOL_T1 |
39 | 39 | ||
40 | // apply global override | 40 | // apply global override |
41 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT | 41 | #ifndef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT |
42 | #undef INVERSE_W | 42 | #undef INVERSE_W |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #ifndef SOFTWARE_DRIVER_2_SUBTEXEL | 45 | #ifndef SOFTWARE_DRIVER_2_SUBTEXEL |
46 | #undef SUBTEXEL | 46 | #undef SUBTEXEL |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 49 | #ifndef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
50 | #undef IPOL_C0 | 50 | #undef IPOL_C0 |
51 | #endif | 51 | #endif |
52 | 52 | ||
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 CTRTextureDetailMap2 : public IBurningShader | 79 | class CTRTextureDetailMap2 : public IBurningShader |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | 82 | ||
83 | //! constructor | 83 | //! constructor |
84 | CTRTextureDetailMap2(CBurningVideoDriver* driver); | 84 | CTRTextureDetailMap2(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 | 88 | ||
89 | 89 | ||
90 | private: | 90 | private: |
91 | void scanline_bilinear (); | 91 | void scanline_bilinear (); |
92 | sScanConvertData scan; | 92 | sScanConvertData scan; |
93 | sScanLineData line; | 93 | sScanLineData line; |
94 | 94 | ||
95 | }; | 95 | }; |
96 | 96 | ||
97 | //! constructor | 97 | //! constructor |
98 | CTRTextureDetailMap2::CTRTextureDetailMap2(CBurningVideoDriver* driver) | 98 | CTRTextureDetailMap2::CTRTextureDetailMap2(CBurningVideoDriver* driver) |
99 | : IBurningShader(driver) | 99 | : IBurningShader(driver) |
100 | { | 100 | { |
101 | #ifdef _DEBUG | 101 | #ifdef _DEBUG |
102 | setDebugName("CTRTextureDetailMap2"); | 102 | setDebugName("CTRTextureDetailMap2"); |
103 | #endif | 103 | #endif |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | /*! | 108 | /*! |
109 | */ | 109 | */ |
110 | void CTRTextureDetailMap2::scanline_bilinear () | 110 | void CTRTextureDetailMap2::scanline_bilinear () |
111 | { | 111 | { |
112 | tVideoSample *dst; | 112 | tVideoSample *dst; |
113 | 113 | ||
114 | #ifdef USE_ZBUFFER | 114 | #ifdef USE_ZBUFFER |
115 | fp24 *z; | 115 | fp24 *z; |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | s32 xStart; | 118 | s32 xStart; |
119 | s32 xEnd; | 119 | s32 xEnd; |
120 | s32 dx; | 120 | s32 dx; |
121 | 121 | ||
122 | 122 | ||
123 | #ifdef SUBTEXEL | 123 | #ifdef SUBTEXEL |
124 | f32 subPixel; | 124 | f32 subPixel; |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | #ifdef IPOL_Z | 127 | #ifdef IPOL_Z |
128 | f32 slopeZ; | 128 | f32 slopeZ; |
129 | #endif | 129 | #endif |
130 | #ifdef IPOL_W | 130 | #ifdef IPOL_W |
131 | fp24 slopeW; | 131 | fp24 slopeW; |
132 | #endif | 132 | #endif |
133 | #ifdef IPOL_C0 | 133 | #ifdef IPOL_C0 |
134 | sVec4 slopeC; | 134 | sVec4 slopeC; |
135 | #endif | 135 | #endif |
136 | #ifdef IPOL_T0 | 136 | #ifdef IPOL_T0 |
137 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; | 137 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES]; |
138 | #endif | 138 | #endif |
139 | 139 | ||
140 | // apply top-left fill-convention, left | 140 | // apply top-left fill-convention, left |
141 | xStart = core::ceil32( line.x[0] ); | 141 | xStart = core::ceil32( line.x[0] ); |
142 | xEnd = core::ceil32( line.x[1] ) - 1; | 142 | xEnd = core::ceil32( line.x[1] ) - 1; |
143 | 143 | ||
144 | dx = xEnd - xStart; | 144 | dx = xEnd - xStart; |
145 | 145 | ||
146 | if ( dx < 0 ) | 146 | if ( dx < 0 ) |
147 | return; | 147 | return; |
148 | 148 | ||
149 | // slopes | 149 | // slopes |
150 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); | 150 | const f32 invDeltaX = core::reciprocal_approxim ( line.x[1] - line.x[0] ); |
151 | 151 | ||
152 | #ifdef IPOL_Z | 152 | #ifdef IPOL_Z |
153 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; | 153 | slopeZ = (line.z[1] - line.z[0]) * invDeltaX; |
154 | #endif | 154 | #endif |
155 | #ifdef IPOL_W | 155 | #ifdef IPOL_W |
156 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; | 156 | slopeW = (line.w[1] - line.w[0]) * invDeltaX; |
157 | #endif | 157 | #endif |
158 | #ifdef IPOL_C0 | 158 | #ifdef IPOL_C0 |
159 | slopeC = (line.c[0][1] - line.c[0][0]) * invDeltaX; | 159 | slopeC = (line.c[0][1] - line.c[0][0]) * invDeltaX; |
160 | #endif | 160 | #endif |
161 | #ifdef IPOL_T0 | 161 | #ifdef IPOL_T0 |
162 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; | 162 | slopeT[0] = (line.t[0][1] - line.t[0][0]) * invDeltaX; |
163 | #endif | 163 | #endif |
164 | #ifdef IPOL_T1 | 164 | #ifdef IPOL_T1 |
165 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; | 165 | slopeT[1] = (line.t[1][1] - line.t[1][0]) * invDeltaX; |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #ifdef SUBTEXEL | 168 | #ifdef SUBTEXEL |
169 | subPixel = ( (f32) xStart ) - line.x[0]; | 169 | subPixel = ( (f32) xStart ) - line.x[0]; |
170 | #ifdef IPOL_Z | 170 | #ifdef IPOL_Z |
171 | line.z[0] += slopeZ * subPixel; | 171 | line.z[0] += slopeZ * subPixel; |
172 | #endif | 172 | #endif |
173 | #ifdef IPOL_W | 173 | #ifdef IPOL_W |
174 | line.w[0] += slopeW * subPixel; | 174 | line.w[0] += slopeW * subPixel; |
175 | #endif | 175 | #endif |
176 | #ifdef IPOL_C0 | 176 | #ifdef IPOL_C0 |
177 | line.c[0][0] += slopeC * subPixel; | 177 | line.c[0][0] += slopeC * subPixel; |
178 | #endif | 178 | #endif |
179 | #ifdef IPOL_T0 | 179 | #ifdef IPOL_T0 |
180 | line.t[0][0] += slopeT[0] * subPixel; | 180 | line.t[0][0] += slopeT[0] * subPixel; |
181 | #endif | 181 | #endif |
182 | #ifdef IPOL_T1 | 182 | #ifdef IPOL_T1 |
183 | line.t[1][0] += slopeT[1] * subPixel; | 183 | line.t[1][0] += slopeT[1] * subPixel; |
184 | #endif | 184 | #endif |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 187 | dst = (tVideoSample*)RenderTarget->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
188 | 188 | ||
189 | #ifdef USE_ZBUFFER | 189 | #ifdef USE_ZBUFFER |
190 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; | 190 | z = (fp24*) DepthBuffer->lock() + ( line.y * RenderTarget->getDimension().Width ) + xStart; |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | 193 | ||
194 | #ifdef INVERSE_W | 194 | #ifdef INVERSE_W |
195 | f32 inversew; | 195 | f32 inversew; |
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | tFixPoint tx0, tx1; | 198 | tFixPoint tx0, tx1; |
199 | tFixPoint ty0, ty1; | 199 | tFixPoint ty0, ty1; |
200 | 200 | ||
201 | tFixPoint r0, g0, b0; | 201 | tFixPoint r0, g0, b0; |
202 | tFixPoint r1, g1, b1; | 202 | tFixPoint r1, g1, b1; |
203 | tFixPoint r2, g2, b2; | 203 | tFixPoint r2, g2, b2; |
204 | 204 | ||
205 | 205 | ||
206 | for ( s32 i = 0; i <= dx; ++i ) | 206 | for ( s32 i = 0; i <= dx; ++i ) |
207 | { | 207 | { |
208 | #ifdef CMP_Z | 208 | #ifdef CMP_Z |
209 | if ( line.z[0] < z[i] ) | 209 | if ( line.z[0] < z[i] ) |
210 | #endif | 210 | #endif |
211 | #ifdef CMP_W | 211 | #ifdef CMP_W |
212 | if ( line.w[0] >= z[i] ) | 212 | if ( line.w[0] >= z[i] ) |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | { | 215 | { |
216 | #ifdef INVERSE_W | 216 | #ifdef INVERSE_W |
217 | inversew = fix_inverse32 ( line.w[0] ); | 217 | inversew = fix_inverse32 ( line.w[0] ); |
218 | 218 | ||
219 | tx0 = tofix ( line.t[0][0].x,inversew); | 219 | tx0 = tofix ( line.t[0][0].x,inversew); |
220 | ty0 = tofix ( line.t[0][0].y,inversew); | 220 | ty0 = tofix ( line.t[0][0].y,inversew); |
221 | tx1 = tofix ( line.t[1][0].x,inversew); | 221 | tx1 = tofix ( line.t[1][0].x,inversew); |
222 | ty1 = tofix ( line.t[1][0].y,inversew); | 222 | ty1 = tofix ( line.t[1][0].y,inversew); |
223 | 223 | ||
224 | #else | 224 | #else |
225 | tx0 = tofix ( line.t[0][0].x ); | 225 | tx0 = tofix ( line.t[0][0].x ); |
226 | ty0 = tofix ( line.t[0][0].y ); | 226 | ty0 = tofix ( line.t[0][0].y ); |
227 | tx1 = tofix ( line.t[1][0].x ); | 227 | tx1 = tofix ( line.t[1][0].x ); |
228 | ty1 = tofix ( line.t[1][0].y ); | 228 | ty1 = tofix ( line.t[1][0].y ); |
229 | #endif | 229 | #endif |
230 | getSample_texture ( r0, g0, b0, &IT[0], tx0,ty0 ); | 230 | getSample_texture ( r0, g0, b0, &IT[0], tx0,ty0 ); |
231 | getSample_texture ( r1, g1, b1, &IT[1], tx1,ty1 ); | 231 | getSample_texture ( r1, g1, b1, &IT[1], tx1,ty1 ); |
232 | 232 | ||
233 | // bias half color | 233 | // bias half color |
234 | r1 += -FIX_POINT_HALF_COLOR; | 234 | r1 += -FIX_POINT_HALF_COLOR; |
235 | g1 += -FIX_POINT_HALF_COLOR; | 235 | g1 += -FIX_POINT_HALF_COLOR; |
236 | b1 += -FIX_POINT_HALF_COLOR; | 236 | b1 += -FIX_POINT_HALF_COLOR; |
237 | 237 | ||
238 | r2 = clampfix_mincolor ( clampfix_maxcolor ( r0 + r1 ) ); | 238 | r2 = clampfix_mincolor ( clampfix_maxcolor ( r0 + r1 ) ); |
239 | g2 = clampfix_mincolor ( clampfix_maxcolor ( g0 + g1 ) ); | 239 | g2 = clampfix_mincolor ( clampfix_maxcolor ( g0 + g1 ) ); |
240 | b2 = clampfix_mincolor ( clampfix_maxcolor ( b0 + b1 ) ); | 240 | b2 = clampfix_mincolor ( clampfix_maxcolor ( b0 + b1 ) ); |
241 | 241 | ||
242 | dst[i] = fix_to_color ( r2, g2, b2 ); | 242 | dst[i] = fix_to_color ( r2, g2, b2 ); |
243 | 243 | ||
244 | #ifdef WRITE_Z | 244 | #ifdef WRITE_Z |
245 | z[i] = line.z[0]; | 245 | z[i] = line.z[0]; |
246 | #endif | 246 | #endif |
247 | #ifdef WRITE_W | 247 | #ifdef WRITE_W |
248 | z[i] = line.w[0]; | 248 | z[i] = line.w[0]; |
249 | #endif | 249 | #endif |
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | #ifdef IPOL_Z | 253 | #ifdef IPOL_Z |
254 | line.z[0] += slopeZ; | 254 | line.z[0] += slopeZ; |
255 | #endif | 255 | #endif |
256 | #ifdef IPOL_W | 256 | #ifdef IPOL_W |
257 | line.w[0] += slopeW; | 257 | line.w[0] += slopeW; |
258 | #endif | 258 | #endif |
259 | #ifdef IPOL_C0 | 259 | #ifdef IPOL_C0 |
260 | line.c[0][0] += slopeC; | 260 | line.c[0][0] += slopeC; |
261 | #endif | 261 | #endif |
262 | #ifdef IPOL_T0 | 262 | #ifdef IPOL_T0 |
263 | line.t[0][0] += slopeT[0]; | 263 | line.t[0][0] += slopeT[0]; |
264 | #endif | 264 | #endif |
265 | #ifdef IPOL_T1 | 265 | #ifdef IPOL_T1 |
266 | line.t[1][0] += slopeT[1]; | 266 | line.t[1][0] += slopeT[1]; |
267 | #endif | 267 | #endif |
268 | } | 268 | } |
269 | 269 | ||
270 | } | 270 | } |
271 | 271 | ||
272 | void CTRTextureDetailMap2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) | 272 | void CTRTextureDetailMap2::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) |
273 | { | 273 | { |
274 | // sort on height, y | 274 | // sort on height, y |
275 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); | 275 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); |
276 | if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c); | 276 | if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c); |
277 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); | 277 | if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); |
278 | 278 | ||
279 | const f32 ca = c->Pos.y - a->Pos.y; | 279 | const f32 ca = c->Pos.y - a->Pos.y; |
280 | const f32 ba = b->Pos.y - a->Pos.y; | 280 | const f32 ba = b->Pos.y - a->Pos.y; |
281 | const f32 cb = c->Pos.y - b->Pos.y; | 281 | const f32 cb = c->Pos.y - b->Pos.y; |
282 | // calculate delta y of the edges | 282 | // calculate delta y of the edges |
283 | scan.invDeltaY[0] = core::reciprocal( ca ); | 283 | scan.invDeltaY[0] = core::reciprocal( ca ); |
284 | scan.invDeltaY[1] = core::reciprocal( ba ); | 284 | scan.invDeltaY[1] = core::reciprocal( ba ); |
285 | scan.invDeltaY[2] = core::reciprocal( cb ); | 285 | scan.invDeltaY[2] = core::reciprocal( cb ); |
286 | 286 | ||
287 | if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) ) | 287 | if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) ) |
288 | return; | 288 | return; |
289 | 289 | ||
290 | // find if the major edge is left or right aligned | 290 | // find if the major edge is left or right aligned |
291 | f32 temp[4]; | 291 | f32 temp[4]; |
292 | 292 | ||
293 | temp[0] = a->Pos.x - c->Pos.x; | 293 | temp[0] = a->Pos.x - c->Pos.x; |
294 | temp[1] = -ca; | 294 | temp[1] = -ca; |
295 | temp[2] = b->Pos.x - a->Pos.x; | 295 | temp[2] = b->Pos.x - a->Pos.x; |
296 | temp[3] = ba; | 296 | temp[3] = ba; |
297 | 297 | ||
298 | scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1; | 298 | scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > 0.f ? 0 : 1; |
299 | scan.right = 1 - scan.left; | 299 | scan.right = 1 - scan.left; |
300 | 300 | ||
301 | // calculate slopes for the major edge | 301 | // calculate slopes for the major edge |
302 | scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0]; | 302 | scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0]; |
303 | scan.x[0] = a->Pos.x; | 303 | scan.x[0] = a->Pos.x; |
304 | 304 | ||
305 | #ifdef IPOL_Z | 305 | #ifdef IPOL_Z |
306 | scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0]; | 306 | scan.slopeZ[0] = (c->Pos.z - a->Pos.z) * scan.invDeltaY[0]; |
307 | scan.z[0] = a->Pos.z; | 307 | scan.z[0] = a->Pos.z; |
308 | #endif | 308 | #endif |
309 | 309 | ||
310 | #ifdef IPOL_W | 310 | #ifdef IPOL_W |
311 | scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0]; | 311 | scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0]; |
312 | scan.w[0] = a->Pos.w; | 312 | scan.w[0] = a->Pos.w; |
313 | #endif | 313 | #endif |
314 | 314 | ||
315 | #ifdef IPOL_C0 | 315 | #ifdef IPOL_C0 |
316 | scan.slopeC[0][0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0]; | 316 | scan.slopeC[0][0] = (c->Color[0] - a->Color[0]) * scan.invDeltaY[0]; |
317 | scan.c[0][0] = a->Color[0]; | 317 | scan.c[0][0] = a->Color[0]; |
318 | #endif | 318 | #endif |
319 | 319 | ||
320 | #ifdef IPOL_T0 | 320 | #ifdef IPOL_T0 |
321 | scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0]; | 321 | scan.slopeT[0][0] = (c->Tex[0] - a->Tex[0]) * scan.invDeltaY[0]; |
322 | scan.t[0][0] = a->Tex[0]; | 322 | scan.t[0][0] = a->Tex[0]; |
323 | #endif | 323 | #endif |
324 | 324 | ||
325 | #ifdef IPOL_T1 | 325 | #ifdef IPOL_T1 |
326 | scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0]; | 326 | scan.slopeT[1][0] = (c->Tex[1] - a->Tex[1]) * scan.invDeltaY[0]; |
327 | scan.t[1][0] = a->Tex[1]; | 327 | scan.t[1][0] = a->Tex[1]; |
328 | #endif | 328 | #endif |
329 | 329 | ||
330 | // top left fill convention y run | 330 | // top left fill convention y run |
331 | s32 yStart; | 331 | s32 yStart; |
332 | s32 yEnd; | 332 | s32 yEnd; |
333 | 333 | ||
334 | #ifdef SUBTEXEL | 334 | #ifdef SUBTEXEL |
335 | f32 subPixel; | 335 | f32 subPixel; |
336 | #endif | 336 | #endif |
337 | 337 | ||
338 | // rasterize upper sub-triangle | 338 | // rasterize upper sub-triangle |
339 | if ( (f32) 0.0 != scan.invDeltaY[1] ) | 339 | if ( (f32) 0.0 != scan.invDeltaY[1] ) |
340 | { | 340 | { |
341 | // calculate slopes for top edge | 341 | // calculate slopes for top edge |
342 | scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1]; | 342 | scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1]; |
343 | scan.x[1] = a->Pos.x; | 343 | scan.x[1] = a->Pos.x; |
344 | 344 | ||
345 | #ifdef IPOL_Z | 345 | #ifdef IPOL_Z |
346 | scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1]; | 346 | scan.slopeZ[1] = (b->Pos.z - a->Pos.z) * scan.invDeltaY[1]; |
347 | scan.z[1] = a->Pos.z; | 347 | scan.z[1] = a->Pos.z; |
348 | #endif | 348 | #endif |
349 | 349 | ||
350 | #ifdef IPOL_W | 350 | #ifdef IPOL_W |
351 | scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1]; | 351 | scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1]; |
352 | scan.w[1] = a->Pos.w; | 352 | scan.w[1] = a->Pos.w; |
353 | #endif | 353 | #endif |
354 | 354 | ||
355 | #ifdef IPOL_C0 | 355 | #ifdef IPOL_C0 |
356 | scan.slopeC[0][1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1]; | 356 | scan.slopeC[0][1] = (b->Color[0] - a->Color[0]) * scan.invDeltaY[1]; |
357 | scan.c[0][1] = a->Color[0]; | 357 | scan.c[0][1] = a->Color[0]; |
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | #ifdef IPOL_T0 | 360 | #ifdef IPOL_T0 |
361 | scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1]; | 361 | scan.slopeT[0][1] = (b->Tex[0] - a->Tex[0]) * scan.invDeltaY[1]; |
362 | scan.t[0][1] = a->Tex[0]; | 362 | scan.t[0][1] = a->Tex[0]; |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | #ifdef IPOL_T1 | 365 | #ifdef IPOL_T1 |
366 | scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1]; | 366 | scan.slopeT[1][1] = (b->Tex[1] - a->Tex[1]) * scan.invDeltaY[1]; |
367 | scan.t[1][1] = a->Tex[1]; | 367 | scan.t[1][1] = a->Tex[1]; |
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | // apply top-left fill convention, top part | 370 | // apply top-left fill convention, top part |
371 | yStart = core::ceil32( a->Pos.y ); | 371 | yStart = core::ceil32( a->Pos.y ); |
372 | yEnd = core::ceil32( b->Pos.y ) - 1; | 372 | yEnd = core::ceil32( b->Pos.y ) - 1; |
373 | 373 | ||
374 | #ifdef SUBTEXEL | 374 | #ifdef SUBTEXEL |
375 | subPixel = ( (f32) yStart ) - a->Pos.y; | 375 | subPixel = ( (f32) yStart ) - a->Pos.y; |
376 | 376 | ||
377 | // correct to pixel center | 377 | // correct to pixel center |
378 | scan.x[0] += scan.slopeX[0] * subPixel; | 378 | scan.x[0] += scan.slopeX[0] * subPixel; |
379 | scan.x[1] += scan.slopeX[1] * subPixel; | 379 | scan.x[1] += scan.slopeX[1] * subPixel; |
380 | 380 | ||
381 | #ifdef IPOL_Z | 381 | #ifdef IPOL_Z |
382 | scan.z[0] += scan.slopeZ[0] * subPixel; | 382 | scan.z[0] += scan.slopeZ[0] * subPixel; |
383 | scan.z[1] += scan.slopeZ[1] * subPixel; | 383 | scan.z[1] += scan.slopeZ[1] * subPixel; |
384 | #endif | 384 | #endif |
385 | 385 | ||
386 | #ifdef IPOL_W | 386 | #ifdef IPOL_W |
387 | scan.w[0] += scan.slopeW[0] * subPixel; | 387 | scan.w[0] += scan.slopeW[0] * subPixel; |
388 | scan.w[1] += scan.slopeW[1] * subPixel; | 388 | scan.w[1] += scan.slopeW[1] * subPixel; |
389 | #endif | 389 | #endif |
390 | 390 | ||
391 | #ifdef IPOL_C0 | 391 | #ifdef IPOL_C0 |
392 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; | 392 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; |
393 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; | 393 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; |
394 | #endif | 394 | #endif |
395 | 395 | ||
396 | #ifdef IPOL_T0 | 396 | #ifdef IPOL_T0 |
397 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; | 397 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; |
398 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; | 398 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | #ifdef IPOL_T1 | 401 | #ifdef IPOL_T1 |
402 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; | 402 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; |
403 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; | 403 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | // rasterize the edge scanlines | 408 | // rasterize the edge scanlines |
409 | for( line.y = yStart; line.y <= yEnd; ++line.y) | 409 | for( line.y = yStart; line.y <= yEnd; ++line.y) |
410 | { | 410 | { |
411 | line.x[scan.left] = scan.x[0]; | 411 | line.x[scan.left] = scan.x[0]; |
412 | line.x[scan.right] = scan.x[1]; | 412 | line.x[scan.right] = scan.x[1]; |
413 | 413 | ||
414 | #ifdef IPOL_Z | 414 | #ifdef IPOL_Z |
415 | line.z[scan.left] = scan.z[0]; | 415 | line.z[scan.left] = scan.z[0]; |
416 | line.z[scan.right] = scan.z[1]; | 416 | line.z[scan.right] = scan.z[1]; |
417 | #endif | 417 | #endif |
418 | 418 | ||
419 | #ifdef IPOL_W | 419 | #ifdef IPOL_W |
420 | line.w[scan.left] = scan.w[0]; | 420 | line.w[scan.left] = scan.w[0]; |
421 | line.w[scan.right] = scan.w[1]; | 421 | line.w[scan.right] = scan.w[1]; |
422 | #endif | 422 | #endif |
423 | 423 | ||
424 | #ifdef IPOL_C0 | 424 | #ifdef IPOL_C0 |
425 | line.c[0][scan.left] = scan.c[0][0]; | 425 | line.c[0][scan.left] = scan.c[0][0]; |
426 | line.c[0][scan.right] = scan.c[0][1]; | 426 | line.c[0][scan.right] = scan.c[0][1]; |
427 | #endif | 427 | #endif |
428 | 428 | ||
429 | #ifdef IPOL_T0 | 429 | #ifdef IPOL_T0 |
430 | line.t[0][scan.left] = scan.t[0][0]; | 430 | line.t[0][scan.left] = scan.t[0][0]; |
431 | line.t[0][scan.right] = scan.t[0][1]; | 431 | line.t[0][scan.right] = scan.t[0][1]; |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | #ifdef IPOL_T1 | 434 | #ifdef IPOL_T1 |
435 | line.t[1][scan.left] = scan.t[1][0]; | 435 | line.t[1][scan.left] = scan.t[1][0]; |
436 | line.t[1][scan.right] = scan.t[1][1]; | 436 | line.t[1][scan.right] = scan.t[1][1]; |
437 | #endif | 437 | #endif |
438 | 438 | ||
439 | // render a scanline | 439 | // render a scanline |
440 | scanline_bilinear (); | 440 | scanline_bilinear (); |
441 | 441 | ||
442 | scan.x[0] += scan.slopeX[0]; | 442 | scan.x[0] += scan.slopeX[0]; |
443 | scan.x[1] += scan.slopeX[1]; | 443 | scan.x[1] += scan.slopeX[1]; |
444 | 444 | ||
445 | #ifdef IPOL_Z | 445 | #ifdef IPOL_Z |
446 | scan.z[0] += scan.slopeZ[0]; | 446 | scan.z[0] += scan.slopeZ[0]; |
447 | scan.z[1] += scan.slopeZ[1]; | 447 | scan.z[1] += scan.slopeZ[1]; |
448 | #endif | 448 | #endif |
449 | 449 | ||
450 | #ifdef IPOL_W | 450 | #ifdef IPOL_W |
451 | scan.w[0] += scan.slopeW[0]; | 451 | scan.w[0] += scan.slopeW[0]; |
452 | scan.w[1] += scan.slopeW[1]; | 452 | scan.w[1] += scan.slopeW[1]; |
453 | #endif | 453 | #endif |
454 | 454 | ||
455 | #ifdef IPOL_C0 | 455 | #ifdef IPOL_C0 |
456 | scan.c[0][0] += scan.slopeC[0][0]; | 456 | scan.c[0][0] += scan.slopeC[0][0]; |
457 | scan.c[0][1] += scan.slopeC[0][1]; | 457 | scan.c[0][1] += scan.slopeC[0][1]; |
458 | #endif | 458 | #endif |
459 | 459 | ||
460 | #ifdef IPOL_T0 | 460 | #ifdef IPOL_T0 |
461 | scan.t[0][0] += scan.slopeT[0][0]; | 461 | scan.t[0][0] += scan.slopeT[0][0]; |
462 | scan.t[0][1] += scan.slopeT[0][1]; | 462 | scan.t[0][1] += scan.slopeT[0][1]; |
463 | #endif | 463 | #endif |
464 | 464 | ||
465 | #ifdef IPOL_T1 | 465 | #ifdef IPOL_T1 |
466 | scan.t[1][0] += scan.slopeT[1][0]; | 466 | scan.t[1][0] += scan.slopeT[1][0]; |
467 | scan.t[1][1] += scan.slopeT[1][1]; | 467 | scan.t[1][1] += scan.slopeT[1][1]; |
468 | #endif | 468 | #endif |
469 | 469 | ||
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | // rasterize lower sub-triangle | 473 | // rasterize lower sub-triangle |
474 | if ( (f32) 0.0 != scan.invDeltaY[2] ) | 474 | if ( (f32) 0.0 != scan.invDeltaY[2] ) |
475 | { | 475 | { |
476 | // advance to middle point | 476 | // advance to middle point |
477 | if( (f32) 0.0 != scan.invDeltaY[1] ) | 477 | if( (f32) 0.0 != scan.invDeltaY[1] ) |
478 | { | 478 | { |
479 | temp[0] = b->Pos.y - a->Pos.y; // dy | 479 | temp[0] = b->Pos.y - a->Pos.y; // dy |
480 | 480 | ||
481 | scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0]; | 481 | scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0]; |
482 | #ifdef IPOL_Z | 482 | #ifdef IPOL_Z |
483 | scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0]; | 483 | scan.z[0] = a->Pos.z + scan.slopeZ[0] * temp[0]; |
484 | #endif | 484 | #endif |
485 | #ifdef IPOL_W | 485 | #ifdef IPOL_W |
486 | scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0]; | 486 | scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0]; |
487 | #endif | 487 | #endif |
488 | #ifdef IPOL_C0 | 488 | #ifdef IPOL_C0 |
489 | scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0]; | 489 | scan.c[0][0] = a->Color[0] + scan.slopeC[0][0] * temp[0]; |
490 | #endif | 490 | #endif |
491 | #ifdef IPOL_T0 | 491 | #ifdef IPOL_T0 |
492 | scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0]; | 492 | scan.t[0][0] = a->Tex[0] + scan.slopeT[0][0] * temp[0]; |
493 | #endif | 493 | #endif |
494 | #ifdef IPOL_T1 | 494 | #ifdef IPOL_T1 |
495 | scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0]; | 495 | scan.t[1][0] = a->Tex[1] + scan.slopeT[1][0] * temp[0]; |
496 | #endif | 496 | #endif |
497 | 497 | ||
498 | } | 498 | } |
499 | 499 | ||
500 | // calculate slopes for bottom edge | 500 | // calculate slopes for bottom edge |
501 | scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2]; | 501 | scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2]; |
502 | scan.x[1] = b->Pos.x; | 502 | scan.x[1] = b->Pos.x; |
503 | 503 | ||
504 | #ifdef IPOL_Z | 504 | #ifdef IPOL_Z |
505 | scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2]; | 505 | scan.slopeZ[1] = (c->Pos.z - b->Pos.z) * scan.invDeltaY[2]; |
506 | scan.z[1] = b->Pos.z; | 506 | scan.z[1] = b->Pos.z; |
507 | #endif | 507 | #endif |
508 | 508 | ||
509 | #ifdef IPOL_W | 509 | #ifdef IPOL_W |
510 | scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2]; | 510 | scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2]; |
511 | scan.w[1] = b->Pos.w; | 511 | scan.w[1] = b->Pos.w; |
512 | #endif | 512 | #endif |
513 | 513 | ||
514 | #ifdef IPOL_C0 | 514 | #ifdef IPOL_C0 |
515 | scan.slopeC[0][1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2]; | 515 | scan.slopeC[0][1] = (c->Color[0] - b->Color[0]) * scan.invDeltaY[2]; |
516 | scan.c[0][1] = b->Color[0]; | 516 | scan.c[0][1] = b->Color[0]; |
517 | #endif | 517 | #endif |
518 | 518 | ||
519 | #ifdef IPOL_T0 | 519 | #ifdef IPOL_T0 |
520 | scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2]; | 520 | scan.slopeT[0][1] = (c->Tex[0] - b->Tex[0]) * scan.invDeltaY[2]; |
521 | scan.t[0][1] = b->Tex[0]; | 521 | scan.t[0][1] = b->Tex[0]; |
522 | #endif | 522 | #endif |
523 | 523 | ||
524 | #ifdef IPOL_T1 | 524 | #ifdef IPOL_T1 |
525 | scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2]; | 525 | scan.slopeT[1][1] = (c->Tex[1] - b->Tex[1]) * scan.invDeltaY[2]; |
526 | scan.t[1][1] = b->Tex[1]; | 526 | scan.t[1][1] = b->Tex[1]; |
527 | #endif | 527 | #endif |
528 | 528 | ||
529 | // apply top-left fill convention, top part | 529 | // apply top-left fill convention, top part |
530 | yStart = core::ceil32( b->Pos.y ); | 530 | yStart = core::ceil32( b->Pos.y ); |
531 | yEnd = core::ceil32( c->Pos.y ) - 1; | 531 | yEnd = core::ceil32( c->Pos.y ) - 1; |
532 | 532 | ||
533 | #ifdef SUBTEXEL | 533 | #ifdef SUBTEXEL |
534 | 534 | ||
535 | subPixel = ( (f32) yStart ) - b->Pos.y; | 535 | subPixel = ( (f32) yStart ) - b->Pos.y; |
536 | 536 | ||
537 | // correct to pixel center | 537 | // correct to pixel center |
538 | scan.x[0] += scan.slopeX[0] * subPixel; | 538 | scan.x[0] += scan.slopeX[0] * subPixel; |
539 | scan.x[1] += scan.slopeX[1] * subPixel; | 539 | scan.x[1] += scan.slopeX[1] * subPixel; |
540 | 540 | ||
541 | #ifdef IPOL_Z | 541 | #ifdef IPOL_Z |
542 | scan.z[0] += scan.slopeZ[0] * subPixel; | 542 | scan.z[0] += scan.slopeZ[0] * subPixel; |
543 | scan.z[1] += scan.slopeZ[1] * subPixel; | 543 | scan.z[1] += scan.slopeZ[1] * subPixel; |
544 | #endif | 544 | #endif |
545 | 545 | ||
546 | #ifdef IPOL_W | 546 | #ifdef IPOL_W |
547 | scan.w[0] += scan.slopeW[0] * subPixel; | 547 | scan.w[0] += scan.slopeW[0] * subPixel; |
548 | scan.w[1] += scan.slopeW[1] * subPixel; | 548 | scan.w[1] += scan.slopeW[1] * subPixel; |
549 | #endif | 549 | #endif |
550 | 550 | ||
551 | #ifdef IPOL_C0 | 551 | #ifdef IPOL_C0 |
552 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; | 552 | scan.c[0][0] += scan.slopeC[0][0] * subPixel; |
553 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; | 553 | scan.c[0][1] += scan.slopeC[0][1] * subPixel; |
554 | #endif | 554 | #endif |
555 | 555 | ||
556 | #ifdef IPOL_T0 | 556 | #ifdef IPOL_T0 |
557 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; | 557 | scan.t[0][0] += scan.slopeT[0][0] * subPixel; |
558 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; | 558 | scan.t[0][1] += scan.slopeT[0][1] * subPixel; |
559 | #endif | 559 | #endif |
560 | 560 | ||
561 | #ifdef IPOL_T1 | 561 | #ifdef IPOL_T1 |
562 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; | 562 | scan.t[1][0] += scan.slopeT[1][0] * subPixel; |
563 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; | 563 | scan.t[1][1] += scan.slopeT[1][1] * subPixel; |
564 | #endif | 564 | #endif |
565 | 565 | ||
566 | #endif | 566 | #endif |
567 | 567 | ||
568 | // rasterize the edge scanlines | 568 | // rasterize the edge scanlines |
569 | for( line.y = yStart; line.y <= yEnd; ++line.y) | 569 | for( line.y = yStart; line.y <= yEnd; ++line.y) |
570 | { | 570 | { |
571 | line.x[scan.left] = scan.x[0]; | 571 | line.x[scan.left] = scan.x[0]; |
572 | line.x[scan.right] = scan.x[1]; | 572 | line.x[scan.right] = scan.x[1]; |
573 | 573 | ||
574 | #ifdef IPOL_Z | 574 | #ifdef IPOL_Z |
575 | line.z[scan.left] = scan.z[0]; | 575 | line.z[scan.left] = scan.z[0]; |
576 | line.z[scan.right] = scan.z[1]; | 576 | line.z[scan.right] = scan.z[1]; |
577 | #endif | 577 | #endif |
578 | 578 | ||
579 | #ifdef IPOL_W | 579 | #ifdef IPOL_W |
580 | line.w[scan.left] = scan.w[0]; | 580 | line.w[scan.left] = scan.w[0]; |
581 | line.w[scan.right] = scan.w[1]; | 581 | line.w[scan.right] = scan.w[1]; |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | #ifdef IPOL_C0 | 584 | #ifdef IPOL_C0 |
585 | line.c[0][scan.left] = scan.c[0][0]; | 585 | line.c[0][scan.left] = scan.c[0][0]; |
586 | line.c[0][scan.right] = scan.c[0][1]; | 586 | line.c[0][scan.right] = scan.c[0][1]; |
587 | #endif | 587 | #endif |
588 | 588 | ||
589 | #ifdef IPOL_T0 | 589 | #ifdef IPOL_T0 |
590 | line.t[0][scan.left] = scan.t[0][0]; | 590 | line.t[0][scan.left] = scan.t[0][0]; |
591 | line.t[0][scan.right] = scan.t[0][1]; | 591 | line.t[0][scan.right] = scan.t[0][1]; |
592 | #endif | 592 | #endif |
593 | 593 | ||
594 | #ifdef IPOL_T1 | 594 | #ifdef IPOL_T1 |
595 | line.t[1][scan.left] = scan.t[1][0]; | 595 | line.t[1][scan.left] = scan.t[1][0]; |
596 | line.t[1][scan.right] = scan.t[1][1]; | 596 | line.t[1][scan.right] = scan.t[1][1]; |
597 | #endif | 597 | #endif |
598 | 598 | ||
599 | // render a scanline | 599 | // render a scanline |
600 | scanline_bilinear (); | 600 | scanline_bilinear (); |
601 | 601 | ||
602 | scan.x[0] += scan.slopeX[0]; | 602 | scan.x[0] += scan.slopeX[0]; |
603 | scan.x[1] += scan.slopeX[1]; | 603 | scan.x[1] += scan.slopeX[1]; |
604 | 604 | ||
605 | #ifdef IPOL_Z | 605 | #ifdef IPOL_Z |
606 | scan.z[0] += scan.slopeZ[0]; | 606 | scan.z[0] += scan.slopeZ[0]; |
607 | scan.z[1] += scan.slopeZ[1]; | 607 | scan.z[1] += scan.slopeZ[1]; |
608 | #endif | 608 | #endif |
609 | 609 | ||
610 | #ifdef IPOL_W | 610 | #ifdef IPOL_W |
611 | scan.w[0] += scan.slopeW[0]; | 611 | scan.w[0] += scan.slopeW[0]; |
612 | scan.w[1] += scan.slopeW[1]; | 612 | scan.w[1] += scan.slopeW[1]; |
613 | #endif | 613 | #endif |
614 | 614 | ||
615 | #ifdef IPOL_C0 | 615 | #ifdef IPOL_C0 |
616 | scan.c[0][0] += scan.slopeC[0][0]; | 616 | scan.c[0][0] += scan.slopeC[0][0]; |
617 | scan.c[0][1] += scan.slopeC[0][1]; | 617 | scan.c[0][1] += scan.slopeC[0][1]; |
618 | #endif | 618 | #endif |
619 | 619 | ||
620 | #ifdef IPOL_T0 | 620 | #ifdef IPOL_T0 |
621 | scan.t[0][0] += scan.slopeT[0][0]; | 621 | scan.t[0][0] += scan.slopeT[0][0]; |
622 | scan.t[0][1] += scan.slopeT[0][1]; | 622 | scan.t[0][1] += scan.slopeT[0][1]; |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | #ifdef IPOL_T1 | 625 | #ifdef IPOL_T1 |
626 | scan.t[1][0] += scan.slopeT[1][0]; | 626 | scan.t[1][0] += scan.slopeT[1][0]; |
627 | scan.t[1][1] += scan.slopeT[1][1]; | 627 | scan.t[1][1] += scan.slopeT[1][1]; |
628 | #endif | 628 | #endif |
629 | 629 | ||
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
633 | } | 633 | } |
634 | 634 | ||
635 | } // end namespace video | 635 | } // end namespace video |
636 | } // end namespace irr | 636 | } // end namespace irr |
637 | 637 | ||
638 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 638 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
639 | 639 | ||
640 | namespace irr | 640 | namespace irr |
641 | { | 641 | { |
642 | namespace video | 642 | namespace video |
643 | { | 643 | { |
644 | 644 | ||
645 | //! creates a flat triangle renderer | 645 | //! creates a flat triangle renderer |
646 | IBurningShader* createTriangleRendererTextureDetailMap2(CBurningVideoDriver* driver) | 646 | IBurningShader* createTriangleRendererTextureDetailMap2(CBurningVideoDriver* driver) |
647 | { | 647 | { |
648 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 648 | #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
649 | return new CTRTextureDetailMap2(driver); | 649 | return new CTRTextureDetailMap2(driver); |
650 | #else | 650 | #else |
651 | return 0; | 651 | return 0; |
652 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ | 652 | #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ |
653 | } | 653 | } |
654 | 654 | ||
655 | 655 | ||
656 | } // end namespace video | 656 | } // end namespace video |
657 | } // end namespace irr | 657 | } // end namespace irr |
658 | 658 | ||
659 | 659 | ||