[PATCH] d3drm: Implement IDirect3DRMFrameX_GetTransform. (resend)
Christian Costa
titan.costa at gmail.com
Tue May 8 15:31:16 CDT 2012
---
dlls/d3drm/frame.c | 25 +++++++++++++++++++++----
dlls/d3drm/tests/d3drm.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c
index 536932e..b3d2f60 100644
--- a/dlls/d3drm/frame.c
+++ b/dlls/d3drm/frame.c
@@ -30,6 +30,13 @@
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;
struct IDirect3DRMFrameImpl {
@@ -46,6 +53,7 @@ struct IDirect3DRMFrameImpl {
ULONG nb_lights;
ULONG lights_capacity;
IDirect3DRMLight** lights;
+ D3DRMMATRIX4D transform;
};
typedef struct {
@@ -420,9 +428,11 @@ static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* ifac
{
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,
@@ -1430,9 +1440,14 @@ static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTransform(IDirect3DRMFrame3* ifac
{
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,
@@ -2220,6 +2235,8 @@ HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown** ppObj)
object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl;
object->ref = 1;
+ memcpy(&object->transform[0][0], &identity[0][0], sizeof(D3DRMMATRIX4D));
+
if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
*ppObj = (IUnknown*)&object->IDirect3DRMFrame3_iface;
else
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c
index 1aba046..cd71405 100644
--- a/dlls/d3drm/tests/d3drm.c
+++ b/dlls/d3drm/tests/d3drm.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Christian Costa
+ * Copyright 2010, 2012 Christian Costa
* Copyright 2012 André Hentschel
*
* 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 );
}
+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[] =
"xof 0302txt 0064\n"
"Header Object\n"
@@ -760,6 +767,26 @@ static void test_Light(void)
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 const GUID* refiids[] =
{
@@ -804,6 +831,7 @@ START_TEST(d3drm)
test_MeshBuilder3();
test_Frame();
test_Light();
+ test_frame_transform();
test_d3drm_load();
FreeLibrary(d3drm_handle);
More information about the wine-patches
mailing list