52 TRACE(
"pout %p, pc %p, s %f\n", pout, pc,
s);
54 pout->
r = 0.5f +
s * (pc->
r - 0.5f);
55 pout->
g = 0.5f +
s * (pc->
g - 0.5f);
56 pout->
b = 0.5f +
s * (pc->
b - 0.5f);
65 TRACE(
"pout %p, pc %p, s %f\n", pout, pc,
s);
67 grey = pc->
r * 0.2125f + pc->
g * 0.7154f + pc->
b * 0.0721f;
68 pout->
r = grey +
s * (pc->
r - grey);
69 pout->
g = grey +
s * (pc->
g - grey);
70 pout->
b = grey +
s * (pc->
b - grey);
81 TRACE(
"costheta %f, refractionindex %f\n", costheta, refractionindex);
83 g =
sqrtf(refractionindex * refractionindex + costheta * costheta - 1.0f);
86 result = (costheta *
a - 1.0f) * (costheta *
a - 1.0f) / ((costheta *
d + 1.0f) * (costheta *
d + 1.0f)) + 1.0f;
97 TRACE(
"out %p, scaling %f, rotationcenter %p, rotation %p, translation %p\n",
98 out, scaling, rotationcenter, rotation, translation);
100 D3DXMatrixIdentity(
out);
104 FLOAT temp00, temp01, temp02, temp10, temp11, temp12, temp20, temp21, temp22;
106 temp00 = 1.0f - 2.0f * (rotation->
y * rotation->
y + rotation->
z * rotation->
z);
107 temp01 = 2.0f * (rotation->
x * rotation->
y + rotation->
z * rotation->
w);
108 temp02 = 2.0f * (rotation->
x * rotation->
z - rotation->
y * rotation->
w);
109 temp10 = 2.0f * (rotation->
x * rotation->
y - rotation->
z * rotation->
w);
110 temp11 = 1.0f - 2.0f * (rotation->
x * rotation->
x + rotation->
z * rotation->
z);
111 temp12 = 2.0f * (rotation->
y * rotation->
z + rotation->
x * rotation->
w);
112 temp20 = 2.0f * (rotation->
x * rotation->
z + rotation->
y * rotation->
w);
113 temp21 = 2.0f * (rotation->
y * rotation->
z - rotation->
x * rotation->
w);
114 temp22 = 1.0f - 2.0f * (rotation->
x * rotation->
x + rotation->
y * rotation->
y);
116 out->u.m[0][0] = scaling * temp00;
117 out->u.m[0][1] = scaling * temp01;
118 out->u.m[0][2] = scaling * temp02;
119 out->u.m[1][0] = scaling * temp10;
120 out->u.m[1][1] = scaling * temp11;
121 out->u.m[1][2] = scaling * temp12;
122 out->u.m[2][0] = scaling * temp20;
123 out->u.m[2][1] = scaling * temp21;
124 out->u.m[2][2] = scaling * temp22;
128 out->u.m[3][0] = rotationcenter->
x * (1.0f - temp00) - rotationcenter->
y * temp10
129 - rotationcenter->
z * temp20;
130 out->u.m[3][1] = rotationcenter->
y * (1.0f - temp11) - rotationcenter->
x * temp01
131 - rotationcenter->
z * temp21;
132 out->u.m[3][2] = rotationcenter->
z * (1.0f - temp22) - rotationcenter->
x * temp02
133 - rotationcenter->
y * temp12;
138 out->u.m[0][0] = scaling;
139 out->u.m[1][1] = scaling;
140 out->u.m[2][2] = scaling;
145 out->u.m[3][0] += translation->
x;
146 out->u.m[3][1] += translation->
y;
147 out->u.m[3][2] += translation->
z;
158 TRACE(
"out %p, scaling %f, rotationcenter %p, rotation %f, translation %p\n",
159 out, scaling, rotationcenter, rotation, translation);
161 s =
sinf(rotation / 2.0f);
162 tmp1 = 1.0f - 2.0f *
s *
s;
163 tmp2 = 2.0f *
s *
cosf(rotation / 2.0f);
165 D3DXMatrixIdentity(
out);
166 out->u.m[0][0] = scaling * tmp1;
167 out->u.m[0][1] = scaling * tmp2;
168 out->u.m[1][0] = -scaling * tmp2;
169 out->u.m[1][1] = scaling * tmp1;
175 x = rotationcenter->
x;
176 y = rotationcenter->
y;
178 out->u.m[3][0] =
y * tmp2 -
x * tmp1 +
x;
179 out->u.m[3][1] = -
x * tmp2 -
y * tmp1 +
y;
184 out->u.m[3][0] += translation->
x;
185 out->u.m[3][1] += translation->
y;
196 TRACE(
"poutscale %p, poutrotation %p, pouttranslation %p, pm %p\n", poutscale, poutrotation, pouttranslation,
pm);
202 poutscale->
x=D3DXVec3Length(&
vec);
207 poutscale->
y=D3DXVec3Length(&
vec);
212 poutscale->
z=D3DXVec3Length(&
vec);
215 pouttranslation->
x=
pm->u.m[3][0];
216 pouttranslation->
y=
pm->u.m[3][1];
217 pouttranslation->
z=
pm->u.m[3][2];
220 if ( (poutscale->
x == 0.0f) || (poutscale->
y == 0.0f) || (poutscale->
z == 0.0f) )
return D3DERR_INVALIDCALL;
242 t[0] =
pm->u.m[2][2] *
pm->u.m[3][3] -
pm->u.m[2][3] *
pm->u.m[3][2];
243 t[1] =
pm->u.m[1][2] *
pm->u.m[3][3] -
pm->u.m[1][3] *
pm->u.m[3][2];
244 t[2] =
pm->u.m[1][2] *
pm->u.m[2][3] -
pm->u.m[1][3] *
pm->u.m[2][2];
245 v[0] =
pm->u.m[1][1] *
t[0] -
pm->u.m[2][1] *
t[1] +
pm->u.m[3][1] *
t[2];
246 v[1] = -
pm->u.m[1][0] *
t[0] +
pm->u.m[2][0] *
t[1] -
pm->u.m[3][0] *
t[2];
248 t[0] =
pm->u.m[1][0] *
pm->u.m[2][1] -
pm->u.m[2][0] *
pm->u.m[1][1];
249 t[1] =
pm->u.m[1][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[1][1];
250 t[2] =
pm->u.m[2][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[2][1];
251 v[2] =
pm->u.m[3][3] *
t[0] -
pm->u.m[2][3] *
t[1] +
pm->u.m[1][3] *
t[2];
252 v[3] = -
pm->u.m[3][2] *
t[0] +
pm->u.m[2][2] *
t[1] -
pm->u.m[1][2] *
t[2];
254 return pm->u.m[0][0] *
v[0] +
pm->u.m[0][1] *
v[1] +
255 pm->u.m[0][2] *
v[2] +
pm->u.m[0][3] *
v[3];
263 TRACE(
"pout %p, pdeterminant %p, pm %p\n", pout, pdeterminant,
pm);
265 t[0] =
pm->u.m[2][2] *
pm->u.m[3][3] -
pm->u.m[2][3] *
pm->u.m[3][2];
266 t[1] =
pm->u.m[1][2] *
pm->u.m[3][3] -
pm->u.m[1][3] *
pm->u.m[3][2];
267 t[2] =
pm->u.m[1][2] *
pm->u.m[2][3] -
pm->u.m[1][3] *
pm->u.m[2][2];
268 v[0] =
pm->u.m[1][1] *
t[0] -
pm->u.m[2][1] *
t[1] +
pm->u.m[3][1] *
t[2];
269 v[4] = -
pm->u.m[1][0] *
t[0] +
pm->u.m[2][0] *
t[1] -
pm->u.m[3][0] *
t[2];
271 t[0] =
pm->u.m[1][0] *
pm->u.m[2][1] -
pm->u.m[2][0] *
pm->u.m[1][1];
272 t[1] =
pm->u.m[1][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[1][1];
273 t[2] =
pm->u.m[2][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[2][1];
274 v[8] =
pm->u.m[3][3] *
t[0] -
pm->u.m[2][3] *
t[1] +
pm->u.m[1][3] *
t[2];
275 v[12] = -
pm->u.m[3][2] *
t[0] +
pm->u.m[2][2] *
t[1] -
pm->u.m[1][2] *
t[2];
277 det =
pm->u.m[0][0] *
v[0] +
pm->u.m[0][1] *
v[4] +
278 pm->u.m[0][2] *
v[8] +
pm->u.m[0][3] *
v[12];
284 t[0] =
pm->u.m[2][2] *
pm->u.m[3][3] -
pm->u.m[2][3] *
pm->u.m[3][2];
285 t[1] =
pm->u.m[0][2] *
pm->u.m[3][3] -
pm->u.m[0][3] *
pm->u.m[3][2];
286 t[2] =
pm->u.m[0][2] *
pm->u.m[2][3] -
pm->u.m[0][3] *
pm->u.m[2][2];
287 v[1] = -
pm->u.m[0][1] *
t[0] +
pm->u.m[2][1] *
t[1] -
pm->u.m[3][1] *
t[2];
288 v[5] =
pm->u.m[0][0] *
t[0] -
pm->u.m[2][0] *
t[1] +
pm->u.m[3][0] *
t[2];
290 t[0] =
pm->u.m[0][0] *
pm->u.m[2][1] -
pm->u.m[2][0] *
pm->u.m[0][1];
291 t[1] =
pm->u.m[3][0] *
pm->u.m[0][1] -
pm->u.m[0][0] *
pm->u.m[3][1];
292 t[2] =
pm->u.m[2][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[2][1];
293 v[9] = -
pm->u.m[3][3] *
t[0] -
pm->u.m[2][3] *
t[1]-
pm->u.m[0][3] *
t[2];
294 v[13] =
pm->u.m[3][2] *
t[0] +
pm->u.m[2][2] *
t[1] +
pm->u.m[0][2] *
t[2];
296 t[0] =
pm->u.m[1][2] *
pm->u.m[3][3] -
pm->u.m[1][3] *
pm->u.m[3][2];
297 t[1] =
pm->u.m[0][2] *
pm->u.m[3][3] -
pm->u.m[0][3] *
pm->u.m[3][2];
298 t[2] =
pm->u.m[0][2] *
pm->u.m[1][3] -
pm->u.m[0][3] *
pm->u.m[1][2];
299 v[2] =
pm->u.m[0][1] *
t[0] -
pm->u.m[1][1] *
t[1] +
pm->u.m[3][1] *
t[2];
300 v[6] = -
pm->u.m[0][0] *
t[0] +
pm->u.m[1][0] *
t[1] -
pm->u.m[3][0] *
t[2];
302 t[0] =
pm->u.m[0][0] *
pm->u.m[1][1] -
pm->u.m[1][0] *
pm->u.m[0][1];
303 t[1] =
pm->u.m[3][0] *
pm->u.m[0][1] -
pm->u.m[0][0] *
pm->u.m[3][1];
304 t[2] =
pm->u.m[1][0] *
pm->u.m[3][1] -
pm->u.m[3][0] *
pm->u.m[1][1];
305 v[10] =
pm->u.m[3][3] *
t[0] +
pm->u.m[1][3] *
t[1] +
pm->u.m[0][3] *
t[2];
306 v[14] = -
pm->u.m[3][2] *
t[0] -
pm->u.m[1][2] *
t[1] -
pm->u.m[0][2] *
t[2];
308 t[0] =
pm->u.m[1][2] *
pm->u.m[2][3] -
pm->u.m[1][3] *
pm->u.m[2][2];
309 t[1] =
pm->u.m[0][2] *
pm->u.m[2][3] -
pm->u.m[0][3] *
pm->u.m[2][2];
310 t[2] =
pm->u.m[0][2] *
pm->u.m[1][3] -
pm->u.m[0][3] *
pm->u.m[1][2];
311 v[3] = -
pm->u.m[0][1] *
t[0] +
pm->u.m[1][1] *
t[1] -
pm->u.m[2][1] *
t[2];
312 v[7] =
pm->u.m[0][0] *
t[0] -
pm->u.m[1][0] *
t[1] +
pm->u.m[2][0] *
t[2];
314 v[11] = -
pm->u.m[0][0] * (
pm->u.m[1][1] *
pm->u.m[2][3] -
pm->u.m[1][3] *
pm->u.m[2][1]) +
315 pm->u.m[1][0] * (
pm->u.m[0][1] *
pm->u.m[2][3] -
pm->u.m[0][3] *
pm->u.m[2][1]) -
316 pm->u.m[2][0] * (
pm->u.m[0][1] *
pm->u.m[1][3] -
pm->u.m[0][3] *
pm->u.m[1][1]);
318 v[15] =
pm->u.m[0][0] * (
pm->u.m[1][1] *
pm->u.m[2][2] -
pm->u.m[1][2] *
pm->u.m[2][1]) -
319 pm->u.m[1][0] * (
pm->u.m[0][1] *
pm->u.m[2][2] -
pm->u.m[0][2] *
pm->u.m[2][1]) +
320 pm->u.m[2][0] * (
pm->u.m[0][1] *
pm->u.m[1][2] -
pm->u.m[0][2] *
pm->u.m[1][1]);
324 for (
i = 0;
i < 4;
i++)
325 for (
j = 0;
j < 4;
j++)
326 pout->u.
m[
i][
j] =
v[4 *
i +
j] * det;
336 TRACE(
"out %p, eye %p, at %p, up %p\n",
out, eye, at,
up);
338 D3DXVec3Subtract(&
vec, at, eye);
347 out->u.m[3][0] = -D3DXVec3Dot(&
right, eye);
348 out->u.m[0][1] = upn.
x;
349 out->u.m[1][1] = upn.
y;
350 out->u.m[2][1] = upn.
z;
351 out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
355 out->u.m[3][2] = -D3DXVec3Dot(&
vec, eye);
356 out->u.m[0][3] = 0.0f;
357 out->u.m[1][3] = 0.0f;
358 out->u.m[2][3] = 0.0f;
359 out->u.m[3][3] = 1.0f;
369 TRACE(
"out %p, eye %p, at %p, up %p\n",
out, eye, at,
up);
371 D3DXVec3Subtract(&
vec, at, eye);
380 out->u.m[3][0] = D3DXVec3Dot(&
right, eye);
381 out->u.m[0][1] = upn.
x;
382 out->u.m[1][1] = upn.
y;
383 out->u.m[2][1] = upn.
z;
384 out->u.m[3][1] = -D3DXVec3Dot(&upn, eye);
388 out->u.m[3][2] = D3DXVec3Dot(&
vec, eye);
389 out->u.m[0][3] = 0.0f;
390 out->u.m[1][3] = 0.0f;
391 out->u.m[2][3] = 0.0f;
392 out->u.m[3][3] = 1.0f;
402 TRACE(
"pout %p, pm1 %p, pm2 %p\n", pout, pm1,
pm2);
408 out.u.m[
i][
j] = pm1->u.
m[
i][0] *
pm2->u.m[0][
j] + pm1->u.
m[
i][1] *
pm2->u.m[1][
j] + pm1->u.
m[
i][2] *
pm2->u.m[2][
j] + pm1->u.
m[
i][3] *
pm2->u.m[3][
j];
421 TRACE(
"pout %p, pm1 %p, pm2 %p\n", pout, pm1,
pm2);
423 for (
i = 0;
i < 4;
i++)
424 for (
j = 0;
j < 4;
j++)
425 temp.u.m[
j][
i] = pm1->u.
m[
i][0] *
pm2->u.m[0][
j] + pm1->u.
m[
i][1] *
pm2->u.m[1][
j] + pm1->u.
m[
i][2] *
pm2->u.m[2][
j] + pm1->u.
m[
i][3] *
pm2->u.m[3][
j];
433 TRACE(
"pout %p, w %f, h %f, zn %f, zf %f\n", pout,
w,
h, zn, zf);
435 D3DXMatrixIdentity(pout);
436 pout->u.
m[0][0] = 2.0f /
w;
437 pout->u.
m[1][1] = 2.0f /
h;
438 pout->u.
m[2][2] = 1.0f / (zf - zn);
439 pout->u.
m[3][2] = zn / (zn - zf);
445 TRACE(
"pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout,
l,
r,
b,
t, zn, zf);
447 D3DXMatrixIdentity(pout);
448 pout->u.
m[0][0] = 2.0f / (
r -
l);
449 pout->u.
m[1][1] = 2.0f / (
t -
b);
450 pout->u.
m[2][2] = 1.0f / (zf -zn);
451 pout->u.
m[3][0] = -1.0f -2.0f *
l / (
r -
l);
452 pout->u.
m[3][1] = 1.0f + 2.0f *
t / (
b -
t);
453 pout->u.
m[3][2] = zn / (zn -zf);
459 TRACE(
"pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout,
l,
r,
b,
t, zn, zf);
461 D3DXMatrixIdentity(pout);
462 pout->u.
m[0][0] = 2.0f / (
r -
l);
463 pout->u.
m[1][1] = 2.0f / (
t -
b);
464 pout->u.
m[2][2] = 1.0f / (zn -zf);
465 pout->u.
m[3][0] = -1.0f -2.0f *
l / (
r -
l);
466 pout->u.
m[3][1] = 1.0f + 2.0f *
t / (
b -
t);
467 pout->u.
m[3][2] = zn / (zn -zf);
473 TRACE(
"pout %p, w %f, h %f, zn %f, zf %f\n", pout,
w,
h, zn, zf);
475 D3DXMatrixIdentity(pout);
476 pout->u.
m[0][0] = 2.0f /
w;
477 pout->u.
m[1][1] = 2.0f /
h;
478 pout->u.
m[2][2] = 1.0f / (zn - zf);
479 pout->u.
m[3][2] = zn / (zn - zf);
485 TRACE(
"pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
487 D3DXMatrixIdentity(pout);
488 pout->u.
m[0][0] = 1.0f / (aspect *
tanf(fovy/2.0f));
489 pout->u.
m[1][1] = 1.0f /
tanf(fovy/2.0f);
490 pout->u.
m[2][2] = zf / (zf - zn);
491 pout->u.
m[2][3] = 1.0f;
492 pout->u.
m[3][2] = (zf * zn) / (zn - zf);
493 pout->u.
m[3][3] = 0.0f;
499 TRACE(
"pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
501 D3DXMatrixIdentity(pout);
502 pout->u.
m[0][0] = 1.0f / (aspect *
tanf(fovy/2.0f));
503 pout->u.
m[1][1] = 1.0f /
tanf(fovy/2.0f);
504 pout->u.
m[2][2] = zf / (zn - zf);
505 pout->u.
m[2][3] = -1.0f;
506 pout->u.
m[3][2] = (zf * zn) / (zn - zf);
507 pout->u.
m[3][3] = 0.0f;
513 TRACE(
"pout %p, w %f, h %f, zn %f, zf %f\n", pout,
w,
h, zn, zf);
515 D3DXMatrixIdentity(pout);
516 pout->u.
m[0][0] = 2.0f * zn /
w;
517 pout->u.
m[1][1] = 2.0f * zn /
h;
518 pout->u.
m[2][2] = zf / (zf - zn);
519 pout->u.
m[3][2] = (zn * zf) / (zn - zf);
520 pout->u.
m[2][3] = 1.0f;
521 pout->u.
m[3][3] = 0.0f;
527 TRACE(
"pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout,
l,
r,
b,
t, zn, zf);
529 D3DXMatrixIdentity(pout);
530 pout->u.
m[0][0] = 2.0f * zn / (
r -
l);
531 pout->u.
m[1][1] = -2.0f * zn / (
b -
t);
532 pout->u.
m[2][0] = -1.0f - 2.0f *
l / (
r -
l);
533 pout->u.
m[2][1] = 1.0f + 2.0f *
t / (
b -
t);
534 pout->u.
m[2][2] = - zf / (zn - zf);
535 pout->u.
m[3][2] = (zn * zf) / (zn -zf);
536 pout->u.
m[2][3] = 1.0f;
537 pout->u.
m[3][3] = 0.0f;
543 TRACE(
"pout %p, l %f, r %f, b %f, t %f, zn %f, zf %f\n", pout,
l,
r,
b,
t, zn, zf);
545 D3DXMatrixIdentity(pout);
546 pout->u.
m[0][0] = 2.0f * zn / (
r -
l);
547 pout->u.
m[1][1] = -2.0f * zn / (
b -
t);
548 pout->u.
m[2][0] = 1.0f + 2.0f *
l / (
r -
l);
549 pout->u.
m[2][1] = -1.0f -2.0f *
t / (
b -
t);
550 pout->u.
m[2][2] = zf / (zn - zf);
551 pout->u.
m[3][2] = (zn * zf) / (zn -zf);
552 pout->u.
m[2][3] = -1.0f;
553 pout->u.
m[3][3] = 0.0f;
559 TRACE(
"pout %p, w %f, h %f, zn %f, zf %f\n", pout,
w,
h, zn, zf);
561 D3DXMatrixIdentity(pout);
562 pout->u.
m[0][0] = 2.0f * zn /
w;
563 pout->u.
m[1][1] = 2.0f * zn /
h;
564 pout->u.
m[2][2] = zf / (zn - zf);
565 pout->u.
m[3][2] = (zn * zf) / (zn - zf);
566 pout->u.
m[2][3] = -1.0f;
567 pout->u.
m[3][3] = 0.0f;
575 TRACE(
"pout %p, pplane %p\n", pout, pplane);
578 D3DXMatrixIdentity(pout);
579 pout->u.
m[0][0] = 1.0f - 2.0f * Nplane.
a * Nplane.
a;
580 pout->u.
m[0][1] = -2.0f * Nplane.
a * Nplane.
b;
581 pout->u.
m[0][2] = -2.0f * Nplane.
a * Nplane.
c;
582 pout->u.
m[1][0] = -2.0f * Nplane.
a * Nplane.
b;
583 pout->u.
m[1][1] = 1.0f - 2.0f * Nplane.
b * Nplane.
b;
584 pout->u.
m[1][2] = -2.0f * Nplane.
b * Nplane.
c;
585 pout->u.
m[2][0] = -2.0f * Nplane.
c * Nplane.
a;
586 pout->u.
m[2][1] = -2.0f * Nplane.
c * Nplane.
b;
587 pout->u.
m[2][2] = 1.0f - 2.0f * Nplane.
c * Nplane.
c;
588 pout->u.
m[3][0] = -2.0f * Nplane.
d * Nplane.
a;
589 pout->u.
m[3][1] = -2.0f * Nplane.
d * Nplane.
b;
590 pout->u.
m[3][2] = -2.0f * Nplane.
d * Nplane.
c;
597 FLOAT sangle, cangle, cdiff;
604 cdiff = 1.0f - cangle;
606 out->u.m[0][0] = cdiff * nv.
x * nv.
x + cangle;
607 out->u.m[1][0] = cdiff * nv.
x * nv.
y - sangle * nv.
z;
608 out->u.m[2][0] = cdiff * nv.
x * nv.
z + sangle * nv.
y;
609 out->u.m[3][0] = 0.0f;
610 out->u.m[0][1] = cdiff * nv.
y * nv.
x + sangle * nv.
z;
611 out->u.m[1][1] = cdiff * nv.
y * nv.
y + cangle;
612 out->u.m[2][1] = cdiff * nv.
y * nv.
z - sangle * nv.
x;
613 out->u.m[3][1] = 0.0f;
614 out->u.m[0][2] = cdiff * nv.
z * nv.
x - sangle * nv.
y;
615 out->u.m[1][2] = cdiff * nv.
z * nv.
y + sangle * nv.
x;
616 out->u.m[2][2] = cdiff * nv.
z * nv.
z + cangle;
617 out->u.m[3][2] = 0.0f;
618 out->u.m[0][3] = 0.0f;
619 out->u.m[1][3] = 0.0f;
620 out->u.m[2][3] = 0.0f;
621 out->u.m[3][3] = 1.0f;
628 TRACE(
"pout %p, pq %p\n", pout, pq);
630 D3DXMatrixIdentity(pout);
631 pout->u.
m[0][0] = 1.0f - 2.0f * (pq->
y * pq->
y + pq->
z * pq->
z);
632 pout->u.
m[0][1] = 2.0f * (pq->
x *pq->
y + pq->
z * pq->
w);
633 pout->u.
m[0][2] = 2.0f * (pq->
x * pq->
z - pq->
y * pq->
w);
634 pout->u.
m[1][0] = 2.0f * (pq->
x * pq->
y - pq->
z * pq->
w);
635 pout->u.
m[1][1] = 1.0f - 2.0f * (pq->
x * pq->
x + pq->
z * pq->
z);
636 pout->u.
m[1][2] = 2.0f * (pq->
y *pq->
z + pq->
x *pq->
w);
637 pout->u.
m[2][0] = 2.0f * (pq->
x * pq->
z + pq->
y * pq->
w);
638 pout->u.
m[2][1] = 2.0f * (pq->
y *pq->
z - pq->
x *pq->
w);
639 pout->u.
m[2][2] = 1.0f - 2.0f * (pq->
x * pq->
x + pq->
y * pq->
y);
647 D3DXMatrixIdentity(pout);
659 D3DXMatrixIdentity(pout);
669 FLOAT sroll, croll, spitch, cpitch, syaw, cyaw;
671 TRACE(
"out %p, yaw %f, pitch %f, roll %f\n",
out, yaw, pitch, roll);
675 spitch =
sinf(pitch);
676 cpitch =
cosf(pitch);
680 out->u.m[0][0] = sroll * spitch * syaw + croll * cyaw;
681 out->u.m[0][1] = sroll * cpitch;
682 out->u.m[0][2] = sroll * spitch * cyaw - croll * syaw;
683 out->u.m[0][3] = 0.0f;
684 out->u.m[1][0] = croll * spitch * syaw - sroll * cyaw;
685 out->u.m[1][1] = croll * cpitch;
686 out->u.m[1][2] = croll * spitch * cyaw + sroll * syaw;
687 out->u.m[1][3] = 0.0f;
688 out->u.m[2][0] = cpitch * syaw;
689 out->u.m[2][1] = -spitch;
690 out->u.m[2][2] = cpitch * cyaw;
691 out->u.m[2][3] = 0.0f;
692 out->u.m[3][0] = 0.0f;
693 out->u.m[3][1] = 0.0f;
694 out->u.m[3][2] = 0.0f;
695 out->u.m[3][3] = 1.0f;
704 D3DXMatrixIdentity(pout);
714 TRACE(
"pout %p, sx %f, sy %f, sz %f\n", pout, sx, sy, sz);
716 D3DXMatrixIdentity(pout);
717 pout->u.
m[0][0] = sx;
718 pout->u.
m[1][1] = sy;
719 pout->u.
m[2][2] = sz;
728 TRACE(
"pout %p, plight %p, pplane %p\n", pout, plight, pplane);
731 dot = D3DXPlaneDot(&Nplane, plight);
732 pout->u.
m[0][0] = dot - Nplane.
a * plight->
x;
733 pout->u.
m[0][1] = -Nplane.
a * plight->
y;
734 pout->u.
m[0][2] = -Nplane.
a * plight->
z;
735 pout->u.
m[0][3] = -Nplane.
a * plight->
w;
736 pout->u.
m[1][0] = -Nplane.
b * plight->
x;
737 pout->u.
m[1][1] = dot - Nplane.
b * plight->
y;
738 pout->u.
m[1][2] = -Nplane.
b * plight->
z;
739 pout->u.
m[1][3] = -Nplane.
b * plight->
w;
740 pout->u.
m[2][0] = -Nplane.
c * plight->
x;
741 pout->u.
m[2][1] = -Nplane.
c * plight->
y;
742 pout->u.
m[2][2] = dot - Nplane.
c * plight->
z;
743 pout->u.
m[2][3] = -Nplane.
c * plight->
w;
744 pout->u.
m[3][0] = -Nplane.
d * plight->
x;
745 pout->u.
m[3][1] = -Nplane.
d * plight->
y;
746 pout->u.
m[3][2] = -Nplane.
d * plight->
z;
747 pout->u.
m[3][3] = dot - Nplane.
d * plight->
w;
757 D3DXMATRIX m1, msr1, ms, msr, msc, mrc1, mr, mrc, mt;
761 TRACE(
"out %p, scaling_center %p, scaling_rotation %p, scaling %p, rotation_center %p,"
762 " rotation %p, translation %p.\n",
763 out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
767 sc = scaling_center ? *scaling_center : zero_vector;
769 if (scaling_rotation)
771 q.x = -scaling_rotation->
x;
772 q.y = -scaling_rotation->
y;
773 q.z = -scaling_rotation->
z;
774 q.w = scaling_rotation->
w;
780 if (scaling_rotation)
790 D3DXMatrixIdentity(&m1);
795 rc = rotation_center ? *rotation_center : zero_vector;
834 TRACE(
"out %p, scaling_center %p, scaling_rotation %.8e, scaling %p, rotation_center %p, "
835 "rotation %.8e, translation %p.\n",
836 out, scaling_center, scaling_rotation, scaling, rotation_center, rotation, translation);
847 r.w =
cosf(rotation / 2.0f);
850 r.z =
sinf(rotation / 2.0f);
853 if (scaling_rotation)
855 s_r.
w =
cosf(scaling_rotation / 2.0f);
858 s_r.
z =
sinf(scaling_rotation / 2.0f);
862 scaling_rotation ? &s_r :
NULL, scaling ? &
s :
NULL, rotation_center ? &r_c:
NULL,
863 rotation ? &
r :
NULL, translation ? &
t :
NULL);
868 TRACE(
"pout %p, x %f, y %f, z %f\n", pout,
x,
y,
z);
870 D3DXMatrixIdentity(pout);
882 TRACE(
"pout %p, pm %p\n", pout,
pm);
885 for (
j=0;
j<4;
j++) pout->u.
m[
i][
j] =
m.u.m[
j][
i];
941 TRACE(
"iface %p\n", iface);
950 TRACE(
"iface %p\n", iface);
952 D3DXMatrixIdentity(&
This->stack[
This->current]);
961 TRACE(
"iface %p, pm %p\n", iface,
pm);
972 TRACE(
"iface %p, pm %p\n", iface,
pm);
983 TRACE(
"iface %p, pm %p\n", iface,
pm);
994 TRACE(
"iface %p\n", iface);
1001 unsigned int new_size;
1004 new_size =
This->stack_size / 2;
1008 This->stack_size = new_size;
1009 This->stack = new_stack;
1022 TRACE(
"iface %p\n", iface);
1024 if (
This->current ==
This->stack_size - 1)
1026 unsigned int new_size;
1031 new_size =
This->stack_size * 2;
1035 This->stack_size = new_size;
1036 This->stack = new_stack;
1050 TRACE(
"iface %p, pv %p, angle %f\n", iface, pv,
angle);
1063 TRACE(
"iface %p, pv %p, angle %f\n", iface, pv,
angle);
1076 TRACE(
"iface %p, x %f, y %f, z %f\n", iface,
x,
y,
z);
1089 TRACE(
"iface %p, x %f, y %f, z %f\n", iface,
x,
y,
z);
1102 TRACE(
"iface %p,x %f, y %f, z %f\n", iface,
x,
y,
z);
1115 TRACE(
"iface %p, x %f, y %f, z %f\n", iface,
x,
y,
z);
1128 TRACE(
"iface %p, x %f, y %f, z %f\n", iface,
x,
y,
z);
1141 TRACE(
"iface %p, x %f, y %f, z %f\n", iface,
x,
y,
z);
1192 object->current = 0;
1194 D3DXMatrixIdentity(&
object->stack[0]);
1196 TRACE(
"Created matrix stack %p.\n",
object);
1198 *
stack = &
object->ID3DXMatrixStack_iface;
1206 TRACE(
"pout %p, pvpoint %p, pvnormal %p\n", pout, pvpoint, pvnormal);
1208 pout->
a = pvnormal->
x;
1209 pout->
b = pvnormal->
y;
1210 pout->
c = pvnormal->
z;
1211 pout->
d = -D3DXVec3Dot(pvpoint, pvnormal);
1219 TRACE(
"pout %p, pv1 %p, pv2 %p, pv3 %p\n", pout, pv1,
pv2, pv3);
1221 edge1.
x = 0.0f; edge1.
y = 0.0f; edge1.
z = 0.0f;
1222 edge2.
x = 0.0f; edge2.
y = 0.0f; edge2.
z = 0.0f;
1223 D3DXVec3Subtract(&edge1,
pv2, pv1);
1224 D3DXVec3Subtract(&edge2, pv3, pv1);
1225 D3DXVec3Cross(&
normal, &edge1, &edge2);
1236 TRACE(
"pout %p, pp %p, pv1 %p, pv2 %p\n", pout, pp, pv1,
pv2);
1241 direction.
x =
pv2->x - pv1->
x;
1242 direction.
y =
pv2->y - pv1->
y;
1243 direction.
z =
pv2->z - pv1->
z;
1244 dot = D3DXVec3Dot(&
normal, &direction);
1245 if ( !dot )
return NULL;
1246 temp = ( pp->
d + D3DXVec3Dot(&
normal, pv1) ) / dot;
1247 pout->
x = pv1->
x -
temp * direction.
x;
1248 pout->
y = pv1->
y -
temp * direction.
y;
1249 pout->
z = pv1->
z -
temp * direction.
z;
1282 TRACE(
"pout %p, pplane %p, pm %p\n", pout, pplane,
pm);
1295 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1297 for (
i = 0;
i < elements; ++
i) {
1312 TRACE(
"pout %p, pq1 %p, pq2 %p, pq3 %p, f %f, g %f\n", pout, pq1, pq2, pq3,
f,
g);
1347 TRACE(
"pout %p, pq %p\n", pout, pq);
1349 norm = D3DXQuaternionLengthSq(pq);
1364 if ((
q->w >= 1.0f) || (
q->w == -1.0f))
1381 TRACE(
"pout %p, pq1 %p, pq2 %p\n", pout, pq1, pq2);
1383 out.x = pq2->
w * pq1->
x + pq2->
x * pq1->
w + pq2->
y * pq1->
z - pq2->
z * pq1->
y;
1384 out.y = pq2->
w * pq1->
y - pq2->
x * pq1->
z + pq2->
y * pq1->
w + pq2->
z * pq1->
x;
1385 out.z = pq2->
w * pq1->
z + pq2->
x * pq1->
y - pq2->
y * pq1->
x + pq2->
z * pq1->
w;
1386 out.w = pq2->
w * pq1->
w - pq2->
x * pq1->
x - pq2->
y * pq1->
y - pq2->
z * pq1->
z;
1397 norm = D3DXQuaternionLength(
q);
1429 trace =
m->u.m[0][0] +
m->u.m[1][1] +
m->u.m[2][2] + 1.0f;
1433 out->x = (
m->u.m[1][2] -
m->u.m[2][1]) /
s;
1434 out->y = (
m->u.m[2][0] -
m->u.m[0][2]) /
s;
1435 out->z = (
m->u.m[0][1] -
m->u.m[1][0]) /
s;
1442 for (
i = 1;
i < 3;
i++)
1444 if (
m->u.m[
i][
i] >
m->u.m[maxi][maxi])
1451 s = 2.0f *
sqrtf(1.0f +
m->u.m[0][0] -
m->u.m[1][1] -
m->u.m[2][2]);
1453 out->y = (
m->u.m[0][1] +
m->u.m[1][0]) /
s;
1454 out->z = (
m->u.m[0][2] +
m->u.m[2][0]) /
s;
1455 out->w = (
m->u.m[1][2] -
m->u.m[2][1]) /
s;
1459 s = 2.0f *
sqrtf(1.0f +
m->u.m[1][1] -
m->u.m[0][0] -
m->u.m[2][2]);
1460 out->x = (
m->u.m[0][1] +
m->u.m[1][0]) /
s;
1462 out->z = (
m->u.m[1][2] +
m->u.m[2][1]) /
s;
1463 out->w = (
m->u.m[2][0] -
m->u.m[0][2]) /
s;
1467 s = 2.0f *
sqrtf(1.0f +
m->u.m[2][2] -
m->u.m[0][0] -
m->u.m[1][1]);
1468 out->x = (
m->u.m[0][2] +
m->u.m[2][0]) /
s;
1469 out->y = (
m->u.m[1][2] +
m->u.m[2][1]) /
s;
1471 out->w = (
m->u.m[0][1] -
m->u.m[1][0]) /
s;
1481 FLOAT syaw, cyaw, spitch, cpitch, sroll, croll;
1483 TRACE(
"out %p, yaw %f, pitch %f, roll %f\n",
out, yaw, pitch, roll);
1485 syaw =
sinf(yaw / 2.0f);
1486 cyaw =
cosf(yaw / 2.0f);
1487 spitch =
sinf(pitch / 2.0f);
1488 cpitch =
cosf(pitch / 2.0f);
1489 sroll =
sinf(roll / 2.0f);
1490 croll =
cosf(roll / 2.0f);
1492 out->x = syaw * cpitch * sroll + cyaw * spitch * croll;
1493 out->y = syaw * cpitch * croll - cyaw * spitch * sroll;
1494 out->z = cyaw * cpitch * sroll - syaw * spitch * croll;
1495 out->w = cyaw * cpitch * croll + syaw * spitch * sroll;
1505 TRACE(
"out %p, q1 %p, q2 %p, t %f\n",
out, q1, q2,
t);
1508 dot = D3DXQuaternionDot(q1, q2);
1515 if (1.0f - dot > 0.001f)
1535 TRACE(
"pout %p, pq1 %p, pq2 %p, pq3 %p, pq4 %p, t %f\n", pout, pq1, pq2, pq3, pq4,
t);
1545 temp.x = q1->
x + add * q2->
x;
1546 temp.y = q1->
y + add * q2->
y;
1547 temp.z = q1->
z + add * q2->
z;
1548 temp.w = q1->
w + add * q2->
w;
1558 TRACE(
"paout %p, pbout %p, pcout %p, pq0 %p, pq1 %p, pq2 %p, pq3 %p\n", paout, pbout, pcout, pq0, pq1, pq2, pq3);
1565 if (D3DXQuaternionDot(pq0, pq1) < 0.0f)
1570 if (D3DXQuaternionDot(pq1, pq2) < 0.0f)
1575 if (D3DXQuaternionDot(&
cout, pq3) < 0.0f)
1611 TRACE(
"pq %p, paxis %p, pangle %p\n", pq, paxis, pangle);
1620 *pangle = 2.0f *
acosf(pq->
w);
1627 TRACE(
"pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1,
pv2, pv3,
f,
g);
1629 pout->
x = (1.0f-
f-
g) * (pv1->
x) +
f * (
pv2->x) +
g * (pv3->
x);
1630 pout->
y = (1.0f-
f-
g) * (pv1->
y) +
f * (
pv2->y) +
g * (pv3->
y);
1636 TRACE(
"pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1,
pv2, pv3,
s);
1638 pout->
x = 0.5f * (2.0f * pv1->
x + (
pv2->x - pv0->
x) *
s + (2.0f *pv0->
x - 5.0f * pv1->
x + 4.0f *
pv2->x - pv3->
x) *
s *
s + (pv3->
x -3.0f *
pv2->x + 3.0f * pv1->
x - pv0->
x) *
s *
s *
s);
1639 pout->
y = 0.5f * (2.0f * pv1->
y + (
pv2->y - pv0->
y) *
s + (2.0f *pv0->
y - 5.0f * pv1->
y + 4.0f *
pv2->y - pv3->
y) *
s *
s + (pv3->
y -3.0f *
pv2->y + 3.0f * pv1->
y - pv0->
y) *
s *
s *
s);
1645 FLOAT h1, h2, h3, h4;
1647 TRACE(
"pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1,
pv2, pt2,
s);
1649 h1 = 2.0f *
s *
s *
s - 3.0f *
s *
s + 1.0f;
1650 h2 =
s *
s *
s - 2.0f *
s *
s +
s;
1651 h3 = -2.0f *
s *
s *
s + 3.0f *
s *
s;
1652 h4 =
s *
s *
s -
s *
s;
1654 pout->
x = h1 * (pv1->
x) + h2 * (pt1->
x) + h3 * (
pv2->x) + h4 * (pt2->
x);
1655 pout->
y = h1 * (pv1->
y) + h2 * (pt1->
y) + h3 * (
pv2->y) + h4 * (pt2->
y);
1663 TRACE(
"pout %p, pv %p\n", pout, pv);
1665 norm = D3DXVec2Length(pv);
1684 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1686 out.x =
pm->u.m[0][0] * pv->
x +
pm->u.m[1][0] * pv->
y +
pm->u.m[3][0];
1687 out.y =
pm->u.m[0][1] * pv->
x +
pm->u.m[1][1] * pv->
y +
pm->u.m[3][1];
1688 out.z =
pm->u.m[0][2] * pv->
x +
pm->u.m[1][2] * pv->
y +
pm->u.m[3][2];
1689 out.w =
pm->u.m[0][3] * pv->
x +
pm->u.m[1][3] * pv->
y +
pm->u.m[3][3];
1698 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1700 for (
i = 0;
i < elements; ++
i) {
1714 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1717 norm =
pm->u.m[0][3] * pv->
x +
pm->u.m[1][3] * pv->
y +
pm->u.m[3][3];
1719 pout->
x = (
pm->u.m[0][0] *
v.x +
pm->u.m[1][0] *
v.y +
pm->u.m[3][0]) /
norm;
1720 pout->
y = (
pm->u.m[0][1] *
v.x +
pm->u.m[1][1] *
v.y +
pm->u.m[3][1]) /
norm;
1729 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1731 for (
i = 0;
i < elements; ++
i) {
1744 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1746 pout->
x =
pm->u.m[0][0] *
v.x +
pm->u.m[1][0] *
v.y;
1747 pout->
y =
pm->u.m[0][1] *
v.x +
pm->u.m[1][1] *
v.y;
1755 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1757 for (
i = 0;
i < elements; ++
i) {
1770 TRACE(
"pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1,
pv2, pv3,
f,
g);
1772 pout->
x = (1.0f-
f-
g) * (pv1->
x) +
f * (
pv2->x) +
g * (pv3->
x);
1773 pout->
y = (1.0f-
f-
g) * (pv1->
y) +
f * (
pv2->y) +
g * (pv3->
y);
1774 pout->
z = (1.0f-
f-
g) * (pv1->
z) +
f * (
pv2->z) +
g * (pv3->
z);
1780 TRACE(
"pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1,
pv2, pv3,
s);
1782 pout->
x = 0.5f * (2.0f * pv1->
x + (
pv2->x - pv0->
x) *
s + (2.0f *pv0->
x - 5.0f * pv1->
x + 4.0f *
pv2->x - pv3->
x) *
s *
s + (pv3->
x -3.0f *
pv2->x + 3.0f * pv1->
x - pv0->
x) *
s *
s *
s);
1783 pout->
y = 0.5f * (2.0f * pv1->
y + (
pv2->y - pv0->
y) *
s + (2.0f *pv0->
y - 5.0f * pv1->
y + 4.0f *
pv2->y - pv3->
y) *
s *
s + (pv3->
y -3.0f *
pv2->y + 3.0f * pv1->
y - pv0->
y) *
s *
s *
s);
1784 pout->
z = 0.5f * (2.0f * pv1->
z + (
pv2->z - pv0->
z) *
s + (2.0f *pv0->
z - 5.0f * pv1->
z + 4.0f *
pv2->z - pv3->
z) *
s *
s + (pv3->
z -3.0f *
pv2->z + 3.0f * pv1->
z - pv0->
z) *
s *
s *
s);
1790 FLOAT h1, h2, h3, h4;
1792 TRACE(
"pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1,
pv2, pt2,
s);
1794 h1 = 2.0f *
s *
s *
s - 3.0f *
s *
s + 1.0f;
1795 h2 =
s *
s *
s - 2.0f *
s *
s +
s;
1796 h3 = -2.0f *
s *
s *
s + 3.0f *
s *
s;
1797 h4 =
s *
s *
s -
s *
s;
1799 pout->
x = h1 * (pv1->
x) + h2 * (pt1->
x) + h3 * (
pv2->x) + h4 * (pt2->
x);
1800 pout->
y = h1 * (pv1->
y) + h2 * (pt1->
y) + h3 * (
pv2->y) + h4 * (pt2->
y);
1801 pout->
z = h1 * (pv1->
z) + h2 * (pt1->
z) + h3 * (
pv2->z) + h4 * (pt2->
z);
1809 TRACE(
"pout %p, pv %p\n", pout, pv);
1811 norm = D3DXVec3Length(pv);
1832 TRACE(
"pout %p, pv %p, pviewport %p, pprojection %p, pview %p, pworld %p\n", pout, pv, pviewport, pprojection, pview, pworld);
1834 D3DXMatrixIdentity(&
m);
1843 pout->
x = pviewport->
X + ( 1.0f + pout->
x ) * pviewport->
Width / 2.0f;
1844 pout->
y = pviewport->
Y + ( 1.0f - pout->
y ) * pviewport->
Height / 2.0f;
1845 pout->
z = pviewport->
MinZ + pout->
z * ( pviewport->
MaxZ - pviewport->
MinZ );
1854 TRACE(
"out %p, outstride %u, in %p, instride %u, viewport %p, projection %p, view %p, world %p, elements %u\n",
1855 out, outstride,
in, instride, viewport, projection,
view, world, elements);
1857 for (
i = 0;
i < elements; ++
i) {
1861 viewport, projection,
view, world);
1870 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1872 out.x =
pm->u.m[0][0] * pv->
x +
pm->u.m[1][0] * pv->
y +
pm->u.m[2][0] * pv->
z +
pm->u.m[3][0];
1873 out.y =
pm->u.m[0][1] * pv->
x +
pm->u.m[1][1] * pv->
y +
pm->u.m[2][1] * pv->
z +
pm->u.m[3][1];
1874 out.z =
pm->u.m[0][2] * pv->
x +
pm->u.m[1][2] * pv->
y +
pm->u.m[2][2] * pv->
z +
pm->u.m[3][2];
1875 out.w =
pm->u.m[0][3] * pv->
x +
pm->u.m[1][3] * pv->
y +
pm->u.m[2][3] * pv->
z +
pm->u.m[3][3];
1884 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1886 for (
i = 0;
i < elements; ++
i) {
1900 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1902 norm =
pm->u.m[0][3] * pv->
x +
pm->u.m[1][3] * pv->
y +
pm->u.m[2][3] *pv->
z +
pm->u.m[3][3];
1904 out.x = (
pm->u.m[0][0] * pv->
x +
pm->u.m[1][0] * pv->
y +
pm->u.m[2][0] * pv->
z +
pm->u.m[3][0]) /
norm;
1905 out.y = (
pm->u.m[0][1] * pv->
x +
pm->u.m[1][1] * pv->
y +
pm->u.m[2][1] * pv->
z +
pm->u.m[3][1]) /
norm;
1906 out.z = (
pm->u.m[0][2] * pv->
x +
pm->u.m[1][2] * pv->
y +
pm->u.m[2][2] * pv->
z +
pm->u.m[3][2]) /
norm;
1917 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1919 for (
i = 0;
i < elements; ++
i) {
1932 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
1934 pout->
x =
pm->u.m[0][0] *
v.x +
pm->u.m[1][0] *
v.y +
pm->u.m[2][0] *
v.z;
1935 pout->
y =
pm->u.m[0][1] *
v.x +
pm->u.m[1][1] *
v.y +
pm->u.m[2][1] *
v.z;
1936 pout->
z =
pm->u.m[0][2] *
v.x +
pm->u.m[1][2] *
v.y +
pm->u.m[2][2] *
v.z;
1945 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
1947 for (
i = 0;
i < elements; ++
i) {
1962 TRACE(
"out %p, v %p, viewport %p, projection %p, view %p, world %p.\n",
1963 out,
v, viewport, projection,
view, world);
1965 D3DXMatrixIdentity(&
m);
1977 out->x = 2.0f * (
out->x - viewport->
X) / viewport->
Width - 1.0f;
1978 out->y = 1.0f - 2.0f * (
out->y - viewport->
Y) / viewport->
Height;
1989 TRACE(
"out %p, outstride %u, in %p, instride %u, viewport %p, projection %p, view %p, world %p, elements %u\n",
1990 out, outstride,
in, instride, viewport, projection,
view, world, elements);
1992 for (
i = 0;
i < elements; ++
i) {
1996 viewport, projection,
view, world);
2005 TRACE(
"pout %p, pv1 %p, pv2 %p, pv3 %p, f %f, g %f\n", pout, pv1,
pv2, pv3,
f,
g);
2007 pout->
x = (1.0f-
f-
g) * (pv1->
x) +
f * (
pv2->x) +
g * (pv3->
x);
2008 pout->
y = (1.0f-
f-
g) * (pv1->
y) +
f * (
pv2->y) +
g * (pv3->
y);
2009 pout->
z = (1.0f-
f-
g) * (pv1->
z) +
f * (
pv2->z) +
g * (pv3->
z);
2010 pout->
w = (1.0f-
f-
g) * (pv1->
w) +
f * (
pv2->w) +
g * (pv3->
w);
2016 TRACE(
"pout %p, pv0 %p, pv1 %p, pv2 %p, pv3 %p, s %f\n", pout, pv0, pv1,
pv2, pv3,
s);
2018 pout->
x = 0.5f * (2.0f * pv1->
x + (
pv2->x - pv0->
x) *
s + (2.0f *pv0->
x - 5.0f * pv1->
x + 4.0f *
pv2->x - pv3->
x) *
s *
s + (pv3->
x -3.0f *
pv2->x + 3.0f * pv1->
x - pv0->
x) *
s *
s *
s);
2019 pout->
y = 0.5f * (2.0f * pv1->
y + (
pv2->y - pv0->
y) *
s + (2.0f *pv0->
y - 5.0f * pv1->
y + 4.0f *
pv2->y - pv3->
y) *
s *
s + (pv3->
y -3.0f *
pv2->y + 3.0f * pv1->
y - pv0->
y) *
s *
s *
s);
2020 pout->
z = 0.5f * (2.0f * pv1->
z + (
pv2->z - pv0->
z) *
s + (2.0f *pv0->
z - 5.0f * pv1->
z + 4.0f *
pv2->z - pv3->
z) *
s *
s + (pv3->
z -3.0f *
pv2->z + 3.0f * pv1->
z - pv0->
z) *
s *
s *
s);
2021 pout->
w = 0.5f * (2.0f * pv1->
w + (
pv2->w - pv0->
w) *
s + (2.0f *pv0->
w - 5.0f * pv1->
w + 4.0f *
pv2->w - pv3->
w) *
s *
s + (pv3->
w -3.0f *
pv2->w + 3.0f * pv1->
w - pv0->
w) *
s *
s *
s);
2029 TRACE(
"pout %p, pv1 %p, pv2 %p, pv3 %p\n", pout, pv1,
pv2, pv3);
2031 out.x = pv1->
y * (
pv2->z * pv3->
w - pv3->
z *
pv2->w) - pv1->
z * (
pv2->y * pv3->
w - pv3->
y *
pv2->w) + pv1->
w * (
pv2->y * pv3->
z -
pv2->z *pv3->
y);
2032 out.y = -(pv1->
x * (
pv2->z * pv3->
w - pv3->
z *
pv2->w) - pv1->
z * (
pv2->x * pv3->
w - pv3->
x *
pv2->w) + pv1->
w * (
pv2->x * pv3->
z - pv3->
x *
pv2->z));
2033 out.z = pv1->
x * (
pv2->y * pv3->
w - pv3->
y *
pv2->w) - pv1->
y * (
pv2->x *pv3->
w - pv3->
x *
pv2->w) + pv1->
w * (
pv2->x * pv3->
y - pv3->
x *
pv2->y);
2034 out.w = -(pv1->
x * (
pv2->y * pv3->
z - pv3->
y *
pv2->z) - pv1->
y * (
pv2->x * pv3->
z - pv3->
x *
pv2->z) + pv1->
z * (
pv2->x * pv3->
y - pv3->
x *
pv2->y));
2041 FLOAT h1, h2, h3, h4;
2043 TRACE(
"pout %p, pv1 %p, pt1 %p, pv2 %p, pt2 %p, s %f\n", pout, pv1, pt1,
pv2, pt2,
s);
2045 h1 = 2.0f *
s *
s *
s - 3.0f *
s *
s + 1.0f;
2046 h2 =
s *
s *
s - 2.0f *
s *
s +
s;
2047 h3 = -2.0f *
s *
s *
s + 3.0f *
s *
s;
2048 h4 =
s *
s *
s -
s *
s;
2050 pout->
x = h1 * (pv1->
x) + h2 * (pt1->
x) + h3 * (
pv2->x) + h4 * (pt2->
x);
2051 pout->
y = h1 * (pv1->
y) + h2 * (pt1->
y) + h3 * (
pv2->y) + h4 * (pt2->
y);
2052 pout->
z = h1 * (pv1->
z) + h2 * (pt1->
z) + h3 * (
pv2->z) + h4 * (pt2->
z);
2053 pout->
w = h1 * (pv1->
w) + h2 * (pt1->
w) + h3 * (
pv2->w) + h4 * (pt2->
w);
2061 TRACE(
"pout %p, pv %p\n", pout, pv);
2063 norm = D3DXVec4Length(pv);
2077 TRACE(
"pout %p, pv %p, pm %p\n", pout, pv,
pm);
2079 out.x =
pm->u.m[0][0] * pv->
x +
pm->u.m[1][0] * pv->
y +
pm->u.m[2][0] * pv->
z +
pm->u.m[3][0] * pv->
w;
2080 out.y =
pm->u.m[0][1] * pv->
x +
pm->u.m[1][1] * pv->
y +
pm->u.m[2][1] * pv->
z +
pm->u.m[3][1] * pv->
w;
2081 out.z =
pm->u.m[0][2] * pv->
x +
pm->u.m[1][2] * pv->
y +
pm->u.m[2][2] * pv->
z +
pm->u.m[3][2] * pv->
w;
2082 out.w =
pm->u.m[0][3] * pv->
x +
pm->u.m[1][3] * pv->
y +
pm->u.m[2][3] * pv->
z +
pm->u.m[3][3] * pv->
w;
2091 TRACE(
"out %p, outstride %u, in %p, instride %u, matrix %p, elements %u\n",
out, outstride,
in, instride,
matrix, elements);
2093 for (
i = 0;
i < elements; ++
i) {
2104 int exp = 0, origexp;
2107 unsigned int mantissa;
2113 if (
in == 0.0f)
return (
sign ? 0x8000 : 0x0000);
2115 if (tmp < (
float)(1u << 10))
2121 }
while (tmp < (
float)(1u << 10));
2123 else if (tmp >= (
float)(1u << 11))
2129 }
while (tmp >= (
float)(1u << 11));
2137 mantissa = (
unsigned int) tmp;
2138 if ((tmp - mantissa == 0.5f && mantissa % 2 == 1) ||
2139 (tmp - mantissa > 0.5f))
2143 if (mantissa == 2048)
2156 unsigned int rounding = 0;
2162 return (
sign ? 0x8000 : 0x0000);
2167 mantissa = (
unsigned int)(tmp * (1u << 13));
2168 mantissa >>= 1 -
exp;
2170 mantissa -= ~(mantissa >> 13) & 1;
2173 rounding = mantissa & 1;
2176 ret = mantissa + rounding;
2180 ret = (
exp << 10) | (mantissa & 0x3ff);
2183 ret |= ((
sign ? 1 : 0) << 15);
2191 TRACE(
"pout %p, pin %p, n %u\n", pout,
pin,
n);
2193 for (
i = 0;
i <
n; ++
i)
2205 const unsigned short s = (
in & 0x8000);
2206 const unsigned short e = (
in & 0x7C00) >> 10;
2207 const unsigned short m =
in & 0x3FF;
2208 const float sgn = (
s ? -1.0f : 1.0f);
2212 if (
m == 0)
return sgn * 0.0f;
2213 else return sgn *
powf(2, -14.0f) * (
m / 1024.0f);
2217 return sgn *
powf(2,
e - 15.0f) * (1.0f + (
m / 1024.0f));
2225 TRACE(
"pout %p, pin %p, n %u\n", pout,
pin,
n);
2227 for (
i = 0;
i <
n; ++
i)
2274 out[2] = coeff[0] *
out[1];
2278 coeff[1] = coeff[0] * coeff[0];
2279 coeff[2] = coeff[1] * coeff[1];
2281 out[3] =
D3DX_PI * (-1.25f * coeff[2] + 1.5f * coeff[1] - 0.25f);
2285 out[4] = -0.25f *
D3DX_PI * coeff[0] * (7.0f * coeff[2] - 10.0f * coeff[1] + 3.0f);
2289 out[5] =
D3DX_PI * (-2.625f * coeff[2] * coeff[1] + 4.375f * coeff[2] - 1.875f * coeff[1] + 0.125f);
2298 TRACE(
"order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2299 order,
dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2304 clamped_angle = (radius >
D3DX_PI / 2.0f) ? (
D3DX_PI / 2.0f) : radius;
2309 WARN(
"Order clamped at D3DXSH_MAXORDER\n");
2320 for (
j = 0;
j < 2 *
i + 1;
j++)
2344 const FLOAT dirxxxx = dirxx * dirxx;
2345 const FLOAT diryyyy = diryy * diryy;
2346 const FLOAT dirzzzz = dirzz * dirzz;
2347 const FLOAT dirxyxy = dirxy * dirxy;
2381 out[18] = 0.75f *
sqrtf(5.0f /
D3DX_PI) * dirxy * (7.0f * dirzz - 1.0f);
2382 out[19] = 0.375f *
sqrtf(10.0f /
D3DX_PI) * diryz * (3.0f - 7.0f * dirzz);
2383 out[20] = 3.0f / (16.0f *
sqrtf(
D3DX_PI)) * (35.0f * dirzzzz - 30.f * dirzz + 3.0f);
2384 out[21] = 0.375f *
sqrtf(10.0f /
D3DX_PI) * dirxz * (3.0f - 7.0f * dirzz);
2385 out[22] = 0.375f *
sqrtf(5.0f /
D3DX_PI) * (dirxx - diryy) * (7.0f * dirzz - 1.0f);
2387 out[24] = 3.0f / 16.0f *
sqrtf(35.0f /
D3DX_PI) * (dirxxxx - 6.0f * dirxyxy + diryyyy);
2391 out[25] = -3.0f/ 32.0f *
sqrtf(154.0f /
D3DX_PI) *
dir->y * (5.0f * dirxxxx - 10.0f * dirxyxy + diryyyy);
2393 out[27] =
sqrtf(770.0f /
D3DX_PI) / 32.0f *
dir->y * (3.0f * dirxx - diryy) * (1.0f - 9.0f * dirzz);
2395 out[29] =
sqrtf(165.0f /
D3DX_PI) / 16.0f *
dir->y * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
2396 out[30] =
sqrtf(11.0f /
D3DX_PI) / 16.0f *
dir->z * (63.0f * dirzzzz - 70.0f * dirzz + 15.0f);
2397 out[31] =
sqrtf(165.0f /
D3DX_PI) / 16.0f *
dir->x * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
2398 out[32] =
sqrtf(1155.0f /
D3DX_PI) / 8.0f *
dir->z * (dirxx - diryy) * (3.0f * dirzz - 1.0f);
2399 out[33] =
sqrtf(770.0f /
D3DX_PI) / 32.0f *
dir->x * (dirxx - 3.0f * diryy) * (1.0f - 9.0f * dirzz);
2400 out[34] = 3.0f / 16.0f *
sqrtf(385.0f /
D3DX_PI) *
dir->z * (dirxxxx - 6.0f * dirxyxy + diryyyy);
2401 out[35] = -3.0f/ 32.0f *
sqrtf(154.0f /
D3DX_PI) *
dir->x * (dirxxxx - 10.0f * dirxyxy + 5.0f * diryyyy);
2411 TRACE(
"Order %u, Vector %p, Red %f, Green %f, Blue %f, Rout %p, Gout %p, Bout %p\n",
order,
dir, Rintensity, Gintensity, Bintensity, Rout, Gout, Bout);
2425 Rout[
j] = Rintensity *
temp;
2427 Gout[
j] = Gintensity *
temp;
2429 Bout[
j] = Bintensity *
temp;
2441 TRACE(
"order %u, dir %p, rout %p, gout %p, bout %p\n",
order,
dir, rout, gout, bout);
2448 for (
j = 0;
j < 2 *
i + 1;
j++)
2452 rout[
i *
i +
j] = 0.0f;
2459 for (
j = 0;
j < 2 *
i + 1;
j++)
2463 gout[
i *
i +
j] = 0.0f;
2471 for (
j = 0;
j < 2 *
i + 1;
j++)
2475 bout[
i *
i +
j] = 0.0f;
2488 TRACE(
"order %u, dir %p, radius %f, red %f, green %f, blue %f, rout %p, gout %p, bout %p\n",
2489 order,
dir, radius, Rintensity, Gintensity, Bintensity, rout, gout, bout);
2493 WARN(
"Order clamped at D3DXSH_MAXORDER\n");
2500 dist = D3DXVec3Length(
dir);
2501 clamped_angle = (dist <= radius) ?
D3DX_PI / 2.0f :
asinf(radius / dist);
2508 for (
j = 0;
j < 2 *
i + 1;
j++)
2529 ta = 0.28209479f *
a[0];
2530 tb = 0.28209479f *
b[0];
2533 out[1] = ta *
b[1] +
tb *
a[1];
2534 out[2] = ta *
b[2] +
tb *
a[2];
2535 out[3] = ta *
b[3] +
tb *
a[3];
2546 out[0] = 0.28209479f *
a[0] *
b[0];
2548 ta = 0.28209479f *
a[0] - 0.12615663f *
a[6] - 0.21850969f *
a[8];
2549 tb = 0.28209479f *
b[0] - 0.12615663f *
b[6] - 0.21850969f *
b[8];
2550 out[1] = ta *
b[1] +
tb *
a[1];
2552 out[0] += 0.28209479f *
t;
2553 out[6] = -0.12615663f *
t;
2554 out[8] = -0.21850969f *
t;
2556 ta = 0.21850969f *
a[5];
2557 tb = 0.21850969f *
b[5];
2558 out[1] += ta *
b[2] +
tb *
a[2];
2559 out[2] = ta *
b[1] +
tb *
a[1];
2560 t =
a[1] *
b[2] +
a[2] *
b[1];
2561 out[5] = 0.21850969f *
t;
2563 ta = 0.21850969f *
a[4];
2564 tb = 0.21850969f *
b[4];
2565 out[1] += ta *
b[3] +
tb *
a[3];
2566 out[3] = ta *
b[1] +
tb *
a[1];
2567 t =
a[1] *
b[3] +
a[3] *
b[1];
2568 out[4] = 0.21850969f *
t;
2570 ta = 0.28209480f *
a[0] + 0.25231326f *
a[6];
2571 tb = 0.28209480f *
b[0] + 0.25231326f *
b[6];
2572 out[2] += ta *
b[2] +
tb *
a[2];
2574 out[0] += 0.28209480f *
t;
2575 out[6] += 0.25231326f *
t;
2577 ta = 0.21850969f *
a[7];
2578 tb = 0.21850969f *
b[7];
2579 out[2] += ta *
b[3] +
tb *
a[3];
2580 out[3] += ta *
b[2] +
tb *
a[2];
2581 t =
a[2] *
b[3] +
a[3] *
b[2];
2582 out[7] = 0.21850969f *
t;
2584 ta = 0.28209479f *
a[0] - 0.12615663f *
a[6] + 0.21850969f *
a[8];
2585 tb = 0.28209479f *
b[0] - 0.12615663f *
b[6] + 0.21850969f *
b[8];
2586 out[3] += ta *
b[3] +
tb *
a[3];
2588 out[0] += 0.28209479f *
t;
2589 out[6] -= 0.12615663f *
t;
2590 out[8] += 0.21850969f *
t;
2592 ta = 0.28209479f *
a[0] - 0.18022375f *
a[6];
2593 tb = 0.28209479f *
b[0] - 0.18022375f *
b[6];
2594 out[4] += ta *
b[4] +
tb *
a[4];
2596 out[0] += 0.28209479f *
t;
2597 out[6] -= 0.18022375f *
t;
2599 ta = 0.15607835f *
a[7];
2600 tb = 0.15607835f *
b[7];
2601 out[4] += ta *
b[5] +
tb *
a[5];
2602 out[5] += ta *
b[4] +
tb *
a[4];
2603 t =
a[4] *
b[5] +
a[5] *
b[4];
2604 out[7] += 0.15607835f *
t;
2606 ta = 0.28209479f *
a[0] + 0.09011188f *
a[6] - 0.15607835f *
a[8];
2607 tb = 0.28209479f *
b[0] + 0.09011188f *
b[6] - 0.15607835f *
b[8];
2608 out[5] += ta *
b[5] +
tb *
a[5];
2610 out[0] += 0.28209479f *
t;
2611 out[6] += 0.09011188f *
t;
2612 out[8] -= 0.15607835f *
t;
2614 ta = 0.28209480f *
a[0];
2615 tb = 0.28209480f *
b[0];
2616 out[6] += ta *
b[6] +
tb *
a[6];
2618 out[0] += 0.28209480f *
t;
2619 out[6] += 0.18022376f *
t;
2621 ta = 0.28209479f *
a[0] + 0.09011188f *
a[6] + 0.15607835f *
a[8];
2622 tb = 0.28209479f *
b[0] + 0.09011188f *
b[6] + 0.15607835f *
b[8];
2623 out[7] += ta *
b[7] +
tb *
a[7];
2625 out[0] += 0.28209479f *
t;
2626 out[6] += 0.09011188f *
t;
2627 out[8] += 0.15607835f *
t;
2629 ta = 0.28209479f *
a[0] - 0.18022375f *
a[6];
2630 tb = 0.28209479f *
b[0] - 0.18022375f *
b[6];
2631 out[8] += ta *
b[8] +
tb *
a[8];
2633 out[0] += 0.28209479f *
t;
2634 out[6] -= 0.18022375f *
t;
2645 out[0] = 0.28209479f *
a[0] *
b[0];
2647 ta = 0.28209479f *
a[0] - 0.12615663f *
a[6] - 0.21850969f *
a[8];
2648 tb = 0.28209479f *
b[0] - 0.12615663f *
b[6] - 0.21850969f *
b[8];
2649 out[1] = ta *
b[1] +
tb *
a[1];
2651 out[0] += 0.28209479f *
t;
2652 out[6] = -0.12615663f *
t;
2653 out[8] = -0.21850969f *
t;
2655 ta = 0.21850969f *
a[3] - 0.05839917f *
a[13] - 0.22617901f *
a[15];
2656 tb = 0.21850969f *
b[3] - 0.05839917f *
b[13] - 0.22617901f *
b[15];
2657 out[1] += ta *
b[4] +
tb *
a[4];
2658 out[4] = ta *
b[1] +
tb *
a[1];
2659 t =
a[1] *
b[4] +
a[4] *
b[1];
2660 out[3] = 0.21850969f *
t;
2661 out[13] = -0.05839917f *
t;
2662 out[15] = -0.22617901f *
t;
2664 ta = 0.21850969f *
a[2] - 0.14304817f *
a[12] - 0.18467439f *
a[14];
2665 tb = 0.21850969f *
b[2] - 0.14304817f *
b[12] - 0.18467439f *
b[14];
2666 out[1] += ta *
b[5] +
tb *
a[5];
2667 out[5] = ta *
b[1] +
tb *
a[1];
2668 t =
a[1] *
b[5] +
a[5] *
b[1];
2669 out[2] = 0.21850969f *
t;
2670 out[12] = -0.14304817f *
t;
2671 out[14] = -0.18467439f *
t;
2673 ta = 0.20230066f *
a[11];
2674 tb = 0.20230066f *
b[11];
2675 out[1] += ta *
b[6] +
tb *
a[6];
2676 out[6] += ta *
b[1] +
tb *
a[1];
2677 t =
a[1] *
b[6] +
a[6] *
b[1];
2678 out[11] = 0.20230066f *
t;
2680 ta = 0.22617901f *
a[9] + 0.05839917f *
a[11];
2681 tb = 0.22617901f *
b[9] + 0.05839917f *
b[11];
2682 out[1] += ta *
b[8] +
tb *
a[8];
2683 out[8] += ta *
b[1] +
tb *
a[1];
2684 t =
a[1] *
b[8] +
a[8] *
b[1];
2685 out[9] = 0.22617901f *
t;
2686 out[11] += 0.05839917f *
t;
2688 ta = 0.28209480f *
a[0] + 0.25231326f *
a[6];
2689 tb = 0.28209480f *
b[0] + 0.25231326f *
b[6];
2690 out[2] += ta *
b[2] +
tb *
a[2];
2692 out[0] += 0.28209480f *
t;
2693 out[6] += 0.25231326f *
t;
2695 ta = 0.24776671f *
a[12];
2696 tb = 0.24776671f *
b[12];
2697 out[2] += ta *
b[6] +
tb *
a[6];
2698 out[6] += ta *
b[2] +
tb *
a[2];
2699 t =
a[2] *
b[6] +
a[6] *
b[2];
2700 out[12] += 0.24776671f *
t;
2702 ta = 0.28209480f *
a[0] - 0.12615663f *
a[6] + 0.21850969f *
a[8];
2703 tb = 0.28209480f *
b[0] - 0.12615663f *
b[6] + 0.21850969f *
b[8];
2704 out[3] += ta *
b[3] +
tb *
a[3];
2706 out[0] += 0.28209480f *
t;
2707 out[6] -= 0.12615663f *
t;
2708 out[8] += 0.21850969f *
t;
2710 ta = 0.20230066f *
a[13];
2711 tb = 0.20230066f *
b[13];
2712 out[3] += ta *
b[6] +
tb *
a[6];
2713 out[6] += ta *
b[3] +
tb *
a[3];
2714 t =
a[3] *
b[6] +
a[6] *
b[3];
2715 out[13] += 0.20230066f *
t;
2717 ta = 0.21850969f *
a[2] - 0.14304817f *
a[12] + 0.18467439f *
a[14];
2718 tb = 0.21850969f *
b[2] - 0.14304817f *
b[12] + 0.18467439f *
b[14];
2719 out[3] += ta *
b[7] +
tb *
a[7];
2720 out[7] = ta *
b[3] +
tb *
a[3];
2721 t =
a[3] *
b[7] +
a[7] *
b[3];
2722 out[2] += 0.21850969f *
t;
2723 out[12] -= 0.14304817f *
t;
2724 out[14] += 0.18467439f *
t;
2726 ta = -0.05839917f *
a[13] + 0.22617901f *
a[15];
2727 tb = -0.05839917f *
b[13] + 0.22617901f *
b[15];
2728 out[3] += ta *
b[8] +
tb *
a[8];
2729 out[8] += ta *
b[3] +
tb *
a[3];
2730 t =
a[3] *
b[8] +
a[8] *
b[3];
2731 out[13] -= 0.05839917f *
t;
2732 out[15] += 0.22617901f *
t;
2734 ta = 0.28209479f *
a[0] - 0.18022375f *
a[6];
2735 tb = 0.28209479f *
b[0] - 0.18022375f *
b[6];
2736 out[4] += ta *
b[4] +
tb *
a[4];
2738 out[0] += 0.28209479f *
t;
2739 out[6] -= 0.18022375f *
t;
2741 ta = 0.15607835f *
a[7];
2742 tb = 0.15607835f *
b[7];
2743 out[4] += ta *
b[5] +
tb *
a[5];
2744 out[5] += ta *
b[4] +
tb *
a[4];
2745 t =
a[4] *
b[5] +
a[5] *
b[4];
2746 out[7] += 0.15607835f *
t;
2748 ta = 0.22617901f *
a[3] - 0.09403160f *
a[13];
2749 tb = 0.22617901f *
b[3] - 0.09403160f *
b[13];
2750 out[4] += ta *
b[9] +
tb *
a[9];
2751 out[9] += ta *
b[4] +
tb *
a[4];
2752 t =
a[4] *
b[9] +
a[9] *
b[4];
2753 out[3] += 0.22617901f *
t;
2754 out[13] -= 0.09403160f *
t;
2756 ta = 0.18467439f *
a[2] - 0.18806319f *
a[12];
2757 tb = 0.18467439f *
b[2] - 0.18806319f *
b[12];
2758 out[4] += ta *
b[10] +
tb *
a [10];
2759 out[10] = ta *
b[4] +
tb *
a[4];
2760 t =
a[4] *
b[10] +
a[10] *
b[4];
2761 out[2] += 0.18467439f *
t;
2762 out[12] -= 0.18806319f *
t;
2764 ta = -0.05839917f *
a[3] + 0.14567312f *
a[13] + 0.09403160f *
a[15];
2765 tb = -0.05839917f *
b[3] + 0.14567312f *
b[13] + 0.09403160f *
b[15];
2766 out[4] += ta *
b[11] +
tb *
a[11];
2767 out[11] += ta *
b[4] +
tb *
a[4];
2768 t =
a[4] *
b[11] +
a[11] *
b[4];
2769 out[3] -= 0.05839917f *
t;
2770 out[13] += 0.14567312f *
t;
2771 out[15] += 0.09403160f *
t;
2773 ta = 0.28209479f *
a[0] + 0.09011186f *
a[6] - 0.15607835f *
a[8];
2774 tb = 0.28209479f *
b[0] + 0.09011186f *
b[6] - 0.15607835f *
b[8];
2775 out[5] += ta *
b[5] +
tb *
a[5];
2777 out[0] += 0.28209479f *
t;
2778 out[6] += 0.09011186f *
t;
2779 out[8] -= 0.15607835f *
t;
2781 ta = 0.14867701f *
a[14];
2782 tb = 0.14867701f *
b[14];
2783 out[5] += ta *
b[9] +
tb *
a[9];
2784 out[9] += ta *
b[5] +
tb *
a[5];
2785 t =
a[5] *
b[9] +
a[9] *
b[5];
2786 out[14] += 0.14867701f *
t;
2788 ta = 0.18467439f *
a[3] + 0.11516472f *
a[13] - 0.14867701f *
a[15];
2789 tb = 0.18467439f *
b[3] + 0.11516472f *
b[13] - 0.14867701f *
b[15];
2790 out[5] += ta *
b[10] +
tb *
a[10];
2791 out[10] += ta *
b[5] +
tb *
a[5];
2792 t =
a[5] *
b[10] +
a[10] *
b[5];
2793 out[3] += 0.18467439f *
t;
2794 out[13] += 0.11516472f *
t;
2795 out[15] -= 0.14867701f *
t;
2797 ta = 0.23359668f *
a[2] + 0.05947080f *
a[12] - 0.11516472f *
a[14];
2798 tb = 0.23359668f *
b[2] + 0.05947080f *
b[12] - 0.11516472f *
b[14];
2799 out[5] += ta *
b[11] +
tb *
a[11];
2800 out[11] += ta *
b[5] +
tb *
a[5];
2801 t =
a[5] *
b[11] +
a[11] *
b[5];
2802 out[2] += 0.23359668f *
t;
2803 out[12] += 0.05947080f *
t;
2804 out[14] -= 0.11516472f *
t;
2806 ta = 0.28209479f *
a[0];
2807 tb = 0.28209479f *
b[0];
2808 out[6] += ta *
b[6] +
tb *
a[6];
2810 out[0] += 0.28209479f *
t;
2811 out[6] += 0.18022376f *
t;
2813 ta = 0.09011186f *
a[6] + 0.28209479f *
a[0] + 0.15607835f *
a[8];
2814 tb = 0.09011186f *
b[6] + 0.28209479f *
b[0] + 0.15607835f *
b[8];
2815 out[7] += ta *
b[7] +
tb *
a[7];
2817 out[6] += 0.09011186f *
t;
2818 out[0] += 0.28209479f *
t;
2819 out[8] += 0.15607835f *
t;
2821 ta = 0.14867701f *
a[9] + 0.18467439f *
a[1] + 0.11516472f *
a[11];
2822 tb = 0.14867701f *
b[9] + 0.18467439f *
b[1] + 0.11516472f *
b[11];
2823 out[7] += ta *
b[10] +
tb *
a[10];
2824 out[10] += ta *
b[7] +
tb *
a[7];
2825 t =
a[7] *
b[10] +
a[10] *
b[7];
2826 out[9] += 0.14867701f *
t;
2827 out[1] += 0.18467439f *
t;
2828 out[11] += 0.11516472f *
t;
2830 ta = 0.05947080f *
a[12] + 0.23359668f *
a[2] + 0.11516472f *
a[14];
2831 tb = 0.05947080f *
b[12] + 0.23359668f *
b[2] + 0.11516472f *
b[14];
2832 out[7] += ta *
b[13] +
tb *
a[13];
2833 out[13] += ta *
b[7]+
tb *
a[7];
2834 t =
a[7] *
b[13] +
a[13] *
b[7];
2835 out[12] += 0.05947080f *
t;
2836 out[2] += 0.23359668f *
t;
2837 out[14] += 0.11516472f *
t;
2839 ta = 0.14867701f *
a[15];
2840 tb = 0.14867701f *
b[15];
2841 out[7] += ta *
b[14] +
tb *
a[14];
2842 out[14] += ta *
b[7] +
tb *
a[7];
2843 t =
a[7] *
b[14] +
a[14] *
b[7];
2844 out[15] += 0.14867701f *
t;
2846 ta = 0.28209479f *
a[0] - 0.18022375f *
a[6];
2847 tb = 0.28209479f *
b[0] - 0.18022375f *
b[6];
2848 out[8] += ta *
b[8] +
tb *
a[8];
2850 out[0] += 0.28209479f *
t;
2851 out[6] -= 0.18022375f *
t;
2853 ta = -0.09403160f *
a[11];
2854 tb = -0.09403160f *
b[11];
2855 out[8] += ta *
b[9] +
tb *
a[9];
2856 out[9] += ta *
b[8] +
tb *
a[8];
2857 t =
a[8] *
b[9] +
a[9] *
b[8];
2858 out[11] -= 0.09403160f *
t;
2860 ta = -0.09403160f *
a[15];
2861 tb = -0.09403160f *
b[15];
2862 out[8] += ta *
b[13] +
tb *
a[13];
2863 out[13] += ta *
b[8] +
tb *
a[8];
2864 t =
a[8] *
b[13] +
a[13] *
b[8];
2865 out[15] -= 0.09403160f *
t;
2867 ta = 0.18467439f *
a[2] - 0.18806319f *
a[12];
2868 tb = 0.18467439f *
b[2] - 0.18806319f *
b[12];
2869 out[8] += ta *
b[14] +
tb *
a[14];
2870 out[14] += ta *
b[8] +
tb *
a[8];
2871 t =
a[8] *
b[14] +
a[14] *
b[8];
2872 out[2] += 0.18467439f *
t;
2873 out[12] -= 0.18806319f *
t;
2875 ta = -0.21026104f *
a[6] + 0.28209479f *
a[0];
2876 tb = -0.21026104f *
b[6] + 0.28209479f *
b[0];
2877 out[9] += ta *
b[9] +
tb *
a[9];
2879 out[6] -= 0.21026104f *
t;
2880 out[0] += 0.28209479f *
t;
2882 ta = 0.28209479f *
a[0];
2883 tb = 0.28209479f *
b[0];
2884 out[10] += ta *
b[10] +
tb *
a[10];
2886 out[0] += 0.28209479f *
t;
2888 ta = 0.28209479f *
a[0] + 0.12615663f *
a[6] - 0.14567312f *
a[8];
2889 tb = 0.28209479f *
b[0] + 0.12615663f *
b[6] - 0.14567312f *
b[8];
2890 out[11] += ta *
b[11] +
tb *
a[11];
2892 out[0] += 0.28209479f *
t;
2893 out[6] += 0.12615663f *
t;
2894 out[8] -= 0.14567312f *
t;
2896 ta = 0.28209479f *
a[0] + 0.16820885f *
a[6];
2897 tb = 0.28209479f *
b[0] + 0.16820885f *
b[6];
2898 out[12] += ta *
b[12] +
tb *
a[12];
2900 out[0] += 0.28209479f *
t;
2901 out[6] += 0.16820885f *
t;
2903 ta =0.28209479f *
a[0] + 0.14567312f *
a[8] + 0.12615663f *
a[6];
2904 tb =0.28209479f *
b[0] + 0.14567312f *
b[8] + 0.12615663f *
b[6];
2905 out[13] += ta *
b[13] +
tb *
a[13];
2907 out[0] += 0.28209479f *
t;
2908 out[8] += 0.14567312f *
t;
2909 out[6] += 0.12615663f *
t;
2911 ta = 0.28209479f *
a[0];
2912 tb = 0.28209479f *
b[0];
2913 out[14] += ta *
b[14] +
tb *
a[14];
2915 out[0] += 0.28209479f *
t;
2917 ta = 0.28209479f *
a[0] - 0.21026104f *
a[6];
2918 tb = 0.28209479f *
b[0] - 0.21026104f *
b[6];
2919 out[15] += ta *
b[15] +
tb *
a[15];
2921 out[0] += 0.28209479f *
t;
2922 out[6] -= 0.21026104f *
t;
2937 out[6] = -0.5f *
in[6] - 0.8660253882f *
in[8];
2939 out[8] = -0.8660253882f *
in[6] + 0.5f *
in[8];
2940 out[9] = -
a * 0.7905694842f *
in[12] +
a * 0.6123724580f *
in[14];
2943 out[11] = -
a * 0.6123724580f *
in[12] -
a * 0.7905694842f *
in[14];
2944 out[12] =
a * 0.7905694842f *
in[9] +
a * 0.6123724580f *
in[11];
2945 out[13] = -0.25f *
in[13] - 0.9682458639f *
in[15];
2946 out[14] = -
a * 0.6123724580f *
in[9] +
a * 0.7905694842f *
in[11];
2947 out[15] = -0.9682458639f *
in[13] + 0.25f *
in[15];
2951 out[16] = -
a * 0.9354143739f *
in[21] +
a * 0.3535533845f *
in[23];
2952 out[17] = -0.75f *
in[17] + 0.6614378095f *
in[19];
2953 out[18] = -
a * 0.3535533845f *
in[21] -
a * 0.9354143739f *
in[23];
2954 out[19] = 0.6614378095f *
in[17] + 0.75f *
in[19];
2955 out[20] = 0.375f *
in[20] + 0.5590170026f *
in[22] + 0.7395099998f *
in[24];
2956 out[21] =
a * 0.9354143739f *
in[16] +
a * 0.3535533845f *
in[18];
2957 out[22] = 0.5590170026f *
in[20] + 0.5f *
in[22] - 0.6614378691f *
in[24];
2958 out[23] = -
a * 0.3535533845f *
in[16] +
a * 0.9354143739f *
in[18];
2959 out[24] = 0.7395099998f *
in[20] - 0.6614378691f *
in[22] + 0.125f *
in[24];
2963 out[25] =
a * 0.7015607357f *
in[30] -
a * 0.6846531630f *
in[32] +
a * 0.1976423711f *
in[34];
2964 out[26] = -0.5f *
in[26] + 0.8660253882f *
in[28];
2965 out[27] =
a * 0.5229125023f *
in[30] +
a * 0.3061861992f *
in[32] -
a * 0.7954951525f *
in[34];
2966 out[28] = 0.8660253882f *
in[26] + 0.5f *
in[28];
2967 out[29] =
a * 0.4841229022f *
in[30] +
a * 0.6614378691f *
in[32] +
a * 0.5728219748f *
in[34];
2968 out[30] = -
a * 0.7015607357f *
in[25] -
a * 0.5229125023f *
in[27] -
a * 0.4841229022f *
in[29];
2969 out[31] = 0.125f *
in[31] + 0.4050463140f *
in[33] + 0.9057110548f *
in[35];
2970 out[32] =
a * 0.6846531630f *
in[25] -
a * 0.3061861992f *
in[27] -
a * 0.6614378691f *
in[29];
2971 out[33] = 0.4050463140f *
in[31] + 0.8125f *
in[33] - 0.4192627370f *
in[35];
2972 out[34] = -
a * 0.1976423711f *
in[25] +
a * 0.7954951525f *
in[27] -
a * 0.5728219748f *
in[29];
2973 out[35] = 0.9057110548f *
in[31] - 0.4192627370f *
in[33] + 0.0624999329f *
in[35];
2978 FIXME(
"order %u, cubemap %p, rout %p, gout %p, bout %p: stub!\n",
order, cubemap, rout, gout, bout);
3029 out[6] = (
matrix->u.m[2][2] *
matrix->u.m[2][2] - 0.5f * (coeff[4] + coeff[5])) *
in[6];
3030 out[6] -= (0.5773502692f * (coeff[0] + coeff[1]) - 1.1547005384f *
matrix->u.m[1][2] *
matrix->u.m[0][2]) *
in[4];
3031 out[6] += (0.5773502692f * (coeff[2] + coeff[3]) - 1.1547005384f *
matrix->u.m[1][2] *
matrix->u.m[2][2]) *
in[5];
3032 out[6] += (0.5773502692f * (coeff[6] + coeff[7]) - 1.1547005384f *
matrix->u.m[0][2] *
matrix->u.m[2][2]) *
in[7];
3033 out[6] += (0.2886751347f * (coeff[9] - coeff[8] + coeff[10] - coeff[11]) - 0.5773502692f *
3042 out[8] = 0.5f * (coeff[11] - coeff[8] - coeff[9] + coeff[10]) *
in[8];
3043 out[8] += (coeff[0] - coeff[1]) *
in[4];
3044 out[8] += (coeff[2] - coeff[3]) *
in[5];
3045 out[8] += 0.86602540f * (coeff[4] - coeff[5]) *
in[6];
3046 out[8] += (coeff[7] - coeff[6]) *
in[7];