Commit 7fd7f655 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Added IDirect3DRMAnimation stub.

parent 8d461c1f
......@@ -162,6 +162,19 @@ static HRESULT d3drm_create_mesh_object(void **object, IDirect3DRM *d3drm)
return hr;
}
static HRESULT d3drm_create_animation_object(void **object, IDirect3DRM *d3drm)
{
struct d3drm_animation *animation;
HRESULT hr;
if (FAILED(hr = d3drm_animation_create(&animation, d3drm)))
return hr;
*object = &animation->IDirect3DRMAnimation_iface;
return hr;
}
struct d3drm
{
IDirect3DRM IDirect3DRM_iface;
......@@ -309,9 +322,20 @@ static HRESULT WINAPI d3drm1_CreateFace(IDirect3DRM *iface, IDirect3DRMFace **fa
static HRESULT WINAPI d3drm1_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm_animation *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
if (!animation)
return D3DRMERR_BADVALUE;
if (FAILED(hr = d3drm_animation_create(&object, iface)))
return hr;
*animation = &object->IDirect3DRMAnimation_iface;
return S_OK;
}
static HRESULT WINAPI d3drm1_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set)
......@@ -840,9 +864,11 @@ static HRESULT WINAPI d3drm2_CreateFace(IDirect3DRM2 *iface, IDirect3DRMFace **f
static HRESULT WINAPI d3drm2_CreateAnimation(IDirect3DRM2 *iface, IDirect3DRMAnimation **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
return IDirect3DRM_CreateAnimation(&d3drm->IDirect3DRM_iface, animation);
}
static HRESULT WINAPI d3drm2_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRMAnimationSet **set)
......@@ -1313,6 +1339,7 @@ static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
{&CLSID_CDirect3DRMLight, d3drm_create_light_object},
{&CLSID_CDirect3DRMMaterial, d3drm_create_material_object},
{&CLSID_CDirect3DRMMesh, d3drm_create_mesh_object},
{&CLSID_CDirect3DRMAnimation, d3drm_create_animation_object},
};
TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
......@@ -1428,9 +1455,18 @@ static HRESULT WINAPI d3drm3_CreateFace(IDirect3DRM3 *iface, IDirect3DRMFace2 **
static HRESULT WINAPI d3drm3_CreateAnimation(IDirect3DRM3 *iface, IDirect3DRMAnimation2 **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_animation *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
if (FAILED(hr = d3drm_animation_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*animation = &object->IDirect3DRMAnimation2_iface;
return hr;
}
static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set)
......
......@@ -206,6 +206,16 @@ struct d3drm_material
struct color_rgb ambient;
};
struct d3drm_animation
{
struct d3drm_object obj;
IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
IDirect3DRMAnimation IDirect3DRMAnimation_iface;
LONG ref;
IDirect3DRM *d3drm;
};
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
......@@ -232,6 +242,7 @@ HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDir
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;
......
......@@ -1463,31 +1463,33 @@ static void test_object(void)
{
REFCLSID clsid;
REFIID iid;
BOOL todo;
BOOL takes_d3drm_ref;
}
tests[] =
{
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice2, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice3, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMWinDevice, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture2, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture3, FALSE },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport, FALSE },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport2, FALSE },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder3 },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame2 },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame3 },
{ &CLSID_CDirect3DRMLight, &IID_IDirect3DRMLight },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial2 },
{ &CLSID_CDirect3DRMMesh, &IID_IDirect3DRMMesh },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice2 },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice3 },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMWinDevice },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture2 },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture3 },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport2 },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder, TRUE },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder2, TRUE },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder3, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame2, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame3, TRUE },
{ &CLSID_CDirect3DRMLight, &IID_IDirect3DRMLight, TRUE },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial, TRUE },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial2, TRUE },
{ &CLSID_CDirect3DRMMesh, &IID_IDirect3DRMMesh, TRUE },
{ &CLSID_CDirect3DRMAnimation, &IID_IDirect3DRMAnimation, TRUE },
{ &CLSID_CDirect3DRMAnimation, &IID_IDirect3DRMAnimation2, TRUE },
};
IDirect3DRM *d3drm1;
IDirect3DRM2 *d3drm2;
......@@ -1511,12 +1513,6 @@ static void test_object(void)
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
{
BOOL takes_ref = IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMeshBuilder) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMFrame) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMLight) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMaterial) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMesh);
unknown = (IUnknown *)0xdeadbeef;
hr = IDirect3DRM_CreateObject(d3drm1, NULL, NULL, tests[i].iid, (void **)&unknown);
ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
......@@ -1529,12 +1525,11 @@ static void test_object(void)
ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
hr = IDirect3DRM_CreateObject(d3drm1, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
todo_wine_if(tests[i].todo)
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
if (SUCCEEDED(hr))
{
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
......@@ -1557,7 +1552,7 @@ static void test_object(void)
hr = IDirect3DRM2_CreateObject(d3drm2, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
......@@ -1576,7 +1571,7 @@ static void test_object(void)
hr = IDirect3DRM3_CreateObject(d3drm3, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
......@@ -6706,6 +6701,48 @@ static void test_create_texture_from_surface(void)
IDirectDraw_Release(ddraw);
}
static void test_animation(void)
{
IDirect3DRMAnimation2 *animation2;
IDirect3DRMAnimation *animation;
IDirect3DRMObject *obj, *obj2;
IDirect3DRM *d3drm1;
HRESULT hr;
hr = Direct3DRMCreate(&d3drm1);
ok(SUCCEEDED(hr), "Failed to create IDirect3DRM instance, hr 0x%08x.\n", hr);
hr = IDirect3DRM_CreateAnimation(d3drm1, NULL);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr 0x%08x.\n", hr);
CHECK_REFCOUNT(d3drm1, 1);
hr = IDirect3DRM_CreateAnimation(d3drm1, &animation);
ok(SUCCEEDED(hr), "Failed to create animation hr 0x%08x.\n", hr);
CHECK_REFCOUNT(d3drm1, 2);
test_class_name((IDirect3DRMObject *)animation, "Animation");
hr = IDirect3DRMAnimation_QueryInterface(animation, &IID_IDirect3DRMAnimation2, (void **)&animation2);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMAnimation2, hr 0x%08x.\n", hr);
ok(animation != (void *)animation2, "Expected different interface pointer.\n");
hr = IDirect3DRMAnimation_QueryInterface(animation, &IID_IDirect3DRMObject, (void **)&obj);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, hr 0x%08x.\n", hr);
hr = IDirect3DRMAnimation2_QueryInterface(animation2, &IID_IDirect3DRMObject, (void **)&obj2);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, hr 0x%08x.\n", hr);
ok(obj == obj2 && obj == (IDirect3DRMObject *)animation, "Unexpected object pointer.\n");
IDirect3DRMObject_Release(obj);
IDirect3DRMObject_Release(obj2);
IDirect3DRMAnimation2_Release(animation2);
IDirect3DRMAnimation_Release(animation);
IDirect3DRM_Release(d3drm1);
}
START_TEST(d3drm)
{
test_MeshBuilder();
......@@ -6740,4 +6777,5 @@ START_TEST(d3drm)
test_viewport_clear1();
test_viewport_clear2();
test_create_texture_from_surface();
test_animation();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment