2012-01-13 00:17:02 +01:00
|
|
|
/*
|
|
|
|
* Implementation of IDirect3DRMViewport Interface
|
|
|
|
*
|
|
|
|
* Copyright 2012 André Hentschel
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "d3drm_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport_iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static inline struct d3drm_viewport *impl_from_IDirect3DRMViewport2(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct d3drm_viewport, IDirect3DRMViewport2_iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-08-17 20:28:41 +02:00
|
|
|
static inline void d3drm_normalize_d3d_color(D3DCOLORVALUE *color_value, D3DCOLOR color)
|
|
|
|
{
|
2016-11-10 16:17:40 +01:00
|
|
|
color_value->u1.r = RGBA_GETRED(color) / 255.0f;
|
|
|
|
color_value->u2.g = RGBA_GETGREEN(color) / 255.0f;
|
|
|
|
color_value->u3.b = RGBA_GETBLUE(color) / 255.0f;
|
|
|
|
color_value->u4.a = RGBA_GETALPHA(color) / 255.0f;
|
2016-08-17 20:28:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT d3drm_update_background_material(struct d3drm_viewport *viewport)
|
|
|
|
{
|
|
|
|
IDirect3DRMFrame *root_frame;
|
|
|
|
D3DCOLOR color;
|
|
|
|
D3DMATERIAL mat;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRMFrame_GetScene(viewport->camera, &root_frame)))
|
|
|
|
return hr;
|
|
|
|
color = IDirect3DRMFrame_GetSceneBackground(root_frame);
|
2019-07-01 19:17:29 +02:00
|
|
|
IDirect3DRMFrame_Release(root_frame);
|
2016-08-17 20:28:41 +02:00
|
|
|
|
|
|
|
memset(&mat, 0, sizeof(mat));
|
|
|
|
mat.dwSize = sizeof(mat);
|
2016-11-10 16:17:40 +01:00
|
|
|
d3drm_normalize_d3d_color(&mat.u.diffuse, color);
|
2016-08-17 20:28:41 +02:00
|
|
|
|
|
|
|
return IDirect3DMaterial_SetMaterial(viewport->material, &mat);
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:02 +02:00
|
|
|
static void d3drm_viewport_destroy(struct d3drm_viewport *viewport)
|
|
|
|
{
|
2016-07-28 19:18:47 +02:00
|
|
|
TRACE("viewport %p releasing attached interfaces.\n", viewport);
|
2016-06-29 15:39:02 +02:00
|
|
|
|
|
|
|
d3drm_object_cleanup((IDirect3DRMObject *)&viewport->IDirect3DRMViewport_iface, &viewport->obj);
|
2016-07-28 19:18:47 +02:00
|
|
|
|
|
|
|
if (viewport->d3d_viewport)
|
|
|
|
{
|
|
|
|
IDirect3DViewport_Release(viewport->d3d_viewport);
|
|
|
|
IDirect3DMaterial_Release(viewport->material);
|
|
|
|
IDirect3DRMFrame_Release(viewport->camera);
|
|
|
|
IDirect3DRM_Release(viewport->d3drm);
|
|
|
|
}
|
|
|
|
|
2018-02-08 22:58:47 +01:00
|
|
|
heap_free(viewport);
|
2016-06-29 15:39:02 +02:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
if (IsEqualGUID(riid, &IID_IDirect3DRMViewport)
|
2016-03-03 09:10:20 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IDirect3DRMObject)
|
2013-11-01 09:41:02 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IUnknown))
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
*out = &viewport->IDirect3DRMViewport_iface;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
2013-11-01 09:41:02 +01:00
|
|
|
else if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
*out = &viewport->IDirect3DRMViewport2_iface;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
*out = NULL;
|
2016-07-19 20:08:42 +02:00
|
|
|
WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
2012-01-17 23:00:50 +01:00
|
|
|
return S_OK;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_QueryInterface(IDirect3DRMViewport *iface, REFIID riid, void **out)
|
2016-06-29 15:39:03 +02:00
|
|
|
{
|
2016-06-29 15:39:04 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
return d3drm_viewport2_QueryInterface(&viewport->IDirect3DRMViewport2_iface, riid, out);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
static ULONG WINAPI d3drm_viewport2_AddRef(IDirect3DRMViewport2 *iface)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:04 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2016-03-01 17:45:29 +01:00
|
|
|
ULONG refcount = InterlockedIncrement(&viewport->obj.ref);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
return refcount;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface)
|
2016-06-29 15:39:03 +02:00
|
|
|
{
|
2016-06-29 15:39:04 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
return d3drm_viewport2_AddRef(&viewport->IDirect3DRMViewport2_iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
static ULONG WINAPI d3drm_viewport2_Release(IDirect3DRMViewport2 *iface)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:04 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2016-03-01 17:45:29 +01:00
|
|
|
ULONG refcount = InterlockedDecrement(&viewport->obj.ref);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
if (!refcount)
|
2016-06-29 15:39:02 +02:00
|
|
|
d3drm_viewport_destroy(viewport);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
return refcount;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:04 +02:00
|
|
|
static ULONG WINAPI d3drm_viewport1_Release(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_Release(&viewport->IDirect3DRMViewport2_iface);
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Clone(IDirect3DRMViewport2 *iface,
|
2013-08-20 10:20:13 +02:00
|
|
|
IUnknown *outer, REFIID iid, void **out)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-08-20 10:20:13 +02:00
|
|
|
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Clone(IDirect3DRMViewport *iface,
|
|
|
|
IUnknown *outer, REFIID iid, void **out)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:03 +02:00
|
|
|
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
|
2016-03-03 09:10:21 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return E_NOTIMPL;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_AddDestroyCallback(IDirect3DRMViewport2 *iface,
|
2013-09-09 10:26:21 +02:00
|
|
|
D3DRMOBJECTCALLBACK cb, void *ctx)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:03 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-03-03 09:10:21 +01:00
|
|
|
TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_object_add_destroy_callback(&viewport->obj, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_AddDestroyCallback(IDirect3DRMViewport *iface,
|
|
|
|
D3DRMOBJECTCALLBACK cb, void *ctx)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_viewport2_AddDestroyCallback(&viewport->IDirect3DRMViewport2_iface, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_DeleteDestroyCallback(IDirect3DRMViewport2 *iface,
|
|
|
|
D3DRMOBJECTCALLBACK cb, void *ctx)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:03 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_object_delete_destroy_callback(&viewport->obj, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_DeleteDestroyCallback(IDirect3DRMViewport *iface,
|
|
|
|
D3DRMOBJECTCALLBACK cb, void *ctx)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_viewport2_DeleteDestroyCallback(&viewport->IDirect3DRMViewport2_iface, cb, ctx);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetAppData(IDirect3DRMViewport2 *iface, DWORD data)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:03 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, data %#x\n", iface, data);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
viewport->obj.appdata = data;
|
|
|
|
return S_OK;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetAppData(IDirect3DRMViewport *iface, DWORD data)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, data %#x\n", iface, data);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_viewport2_SetAppData(&viewport->IDirect3DRMViewport2_iface, data);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static DWORD WINAPI d3drm_viewport2_GetAppData(IDirect3DRMViewport2 *iface)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2016-06-29 15:39:03 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p\n", iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return viewport->obj.appdata;
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p.\n", iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_viewport2_GetAppData(&viewport->IDirect3DRMViewport2_iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2017-06-21 14:39:30 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-21 14:39:30 +02:00
|
|
|
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
|
|
|
|
|
|
|
|
return d3drm_object_set_name(&viewport->obj, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2017-06-21 14:39:30 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-21 14:39:30 +02:00
|
|
|
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetName(&viewport->IDirect3DRMViewport2_iface, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2017-06-21 14:39:30 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-21 14:39:30 +02:00
|
|
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
|
|
|
|
|
|
|
return d3drm_object_get_name(&viewport->obj, size, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetName(IDirect3DRMViewport *iface, DWORD *size, char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2017-06-21 14:39:30 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-21 14:39:30 +02:00
|
|
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetName(&viewport->IDirect3DRMViewport2_iface, size, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetClassName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2017-06-06 13:10:34 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-06 13:10:34 +02:00
|
|
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2017-06-06 13:10:34 +02:00
|
|
|
return d3drm_object_get_class_name(&viewport->obj, size, name);
|
2012-01-13 00:17:02 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetClassName(IDirect3DRMViewport *iface, DWORD *size, char *name)
|
2012-01-13 00:17:02 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2012-01-13 00:17:02 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
return d3drm_viewport2_GetClassName(&viewport->IDirect3DRMViewport2_iface, size, name);
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Init(IDirect3DRMViewport2 *iface, IDirect3DRMDevice3 *device,
|
|
|
|
IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2016-07-28 19:18:47 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2016-07-28 19:18:52 +02:00
|
|
|
struct d3drm_device *device_obj = unsafe_impl_from_IDirect3DRMDevice3(device);
|
2016-07-28 19:18:47 +02:00
|
|
|
D3DVIEWPORT vp;
|
|
|
|
D3DVALUE scale;
|
|
|
|
IDirect3D *d3d1 = NULL;
|
|
|
|
IDirect3DDevice *d3d_device = NULL;
|
|
|
|
IDirect3DMaterial *material = NULL;
|
|
|
|
D3DMATERIALHANDLE hmat;
|
|
|
|
HRESULT hr = D3DRM_OK;
|
|
|
|
|
|
|
|
TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u.\n",
|
2016-06-29 15:39:03 +02:00
|
|
|
iface, device, camera, x, y, width, height);
|
2012-06-17 19:07:14 +02:00
|
|
|
|
2016-07-28 19:18:52 +02:00
|
|
|
if (!device_obj || !camera
|
|
|
|
|| width > device_obj->width
|
|
|
|
|| height > device_obj->height)
|
2016-07-28 19:18:47 +02:00
|
|
|
{
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (viewport->d3d_viewport)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
IDirect3DRM_AddRef(viewport->d3drm);
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRMDevice3_GetDirect3DDevice(device, &d3d_device)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DDevice_GetDirect3D(d3d_device, &d3d1)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3D_CreateViewport(d3d1, &viewport->d3d_viewport, NULL)))
|
|
|
|
goto cleanup;
|
|
|
|
|
2018-04-20 00:55:39 +02:00
|
|
|
if (FAILED(hr = IDirect3DDevice_AddViewport(d3d_device, viewport->d3d_viewport)))
|
|
|
|
goto cleanup;
|
|
|
|
|
2016-07-28 19:18:47 +02:00
|
|
|
vp.dwSize = sizeof(vp);
|
|
|
|
vp.dwWidth = width;
|
|
|
|
vp.dwHeight = height;
|
|
|
|
vp.dwX = x;
|
|
|
|
vp.dwY = y;
|
|
|
|
scale = width > height ? (float)width / 2.0f : (float)height / 2.0f;
|
|
|
|
vp.dvScaleX = scale;
|
|
|
|
vp.dvScaleY = scale;
|
|
|
|
vp.dvMaxX = vp.dwWidth / (2.0f * vp.dvScaleX);
|
|
|
|
vp.dvMaxY = vp.dwHeight / (2.0f * vp.dvScaleY);
|
|
|
|
vp.dvMinZ = 0.0f;
|
|
|
|
vp.dvMaxZ = 1.0f;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DViewport_SetViewport(viewport->d3d_viewport, &vp)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRMFrame3_QueryInterface(camera, &IID_IDirect3DRMFrame, (void **)&viewport->camera)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3D_CreateMaterial(d3d1, &material, NULL)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DMaterial_GetHandle(material, d3d_device, &hmat)))
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
hr = IDirect3DViewport_SetBackground(viewport->d3d_viewport, hmat);
|
|
|
|
viewport->material = material;
|
2016-07-28 19:18:52 +02:00
|
|
|
viewport->device = device_obj;
|
2016-07-28 19:18:47 +02:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
viewport->clip.left = -0.5f;
|
|
|
|
viewport->clip.top = 0.5f;
|
|
|
|
viewport->clip.right = 0.5f;
|
|
|
|
viewport->clip.bottom = -0.5f;
|
|
|
|
|
2016-07-28 19:18:47 +02:00
|
|
|
cleanup:
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
if (viewport->d3d_viewport)
|
|
|
|
{
|
|
|
|
IDirect3DViewport_Release(viewport->d3d_viewport);
|
|
|
|
viewport->d3d_viewport = NULL;
|
|
|
|
}
|
|
|
|
if (viewport->camera)
|
|
|
|
IDirect3DRMFrame_Release(viewport->camera);
|
|
|
|
if (material)
|
|
|
|
IDirect3DMaterial_Release(material);
|
|
|
|
IDirect3DRM_Release(viewport->d3drm);
|
|
|
|
}
|
|
|
|
if (d3d_device)
|
|
|
|
IDirect3DDevice_Release(d3d_device);
|
|
|
|
if (d3d1)
|
|
|
|
IDirect3D_Release(d3d1);
|
|
|
|
|
|
|
|
return hr;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Init(IDirect3DRMViewport *iface, IDirect3DRMDevice *device,
|
|
|
|
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2016-07-28 19:18:47 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame(camera);
|
|
|
|
IDirect3DRMDevice3 *device3;
|
|
|
|
HRESULT hr;
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2016-07-28 19:18:47 +02:00
|
|
|
TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u.\n",
|
|
|
|
iface, device, camera, x, y, width, height);
|
|
|
|
|
|
|
|
if (!device || !frame)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = d3drm_viewport2_Init(&viewport->IDirect3DRMViewport2_iface, device3, &frame->IDirect3DRMFrame3_iface,
|
|
|
|
x, y, width, height);
|
|
|
|
IDirect3DRMDevice3_Release(device3);
|
|
|
|
|
|
|
|
return hr;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Clear(IDirect3DRMViewport2 *iface, DWORD flags)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2016-08-17 20:28:41 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
|
|
|
DDSCAPS caps = { DDSCAPS_ZBUFFER };
|
|
|
|
HRESULT hr;
|
|
|
|
D3DRECT clear_rect;
|
|
|
|
IDirectDrawSurface *ds;
|
|
|
|
DWORD clear_flags = 0;
|
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x.\n", iface, flags);
|
|
|
|
|
2016-11-10 16:17:40 +01:00
|
|
|
clear_rect.u1.x1 = clear_rect.u2.y1 = 0;
|
|
|
|
clear_rect.u3.x2 = viewport->device->width;
|
|
|
|
clear_rect.u4.y2 = viewport->device->height;
|
2016-08-17 20:28:41 +02:00
|
|
|
|
|
|
|
if (flags & D3DRMCLEAR_TARGET)
|
|
|
|
{
|
|
|
|
clear_flags |= D3DCLEAR_TARGET;
|
|
|
|
d3drm_update_background_material(viewport);
|
|
|
|
}
|
|
|
|
if (flags & D3DRMCLEAR_ZBUFFER)
|
|
|
|
{
|
|
|
|
hr = IDirectDrawSurface_GetAttachedSurface(viewport->device->render_target, &caps, &ds);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
clear_flags |= D3DCLEAR_ZBUFFER;
|
|
|
|
IDirectDrawSurface_Release(ds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flags & D3DRMCLEAR_DIRTYRECTS)
|
|
|
|
FIXME("Flag D3DRMCLEAR_DIRTYRECT not implemented yet.\n");
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DViewport_Clear(viewport->d3d_viewport, 1, &clear_rect, clear_flags)))
|
|
|
|
return hr;
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2012-06-07 13:48:28 +02:00
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Clear(IDirect3DRMViewport *iface)
|
|
|
|
{
|
2016-08-17 20:28:41 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2016-08-17 20:28:41 +02:00
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_Clear(&viewport->IDirect3DRMViewport2_iface, D3DRMCLEAR_ALL);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Render(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 *frame)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-04-22 15:18:44 +02:00
|
|
|
FIXME("iface %p, frame %p stub!\n", iface, frame);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2012-06-07 13:49:30 +02:00
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Render(IDirect3DRMViewport *iface, IDirect3DRMFrame *frame)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, frame %p stub!\n", iface, frame);
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetFront(IDirect3DRMViewport2 *iface, D3DVALUE front)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p, front %.8e.\n", iface, front);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
viewport->clip.front = front;
|
2012-06-07 13:44:27 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetFront(IDirect3DRMViewport *iface, D3DVALUE front)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, front %.8e.\n", iface, front);
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetFront(&viewport->IDirect3DRMViewport2_iface, front);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetBack(IDirect3DRMViewport2 *iface, D3DVALUE back)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p, back %.8e.\n", iface, back);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
viewport->clip.back = back;
|
2012-06-07 13:43:40 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetBack(IDirect3DRMViewport *iface, D3DVALUE back)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, back %.8e.\n", iface, back);
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetBack(&viewport->IDirect3DRMViewport2_iface, back);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetField(IDirect3DRMViewport2 *iface, D3DVALUE field)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p, field %.8e.\n", iface, field);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
if (!viewport->d3d_viewport)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
2019-07-08 17:19:45 +02:00
|
|
|
if (field <= 0.0f)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
viewport->clip.left = -field;
|
|
|
|
viewport->clip.right = field;
|
|
|
|
viewport->clip.bottom = -field;
|
|
|
|
viewport->clip.top = field;
|
2012-06-07 13:46:08 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetField(IDirect3DRMViewport *iface, D3DVALUE field)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, field %.8e.\n", iface, field);
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetField(&viewport->IDirect3DRMViewport2_iface, field);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetUniformScaling(IDirect3DRMViewport2 *iface, BOOL b)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, b %#x stub!\n", iface, b);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetUniformScaling(IDirect3DRMViewport *iface, BOOL b)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, b %#x stub!\n", iface, b);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 *camera)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2019-08-30 21:23:51 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
|
|
|
struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame3(camera);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:51 +02:00
|
|
|
TRACE("iface %p, camera %p.\n", iface, camera);
|
|
|
|
|
|
|
|
if (!camera || !viewport->camera)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
IDirect3DRMFrame_AddRef(&frame->IDirect3DRMFrame_iface);
|
|
|
|
IDirect3DRMFrame_Release(viewport->camera);
|
|
|
|
viewport->camera = &frame->IDirect3DRMFrame_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetCamera(IDirect3DRMViewport *iface, IDirect3DRMFrame *camera)
|
|
|
|
{
|
2019-08-30 21:23:51 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
struct d3drm_frame *frame = unsafe_impl_from_IDirect3DRMFrame(camera);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2019-08-30 21:23:51 +02:00
|
|
|
TRACE("iface %p, camera %p.\n", iface, camera);
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetCamera(&viewport->IDirect3DRMViewport2_iface,
|
|
|
|
frame ? &frame->IDirect3DRMFrame3_iface : NULL);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetProjection(IDirect3DRMViewport2 *iface, D3DRMPROJECTIONTYPE type)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p, type %#x.\n", iface, type);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
viewport->projection = type;
|
2012-06-07 13:47:02 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetProjection(IDirect3DRMViewport *iface, D3DRMPROJECTIONTYPE type)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, type %#x.\n", iface, type);
|
|
|
|
|
|
|
|
return d3drm_viewport2_SetProjection(&viewport->IDirect3DRMViewport2_iface, type);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Transform(IDirect3DRMViewport2 *iface, D3DRMVECTOR4D *d, D3DVECTOR *s)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Transform(IDirect3DRMViewport *iface, D3DRMVECTOR4D *d, D3DVECTOR *s)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_InverseTransform(IDirect3DRMViewport2 *iface, D3DVECTOR *d, D3DRMVECTOR4D *s)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_InverseTransform(IDirect3DRMViewport *iface, D3DVECTOR *d, D3DRMVECTOR4D *s)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Configure(IDirect3DRMViewport2 *iface,
|
|
|
|
LONG x, LONG y, DWORD width, DWORD height)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, x %d, y %d, width %u, height %u stub!\n", iface, x, y, width, height);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Configure(IDirect3DRMViewport *iface,
|
|
|
|
LONG x, LONG y, DWORD width, DWORD height)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, x %d, y %d, width %u, height %u stub!\n", iface, x, y, width, height);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_ForceUpdate(IDirect3DRMViewport2* iface,
|
|
|
|
DWORD x1, DWORD y1, DWORD x2, DWORD y2)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, x1 %u, y1 %u, x2 %u, y2 %u stub!\n", iface, x1, y1, x2, y2);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_ForceUpdate(IDirect3DRMViewport *iface,
|
|
|
|
DWORD x1, DWORD y1, DWORD x2, DWORD y2)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, x1 %u, y1 %u, x2 %u, y2 %u stub!\n", iface, x1, y1, x2, y2);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_SetPlane(IDirect3DRMViewport2 *iface,
|
|
|
|
D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
|
|
|
|
iface, left, right, bottom, top);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_SetPlane(IDirect3DRMViewport *iface,
|
|
|
|
D3DVALUE left, D3DVALUE right, D3DVALUE bottom, D3DVALUE top)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
|
|
|
|
iface, left, right, bottom, top);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetCamera(IDirect3DRMViewport2 *iface, IDirect3DRMFrame3 **camera)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2019-08-30 21:23:50 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:50 +02:00
|
|
|
TRACE("iface %p, camera %p.\n", iface, camera);
|
|
|
|
|
|
|
|
if (!camera)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
if (!viewport->camera)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
return IDirect3DRMFrame_QueryInterface(viewport->camera, &IID_IDirect3DRMFrame3, (void **)camera);
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetCamera(IDirect3DRMViewport *iface, IDirect3DRMFrame **camera)
|
|
|
|
{
|
2019-08-30 21:23:50 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
struct d3drm_frame *camera_impl;
|
|
|
|
IDirect3DRMFrame3 *camera3;
|
|
|
|
HRESULT hr;
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2019-08-30 21:23:50 +02:00
|
|
|
TRACE("iface %p, camera %p.\n", iface, camera);
|
|
|
|
|
|
|
|
if (!camera)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
if (FAILED(hr = d3drm_viewport2_GetCamera(&viewport->IDirect3DRMViewport2_iface, &camera3)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
camera_impl = unsafe_impl_from_IDirect3DRMFrame3(camera3);
|
|
|
|
*camera = &camera_impl->IDirect3DRMFrame_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetDevice(IDirect3DRMViewport2 *iface, IDirect3DRMDevice3 **device)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2016-07-28 19:18:52 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2016-07-28 19:18:52 +02:00
|
|
|
TRACE("iface %p, device %p.\n", iface, device);
|
|
|
|
|
2019-07-08 17:19:43 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
2016-07-28 19:18:52 +02:00
|
|
|
if (!viewport->device)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
*device = &viewport->device->IDirect3DRMDevice3_iface;
|
|
|
|
IDirect3DRMDevice3_AddRef(*device);
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetDevice(IDirect3DRMViewport *iface, IDirect3DRMDevice **device)
|
|
|
|
{
|
2016-07-28 19:18:52 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2016-07-28 19:18:52 +02:00
|
|
|
TRACE("iface %p, device %p.\n\n", iface, device);
|
|
|
|
|
2019-07-08 17:19:43 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
2016-07-28 19:18:52 +02:00
|
|
|
if (!viewport->device)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
*device = &viewport->device->IDirect3DRMDevice_iface;
|
|
|
|
IDirect3DRMDevice_AddRef(*device);
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetPlane(IDirect3DRMViewport2 *iface,
|
|
|
|
D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2019-08-30 21:23:52 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, left %p, right %p, bottom %p, top %p.\n",
|
2013-11-01 09:41:02 +01:00
|
|
|
iface, left, right, bottom, top);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
if (!viewport->d3d_viewport)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
*left = viewport->clip.left;
|
|
|
|
*right = viewport->clip.right;
|
|
|
|
*bottom = viewport->clip.bottom;
|
|
|
|
*top = viewport->clip.top;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetPlane(IDirect3DRMViewport *iface,
|
|
|
|
D3DVALUE *left, D3DVALUE *right, D3DVALUE *bottom, D3DVALUE *top)
|
|
|
|
{
|
2019-08-30 21:23:52 +02:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, left %p, right %p, bottom %p, top %p.\n",
|
2016-06-29 15:39:03 +02:00
|
|
|
iface, left, right, bottom, top);
|
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
return d3drm_viewport2_GetPlane(&viewport->IDirect3DRMViewport2_iface, left, right, bottom, top);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_Pick(IDirect3DRMViewport2 *iface,
|
2013-08-13 08:51:47 +02:00
|
|
|
LONG x, LONG y, IDirect3DRMPickedArray **visuals)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-08-13 08:51:47 +02:00
|
|
|
FIXME("iface %p, x %d, y %d, visuals %p stub!\n", iface, x, y, visuals);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_Pick(IDirect3DRMViewport *iface,
|
|
|
|
LONG x, LONG y, IDirect3DRMPickedArray **visuals)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, x %d, y %d, visuals %p stub!\n", iface, x, y, visuals);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static BOOL WINAPI d3drm_viewport2_GetUniformScaling(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2015-10-12 21:25:29 +02:00
|
|
|
return FALSE;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static BOOL WINAPI d3drm_viewport1_GetUniformScaling(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static LONG WINAPI d3drm_viewport2_GetX(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static LONG WINAPI d3drm_viewport1_GetX(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static LONG WINAPI d3drm_viewport2_GetY(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static LONG WINAPI d3drm_viewport1_GetY(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static DWORD WINAPI d3drm_viewport2_GetWidth(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static DWORD WINAPI d3drm_viewport1_GetWidth(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static DWORD WINAPI d3drm_viewport2_GetHeight(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p stub!\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static DWORD WINAPI d3drm_viewport1_GetHeight(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport2_GetField(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p.\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
if (!viewport->d3d_viewport)
|
|
|
|
return -1.0f;
|
|
|
|
|
|
|
|
return (viewport->clip.right - viewport->clip.left
|
|
|
|
+ viewport->clip.top - viewport->clip.bottom) / 4.0f;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport1_GetField(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetField(&viewport->IDirect3DRMViewport2_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport2_GetBack(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p.\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
return viewport->clip.back;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport1_GetBack(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetBack(&viewport->IDirect3DRMViewport2_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport2_GetFront(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p.\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2019-08-30 21:23:52 +02:00
|
|
|
return viewport->clip.front;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static D3DVALUE WINAPI d3drm_viewport1_GetFront(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetFront(&viewport->IDirect3DRMViewport2_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static D3DRMPROJECTIONTYPE WINAPI d3drm_viewport2_GetProjection(IDirect3DRMViewport2 *iface)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
TRACE("iface %p.\n", iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
return viewport->projection;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static D3DRMPROJECTIONTYPE WINAPI d3drm_viewport1_GetProjection(IDirect3DRMViewport *iface)
|
|
|
|
{
|
|
|
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetProjection(&viewport->IDirect3DRMViewport2_iface);
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_GetDirect3DViewport(IDirect3DRMViewport2 *iface,
|
2012-11-20 22:40:18 +01:00
|
|
|
IDirect3DViewport **viewport)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2016-07-28 19:18:49 +02:00
|
|
|
struct d3drm_viewport *viewport_object = impl_from_IDirect3DRMViewport2(iface);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
2016-07-28 19:18:49 +02:00
|
|
|
TRACE("iface %p, viewport %p.\n", iface, viewport);
|
|
|
|
|
2019-07-08 17:19:44 +02:00
|
|
|
if (!viewport)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
2016-07-28 19:18:49 +02:00
|
|
|
if (!viewport_object->d3d_viewport)
|
|
|
|
return D3DRMERR_BADOBJECT;
|
|
|
|
|
|
|
|
*viewport = viewport_object->d3d_viewport;
|
|
|
|
IDirect3DViewport_AddRef(*viewport);
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2012-01-17 23:00:50 +01:00
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static HRESULT WINAPI d3drm_viewport1_GetDirect3DViewport(IDirect3DRMViewport *iface,
|
|
|
|
IDirect3DViewport **viewport)
|
|
|
|
{
|
2016-07-28 19:18:49 +02:00
|
|
|
struct d3drm_viewport *viewport_object = impl_from_IDirect3DRMViewport(iface);
|
2016-06-29 15:39:03 +02:00
|
|
|
|
2016-07-28 19:18:49 +02:00
|
|
|
TRACE("iface %p, viewport %p.\n", iface, viewport);
|
|
|
|
|
|
|
|
return d3drm_viewport2_GetDirect3DViewport(&viewport_object->IDirect3DRMViewport2_iface, viewport);
|
2016-06-29 15:39:03 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_TransformVectors(IDirect3DRMViewport2 *iface,
|
|
|
|
DWORD vector_count, D3DRMVECTOR4D *dst, D3DVECTOR *src)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, vector_count %u, dst %p, src %p stub!\n", iface, vector_count, dst, src);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static HRESULT WINAPI d3drm_viewport2_InverseTransformVectors(IDirect3DRMViewport2 *iface,
|
|
|
|
DWORD vector_count, D3DVECTOR *dst, D3DRMVECTOR4D *src)
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
FIXME("iface %p, vector_count %u, dst %p, src %p stub!\n", iface, vector_count, dst, src);
|
2012-01-17 23:00:50 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
static const struct IDirect3DRMViewport2Vtbl d3drm_viewport2_vtbl =
|
2012-01-17 23:00:50 +01:00
|
|
|
{
|
2013-11-01 09:41:02 +01:00
|
|
|
d3drm_viewport2_QueryInterface,
|
|
|
|
d3drm_viewport2_AddRef,
|
|
|
|
d3drm_viewport2_Release,
|
|
|
|
d3drm_viewport2_Clone,
|
|
|
|
d3drm_viewport2_AddDestroyCallback,
|
|
|
|
d3drm_viewport2_DeleteDestroyCallback,
|
|
|
|
d3drm_viewport2_SetAppData,
|
|
|
|
d3drm_viewport2_GetAppData,
|
|
|
|
d3drm_viewport2_SetName,
|
|
|
|
d3drm_viewport2_GetName,
|
|
|
|
d3drm_viewport2_GetClassName,
|
|
|
|
d3drm_viewport2_Init,
|
|
|
|
d3drm_viewport2_Clear,
|
|
|
|
d3drm_viewport2_Render,
|
|
|
|
d3drm_viewport2_SetFront,
|
|
|
|
d3drm_viewport2_SetBack,
|
|
|
|
d3drm_viewport2_SetField,
|
|
|
|
d3drm_viewport2_SetUniformScaling,
|
|
|
|
d3drm_viewport2_SetCamera,
|
|
|
|
d3drm_viewport2_SetProjection,
|
|
|
|
d3drm_viewport2_Transform,
|
|
|
|
d3drm_viewport2_InverseTransform,
|
|
|
|
d3drm_viewport2_Configure,
|
|
|
|
d3drm_viewport2_ForceUpdate,
|
|
|
|
d3drm_viewport2_SetPlane,
|
|
|
|
d3drm_viewport2_GetCamera,
|
|
|
|
d3drm_viewport2_GetDevice,
|
|
|
|
d3drm_viewport2_GetPlane,
|
|
|
|
d3drm_viewport2_Pick,
|
|
|
|
d3drm_viewport2_GetUniformScaling,
|
|
|
|
d3drm_viewport2_GetX,
|
|
|
|
d3drm_viewport2_GetY,
|
|
|
|
d3drm_viewport2_GetWidth,
|
|
|
|
d3drm_viewport2_GetHeight,
|
|
|
|
d3drm_viewport2_GetField,
|
|
|
|
d3drm_viewport2_GetBack,
|
|
|
|
d3drm_viewport2_GetFront,
|
|
|
|
d3drm_viewport2_GetProjection,
|
|
|
|
d3drm_viewport2_GetDirect3DViewport,
|
|
|
|
d3drm_viewport2_TransformVectors,
|
|
|
|
d3drm_viewport2_InverseTransformVectors,
|
2012-01-17 23:00:50 +01:00
|
|
|
};
|
|
|
|
|
2016-06-29 15:39:03 +02:00
|
|
|
static const struct IDirect3DRMViewportVtbl d3drm_viewport1_vtbl =
|
|
|
|
{
|
|
|
|
d3drm_viewport1_QueryInterface,
|
|
|
|
d3drm_viewport1_AddRef,
|
|
|
|
d3drm_viewport1_Release,
|
|
|
|
d3drm_viewport1_Clone,
|
|
|
|
d3drm_viewport1_AddDestroyCallback,
|
|
|
|
d3drm_viewport1_DeleteDestroyCallback,
|
|
|
|
d3drm_viewport1_SetAppData,
|
|
|
|
d3drm_viewport1_GetAppData,
|
|
|
|
d3drm_viewport1_SetName,
|
|
|
|
d3drm_viewport1_GetName,
|
|
|
|
d3drm_viewport1_GetClassName,
|
|
|
|
d3drm_viewport1_Init,
|
|
|
|
d3drm_viewport1_Clear,
|
|
|
|
d3drm_viewport1_Render,
|
|
|
|
d3drm_viewport1_SetFront,
|
|
|
|
d3drm_viewport1_SetBack,
|
|
|
|
d3drm_viewport1_SetField,
|
|
|
|
d3drm_viewport1_SetUniformScaling,
|
|
|
|
d3drm_viewport1_SetCamera,
|
|
|
|
d3drm_viewport1_SetProjection,
|
|
|
|
d3drm_viewport1_Transform,
|
|
|
|
d3drm_viewport1_InverseTransform,
|
|
|
|
d3drm_viewport1_Configure,
|
|
|
|
d3drm_viewport1_ForceUpdate,
|
|
|
|
d3drm_viewport1_SetPlane,
|
|
|
|
d3drm_viewport1_GetCamera,
|
|
|
|
d3drm_viewport1_GetDevice,
|
|
|
|
d3drm_viewport1_GetPlane,
|
|
|
|
d3drm_viewport1_Pick,
|
|
|
|
d3drm_viewport1_GetUniformScaling,
|
|
|
|
d3drm_viewport1_GetX,
|
|
|
|
d3drm_viewport1_GetY,
|
|
|
|
d3drm_viewport1_GetWidth,
|
|
|
|
d3drm_viewport1_GetHeight,
|
|
|
|
d3drm_viewport1_GetField,
|
|
|
|
d3drm_viewport1_GetBack,
|
|
|
|
d3drm_viewport1_GetFront,
|
|
|
|
d3drm_viewport1_GetProjection,
|
|
|
|
d3drm_viewport1_GetDirect3DViewport,
|
|
|
|
};
|
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm)
|
2012-01-17 23:00:17 +01:00
|
|
|
{
|
2017-06-06 13:10:34 +02:00
|
|
|
static const char classname[] = "Viewport";
|
2013-11-01 09:41:02 +01:00
|
|
|
struct d3drm_viewport *object;
|
2012-01-17 23:00:17 +01:00
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
|
2012-01-17 23:00:17 +01:00
|
|
|
|
2018-02-08 22:58:47 +01:00
|
|
|
if (!(object = heap_alloc_zero(sizeof(*object))))
|
2012-01-17 23:00:17 +01:00
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-11-01 09:41:02 +01:00
|
|
|
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
|
|
|
|
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
|
2016-06-19 21:28:09 +02:00
|
|
|
object->d3drm = d3drm;
|
2017-06-06 13:10:34 +02:00
|
|
|
d3drm_object_init(&object->obj, classname);
|
2012-01-17 23:00:17 +01:00
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
*viewport = object;
|
2012-01-17 23:00:17 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|