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/S4DVertex.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h | 1386 |
1 files changed, 693 insertions, 693 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h b/libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h index 3b80919..487b1cc 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/S4DVertex.h | |||
@@ -1,693 +1,693 @@ | |||
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 | 5 | ||
6 | #ifndef __S_4D_VERTEX_H_INCLUDED__ | 6 | #ifndef __S_4D_VERTEX_H_INCLUDED__ |
7 | #define __S_4D_VERTEX_H_INCLUDED__ | 7 | #define __S_4D_VERTEX_H_INCLUDED__ |
8 | 8 | ||
9 | #include "SoftwareDriver2_compile_config.h" | 9 | #include "SoftwareDriver2_compile_config.h" |
10 | #include "SoftwareDriver2_helper.h" | 10 | #include "SoftwareDriver2_helper.h" |
11 | #include "irrAllocator.h" | 11 | #include "irrAllocator.h" |
12 | 12 | ||
13 | namespace irr | 13 | namespace irr |
14 | { | 14 | { |
15 | 15 | ||
16 | namespace video | 16 | namespace video |
17 | { | 17 | { |
18 | 18 | ||
19 | struct sVec2 | 19 | struct sVec2 |
20 | { | 20 | { |
21 | f32 x; | 21 | f32 x; |
22 | f32 y; | 22 | f32 y; |
23 | 23 | ||
24 | sVec2 () {} | 24 | sVec2 () {} |
25 | 25 | ||
26 | sVec2 ( f32 s) : x ( s ), y ( s ) {} | 26 | sVec2 ( f32 s) : x ( s ), y ( s ) {} |
27 | sVec2 ( f32 _x, f32 _y ) | 27 | sVec2 ( f32 _x, f32 _y ) |
28 | : x ( _x ), y ( _y ) {} | 28 | : x ( _x ), y ( _y ) {} |
29 | 29 | ||
30 | void set ( f32 _x, f32 _y ) | 30 | void set ( f32 _x, f32 _y ) |
31 | { | 31 | { |
32 | x = _x; | 32 | x = _x; |
33 | y = _y; | 33 | y = _y; |
34 | } | 34 | } |
35 | 35 | ||
36 | // f = a * t + b * ( 1 - t ) | 36 | // f = a * t + b * ( 1 - t ) |
37 | void interpolate(const sVec2& a, const sVec2& b, const f32 t) | 37 | void interpolate(const sVec2& a, const sVec2& b, const f32 t) |
38 | { | 38 | { |
39 | x = b.x + ( ( a.x - b.x ) * t ); | 39 | x = b.x + ( ( a.x - b.x ) * t ); |
40 | y = b.y + ( ( a.y - b.y ) * t ); | 40 | y = b.y + ( ( a.y - b.y ) * t ); |
41 | } | 41 | } |
42 | 42 | ||
43 | sVec2 operator-(const sVec2& other) const | 43 | sVec2 operator-(const sVec2& other) const |
44 | { | 44 | { |
45 | return sVec2(x - other.x, y - other.y); | 45 | return sVec2(x - other.x, y - other.y); |
46 | } | 46 | } |
47 | 47 | ||
48 | sVec2 operator+(const sVec2& other) const | 48 | sVec2 operator+(const sVec2& other) const |
49 | { | 49 | { |
50 | return sVec2(x + other.x, y + other.y); | 50 | return sVec2(x + other.x, y + other.y); |
51 | } | 51 | } |
52 | 52 | ||
53 | void operator+=(const sVec2& other) | 53 | void operator+=(const sVec2& other) |
54 | { | 54 | { |
55 | x += other.x; | 55 | x += other.x; |
56 | y += other.y; | 56 | y += other.y; |
57 | } | 57 | } |
58 | 58 | ||
59 | sVec2 operator*(const f32 s) const | 59 | sVec2 operator*(const f32 s) const |
60 | { | 60 | { |
61 | return sVec2(x * s , y * s); | 61 | return sVec2(x * s , y * s); |
62 | } | 62 | } |
63 | 63 | ||
64 | void operator*=( const f32 s) | 64 | void operator*=( const f32 s) |
65 | { | 65 | { |
66 | x *= s; | 66 | x *= s; |
67 | y *= s; | 67 | y *= s; |
68 | } | 68 | } |
69 | 69 | ||
70 | void operator=(const sVec2& other) | 70 | void operator=(const sVec2& other) |
71 | { | 71 | { |
72 | x = other.x; | 72 | x = other.x; |
73 | y = other.y; | 73 | y = other.y; |
74 | } | 74 | } |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | // A8R8G8B8 | 78 | // A8R8G8B8 |
79 | struct sVec4; | 79 | struct sVec4; |
80 | struct sCompressedVec4 | 80 | struct sCompressedVec4 |
81 | { | 81 | { |
82 | u32 argb; | 82 | u32 argb; |
83 | 83 | ||
84 | void setA8R8G8B8 ( u32 value ) | 84 | void setA8R8G8B8 ( u32 value ) |
85 | { | 85 | { |
86 | argb = value; | 86 | argb = value; |
87 | } | 87 | } |
88 | 88 | ||
89 | void setColorf ( const video::SColorf & color ) | 89 | void setColorf ( const video::SColorf & color ) |
90 | { | 90 | { |
91 | argb = core::floor32 ( color.a * 255.f ) << 24 | | 91 | argb = core::floor32 ( color.a * 255.f ) << 24 | |
92 | core::floor32 ( color.r * 255.f ) << 16 | | 92 | core::floor32 ( color.r * 255.f ) << 16 | |
93 | core::floor32 ( color.g * 255.f ) << 8 | | 93 | core::floor32 ( color.g * 255.f ) << 8 | |
94 | core::floor32 ( color.b * 255.f ); | 94 | core::floor32 ( color.b * 255.f ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void setVec4 ( const sVec4 & v ); | 97 | void setVec4 ( const sVec4 & v ); |
98 | 98 | ||
99 | // f = a * t + b * ( 1 - t ) | 99 | // f = a * t + b * ( 1 - t ) |
100 | void interpolate(const sCompressedVec4& a, const sCompressedVec4& b, const f32 t) | 100 | void interpolate(const sCompressedVec4& a, const sCompressedVec4& b, const f32 t) |
101 | { | 101 | { |
102 | argb = PixelBlend32 ( b.argb, a.argb, core::floor32 ( t * 256.f ) ); | 102 | argb = PixelBlend32 ( b.argb, a.argb, core::floor32 ( t * 256.f ) ); |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | struct sVec4 | 109 | struct sVec4 |
110 | { | 110 | { |
111 | union | 111 | union |
112 | { | 112 | { |
113 | struct { f32 x, y, z, w; }; | 113 | struct { f32 x, y, z, w; }; |
114 | struct { f32 a, r, g, b; }; | 114 | struct { f32 a, r, g, b; }; |
115 | // struct { sVec2 xy, zw; }; // sorry, this does not compile with gcc | 115 | // struct { sVec2 xy, zw; }; // sorry, this does not compile with gcc |
116 | }; | 116 | }; |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | sVec4 () {} | 120 | sVec4 () {} |
121 | 121 | ||
122 | sVec4 ( f32 s) : x ( s ), y ( s ), z ( s ), w ( s ) {} | 122 | sVec4 ( f32 s) : x ( s ), y ( s ), z ( s ), w ( s ) {} |
123 | 123 | ||
124 | sVec4 ( f32 _x, f32 _y, f32 _z, f32 _w ) | 124 | sVec4 ( f32 _x, f32 _y, f32 _z, f32 _w ) |
125 | : x ( _x ), y ( _y ), z( _z ), w ( _w ){} | 125 | : x ( _x ), y ( _y ), z( _z ), w ( _w ){} |
126 | 126 | ||
127 | void set ( f32 _x, f32 _y, f32 _z, f32 _w ) | 127 | void set ( f32 _x, f32 _y, f32 _z, f32 _w ) |
128 | { | 128 | { |
129 | x = _x; | 129 | x = _x; |
130 | y = _y; | 130 | y = _y; |
131 | z = _z; | 131 | z = _z; |
132 | w = _w; | 132 | w = _w; |
133 | } | 133 | } |
134 | 134 | ||
135 | void setA8R8G8B8 ( u32 argb ) | 135 | void setA8R8G8B8 ( u32 argb ) |
136 | { | 136 | { |
137 | x = ( ( argb & 0xFF000000 ) >> 24 ) * ( 1.f / 255.f ); | 137 | x = ( ( argb & 0xFF000000 ) >> 24 ) * ( 1.f / 255.f ); |
138 | y = ( ( argb & 0x00FF0000 ) >> 16 ) * ( 1.f / 255.f ); | 138 | y = ( ( argb & 0x00FF0000 ) >> 16 ) * ( 1.f / 255.f ); |
139 | z = ( ( argb & 0x0000FF00 ) >> 8 ) * ( 1.f / 255.f ); | 139 | z = ( ( argb & 0x0000FF00 ) >> 8 ) * ( 1.f / 255.f ); |
140 | w = ( ( argb & 0x000000FF ) ) * ( 1.f / 255.f ); | 140 | w = ( ( argb & 0x000000FF ) ) * ( 1.f / 255.f ); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | void setColorf ( const video::SColorf & color ) | 144 | void setColorf ( const video::SColorf & color ) |
145 | { | 145 | { |
146 | x = color.a; | 146 | x = color.a; |
147 | y = color.r; | 147 | y = color.r; |
148 | z = color.g; | 148 | z = color.g; |
149 | w = color.b; | 149 | w = color.b; |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | // f = a * t + b * ( 1 - t ) | 153 | // f = a * t + b * ( 1 - t ) |
154 | void interpolate(const sVec4& a, const sVec4& b, const f32 t) | 154 | void interpolate(const sVec4& a, const sVec4& b, const f32 t) |
155 | { | 155 | { |
156 | x = b.x + ( ( a.x - b.x ) * t ); | 156 | x = b.x + ( ( a.x - b.x ) * t ); |
157 | y = b.y + ( ( a.y - b.y ) * t ); | 157 | y = b.y + ( ( a.y - b.y ) * t ); |
158 | z = b.z + ( ( a.z - b.z ) * t ); | 158 | z = b.z + ( ( a.z - b.z ) * t ); |
159 | w = b.w + ( ( a.w - b.w ) * t ); | 159 | w = b.w + ( ( a.w - b.w ) * t ); |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | f32 dotProduct(const sVec4& other) const | 163 | f32 dotProduct(const sVec4& other) const |
164 | { | 164 | { |
165 | return x*other.x + y*other.y + z*other.z + w*other.w; | 165 | return x*other.x + y*other.y + z*other.z + w*other.w; |
166 | } | 166 | } |
167 | 167 | ||
168 | f32 dot_xyz( const sVec4& other) const | 168 | f32 dot_xyz( const sVec4& other) const |
169 | { | 169 | { |
170 | return x*other.x + y*other.y + z*other.z; | 170 | return x*other.x + y*other.y + z*other.z; |
171 | } | 171 | } |
172 | 172 | ||
173 | f32 get_length_xyz_square () const | 173 | f32 get_length_xyz_square () const |
174 | { | 174 | { |
175 | return x * x + y * y + z * z; | 175 | return x * x + y * y + z * z; |
176 | } | 176 | } |
177 | 177 | ||
178 | f32 get_length_xyz () const | 178 | f32 get_length_xyz () const |
179 | { | 179 | { |
180 | return core::squareroot ( x * x + y * y + z * z ); | 180 | return core::squareroot ( x * x + y * y + z * z ); |
181 | } | 181 | } |
182 | 182 | ||
183 | void normalize_xyz () | 183 | void normalize_xyz () |
184 | { | 184 | { |
185 | const f32 l = core::reciprocal_squareroot ( x * x + y * y + z * z ); | 185 | const f32 l = core::reciprocal_squareroot ( x * x + y * y + z * z ); |
186 | 186 | ||
187 | x *= l; | 187 | x *= l; |
188 | y *= l; | 188 | y *= l; |
189 | z *= l; | 189 | z *= l; |
190 | } | 190 | } |
191 | 191 | ||
192 | void project_xyz () | 192 | void project_xyz () |
193 | { | 193 | { |
194 | w = core::reciprocal ( w ); | 194 | w = core::reciprocal ( w ); |
195 | x *= w; | 195 | x *= w; |
196 | y *= w; | 196 | y *= w; |
197 | z *= w; | 197 | z *= w; |
198 | } | 198 | } |
199 | 199 | ||
200 | sVec4 operator-(const sVec4& other) const | 200 | sVec4 operator-(const sVec4& other) const |
201 | { | 201 | { |
202 | return sVec4(x - other.x, y - other.y, z - other.z,w - other.w); | 202 | return sVec4(x - other.x, y - other.y, z - other.z,w - other.w); |
203 | } | 203 | } |
204 | 204 | ||
205 | sVec4 operator+(const sVec4& other) const | 205 | sVec4 operator+(const sVec4& other) const |
206 | { | 206 | { |
207 | return sVec4(x + other.x, y + other.y, z + other.z,w + other.w); | 207 | return sVec4(x + other.x, y + other.y, z + other.z,w + other.w); |
208 | } | 208 | } |
209 | 209 | ||
210 | void operator+=(const sVec4& other) | 210 | void operator+=(const sVec4& other) |
211 | { | 211 | { |
212 | x += other.x; | 212 | x += other.x; |
213 | y += other.y; | 213 | y += other.y; |
214 | z += other.z; | 214 | z += other.z; |
215 | w += other.w; | 215 | w += other.w; |
216 | } | 216 | } |
217 | 217 | ||
218 | sVec4 operator*(const f32 s) const | 218 | sVec4 operator*(const f32 s) const |
219 | { | 219 | { |
220 | return sVec4(x * s , y * s, z * s,w * s); | 220 | return sVec4(x * s , y * s, z * s,w * s); |
221 | } | 221 | } |
222 | 222 | ||
223 | sVec4 operator*(const sVec4 &other) const | 223 | sVec4 operator*(const sVec4 &other) const |
224 | { | 224 | { |
225 | return sVec4(x * other.x , y * other.y, z * other.z,w * other.w); | 225 | return sVec4(x * other.x , y * other.y, z * other.z,w * other.w); |
226 | } | 226 | } |
227 | 227 | ||
228 | void mulReciprocal ( f32 s ) | 228 | void mulReciprocal ( f32 s ) |
229 | { | 229 | { |
230 | const f32 i = core::reciprocal ( s ); | 230 | const f32 i = core::reciprocal ( s ); |
231 | x = (f32) ( x * i ); | 231 | x = (f32) ( x * i ); |
232 | y = (f32) ( y * i ); | 232 | y = (f32) ( y * i ); |
233 | z = (f32) ( z * i ); | 233 | z = (f32) ( z * i ); |
234 | w = (f32) ( w * i ); | 234 | w = (f32) ( w * i ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void mul ( const f32 s ) | 237 | void mul ( const f32 s ) |
238 | { | 238 | { |
239 | x *= s; | 239 | x *= s; |
240 | y *= s; | 240 | y *= s; |
241 | z *= s; | 241 | z *= s; |
242 | w *= s; | 242 | w *= s; |
243 | } | 243 | } |
244 | 244 | ||
245 | /* | 245 | /* |
246 | void operator*=(f32 s) | 246 | void operator*=(f32 s) |
247 | { | 247 | { |
248 | x *= s; | 248 | x *= s; |
249 | y *= s; | 249 | y *= s; |
250 | z *= s; | 250 | z *= s; |
251 | w *= s; | 251 | w *= s; |
252 | } | 252 | } |
253 | */ | 253 | */ |
254 | void operator*=(const sVec4 &other) | 254 | void operator*=(const sVec4 &other) |
255 | { | 255 | { |
256 | x *= other.x; | 256 | x *= other.x; |
257 | y *= other.y; | 257 | y *= other.y; |
258 | z *= other.z; | 258 | z *= other.z; |
259 | w *= other.w; | 259 | w *= other.w; |
260 | } | 260 | } |
261 | 261 | ||
262 | void operator=(const sVec4& other) | 262 | void operator=(const sVec4& other) |
263 | { | 263 | { |
264 | x = other.x; | 264 | x = other.x; |
265 | y = other.y; | 265 | y = other.y; |
266 | z = other.z; | 266 | z = other.z; |
267 | w = other.w; | 267 | w = other.w; |
268 | } | 268 | } |
269 | }; | 269 | }; |
270 | 270 | ||
271 | struct sVec3 | 271 | struct sVec3 |
272 | { | 272 | { |
273 | union | 273 | union |
274 | { | 274 | { |
275 | struct { f32 r, g, b; }; | 275 | struct { f32 r, g, b; }; |
276 | struct { f32 x, y, z; }; | 276 | struct { f32 x, y, z; }; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | 279 | ||
280 | sVec3 () {} | 280 | sVec3 () {} |
281 | sVec3 ( f32 _x, f32 _y, f32 _z ) | 281 | sVec3 ( f32 _x, f32 _y, f32 _z ) |
282 | : r ( _x ), g ( _y ), b( _z ) {} | 282 | : r ( _x ), g ( _y ), b( _z ) {} |
283 | 283 | ||
284 | sVec3 ( const sVec4 &v ) | 284 | sVec3 ( const sVec4 &v ) |
285 | : r ( v.x ), g ( v.y ), b( v.z ) {} | 285 | : r ( v.x ), g ( v.y ), b( v.z ) {} |
286 | 286 | ||
287 | void set ( f32 _r, f32 _g, f32 _b ) | 287 | void set ( f32 _r, f32 _g, f32 _b ) |
288 | { | 288 | { |
289 | r = _r; | 289 | r = _r; |
290 | g = _g; | 290 | g = _g; |
291 | b = _b; | 291 | b = _b; |
292 | } | 292 | } |
293 | 293 | ||
294 | void setR8G8B8 ( u32 argb ) | 294 | void setR8G8B8 ( u32 argb ) |
295 | { | 295 | { |
296 | r = ( ( argb & 0x00FF0000 ) >> 16 ) * ( 1.f / 255.f ); | 296 | r = ( ( argb & 0x00FF0000 ) >> 16 ) * ( 1.f / 255.f ); |
297 | g = ( ( argb & 0x0000FF00 ) >> 8 ) * ( 1.f / 255.f ); | 297 | g = ( ( argb & 0x0000FF00 ) >> 8 ) * ( 1.f / 255.f ); |
298 | b = ( ( argb & 0x000000FF ) ) * ( 1.f / 255.f ); | 298 | b = ( ( argb & 0x000000FF ) ) * ( 1.f / 255.f ); |
299 | } | 299 | } |
300 | 300 | ||
301 | void setColorf ( const video::SColorf & color ) | 301 | void setColorf ( const video::SColorf & color ) |
302 | { | 302 | { |
303 | r = color.r; | 303 | r = color.r; |
304 | g = color.g; | 304 | g = color.g; |
305 | b = color.b; | 305 | b = color.b; |
306 | } | 306 | } |
307 | 307 | ||
308 | void add (const sVec3& other) | 308 | void add (const sVec3& other) |
309 | { | 309 | { |
310 | r += other.r; | 310 | r += other.r; |
311 | g += other.g; | 311 | g += other.g; |
312 | b += other.b; | 312 | b += other.b; |
313 | } | 313 | } |
314 | 314 | ||
315 | void mulAdd(const sVec3& other, const f32 v) | 315 | void mulAdd(const sVec3& other, const f32 v) |
316 | { | 316 | { |
317 | r += other.r * v; | 317 | r += other.r * v; |
318 | g += other.g * v; | 318 | g += other.g * v; |
319 | b += other.b * v; | 319 | b += other.b * v; |
320 | } | 320 | } |
321 | 321 | ||
322 | void mulAdd(const sVec3& v0, const sVec3& v1) | 322 | void mulAdd(const sVec3& v0, const sVec3& v1) |
323 | { | 323 | { |
324 | r += v0.r * v1.r; | 324 | r += v0.r * v1.r; |
325 | g += v0.g * v1.g; | 325 | g += v0.g * v1.g; |
326 | b += v0.b * v1.b; | 326 | b += v0.b * v1.b; |
327 | } | 327 | } |
328 | 328 | ||
329 | void saturate ( sVec4 &dest, u32 argb ) | 329 | void saturate ( sVec4 &dest, u32 argb ) |
330 | { | 330 | { |
331 | dest.x = ( ( argb & 0xFF000000 ) >> 24 ) * ( 1.f / 255.f ); | 331 | dest.x = ( ( argb & 0xFF000000 ) >> 24 ) * ( 1.f / 255.f ); |
332 | dest.y = core::min_ ( r, 1.f ); | 332 | dest.y = core::min_ ( r, 1.f ); |
333 | dest.z = core::min_ ( g, 1.f ); | 333 | dest.z = core::min_ ( g, 1.f ); |
334 | dest.w = core::min_ ( b, 1.f ); | 334 | dest.w = core::min_ ( b, 1.f ); |
335 | } | 335 | } |
336 | 336 | ||
337 | // f = a * t + b * ( 1 - t ) | 337 | // f = a * t + b * ( 1 - t ) |
338 | void interpolate(const sVec3& v0, const sVec3& v1, const f32 t) | 338 | void interpolate(const sVec3& v0, const sVec3& v1, const f32 t) |
339 | { | 339 | { |
340 | r = v1.r + ( ( v0.r - v1.r ) * t ); | 340 | r = v1.r + ( ( v0.r - v1.r ) * t ); |
341 | g = v1.g + ( ( v0.g - v1.g ) * t ); | 341 | g = v1.g + ( ( v0.g - v1.g ) * t ); |
342 | b = v1.b + ( ( v0.b - v1.b ) * t ); | 342 | b = v1.b + ( ( v0.b - v1.b ) * t ); |
343 | } | 343 | } |
344 | 344 | ||
345 | sVec3 operator-(const sVec3& other) const | 345 | sVec3 operator-(const sVec3& other) const |
346 | { | 346 | { |
347 | return sVec3(r - other.r, b - other.b, g - other.g); | 347 | return sVec3(r - other.r, b - other.b, g - other.g); |
348 | } | 348 | } |
349 | 349 | ||
350 | sVec3 operator+(const sVec3& other) const | 350 | sVec3 operator+(const sVec3& other) const |
351 | { | 351 | { |
352 | return sVec3(r + other.r, g + other.g, b + other.b); | 352 | return sVec3(r + other.r, g + other.g, b + other.b); |
353 | } | 353 | } |
354 | 354 | ||
355 | sVec3 operator*(const f32 s) const | 355 | sVec3 operator*(const f32 s) const |
356 | { | 356 | { |
357 | return sVec3(r * s , g * s, b * s); | 357 | return sVec3(r * s , g * s, b * s); |
358 | } | 358 | } |
359 | 359 | ||
360 | sVec3 operator/(const f32 s) const | 360 | sVec3 operator/(const f32 s) const |
361 | { | 361 | { |
362 | f32 inv = 1.f / s; | 362 | f32 inv = 1.f / s; |
363 | return sVec3(r * inv , g * inv, b * inv); | 363 | return sVec3(r * inv , g * inv, b * inv); |
364 | } | 364 | } |
365 | 365 | ||
366 | sVec3 operator*(const sVec3 &other) const | 366 | sVec3 operator*(const sVec3 &other) const |
367 | { | 367 | { |
368 | return sVec3(r * other.r , b * other.b, g * other.g); | 368 | return sVec3(r * other.r , b * other.b, g * other.g); |
369 | } | 369 | } |
370 | 370 | ||
371 | void operator+=(const sVec3& other) | 371 | void operator+=(const sVec3& other) |
372 | { | 372 | { |
373 | r += other.r; | 373 | r += other.r; |
374 | g += other.g; | 374 | g += other.g; |
375 | b += other.b; | 375 | b += other.b; |
376 | } | 376 | } |
377 | 377 | ||
378 | void setLength ( f32 len ) | 378 | void setLength ( f32 len ) |
379 | { | 379 | { |
380 | const f32 l = len * core::reciprocal_squareroot ( r * r + g * g + b * b ); | 380 | const f32 l = len * core::reciprocal_squareroot ( r * r + g * g + b * b ); |
381 | 381 | ||
382 | r *= l; | 382 | r *= l; |
383 | g *= l; | 383 | g *= l; |
384 | b *= l; | 384 | b *= l; |
385 | } | 385 | } |
386 | 386 | ||
387 | }; | 387 | }; |
388 | 388 | ||
389 | 389 | ||
390 | 390 | ||
391 | inline void sCompressedVec4::setVec4 ( const sVec4 & v ) | 391 | inline void sCompressedVec4::setVec4 ( const sVec4 & v ) |
392 | { | 392 | { |
393 | argb = core::floor32 ( v.x * 255.f ) << 24 | | 393 | argb = core::floor32 ( v.x * 255.f ) << 24 | |
394 | core::floor32 ( v.y * 255.f ) << 16 | | 394 | core::floor32 ( v.y * 255.f ) << 16 | |
395 | core::floor32 ( v.z * 255.f ) << 8 | | 395 | core::floor32 ( v.z * 255.f ) << 8 | |
396 | core::floor32 ( v.w * 255.f ); | 396 | core::floor32 ( v.w * 255.f ); |
397 | } | 397 | } |
398 | 398 | ||
399 | 399 | ||
400 | enum e4DVertexFlag | 400 | enum e4DVertexFlag |
401 | { | 401 | { |
402 | VERTEX4D_INSIDE = 0x0000003F, | 402 | VERTEX4D_INSIDE = 0x0000003F, |
403 | VERTEX4D_CLIPMASK = 0x0000003F, | 403 | VERTEX4D_CLIPMASK = 0x0000003F, |
404 | VERTEX4D_PROJECTED = 0x00000100, | 404 | VERTEX4D_PROJECTED = 0x00000100, |
405 | 405 | ||
406 | VERTEX4D_FORMAT_MASK = 0xFFFF0000, | 406 | VERTEX4D_FORMAT_MASK = 0xFFFF0000, |
407 | 407 | ||
408 | VERTEX4D_FORMAT_MASK_TEXTURE = 0x000F0000, | 408 | VERTEX4D_FORMAT_MASK_TEXTURE = 0x000F0000, |
409 | VERTEX4D_FORMAT_TEXTURE_1 = 0x00010000, | 409 | VERTEX4D_FORMAT_TEXTURE_1 = 0x00010000, |
410 | VERTEX4D_FORMAT_TEXTURE_2 = 0x00020000, | 410 | VERTEX4D_FORMAT_TEXTURE_2 = 0x00020000, |
411 | VERTEX4D_FORMAT_TEXTURE_3 = 0x00030000, | 411 | VERTEX4D_FORMAT_TEXTURE_3 = 0x00030000, |
412 | VERTEX4D_FORMAT_TEXTURE_4 = 0x00040000, | 412 | VERTEX4D_FORMAT_TEXTURE_4 = 0x00040000, |
413 | 413 | ||
414 | VERTEX4D_FORMAT_MASK_COLOR = 0x00F00000, | 414 | VERTEX4D_FORMAT_MASK_COLOR = 0x00F00000, |
415 | VERTEX4D_FORMAT_COLOR_1 = 0x00100000, | 415 | VERTEX4D_FORMAT_COLOR_1 = 0x00100000, |
416 | VERTEX4D_FORMAT_COLOR_2 = 0x00200000, | 416 | VERTEX4D_FORMAT_COLOR_2 = 0x00200000, |
417 | 417 | ||
418 | VERTEX4D_FORMAT_MASK_BUMP = 0x0F000000, | 418 | VERTEX4D_FORMAT_MASK_BUMP = 0x0F000000, |
419 | VERTEX4D_FORMAT_BUMP_DOT3 = 0x01000000, | 419 | VERTEX4D_FORMAT_BUMP_DOT3 = 0x01000000, |
420 | 420 | ||
421 | }; | 421 | }; |
422 | 422 | ||
423 | const u32 MATERIAL_MAX_COLORS = 1; | 423 | const u32 MATERIAL_MAX_COLORS = 1; |
424 | const u32 BURNING_MATERIAL_MAX_TEXTURES = 2; | 424 | const u32 BURNING_MATERIAL_MAX_TEXTURES = 2; |
425 | const u32 BURNING_MATERIAL_MAX_TANGENT = 1; | 425 | const u32 BURNING_MATERIAL_MAX_TANGENT = 1; |
426 | 426 | ||
427 | // dummy Vertex. used for calculation vertex memory size | 427 | // dummy Vertex. used for calculation vertex memory size |
428 | struct s4DVertex_proxy | 428 | struct s4DVertex_proxy |
429 | { | 429 | { |
430 | u32 flag; | 430 | u32 flag; |
431 | sVec4 Pos; | 431 | sVec4 Pos; |
432 | sVec2 Tex[BURNING_MATERIAL_MAX_TEXTURES]; | 432 | sVec2 Tex[BURNING_MATERIAL_MAX_TEXTURES]; |
433 | 433 | ||
434 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 434 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
435 | sVec4 Color[MATERIAL_MAX_COLORS]; | 435 | sVec4 Color[MATERIAL_MAX_COLORS]; |
436 | #endif | 436 | #endif |
437 | 437 | ||
438 | sVec3 LightTangent[BURNING_MATERIAL_MAX_TANGENT]; | 438 | sVec3 LightTangent[BURNING_MATERIAL_MAX_TANGENT]; |
439 | 439 | ||
440 | }; | 440 | }; |
441 | 441 | ||
442 | #define SIZEOF_SVERTEX 64 | 442 | #define SIZEOF_SVERTEX 64 |
443 | #define SIZEOF_SVERTEX_LOG2 6 | 443 | #define SIZEOF_SVERTEX_LOG2 6 |
444 | 444 | ||
445 | /*! | 445 | /*! |
446 | Internal BurningVideo Vertex | 446 | Internal BurningVideo Vertex |
447 | */ | 447 | */ |
448 | struct s4DVertex | 448 | struct s4DVertex |
449 | { | 449 | { |
450 | u32 flag; | 450 | u32 flag; |
451 | 451 | ||
452 | sVec4 Pos; | 452 | sVec4 Pos; |
453 | sVec2 Tex[ BURNING_MATERIAL_MAX_TEXTURES ]; | 453 | sVec2 Tex[ BURNING_MATERIAL_MAX_TEXTURES ]; |
454 | 454 | ||
455 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 455 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
456 | sVec4 Color[ MATERIAL_MAX_COLORS ]; | 456 | sVec4 Color[ MATERIAL_MAX_COLORS ]; |
457 | #endif | 457 | #endif |
458 | 458 | ||
459 | sVec3 LightTangent[BURNING_MATERIAL_MAX_TANGENT]; | 459 | sVec3 LightTangent[BURNING_MATERIAL_MAX_TANGENT]; |
460 | 460 | ||
461 | //u8 fill [ SIZEOF_SVERTEX - sizeof (s4DVertex_proxy) ]; | 461 | //u8 fill [ SIZEOF_SVERTEX - sizeof (s4DVertex_proxy) ]; |
462 | 462 | ||
463 | // f = a * t + b * ( 1 - t ) | 463 | // f = a * t + b * ( 1 - t ) |
464 | void interpolate(const s4DVertex& b, const s4DVertex& a, const f32 t) | 464 | void interpolate(const s4DVertex& b, const s4DVertex& a, const f32 t) |
465 | { | 465 | { |
466 | u32 i; | 466 | u32 i; |
467 | u32 size; | 467 | u32 size; |
468 | 468 | ||
469 | Pos.interpolate ( a.Pos, b.Pos, t ); | 469 | Pos.interpolate ( a.Pos, b.Pos, t ); |
470 | 470 | ||
471 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 471 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
472 | size = (flag & VERTEX4D_FORMAT_MASK_COLOR) >> 20; | 472 | size = (flag & VERTEX4D_FORMAT_MASK_COLOR) >> 20; |
473 | for ( i = 0; i!= size; ++i ) | 473 | for ( i = 0; i!= size; ++i ) |
474 | { | 474 | { |
475 | Color[i].interpolate ( a.Color[i], b.Color[i], t ); | 475 | Color[i].interpolate ( a.Color[i], b.Color[i], t ); |
476 | } | 476 | } |
477 | #endif | 477 | #endif |
478 | 478 | ||
479 | size = (flag & VERTEX4D_FORMAT_MASK_TEXTURE) >> 16; | 479 | size = (flag & VERTEX4D_FORMAT_MASK_TEXTURE) >> 16; |
480 | for ( i = 0; i!= size; ++i ) | 480 | for ( i = 0; i!= size; ++i ) |
481 | { | 481 | { |
482 | Tex[i].interpolate ( a.Tex[i], b.Tex[i], t ); | 482 | Tex[i].interpolate ( a.Tex[i], b.Tex[i], t ); |
483 | } | 483 | } |
484 | 484 | ||
485 | size = (flag & VERTEX4D_FORMAT_MASK_BUMP) >> 24; | 485 | size = (flag & VERTEX4D_FORMAT_MASK_BUMP) >> 24; |
486 | for ( i = 0; i!= size; ++i ) | 486 | for ( i = 0; i!= size; ++i ) |
487 | { | 487 | { |
488 | LightTangent[i].interpolate ( a.LightTangent[i], b.LightTangent[i], t ); | 488 | LightTangent[i].interpolate ( a.LightTangent[i], b.LightTangent[i], t ); |
489 | } | 489 | } |
490 | 490 | ||
491 | } | 491 | } |
492 | }; | 492 | }; |
493 | 493 | ||
494 | // ----------------- Vertex Cache --------------------------- | 494 | // ----------------- Vertex Cache --------------------------- |
495 | 495 | ||
496 | struct SAlignedVertex | 496 | struct SAlignedVertex |
497 | { | 497 | { |
498 | SAlignedVertex ( u32 element, u32 aligned ) | 498 | SAlignedVertex ( u32 element, u32 aligned ) |
499 | : ElementSize ( element ) | 499 | : ElementSize ( element ) |
500 | { | 500 | { |
501 | u32 byteSize = (ElementSize << SIZEOF_SVERTEX_LOG2 ) + aligned; | 501 | u32 byteSize = (ElementSize << SIZEOF_SVERTEX_LOG2 ) + aligned; |
502 | mem = new u8 [ byteSize ]; | 502 | mem = new u8 [ byteSize ]; |
503 | data = (s4DVertex*) mem; | 503 | data = (s4DVertex*) mem; |
504 | } | 504 | } |
505 | 505 | ||
506 | virtual ~SAlignedVertex () | 506 | virtual ~SAlignedVertex () |
507 | { | 507 | { |
508 | delete [] mem; | 508 | delete [] mem; |
509 | } | 509 | } |
510 | 510 | ||
511 | s4DVertex *data; | 511 | s4DVertex *data; |
512 | u8 *mem; | 512 | u8 *mem; |
513 | u32 ElementSize; | 513 | u32 ElementSize; |
514 | }; | 514 | }; |
515 | 515 | ||
516 | 516 | ||
517 | // hold info for different Vertex Types | 517 | // hold info for different Vertex Types |
518 | struct SVSize | 518 | struct SVSize |
519 | { | 519 | { |
520 | u32 Format; | 520 | u32 Format; |
521 | u32 Pitch; | 521 | u32 Pitch; |
522 | u32 TexSize; | 522 | u32 TexSize; |
523 | }; | 523 | }; |
524 | 524 | ||
525 | 525 | ||
526 | // a cache info | 526 | // a cache info |
527 | struct SCacheInfo | 527 | struct SCacheInfo |
528 | { | 528 | { |
529 | u32 index; | 529 | u32 index; |
530 | u32 hit; | 530 | u32 hit; |
531 | }; | 531 | }; |
532 | 532 | ||
533 | #define VERTEXCACHE_ELEMENT 16 | 533 | #define VERTEXCACHE_ELEMENT 16 |
534 | #define VERTEXCACHE_MISS 0xFFFFFFFF | 534 | #define VERTEXCACHE_MISS 0xFFFFFFFF |
535 | struct SVertexCache | 535 | struct SVertexCache |
536 | { | 536 | { |
537 | SVertexCache (): mem ( VERTEXCACHE_ELEMENT * 2, 128 ) {} | 537 | SVertexCache (): mem ( VERTEXCACHE_ELEMENT * 2, 128 ) {} |
538 | 538 | ||
539 | SCacheInfo info[VERTEXCACHE_ELEMENT]; | 539 | SCacheInfo info[VERTEXCACHE_ELEMENT]; |
540 | 540 | ||
541 | 541 | ||
542 | // Transformed and lite, clipping state | 542 | // Transformed and lite, clipping state |
543 | // + Clipped, Projected | 543 | // + Clipped, Projected |
544 | SAlignedVertex mem; | 544 | SAlignedVertex mem; |
545 | 545 | ||
546 | // source | 546 | // source |
547 | const void* vertices; | 547 | const void* vertices; |
548 | u32 vertexCount; | 548 | u32 vertexCount; |
549 | 549 | ||
550 | const void* indices; | 550 | const void* indices; |
551 | u32 indexCount; | 551 | u32 indexCount; |
552 | u32 indicesIndex; | 552 | u32 indicesIndex; |
553 | 553 | ||
554 | u32 indicesRun; | 554 | u32 indicesRun; |
555 | 555 | ||
556 | // primitives consist of x vertices | 556 | // primitives consist of x vertices |
557 | u32 primitivePitch; | 557 | u32 primitivePitch; |
558 | 558 | ||
559 | u32 vType; //E_VERTEX_TYPE | 559 | u32 vType; //E_VERTEX_TYPE |
560 | u32 pType; //scene::E_PRIMITIVE_TYPE | 560 | u32 pType; //scene::E_PRIMITIVE_TYPE |
561 | u32 iType; //E_INDEX_TYPE iType | 561 | u32 iType; //E_INDEX_TYPE iType |
562 | 562 | ||
563 | }; | 563 | }; |
564 | 564 | ||
565 | 565 | ||
566 | // swap 2 pointer | 566 | // swap 2 pointer |
567 | REALINLINE void swapVertexPointer(const s4DVertex** v1, const s4DVertex** v2) | 567 | REALINLINE void swapVertexPointer(const s4DVertex** v1, const s4DVertex** v2) |
568 | { | 568 | { |
569 | const s4DVertex* b = *v1; | 569 | const s4DVertex* b = *v1; |
570 | *v1 = *v2; | 570 | *v1 = *v2; |
571 | *v2 = b; | 571 | *v2 = b; |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | // ------------------------ Internal Scanline Rasterizer ----------------------------- | 575 | // ------------------------ Internal Scanline Rasterizer ----------------------------- |
576 | 576 | ||
577 | 577 | ||
578 | 578 | ||
579 | // internal scan convert | 579 | // internal scan convert |
580 | struct sScanConvertData | 580 | struct sScanConvertData |
581 | { | 581 | { |
582 | u8 left; // major edge left/right | 582 | u8 left; // major edge left/right |
583 | u8 right; // !left | 583 | u8 right; // !left |
584 | 584 | ||
585 | f32 invDeltaY[3]; // inverse edge delta y | 585 | f32 invDeltaY[3]; // inverse edge delta y |
586 | 586 | ||
587 | f32 x[2]; // x coordinate | 587 | f32 x[2]; // x coordinate |
588 | f32 slopeX[2]; // x slope along edges | 588 | f32 slopeX[2]; // x slope along edges |
589 | 589 | ||
590 | #if defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) || defined ( SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT ) | 590 | #if defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) || defined ( SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT ) |
591 | f32 w[2]; // w coordinate | 591 | f32 w[2]; // w coordinate |
592 | fp24 slopeW[2]; // w slope along edges | 592 | fp24 slopeW[2]; // w slope along edges |
593 | #else | 593 | #else |
594 | f32 z[2]; // z coordinate | 594 | f32 z[2]; // z coordinate |
595 | f32 slopeZ[2]; // z slope along edges | 595 | f32 slopeZ[2]; // z slope along edges |
596 | #endif | 596 | #endif |
597 | 597 | ||
598 | sVec4 c[MATERIAL_MAX_COLORS][2]; // color | 598 | sVec4 c[MATERIAL_MAX_COLORS][2]; // color |
599 | sVec4 slopeC[MATERIAL_MAX_COLORS][2]; // color slope along edges | 599 | sVec4 slopeC[MATERIAL_MAX_COLORS][2]; // color slope along edges |
600 | 600 | ||
601 | sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture | 601 | sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture |
602 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture slope along edges | 602 | sVec2 slopeT[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture slope along edges |
603 | 603 | ||
604 | sVec3 l[BURNING_MATERIAL_MAX_TANGENT][2]; // Light Tangent | 604 | sVec3 l[BURNING_MATERIAL_MAX_TANGENT][2]; // Light Tangent |
605 | sVec3 slopeL[BURNING_MATERIAL_MAX_TEXTURES][2]; // tanget slope along edges | 605 | sVec3 slopeL[BURNING_MATERIAL_MAX_TEXTURES][2]; // tanget slope along edges |
606 | }; | 606 | }; |
607 | 607 | ||
608 | // passed to scan Line | 608 | // passed to scan Line |
609 | struct sScanLineData | 609 | struct sScanLineData |
610 | { | 610 | { |
611 | s32 y; // y position of scanline | 611 | s32 y; // y position of scanline |
612 | f32 x[2]; // x start, x end of scanline | 612 | f32 x[2]; // x start, x end of scanline |
613 | 613 | ||
614 | #if defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) || defined ( SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT ) | 614 | #if defined ( SOFTWARE_DRIVER_2_USE_WBUFFER ) || defined ( SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT ) |
615 | f32 w[2]; // w start, w end of scanline | 615 | f32 w[2]; // w start, w end of scanline |
616 | #else | 616 | #else |
617 | f32 z[2]; // z start, z end of scanline | 617 | f32 z[2]; // z start, z end of scanline |
618 | #endif | 618 | #endif |
619 | 619 | ||
620 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR | 620 | #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR |
621 | sVec4 c[MATERIAL_MAX_COLORS][2]; // color start, color end of scanline | 621 | sVec4 c[MATERIAL_MAX_COLORS][2]; // color start, color end of scanline |
622 | #endif | 622 | #endif |
623 | 623 | ||
624 | sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture start, texture end of scanline | 624 | sVec2 t[BURNING_MATERIAL_MAX_TEXTURES][2]; // texture start, texture end of scanline |
625 | sVec3 l[BURNING_MATERIAL_MAX_TANGENT][2]; // Light Tangent start, end | 625 | sVec3 l[BURNING_MATERIAL_MAX_TANGENT][2]; // Light Tangent start, end |
626 | }; | 626 | }; |
627 | 627 | ||
628 | // passed to pixel Shader | 628 | // passed to pixel Shader |
629 | struct sPixelShaderData | 629 | struct sPixelShaderData |
630 | { | 630 | { |
631 | tVideoSample *dst; | 631 | tVideoSample *dst; |
632 | fp24 *z; | 632 | fp24 *z; |
633 | 633 | ||
634 | s32 xStart; | 634 | s32 xStart; |
635 | s32 xEnd; | 635 | s32 xEnd; |
636 | s32 dx; | 636 | s32 dx; |
637 | s32 i; | 637 | s32 i; |
638 | }; | 638 | }; |
639 | 639 | ||
640 | /* | 640 | /* |
641 | load a color value | 641 | load a color value |
642 | */ | 642 | */ |
643 | inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b, | 643 | inline void getTexel_plain2 ( tFixPoint &r, tFixPoint &g, tFixPoint &b, |
644 | const sVec4 &v | 644 | const sVec4 &v |
645 | ) | 645 | ) |
646 | { | 646 | { |
647 | r = tofix ( v.y ); | 647 | r = tofix ( v.y ); |
648 | g = tofix ( v.z ); | 648 | g = tofix ( v.z ); |
649 | b = tofix ( v.w ); | 649 | b = tofix ( v.w ); |
650 | } | 650 | } |
651 | 651 | ||
652 | /* | 652 | /* |
653 | load a color value | 653 | load a color value |
654 | */ | 654 | */ |
655 | inline void getSample_color ( tFixPoint &a, tFixPoint &r, tFixPoint &g, tFixPoint &b, | 655 | inline void getSample_color ( tFixPoint &a, tFixPoint &r, tFixPoint &g, tFixPoint &b, |
656 | const sVec4 &v | 656 | const sVec4 &v |
657 | ) | 657 | ) |
658 | { | 658 | { |
659 | a = tofix ( v.x ); | 659 | a = tofix ( v.x ); |
660 | r = tofix ( v.y, COLOR_MAX * FIX_POINT_F32_MUL); | 660 | r = tofix ( v.y, COLOR_MAX * FIX_POINT_F32_MUL); |
661 | g = tofix ( v.z, COLOR_MAX * FIX_POINT_F32_MUL); | 661 | g = tofix ( v.z, COLOR_MAX * FIX_POINT_F32_MUL); |
662 | b = tofix ( v.w, COLOR_MAX * FIX_POINT_F32_MUL); | 662 | b = tofix ( v.w, COLOR_MAX * FIX_POINT_F32_MUL); |
663 | } | 663 | } |
664 | 664 | ||
665 | /* | 665 | /* |
666 | load a color value | 666 | load a color value |
667 | */ | 667 | */ |
668 | inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b,const sVec4 &v ) | 668 | inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b,const sVec4 &v ) |
669 | { | 669 | { |
670 | r = tofix ( v.y, COLOR_MAX * FIX_POINT_F32_MUL); | 670 | r = tofix ( v.y, COLOR_MAX * FIX_POINT_F32_MUL); |
671 | g = tofix ( v.z, COLOR_MAX * FIX_POINT_F32_MUL); | 671 | g = tofix ( v.z, COLOR_MAX * FIX_POINT_F32_MUL); |
672 | b = tofix ( v.w, COLOR_MAX * FIX_POINT_F32_MUL); | 672 | b = tofix ( v.w, COLOR_MAX * FIX_POINT_F32_MUL); |
673 | } | 673 | } |
674 | 674 | ||
675 | /* | 675 | /* |
676 | load a color value | 676 | load a color value |
677 | */ | 677 | */ |
678 | inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b, | 678 | inline void getSample_color ( tFixPoint &r, tFixPoint &g, tFixPoint &b, |
679 | const sVec4 &v, const f32 mulby ) | 679 | const sVec4 &v, const f32 mulby ) |
680 | { | 680 | { |
681 | r = tofix ( v.y, mulby); | 681 | r = tofix ( v.y, mulby); |
682 | g = tofix ( v.z, mulby); | 682 | g = tofix ( v.z, mulby); |
683 | b = tofix ( v.w, mulby); | 683 | b = tofix ( v.w, mulby); |
684 | } | 684 | } |
685 | 685 | ||
686 | 686 | ||
687 | 687 | ||
688 | } | 688 | } |
689 | 689 | ||
690 | } | 690 | } |
691 | 691 | ||
692 | #endif | 692 | #endif |
693 | 693 | ||