d3dx8: Implement D3DXMatrixReflect.
This commit is contained in:
parent
a1010e6c94
commit
5cc527d30d
|
@ -48,7 +48,7 @@
|
|||
@ stdcall D3DXMatrixOrthoOffCenterRH(ptr long long long long long long)
|
||||
@ stdcall D3DXMatrixOrthoOffCenterLH(ptr long long long long long long)
|
||||
@ stdcall D3DXMatrixShadow(ptr ptr ptr)
|
||||
@ stub D3DXMatrixReflect
|
||||
@ stdcall D3DXMatrixReflect(ptr ptr)
|
||||
@ stub D3DXQuaternionToAxisAngle
|
||||
@ stub D3DXQuaternionRotationMatrix
|
||||
@ stub D3DXQuaternionRotationAxis
|
||||
|
|
|
@ -325,6 +325,27 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, F
|
|||
return pout;
|
||||
}
|
||||
|
||||
D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, CONST D3DXPLANE *pplane)
|
||||
{
|
||||
D3DXPLANE Nplane;
|
||||
|
||||
D3DXPlaneNormalize(&Nplane, pplane);
|
||||
D3DXMatrixIdentity(pout);
|
||||
pout->u.m[0][0] = 1.0f - 2.0f * Nplane.a * Nplane.a;
|
||||
pout->u.m[0][1] = -2.0f * Nplane.a * Nplane.b;
|
||||
pout->u.m[0][2] = -2.0f * Nplane.a * Nplane.c;
|
||||
pout->u.m[1][0] = -2.0f * Nplane.a * Nplane.b;
|
||||
pout->u.m[1][1] = 1.0f - 2.0f * Nplane.b * Nplane.b;
|
||||
pout->u.m[1][2] = -2.0f * Nplane.b * Nplane.c;
|
||||
pout->u.m[2][0] = -2.0f * Nplane.c * Nplane.a;
|
||||
pout->u.m[2][1] = -2.0f * Nplane.c * Nplane.b;
|
||||
pout->u.m[2][2] = 1.0f - 2.0f * Nplane.c * Nplane.c;
|
||||
pout->u.m[3][0] = -2.0f * Nplane.d * Nplane.a;
|
||||
pout->u.m[3][1] = -2.0f * Nplane.d * Nplane.b;
|
||||
pout->u.m[3][2] = -2.0f * Nplane.d * Nplane.c;
|
||||
return pout;
|
||||
}
|
||||
|
||||
D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle)
|
||||
{
|
||||
D3DXVECTOR3 v;
|
||||
|
|
|
@ -346,6 +346,13 @@ static void D3DXMatrixTest(void)
|
|||
D3DXMatrixPerspectiveRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
|
||||
expect_mat(expectedmat,gotmat);
|
||||
|
||||
/*____________D3DXMatrixReflect______________*/
|
||||
U(expectedmat).m[0][0] = 0.307692f; U(expectedmat).m[0][1] = -0.230769f; U(expectedmat).m[0][2] = 0.923077f; U(expectedmat).m[0][3] = 0.0f;
|
||||
U(expectedmat).m[1][0] = -0.230769; U(expectedmat).m[1][1] = 0.923077f; U(expectedmat).m[1][2] = 0.307693f; U(expectedmat).m[1][3] = 0.0f;
|
||||
U(expectedmat).m[2][0] = 0.923077f; U(expectedmat).m[2][1] = 0.307693f; U(expectedmat).m[2][2] = -0.230769f; U(expectedmat).m[2][3] = 0.0f;
|
||||
U(expectedmat).m[3][0] = 1.615385f; U(expectedmat).m[3][1] = 0.538462f; U(expectedmat).m[3][2] = -2.153846f; U(expectedmat).m[3][3] = 1.0f;
|
||||
D3DXMatrixReflect(&gotmat,&plane);
|
||||
expect_mat(expectedmat,gotmat);
|
||||
/*____________D3DXMatrixRotationAxis_____*/
|
||||
U(expectedmat).m[0][0] = 0.508475f; U(expectedmat).m[0][1] = 0.763805f; U(expectedmat).m[0][2] = 0.397563f; U(expectedmat).m[0][3] = 0.0f;
|
||||
U(expectedmat).m[1][0] = -0.814652f; U(expectedmat).m[1][1] = 0.576271f; U(expectedmat).m[1][2] = -0.065219f; U(expectedmat).m[1][3] = 0.0f;
|
||||
|
|
|
@ -281,6 +281,7 @@ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, F
|
|||
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixReflect(D3DXMATRIX *pout, CONST D3DXPLANE *pplane);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixRotationAxis(D3DXMATRIX *pout, CONST D3DXVECTOR3 *pv, FLOAT angle);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion(D3DXMATRIX *pout, CONST D3DXQUATERNION *pq);
|
||||
D3DXMATRIX* WINAPI D3DXMatrixRotationX(D3DXMATRIX *pout, FLOAT angle);
|
||||
|
|
Loading…
Reference in New Issue