d3drm: Store frame traversal options.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-07-04 10:43:11 +03:00 committed by Alexandre Julliard
parent ca7ef97994
commit 3276e7eebe
3 changed files with 61 additions and 7 deletions

View File

@ -76,6 +76,7 @@ struct d3drm_frame
IDirect3DRMLight **lights;
D3DRMMATRIX4D transform;
D3DCOLOR scenebackground;
DWORD traversal_options;
};
struct d3drm_viewport

View File

@ -2666,18 +2666,33 @@ static HRESULT WINAPI d3drm_frame3_InverseTransformVectors(IDirect3DRMFrame3 *if
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_frame3_SetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD flags)
static HRESULT WINAPI d3drm_frame3_SetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD options)
{
FIXME("iface %p, flags %#x stub!\n", iface, flags);
static const DWORD supported_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE;
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
return E_NOTIMPL;
TRACE("iface %p, options %#x.\n", iface, options);
if (options & ~supported_options)
return D3DRMERR_BADVALUE;
frame->traversal_options = options;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_frame3_GetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD *flags)
static HRESULT WINAPI d3drm_frame3_GetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD *options)
{
FIXME("iface %p, flags %p stub!\n", iface, flags);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
return E_NOTIMPL;
TRACE("iface %p, options %p.\n", iface, options);
if (!options)
return D3DRMERR_BADVALUE;
*options = frame->traversal_options;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_frame3_SetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD flags)
@ -2991,6 +3006,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
object->d3drm = d3drm;
object->ref = 1;
d3drm_set_color(&object->scenebackground, 0.0f, 0.0f, 0.0f, 1.0f);
object->traversal_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE;
d3drm_object_init(&object->obj, classname);

View File

@ -987,9 +987,10 @@ static void test_Frame(void)
IDirect3DRMLight *light1;
IDirect3DRMLight *light_tmp;
IDirect3DRMLightArray *light_array;
IDirect3DRMFrame3 *frame3;
DWORD count, options;
ULONG ref, ref2;
D3DCOLOR color;
DWORD count;
hr = Direct3DRMCreate(&d3drm);
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
@ -1315,6 +1316,42 @@ static void test_Frame(void)
color = IDirect3DRMFrame_GetSceneBackground(pFrameP1);
ok(color == 0xff7f7f7f, "wrong color (%x)\n", color);
/* Traversal options. */
hr = IDirect3DRMFrame_QueryInterface(pFrameP2, &IID_IDirect3DRMFrame3, (void **)&frame3);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMFrame3 interface, hr %#x.\n", hr);
hr = IDirect3DRMFrame3_GetTraversalOptions(frame3, NULL);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
options = 0;
hr = IDirect3DRMFrame3_GetTraversalOptions(frame3, &options);
ok(SUCCEEDED(hr), "Failed to get traversal options, hr %#x.\n", hr);
ok(options == (D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE), "Unexpected default options %#x.\n", options);
hr = IDirect3DRMFrame3_SetTraversalOptions(frame3, 0);
ok(SUCCEEDED(hr), "Unexpected hr %#x.\n", hr);
hr = IDirect3DRMFrame3_SetTraversalOptions(frame3, 0xf0000000);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
hr = IDirect3DRMFrame3_SetTraversalOptions(frame3, 0xf0000000 | D3DRMFRAME_PICKENABLE);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
options = 0xf;
hr = IDirect3DRMFrame3_GetTraversalOptions(frame3, &options);
ok(SUCCEEDED(hr), "Failed to get traversal options, hr %#x.\n", hr);
ok(options == 0, "Unexpected traversal options %#x.\n", options);
hr = IDirect3DRMFrame3_SetTraversalOptions(frame3, D3DRMFRAME_PICKENABLE);
ok(SUCCEEDED(hr), "Failed to set traversal options, hr %#x.\n", hr);
options = 0;
hr = IDirect3DRMFrame3_GetTraversalOptions(frame3, &options);
ok(SUCCEEDED(hr), "Failed to get traversal options, hr %#x.\n", hr);
ok(options == D3DRMFRAME_PICKENABLE, "Unexpected traversal options %#x.\n", options);
IDirect3DRMFrame3_Release(frame3);
/* Cleanup */
IDirect3DRMFrame_Release(pFrameP2);
CHECK_REFCOUNT(pFrameC, 1);