d3dx9: Floatify sqrt into sqrtf.

This commit is contained in:
Nozomi Kodama 2013-04-04 09:07:38 -10:00 committed by Alexandre Julliard
parent 574d4cfba9
commit e2d3553642
1 changed files with 34 additions and 34 deletions

View File

@ -2394,54 +2394,54 @@ FLOAT* WINAPI D3DXSHEvalDirection(FLOAT *out, UINT order, const D3DXVECTOR3 *dir
if ((order < D3DXSH_MINORDER) || (order > D3DXSH_MAXORDER))
return out;
out[0] = 0.5f / sqrt(D3DX_PI);
out[1] = -0.5f / sqrt(D3DX_PI / 3.0f) * dir->y;
out[2] = 0.5f / sqrt(D3DX_PI / 3.0f) * dir->z;
out[3] = -0.5f / sqrt(D3DX_PI / 3.0f) * dir->x;
out[0] = 0.5f / sqrtf(D3DX_PI);
out[1] = -0.5f / sqrtf(D3DX_PI / 3.0f) * dir->y;
out[2] = 0.5f / sqrtf(D3DX_PI / 3.0f) * dir->z;
out[3] = -0.5f / sqrtf(D3DX_PI / 3.0f) * dir->x;
if (order == 2)
return out;
out[4] = 0.5f / sqrt(D3DX_PI / 15.0f) * dirxy;
out[5] = -0.5f / sqrt(D3DX_PI / 15.0f) * diryz;
out[6] = 0.25f / sqrt(D3DX_PI / 5.0f) * (3.0f * dirzz - 1.0f);
out[7] = -0.5f / sqrt(D3DX_PI / 15.0f) * dirxz;
out[8] = 0.25f / sqrt(D3DX_PI / 15.0f) * (dirxx - diryy);
out[4] = 0.5f / sqrtf(D3DX_PI / 15.0f) * dirxy;
out[5] = -0.5f / sqrtf(D3DX_PI / 15.0f) * diryz;
out[6] = 0.25f / sqrtf(D3DX_PI / 5.0f) * (3.0f * dirzz - 1.0f);
out[7] = -0.5f / sqrtf(D3DX_PI / 15.0f) * dirxz;
out[8] = 0.25f / sqrtf(D3DX_PI / 15.0f) * (dirxx - diryy);
if (order == 3)
return out;
out[9] = -sqrt(70.0f / D3DX_PI) / 8.0f * dir->y * (3.0f * dirxx - diryy);
out[10] = sqrt(105.0f / D3DX_PI) / 2.0f * dirxy * dir->z;
out[11] = -sqrt(42.0 / D3DX_PI) / 8.0f * dir->y * (-1.0f + 5.0f * dirzz);
out[12] = sqrt(7.0f / D3DX_PI) / 4.0f * dir->z * (5.0f * dirzz - 3.0f);
out[13] = sqrt(42.0 / D3DX_PI) / 8.0f * dir->x * (1.0f - 5.0f * dirzz);
out[14] = sqrt(105.0f / D3DX_PI) / 4.0f * dir->z * (dirxx - diryy);
out[15] = -sqrt(70.0f / D3DX_PI) / 8.0f * dir->x * (dirxx - 3.0f * diryy);
out[9] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->y * (3.0f * dirxx - diryy);
out[10] = sqrtf(105.0f / D3DX_PI) / 2.0f * dirxy * dir->z;
out[11] = -sqrtf(42.0 / D3DX_PI) / 8.0f * dir->y * (-1.0f + 5.0f * dirzz);
out[12] = sqrtf(7.0f / D3DX_PI) / 4.0f * dir->z * (5.0f * dirzz - 3.0f);
out[13] = sqrtf(42.0 / D3DX_PI) / 8.0f * dir->x * (1.0f - 5.0f * dirzz);
out[14] = sqrtf(105.0f / D3DX_PI) / 4.0f * dir->z * (dirxx - diryy);
out[15] = -sqrtf(70.0f / D3DX_PI) / 8.0f * dir->x * (dirxx - 3.0f * diryy);
if (order == 4)
return out;
out[16] = 0.75f * sqrt(35.0f / D3DX_PI) * dirxy * (dirxx - diryy);
out[16] = 0.75f * sqrtf(35.0f / D3DX_PI) * dirxy * (dirxx - diryy);
out[17] = 3.0f * dir->z * out[9];
out[18] = 0.75f * sqrt(5.0f / D3DX_PI) * dirxy * (7.0f * dirzz - 1.0f);
out[19] = 0.375f * sqrt(10.0f / D3DX_PI) * diryz * (3.0f - 7.0f * dirzz);
out[20] = 3.0f / (16.0f * sqrt(D3DX_PI)) * (35.0f * dirzzzz - 30.f * dirzz + 3.0f);
out[21] = 0.375f * sqrt(10.0f / D3DX_PI) * dirxz * (3.0f - 7.0f * dirzz);
out[22] = 0.375f * sqrt(5.0f / D3DX_PI) * (dirxx - diryy) * (7.0f * dirzz - 1.0f);
out[18] = 0.75f * sqrtf(5.0f / D3DX_PI) * dirxy * (7.0f * dirzz - 1.0f);
out[19] = 0.375f * sqrtf(10.0f / D3DX_PI) * diryz * (3.0f - 7.0f * dirzz);
out[20] = 3.0f / (16.0f * sqrtf(D3DX_PI)) * (35.0f * dirzzzz - 30.f * dirzz + 3.0f);
out[21] = 0.375f * sqrtf(10.0f / D3DX_PI) * dirxz * (3.0f - 7.0f * dirzz);
out[22] = 0.375f * sqrtf(5.0f / D3DX_PI) * (dirxx - diryy) * (7.0f * dirzz - 1.0f);
out[23] = 3.0 * dir->z * out[15];
out[24] = 3.0f / 16.0f * sqrt(35.0f / D3DX_PI) * (dirxxxx - 6.0f * dirxyxy + diryyyy);
out[24] = 3.0f / 16.0f * sqrtf(35.0f / D3DX_PI) * (dirxxxx - 6.0f * dirxyxy + diryyyy);
if (order == 5)
return out;
out[25] = -3.0f/ 32.0f * sqrt(154.0f / D3DX_PI) * dir->y * (5.0f * dirxxxx - 10.0f * dirxyxy + diryyyy);
out[26] = 0.75f * sqrt(385.0f / D3DX_PI) * dirxy * dir->z * (dirxx - diryy);
out[27] = sqrt(770.0f / D3DX_PI) / 32.0f * dir->y * (3.0f * dirxx - diryy) * (1.0f - 9.0f * dirzz);
out[28] = sqrt(1155.0f / D3DX_PI) / 4.0f * dirxy * dir->z * (3.0f * dirzz - 1.0f);
out[29] = sqrt(165.0f / D3DX_PI) / 16.0f * dir->y * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
out[30] = sqrt(11.0f / D3DX_PI) / 16.0f * dir->z * (63.0f * dirzzzz - 70.0f * dirzz + 15.0f);
out[31] = sqrt(165.0f / D3DX_PI) / 16.0f * dir->x * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
out[32] = sqrt(1155.0f / D3DX_PI) / 8.0f * dir->z * (dirxx - diryy) * (3.0f * dirzz - 1.0f);
out[33] = sqrt(770.0f / D3DX_PI) / 32.0f * dir->x * (dirxx - 3.0f * diryy) * (1.0f - 9.0f * dirzz);
out[34] = 3.0f / 16.0f * sqrt(385.0f / D3DX_PI) * dir->z * (dirxxxx - 6.0 * dirxyxy + diryyyy);
out[35] = -3.0f/ 32.0f * sqrt(154.0f / D3DX_PI) * dir->x * (dirxxxx - 10.0f * dirxyxy + 5.0f * diryyyy);
out[25] = -3.0f/ 32.0f * sqrtf(154.0f / D3DX_PI) * dir->y * (5.0f * dirxxxx - 10.0f * dirxyxy + diryyyy);
out[26] = 0.75f * sqrtf(385.0f / D3DX_PI) * dirxy * dir->z * (dirxx - diryy);
out[27] = sqrtf(770.0f / D3DX_PI) / 32.0f * dir->y * (3.0f * dirxx - diryy) * (1.0f - 9.0f * dirzz);
out[28] = sqrtf(1155.0f / D3DX_PI) / 4.0f * dirxy * dir->z * (3.0f * dirzz - 1.0f);
out[29] = sqrtf(165.0f / D3DX_PI) / 16.0f * dir->y * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
out[30] = sqrtf(11.0f / D3DX_PI) / 16.0f * dir->z * (63.0f * dirzzzz - 70.0f * dirzz + 15.0f);
out[31] = sqrtf(165.0f / D3DX_PI) / 16.0f * dir->x * (14.0f * dirzz - 21.0f * dirzzzz - 1.0f);
out[32] = sqrtf(1155.0f / D3DX_PI) / 8.0f * dir->z * (dirxx - diryy) * (3.0f * dirzz - 1.0f);
out[33] = sqrtf(770.0f / D3DX_PI) / 32.0f * dir->x * (dirxx - 3.0f * diryy) * (1.0f - 9.0f * dirzz);
out[34] = 3.0f / 16.0f * sqrtf(385.0f / D3DX_PI) * dir->z * (dirxxxx - 6.0 * dirxyxy + diryyyy);
out[35] = -3.0f/ 32.0f * sqrtf(154.0f / D3DX_PI) * dir->x * (dirxxxx - 10.0f * dirxyxy + 5.0f * diryyyy);
return out;
}