d3dx9: Use set_number instead of get_bool/int/float.
This commit is contained in:
parent
ef003f0fa0
commit
26914eb337
|
@ -94,9 +94,6 @@ const char *debug_d3dxparameter_type(D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN;
|
|||
const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) DECLSPEC_HIDDEN;
|
||||
|
||||
/* parameter type conversion helpers */
|
||||
INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) DECLSPEC_HIDDEN;
|
||||
FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) DECLSPEC_HIDDEN;
|
||||
BOOL get_bool(LPCVOID data) DECLSPEC_HIDDEN;
|
||||
void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __WINE_D3DX9_36_PRIVATE_H */
|
||||
|
|
|
@ -853,7 +853,10 @@ static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector)
|
|||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
((FLOAT *)vector)[i] = i < param->columns ? get_float(param->type, (DWORD *)param->data + i) : 0.0f;
|
||||
if (i < param->columns)
|
||||
set_number((FLOAT *)vector + i, D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
|
||||
else
|
||||
((FLOAT *)vector)[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,7 +879,7 @@ static void get_matrix(struct d3dx_parameter *param, D3DXMATRIX *matrix)
|
|||
for (k = 0; k < 4; ++k)
|
||||
{
|
||||
if ((i < param->rows) && (k < param->columns))
|
||||
matrix->u.m[i][k] = get_float(param->type, (FLOAT *)param->data + i * param->columns + k);
|
||||
set_number((FLOAT *)&matrix->u.m[i][k], D3DXPT_FLOAT, (DWORD *)param->data + i * param->columns + k, param->type);
|
||||
else
|
||||
matrix->u.m[i][k] = 0.0f;
|
||||
}
|
||||
|
@ -1667,7 +1670,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHA
|
|||
|
||||
if (b && param && !param->element_count && param->rows == 1 && param->columns == 1)
|
||||
{
|
||||
*b = get_bool(param->data);
|
||||
set_number(b, D3DXPT_BOOL, param->data, param->type);
|
||||
TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -1733,7 +1736,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D
|
|||
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
b[i] = get_bool((DWORD *)param->data + i);
|
||||
set_number(&b[i], D3DXPT_BOOL, (DWORD *)param->data + i, param->type);
|
||||
}
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -1794,7 +1797,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHAN
|
|||
{
|
||||
if (param->columns == 1 && param->rows == 1)
|
||||
{
|
||||
*n = get_int(param->type, param->data);
|
||||
set_number(n, D3DXPT_INT, param->data, param->type);
|
||||
TRACE("Returning %i\n", *n);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -1879,7 +1882,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3
|
|||
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
n[i] = get_int(param->type, (DWORD *)param->data + i);
|
||||
set_number(&n[i], D3DXPT_INT, (DWORD *)param->data + i, param->type);
|
||||
}
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -1916,7 +1919,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXH
|
|||
|
||||
if (f && param && !param->element_count && param->columns == 1 && param->rows == 1)
|
||||
{
|
||||
*f = get_float(param->type, (DWORD *)param->data);
|
||||
set_number(f, D3DXPT_FLOAT, (DWORD *)param->data, param->type);
|
||||
TRACE("Returning %f\n", *f);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -1981,7 +1984,7 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface,
|
|||
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
f[i] = get_float(param->type, (DWORD *)param->data + i);
|
||||
set_number(&f[i], D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
|
||||
}
|
||||
return D3D_OK;
|
||||
}
|
||||
|
|
|
@ -271,12 +271,12 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
|
|||
#undef WINE_D3DX_TO_STR
|
||||
|
||||
/* parameter type conversion helpers */
|
||||
BOOL get_bool(LPCVOID data)
|
||||
static BOOL get_bool(LPCVOID data)
|
||||
{
|
||||
return (*(DWORD *)data) != 0;
|
||||
}
|
||||
|
||||
INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
|
||||
static INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
|
||||
{
|
||||
INT i;
|
||||
|
||||
|
@ -303,7 +303,7 @@ INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
|
|||
return i;
|
||||
}
|
||||
|
||||
FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
|
||||
static FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
|
||||
{
|
||||
FLOAT f;
|
||||
|
||||
|
|
Loading…
Reference in New Issue