d3drm: Implement D3DRMColorGetRed.

This commit is contained in:
David Adam 2007-05-20 12:24:30 +02:00 committed by Alexandre Julliard
parent 130278f34a
commit e1d3e65381
4 changed files with 24 additions and 1 deletions

View File

@ -1,7 +1,7 @@
@ stub D3DRMColorGetAlpha
@ stub D3DRMColorGetBlue
@ stub D3DRMColorGetGreen
@ stub D3DRMColorGetRed
@ stdcall D3DRMColorGetRed(long)
@ stub D3DRMCreateColorRGB
@ stub D3DRMCreateColorRGBA
@ stdcall D3DRMMatrixFromQuaternion(ptr ptr)

View File

@ -34,6 +34,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
/* Determine the red part of a color */
D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR color)
{
return (RGBA_GETRED(color)/255.0);
}
/* Product of 2 quaternions */
LPD3DRMQUATERNION WINAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q, LPD3DRMQUATERNION a, LPD3DRMQUATERNION b)
{

View File

@ -79,6 +79,7 @@ static LPD3DVECTOR (WINAPI * pD3DRMVectorScale)(LPD3DVECTOR, LPD3DVECTOR, D3DVAL
static LPD3DVECTOR (WINAPI * pD3DRMVectorSubtract)(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR);
static LPD3DRMQUATERNION (WINAPI * pD3DRMQuaternionFromRotation)(LPD3DRMQUATERNION, LPD3DVECTOR, D3DVALUE);
static LPD3DRMQUATERNION (WINAPI * pD3DRMQuaternionSlerp)(LPD3DRMQUATERNION, LPD3DRMQUATERNION, LPD3DRMQUATERNION, D3DVALUE);
static D3DVALUE (WINAPI * pD3DRMColorGetRed)(D3DCOLOR);
#define D3DRM_GET_PROC(func) \
p ## func = (void*)GetProcAddress(d3drm_handle, #func); \
@ -110,6 +111,7 @@ static BOOL InitFunctionPtrs(void)
D3DRM_GET_PROC(D3DRMVectorSubtract)
D3DRM_GET_PROC(D3DRMQuaternionFromRotation)
D3DRM_GET_PROC(D3DRMQuaternionSlerp)
D3DRM_GET_PROC(D3DRMColorGetRed)
return TRUE;
}
@ -246,6 +248,18 @@ static void QuaternionTest(void)
expect_quat(q,r);
}
static void ColorTest(void)
{
D3DCOLOR color;
D3DVALUE expected, got;
/*___________D3DRMColorGetRed__________________________*/
color=0xb62d7a1c;
expected=3.0/17.0;
got=pD3DRMColorGetRed(color);
ok((fabs(expected-got)<admit_error),"Expected=%f, Got=%f\n",expected,got);
}
START_TEST(vector)
{
if(!InitFunctionPtrs())
@ -254,6 +268,7 @@ START_TEST(vector)
VectorTest();
MatrixTest();
QuaternionTest();
ColorTest();
FreeLibrary(d3drm_handle);
}

View File

@ -54,6 +54,8 @@ LPD3DVECTOR WINAPI D3DRMVectorReflect(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR);
LPD3DVECTOR WINAPI D3DRMVectorScale(LPD3DVECTOR, LPD3DVECTOR, D3DVALUE);
LPD3DVECTOR WINAPI D3DRMVectorSubtract(LPD3DVECTOR, LPD3DVECTOR, LPD3DVECTOR);
D3DVALUE WINAPI D3DRMColorGetRed(D3DCOLOR);
#if defined(__cplusplus)
}
#endif