d3drm: Implement IDirect3DRMFrameX_GetTransform.

This commit is contained in:
Christian Costa 2012-05-08 22:31:16 +02:00 committed by Alexandre Julliard
parent 447c97cfbd
commit 43c4c4b1c5
2 changed files with 50 additions and 5 deletions

View File

@ -30,6 +30,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3drm); WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
static D3DRMMATRIX4D identity = {
{ 1.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f }
};
typedef struct IDirect3DRMFrameImpl IDirect3DRMFrameImpl; typedef struct IDirect3DRMFrameImpl IDirect3DRMFrameImpl;
struct IDirect3DRMFrameImpl { struct IDirect3DRMFrameImpl {
@ -46,6 +53,7 @@ struct IDirect3DRMFrameImpl {
ULONG nb_lights; ULONG nb_lights;
ULONG lights_capacity; ULONG lights_capacity;
IDirect3DRMLight** lights; IDirect3DRMLight** lights;
D3DRMMATRIX4D transform;
}; };
typedef struct { typedef struct {
@ -420,9 +428,11 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* ifac
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface); IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
FIXME("(%p/%p)->(%p): stub\n", iface, This, return_matrix); TRACE("(%p/%p)->(%p)\n", iface, This, return_matrix);
return E_NOTIMPL; memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
return D3DRM_OK;
} }
static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface, static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface,
@ -1430,9 +1440,14 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTransform(IDirect3DRMFrame3* ifac
{ {
IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface); IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_matrix); TRACE("(%p/%p)->(%p,%p)\n", iface, This, reference, return_matrix);
return E_NOTIMPL; if (reference)
FIXME("Specifying a frame as the root of the scene different from the current root frame is not supported yet\n");
memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
return D3DRM_OK;
} }
static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVelocity(IDirect3DRMFrame3* iface, static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVelocity(IDirect3DRMFrame3* iface,
@ -2220,6 +2235,8 @@ HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown** ppObj)
object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl; object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl;
object->ref = 1; object->ref = 1;
memcpy(&object->transform[0][0], &identity[0][0], sizeof(D3DRMMATRIX4D));
if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3)) if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
*ppObj = (IUnknown*)&object->IDirect3DRMFrame3_iface; *ppObj = (IUnknown*)&object->IDirect3DRMFrame3_iface;
else else

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2010 Christian Costa * Copyright 2010, 2012 Christian Costa
* Copyright 2012 André Hentschel * Copyright 2012 André Hentschel
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -63,6 +63,13 @@ static int get_refcount(IUnknown *object)
return IUnknown_Release( object ); return IUnknown_Release( object );
} }
static D3DRMMATRIX4D identity = {
{ 1.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f, 1.0f }
};
static char data_bad_version[] = static char data_bad_version[] =
"xof 0302txt 0064\n" "xof 0302txt 0064\n"
"Header Object\n" "Header Object\n"
@ -741,6 +748,26 @@ static void test_Light(void)
IDirect3DRM_Release(pD3DRM); IDirect3DRM_Release(pD3DRM);
} }
static void test_frame_transform(void)
{
HRESULT hr;
LPDIRECT3DRM d3drm;
LPDIRECT3DRMFRAME frame;
D3DRMMATRIX4D matrix;
hr = pDirect3DRMCreate(&d3drm);
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
hr = IDirect3DRM_CreateFrame(d3drm, NULL, &frame);
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame interface (hr = %x)\n", hr);
hr = IDirect3DRMFrame_GetTransform(frame, matrix);
ok(hr == D3DRM_OK, "IDirect3DRMFrame_GetTransform returned hr = %x\n", hr);
ok(!memcmp(matrix, identity, sizeof(D3DRMMATRIX4D)), "Returned matrix is not identity\n");
IDirect3DRM_Release(d3drm);
}
static int nb_objects = 0; static int nb_objects = 0;
static const GUID* refiids[] = static const GUID* refiids[] =
{ {
@ -785,6 +812,7 @@ START_TEST(d3drm)
test_MeshBuilder3(); test_MeshBuilder3();
test_Frame(); test_Frame();
test_Light(); test_Light();
test_frame_transform();
test_d3drm_load(); test_d3drm_load();
FreeLibrary(d3drm_handle); FreeLibrary(d3drm_handle);