d3dx8: Implement D3DXFresnelTerm.
This commit is contained in:
parent
082d740fc1
commit
f20ba24404
|
@ -68,6 +68,7 @@
|
|||
@ stdcall D3DXPlaneTransform(ptr ptr ptr)
|
||||
@ stdcall D3DXColorAdjustSaturation(ptr ptr long)
|
||||
@ stdcall D3DXColorAdjustContrast(ptr ptr long)
|
||||
@ stdcall D3DXFresnelTerm(long long)
|
||||
@ stdcall D3DXCreateMatrixStack(long ptr)
|
||||
@ stdcall D3DXCreateFont(ptr ptr ptr)
|
||||
@ stub D3DXCreateFontIndirect
|
||||
|
|
|
@ -58,6 +58,20 @@ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc
|
|||
return pout;
|
||||
}
|
||||
|
||||
/*_________________Misc__________________________*/
|
||||
|
||||
FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex)
|
||||
{
|
||||
FLOAT a, d, g, result;
|
||||
|
||||
g = sqrt(refractionindex * refractionindex + costheta * costheta - 1.0f);
|
||||
a = g + costheta;
|
||||
d = g - costheta;
|
||||
result = ( costheta * a - 1.0f ) * ( costheta * a - 1.0f ) / ( ( costheta * d + 1.0f ) * ( costheta * d + 1.0f ) ) + 1.0f;
|
||||
result = result * 0.5f * d * d / ( a * a );
|
||||
return result;
|
||||
}
|
||||
|
||||
/*_________________D3DXMatrix____________________*/
|
||||
|
||||
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation)
|
||||
|
|
|
@ -166,6 +166,15 @@ static void D3DXColorTest(void)
|
|||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||
}
|
||||
|
||||
static void D3DXFresnelTest(void)
|
||||
{
|
||||
FLOAT expected, got;
|
||||
|
||||
expected = 0.089187;
|
||||
got = D3DXFresnelTerm(0.5f,1.5);
|
||||
ok( fabs(got - expected) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
|
||||
}
|
||||
|
||||
static void D3DXMatrixTest(void)
|
||||
{
|
||||
D3DXMATRIX expectedmat, gotmat, mat, mat2, mat3;
|
||||
|
@ -1498,6 +1507,7 @@ static void test_matrix_stack(void)
|
|||
START_TEST(math)
|
||||
{
|
||||
D3DXColorTest();
|
||||
D3DXFresnelTest();
|
||||
D3DXMatrixTest();
|
||||
D3DXPlaneTest();
|
||||
D3X8QuaternionTest();
|
||||
|
|
|
@ -271,6 +271,8 @@ extern "C" {
|
|||
D3DXCOLOR* WINAPI D3DXColorAdjustContrast(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
|
||||
D3DXCOLOR* WINAPI D3DXColorAdjustSaturation(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s);
|
||||
|
||||
FLOAT WINAPI D3DXFresnelTerm(FLOAT costheta, FLOAT refractionindex);
|
||||
|
||||
D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *pout, FLOAT scaling, CONST D3DXVECTOR3 *rotationcenter, CONST D3DXQUATERNION *rotation, CONST D3DXVECTOR3 *translation);
|
||||
FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixInverse(D3DXMATRIX *pout, FLOAT *pdeterminant, CONST D3DXMATRIX *pm);
|
||||
|
|
Loading…
Reference in New Issue