d3dx8: Implement D3DX*Transform.
This commit is contained in:
parent
145264efa6
commit
fa58dcee8d
|
@ -2,14 +2,14 @@
|
|||
@ stdcall D3DXVec2Hermite(ptr ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec2CatmullRom(ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec2BaryCentric(ptr ptr ptr ptr long long)
|
||||
@ stub D3DXVec2Transform
|
||||
@ stdcall D3DXVec2Transform(ptr ptr ptr)
|
||||
@ stub D3DXVec2TransformCoord
|
||||
@ stub D3DXVec2TransformNormal
|
||||
@ stdcall D3DXVec3Normalize(ptr ptr)
|
||||
@ stdcall D3DXVec3Hermite(ptr ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec3CatmullRom(ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec3BaryCentric(ptr ptr ptr ptr long long)
|
||||
@ stub D3DXVec3Transform
|
||||
@ stdcall D3DXVec3Transform(ptr ptr ptr)
|
||||
@ stub D3DXVec3TransformCoord
|
||||
@ stub D3DXVec3TransformNormal
|
||||
@ stub D3DXVec3Project
|
||||
|
@ -19,7 +19,7 @@
|
|||
@ stdcall D3DXVec4Hermite(ptr ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec4CatmullRom(ptr ptr ptr ptr long)
|
||||
@ stdcall D3DXVec4BaryCentric(ptr ptr ptr ptr long long)
|
||||
@ stub D3DXVec4Transform
|
||||
@ stdcall D3DXVec4Transform(ptr ptr ptr)
|
||||
@ stub D3DXMatrixfDeterminant
|
||||
@ stub D3DXMatrixMultiply
|
||||
@ stub D3DXMatrixTranspose
|
||||
|
|
|
@ -100,6 +100,15 @@ D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv)
|
|||
return pout;
|
||||
}
|
||||
|
||||
D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm)
|
||||
{
|
||||
pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[3][0];
|
||||
pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[3][1];
|
||||
pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[3][2];
|
||||
pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[3][3];
|
||||
return pout;
|
||||
}
|
||||
|
||||
/*_________________D3DXVec3_____________________*/
|
||||
|
||||
D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g)
|
||||
|
@ -153,6 +162,15 @@ D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv)
|
|||
return pout;
|
||||
}
|
||||
|
||||
D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm)
|
||||
{
|
||||
pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0];
|
||||
pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1];
|
||||
pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2];
|
||||
pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3];
|
||||
return pout;
|
||||
}
|
||||
|
||||
/*_________________D3DXVec4_____________________*/
|
||||
|
||||
D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g)
|
||||
|
@ -210,3 +228,12 @@ D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv)
|
|||
}
|
||||
return pout;
|
||||
}
|
||||
|
||||
D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm)
|
||||
{
|
||||
pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0] * pv->w;
|
||||
pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1] * pv->w;
|
||||
pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2] * pv->w;
|
||||
pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3] * pv->w;
|
||||
return pout;
|
||||
}
|
||||
|
|
|
@ -275,6 +275,8 @@ static void D3X8Vector2Test(void)
|
|||
{
|
||||
D3DXVECTOR2 expectedvec, gotvec, nul, u, v, w, x;
|
||||
LPD3DXVECTOR2 funcpointer;
|
||||
D3DXVECTOR4 expectedtrans, gottrans;
|
||||
D3DXMATRIX mat;
|
||||
FLOAT coeff1, coeff2, expected, got, scale;
|
||||
|
||||
nul.x = 0.0f; nul.y = 0.0f;
|
||||
|
@ -283,6 +285,11 @@ static void D3X8Vector2Test(void)
|
|||
w.x = 4.0f; w.y = -3.0f;
|
||||
x.x = 2.0f; x.y = -11.0f;
|
||||
|
||||
mat.m[0][0] = 1.0f; mat.m[0][1] = 2.0f; mat.m[0][2] = 3.0f; mat.m[0][3] = 4.0f;
|
||||
mat.m[1][0] = 5.0f; mat.m[1][1] = 6.0f; mat.m[1][2] = 7.0f; mat.m[1][3] = 8.0f;
|
||||
mat.m[2][0] = 9.0f; mat.m[2][1] = 10.0f; mat.m[2][2] = 11.0f; mat.m[2][3] = 12.0f;
|
||||
mat.m[3][0] = 13.0f; mat.m[3][1] = 14.0f; mat.m[3][2] = 15.0f; mat.m[3][3] = 16.0f;
|
||||
|
||||
coeff1 = 2.0f; coeff2 = 5.0f;
|
||||
scale = -6.5f;
|
||||
|
||||
|
@ -412,12 +419,18 @@ static void D3X8Vector2Test(void)
|
|||
funcpointer = D3DXVec2Subtract(NULL,NULL,NULL);
|
||||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||
|
||||
/*_______________D3DXVec2Transform_______________________*/
|
||||
expectedtrans.x = 36.0f; expectedtrans.y = 44.0f; expectedtrans.z = 52.0f; expectedtrans.w = 60.0f;
|
||||
D3DXVec2Transform(&gottrans,&u,&mat);
|
||||
expect_vec4(expectedtrans,gottrans);
|
||||
}
|
||||
|
||||
static void D3X8Vector3Test(void)
|
||||
{
|
||||
D3DXVECTOR3 expectedvec, gotvec, nul, u, v, w, x;
|
||||
LPD3DXVECTOR3 funcpointer;
|
||||
D3DXVECTOR4 expectedtrans, gottrans;
|
||||
D3DXMATRIX mat;
|
||||
FLOAT coeff1, coeff2, expected, got, scale;
|
||||
|
||||
nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f;
|
||||
|
@ -426,6 +439,11 @@ static void D3X8Vector3Test(void)
|
|||
w.x = 3.0f; w.y = -5.0f; w.z = 7.0f;
|
||||
x.x = 4.0f; x.y = 1.0f; x.z = 11.0f;
|
||||
|
||||
mat.m[0][0] = 1.0f; mat.m[0][1] = 2.0f; mat.m[0][2] = 3.0f; mat.m[0][3] = 4.0f;
|
||||
mat.m[1][0] = 5.0f; mat.m[1][1] = 6.0f; mat.m[1][2] = 7.0f; mat.m[1][3] = 8.0f;
|
||||
mat.m[2][0] = 9.0f; mat.m[2][1] = 10.0f; mat.m[2][2] = 11.0f; mat.m[2][3] = 12.0f;
|
||||
mat.m[3][0] = 13.0f; mat.m[3][1] = 14.0f; mat.m[3][2] = 15.0f; mat.m[3][3] = 16.0f;
|
||||
|
||||
coeff1 = 2.0f; coeff2 = 5.0f;
|
||||
scale = -6.5f;
|
||||
|
||||
|
@ -554,12 +572,18 @@ static void D3X8Vector3Test(void)
|
|||
funcpointer = D3DXVec3Subtract(NULL,NULL,NULL);
|
||||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||
|
||||
/*_______________D3DXVec3Transform_______________________*/
|
||||
expectedtrans.x = 70.0f; expectedtrans.y = 88.0f; expectedtrans.z = 106.0f; expectedtrans.w = 124.0f;
|
||||
D3DXVec3Transform(&gottrans,&u,&mat);
|
||||
expect_vec4(expectedtrans,gottrans);
|
||||
}
|
||||
|
||||
static void D3X8Vector4Test(void)
|
||||
{
|
||||
D3DXVECTOR4 expectedvec, gotvec, nul, u, v, w, x;
|
||||
LPD3DXVECTOR4 funcpointer;
|
||||
D3DXVECTOR4 expectedtrans, gottrans;
|
||||
D3DXMATRIX mat;
|
||||
FLOAT coeff1, coeff2, expected, got, scale;
|
||||
|
||||
nul.x = 0.0f; nul.y = 0.0f; nul.z = 0.0f; nul.w = 0.0f;
|
||||
|
@ -567,6 +591,12 @@ static void D3X8Vector4Test(void)
|
|||
v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0;
|
||||
w.x = 4.0f; w.y =6.0f; w.z = -2.0f; w.w = 1.0f;
|
||||
x.x = 6.0f; x.y = -7.0f; x.z =8.0f; x.w = -9.0f;
|
||||
|
||||
mat.m[0][0] = 1.0f; mat.m[0][1] = 2.0f; mat.m[0][2] = 3.0f; mat.m[0][3] = 4.0f;
|
||||
mat.m[1][0] = 5.0f; mat.m[1][1] = 6.0f; mat.m[1][2] = 7.0f; mat.m[1][3] = 8.0f;
|
||||
mat.m[2][0] = 9.0f; mat.m[2][1] = 10.0f; mat.m[2][2] = 11.0f; mat.m[2][3] = 12.0f;
|
||||
mat.m[3][0] = 13.0f; mat.m[3][1] = 14.0f; mat.m[3][2] = 15.0f; mat.m[3][3] = 16.0f;
|
||||
|
||||
coeff1 = 2.0f; coeff2 = 5.0;
|
||||
scale = -6.5f;
|
||||
|
||||
|
@ -683,6 +713,11 @@ static void D3X8Vector4Test(void)
|
|||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||
funcpointer = D3DXVec4Subtract(NULL,NULL,NULL);
|
||||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||
|
||||
/*_______________D3DXVec4Transform_______________________*/
|
||||
expectedtrans.x = 177.0f; expectedtrans.y = 194.0f; expectedtrans.z = 211.0f; expectedtrans.w = 228.0f;
|
||||
D3DXVec4Transform(&gottrans,&u,&mat);
|
||||
expect_vec4(expectedtrans,gottrans);
|
||||
}
|
||||
|
||||
START_TEST(math)
|
||||
|
|
|
@ -64,16 +64,19 @@ D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv
|
|||
D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s);
|
||||
D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, FLOAT s);
|
||||
D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv);
|
||||
D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm);
|
||||
|
||||
D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g);
|
||||
D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s);
|
||||
D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, FLOAT s);
|
||||
D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv);
|
||||
D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm);
|
||||
|
||||
D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g);
|
||||
D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT s);
|
||||
D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, FLOAT s);
|
||||
D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv);
|
||||
D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm);
|
||||
|
||||
#include <d3dx8math.inl>
|
||||
|
||||
|
|
Loading…
Reference in New Issue