d3dx9_36: Use float math functions.

This commit is contained in:
Stefan Dösinger 2014-01-02 15:23:49 +01:00 committed by Alexandre Julliard
parent 0f3c31b1ea
commit f06fc7f858
2 changed files with 31 additions and 31 deletions

View file

@ -487,8 +487,8 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOA
TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
D3DXMatrixIdentity(pout);
pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f));
pout->u.m[1][1] = 1.0f / tan(fovy/2.0f);
pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
pout->u.m[2][2] = zf / (zf - zn);
pout->u.m[2][3] = 1.0f;
pout->u.m[3][2] = (zf * zn) / (zn - zf);
@ -501,8 +501,8 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOA
TRACE("pout %p, fovy %f, aspect %f, zn %f, zf %f\n", pout, fovy, aspect, zn, zf);
D3DXMatrixIdentity(pout);
pout->u.m[0][0] = 1.0f / (aspect * tan(fovy/2.0f));
pout->u.m[1][1] = 1.0f / tan(fovy/2.0f);
pout->u.m[0][0] = 1.0f / (aspect * tanf(fovy/2.0f));
pout->u.m[1][1] = 1.0f / tanf(fovy/2.0f);
pout->u.m[2][2] = zf / (zn - zf);
pout->u.m[2][3] = -1.0f;
pout->u.m[3][2] = (zf * zn) / (zn - zf);
@ -647,10 +647,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle)
TRACE("pout %p, angle %f\n", pout, angle);
D3DXMatrixIdentity(pout);
pout->u.m[1][1] = cos(angle);
pout->u.m[2][2] = cos(angle);
pout->u.m[1][2] = sin(angle);
pout->u.m[2][1] = -sin(angle);
pout->u.m[1][1] = cosf(angle);
pout->u.m[2][2] = cosf(angle);
pout->u.m[1][2] = sinf(angle);
pout->u.m[2][1] = -sinf(angle);
return pout;
}
@ -659,10 +659,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationY(D3DXMATRIX *pout, FLOAT angle)
TRACE("pout %p, angle %f\n", pout, angle);
D3DXMatrixIdentity(pout);
pout->u.m[0][0] = cos(angle);
pout->u.m[2][2] = cos(angle);
pout->u.m[0][2] = -sin(angle);
pout->u.m[2][0] = sin(angle);
pout->u.m[0][0] = cosf(angle);
pout->u.m[2][2] = cosf(angle);
pout->u.m[0][2] = -sinf(angle);
pout->u.m[2][0] = sinf(angle);
return pout;
}
@ -704,10 +704,10 @@ D3DXMATRIX* WINAPI D3DXMatrixRotationZ(D3DXMATRIX *pout, FLOAT angle)
TRACE("pout %p, angle %f\n", pout, angle);
D3DXMatrixIdentity(pout);
pout->u.m[0][0] = cos(angle);
pout->u.m[1][1] = cos(angle);
pout->u.m[0][1] = sin(angle);
pout->u.m[1][0] = -sin(angle);
pout->u.m[0][0] = cosf(angle);
pout->u.m[1][1] = cosf(angle);
pout->u.m[0][1] = sinf(angle);
pout->u.m[1][0] = -sinf(angle);
return pout;
}
@ -888,15 +888,15 @@ D3DXMATRIX* WINAPI D3DXMatrixTransformation2D(D3DXMATRIX *pout, const D3DXVECTOR
trans.z=0.0f;
}
rot.w=cos(rotation/2.0f);
rot.w=cosf(rotation/2.0f);
rot.x=0.0f;
rot.y=0.0f;
rot.z=sin(rotation/2.0f);
rot.z=sinf(rotation/2.0f);
sca_rot.w=cos(scalingrotation/2.0f);
sca_rot.w=cosf(scalingrotation/2.0f);
sca_rot.x=0.0f;
sca_rot.y=0.0f;
sca_rot.z=sin(scalingrotation/2.0f);
sca_rot.z=sinf(scalingrotation/2.0f);
D3DXMatrixTransformation(pout, &sca_center, &sca_rot, &sca, &rot_center, &rot, &trans);
@ -1655,7 +1655,7 @@ void WINAPI D3DXQuaternionToAxisAngle(const D3DXQUATERNION *pq, D3DXVECTOR3 *pax
paxis->x = pq->x;
paxis->y = pq->y;
paxis->z = pq->z;
*pangle = 2.0f * acos(pq->w);
*pangle = 2.0f * acosf(pq->w);
}
/*_________________D3DXVec2_____________________*/
@ -2128,7 +2128,7 @@ D3DXVECTOR4* WINAPI D3DXVec4TransformArray(D3DXVECTOR4* out, UINT outstride, con
unsigned short float_32_to_16(const float in)
{
int exp = 0, origexp;
float tmp = fabs(in);
float tmp = fabsf(in);
int sign = (copysignf(1, in) < 0);
unsigned int mantissa;
unsigned short ret;

View file

@ -2404,7 +2404,7 @@ BOOL WINAPI D3DXIntersectTri(const D3DXVECTOR3 *p0, const D3DXVECTOR3 *p1, const
{
*pu = vec.x;
*pv = vec.y;
*pdist = fabs( vec.z );
*pdist = fabsf( vec.z );
return TRUE;
}
}
@ -4569,8 +4569,8 @@ static BOOL compute_sincos_table(struct sincos_table *sincos_table, float angle_
angle = angle_start;
for (i = 0; i < n; i++)
{
sincos_table->sin[i] = sin(angle);
sincos_table->cos[i] = cos(angle);
sincos_table->sin[i] = sinf(angle);
sincos_table->cos[i] = cosf(angle);
angle += angle_step;
}
@ -4660,8 +4660,8 @@ HRESULT WINAPI D3DXCreateSphere(struct IDirect3DDevice9 *device, float radius, U
for (stack = 0; stack < stacks - 1; stack++)
{
sin_theta = sin(theta);
cos_theta = cos(theta);
sin_theta = sinf(theta);
cos_theta = cosf(theta);
for (slice = 0; slice < slices; slice++)
{
@ -5772,9 +5772,9 @@ HRESULT WINAPI D3DXCreateTextW(struct IDirect3DDevice9 *device, HDC hdc, const W
face *face_ptr;
float max_deviation_sq;
const struct cos_table cos_table = {
cos(D3DXToRadian(0.5f)),
cos(D3DXToRadian(45.0f)),
cos(D3DXToRadian(90.0f)),
cosf(D3DXToRadian(0.5f)),
cosf(D3DXToRadian(45.0f)),
cosf(D3DXToRadian(90.0f)),
};
int f1, f2;
@ -6154,7 +6154,7 @@ static BOOL weld_float4(void *to, void *from, FLOAT epsilon)
FLOAT diff_y = fabsf(v1->y - v2->y);
FLOAT diff_z = fabsf(v1->z - v2->z);
FLOAT diff_w = fabsf(v1->w - v2->w);
FLOAT max_abs_diff = fmax(diff_x, diff_y);
FLOAT max_abs_diff = max(diff_x, diff_y);
max_abs_diff = max(diff_z, max_abs_diff);
max_abs_diff = max(diff_w, max_abs_diff);