2 * Implementation of IDirect3DRMViewport Interface
4 * Copyright 2012 André Hentschel
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
24 #include "d3drm_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3drm
);
28 static inline struct d3drm_viewport
*impl_from_IDirect3DRMViewport(IDirect3DRMViewport
*iface
)
30 return CONTAINING_RECORD(iface
, struct d3drm_viewport
, IDirect3DRMViewport_iface
);
33 static inline struct d3drm_viewport
*impl_from_IDirect3DRMViewport2(IDirect3DRMViewport2
*iface
)
35 return CONTAINING_RECORD(iface
, struct d3drm_viewport
, IDirect3DRMViewport2_iface
);
38 static inline void d3drm_normalize_d3d_color(D3DCOLORVALUE
*color_value
, D3DCOLOR color
)
40 color_value
->u1
.r
= RGBA_GETRED(color
) / 255.0f
;
41 color_value
->u2
.g
= RGBA_GETGREEN(color
) / 255.0f
;
42 color_value
->u3
.b
= RGBA_GETBLUE(color
) / 255.0f
;
43 color_value
->u4
.a
= RGBA_GETALPHA(color
) / 255.0f
;
46 static HRESULT
d3drm_update_background_material(struct d3drm_viewport
*viewport
)
48 IDirect3DRMFrame
*root_frame
;
53 if (FAILED(hr
= IDirect3DRMFrame_GetScene(viewport
->camera
, &root_frame
)))
55 color
= IDirect3DRMFrame_GetSceneBackground(root_frame
);
57 memset(&mat
, 0, sizeof(mat
));
58 mat
.dwSize
= sizeof(mat
);
59 d3drm_normalize_d3d_color(&mat
.u
.diffuse
, color
);
61 return IDirect3DMaterial_SetMaterial(viewport
->material
, &mat
);
64 static void d3drm_viewport_destroy(struct d3drm_viewport
*viewport
)
66 TRACE("viewport %p releasing attached interfaces.\n", viewport
);
68 d3drm_object_cleanup((IDirect3DRMObject
*)&viewport
->IDirect3DRMViewport_iface
, &viewport
->obj
);
70 if (viewport
->d3d_viewport
)
72 IDirect3DViewport_Release(viewport
->d3d_viewport
);
73 IDirect3DMaterial_Release(viewport
->material
);
74 IDirect3DRMFrame_Release(viewport
->camera
);
75 IDirect3DRM_Release(viewport
->d3drm
);
78 HeapFree(GetProcessHeap(), 0, viewport
);
81 static HRESULT WINAPI
d3drm_viewport2_QueryInterface(IDirect3DRMViewport2
*iface
, REFIID riid
, void **out
)
83 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
85 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
87 if (IsEqualGUID(riid
, &IID_IDirect3DRMViewport
)
88 || IsEqualGUID(riid
, &IID_IDirect3DRMObject
)
89 || IsEqualGUID(riid
, &IID_IUnknown
))
91 *out
= &viewport
->IDirect3DRMViewport_iface
;
93 else if (IsEqualGUID(riid
, &IID_IDirect3DRMViewport2
))
95 *out
= &viewport
->IDirect3DRMViewport2_iface
;
100 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid
));
101 return CLASS_E_CLASSNOTAVAILABLE
;
104 IUnknown_AddRef((IUnknown
*)*out
);
108 static HRESULT WINAPI
d3drm_viewport1_QueryInterface(IDirect3DRMViewport
*iface
, REFIID riid
, void **out
)
110 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
112 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
114 return d3drm_viewport2_QueryInterface(&viewport
->IDirect3DRMViewport2_iface
, riid
, out
);
117 static ULONG WINAPI
d3drm_viewport2_AddRef(IDirect3DRMViewport2
*iface
)
119 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
120 ULONG refcount
= InterlockedIncrement(&viewport
->obj
.ref
);
122 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
127 static ULONG WINAPI
d3drm_viewport1_AddRef(IDirect3DRMViewport
*iface
)
129 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
131 TRACE("iface %p.\n", iface
);
133 return d3drm_viewport2_AddRef(&viewport
->IDirect3DRMViewport2_iface
);
136 static ULONG WINAPI
d3drm_viewport2_Release(IDirect3DRMViewport2
*iface
)
138 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
139 ULONG refcount
= InterlockedDecrement(&viewport
->obj
.ref
);
141 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
144 d3drm_viewport_destroy(viewport
);
149 static ULONG WINAPI
d3drm_viewport1_Release(IDirect3DRMViewport
*iface
)
151 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
153 TRACE("iface %p.\n", iface
);
155 return d3drm_viewport2_Release(&viewport
->IDirect3DRMViewport2_iface
);
158 static HRESULT WINAPI
d3drm_viewport2_Clone(IDirect3DRMViewport2
*iface
,
159 IUnknown
*outer
, REFIID iid
, void **out
)
161 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
166 static HRESULT WINAPI
d3drm_viewport1_Clone(IDirect3DRMViewport
*iface
,
167 IUnknown
*outer
, REFIID iid
, void **out
)
169 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface
, outer
, debugstr_guid(iid
), out
);
174 static HRESULT WINAPI
d3drm_viewport2_AddDestroyCallback(IDirect3DRMViewport2
*iface
,
175 D3DRMOBJECTCALLBACK cb
, void *ctx
)
177 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
179 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
181 return d3drm_object_add_destroy_callback(&viewport
->obj
, cb
, ctx
);
184 static HRESULT WINAPI
d3drm_viewport1_AddDestroyCallback(IDirect3DRMViewport
*iface
,
185 D3DRMOBJECTCALLBACK cb
, void *ctx
)
187 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
189 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
191 return d3drm_viewport2_AddDestroyCallback(&viewport
->IDirect3DRMViewport2_iface
, cb
, ctx
);
194 static HRESULT WINAPI
d3drm_viewport2_DeleteDestroyCallback(IDirect3DRMViewport2
*iface
,
195 D3DRMOBJECTCALLBACK cb
, void *ctx
)
197 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
199 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
201 return d3drm_object_delete_destroy_callback(&viewport
->obj
, cb
, ctx
);
204 static HRESULT WINAPI
d3drm_viewport1_DeleteDestroyCallback(IDirect3DRMViewport
*iface
,
205 D3DRMOBJECTCALLBACK cb
, void *ctx
)
207 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
209 TRACE("iface %p, cb %p, ctx %p\n", iface
, cb
, ctx
);
211 return d3drm_viewport2_DeleteDestroyCallback(&viewport
->IDirect3DRMViewport2_iface
, cb
, ctx
);
214 static HRESULT WINAPI
d3drm_viewport2_SetAppData(IDirect3DRMViewport2
*iface
, DWORD data
)
216 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
218 TRACE("iface %p, data %#x\n", iface
, data
);
220 viewport
->obj
.appdata
= data
;
224 static HRESULT WINAPI
d3drm_viewport1_SetAppData(IDirect3DRMViewport
*iface
, DWORD data
)
226 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
228 TRACE("iface %p, data %#x\n", iface
, data
);
230 return d3drm_viewport2_SetAppData(&viewport
->IDirect3DRMViewport2_iface
, data
);
233 static DWORD WINAPI
d3drm_viewport2_GetAppData(IDirect3DRMViewport2
*iface
)
235 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
237 TRACE("iface %p\n", iface
);
239 return viewport
->obj
.appdata
;
242 static DWORD WINAPI
d3drm_viewport1_GetAppData(IDirect3DRMViewport
*iface
)
244 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
246 TRACE("iface %p.\n", iface
);
248 return d3drm_viewport2_GetAppData(&viewport
->IDirect3DRMViewport2_iface
);
251 static HRESULT WINAPI
d3drm_viewport2_SetName(IDirect3DRMViewport2
*iface
, const char *name
)
253 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
255 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
257 return d3drm_object_set_name(&viewport
->obj
, name
);
260 static HRESULT WINAPI
d3drm_viewport1_SetName(IDirect3DRMViewport
*iface
, const char *name
)
262 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
264 TRACE("iface %p, name %s.\n", iface
, debugstr_a(name
));
266 return d3drm_viewport2_SetName(&viewport
->IDirect3DRMViewport2_iface
, name
);
269 static HRESULT WINAPI
d3drm_viewport2_GetName(IDirect3DRMViewport2
*iface
, DWORD
*size
, char *name
)
271 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
273 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
275 return d3drm_object_get_name(&viewport
->obj
, size
, name
);
278 static HRESULT WINAPI
d3drm_viewport1_GetName(IDirect3DRMViewport
*iface
, DWORD
*size
, char *name
)
280 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
282 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
284 return d3drm_viewport2_GetName(&viewport
->IDirect3DRMViewport2_iface
, size
, name
);
287 static HRESULT WINAPI
d3drm_viewport2_GetClassName(IDirect3DRMViewport2
*iface
, DWORD
*size
, char *name
)
289 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
291 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
293 return d3drm_object_get_class_name(&viewport
->obj
, size
, name
);
296 static HRESULT WINAPI
d3drm_viewport1_GetClassName(IDirect3DRMViewport
*iface
, DWORD
*size
, char *name
)
298 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
300 TRACE("iface %p, size %p, name %p.\n", iface
, size
, name
);
302 return d3drm_viewport2_GetClassName(&viewport
->IDirect3DRMViewport2_iface
, size
, name
);
305 static HRESULT WINAPI
d3drm_viewport2_Init(IDirect3DRMViewport2
*iface
, IDirect3DRMDevice3
*device
,
306 IDirect3DRMFrame3
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
)
308 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
309 struct d3drm_device
*device_obj
= unsafe_impl_from_IDirect3DRMDevice3(device
);
312 IDirect3D
*d3d1
= NULL
;
313 IDirect3DDevice
*d3d_device
= NULL
;
314 IDirect3DMaterial
*material
= NULL
;
315 D3DMATERIALHANDLE hmat
;
316 HRESULT hr
= D3DRM_OK
;
318 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u.\n",
319 iface
, device
, camera
, x
, y
, width
, height
);
321 if (!device_obj
|| !camera
322 || width
> device_obj
->width
323 || height
> device_obj
->height
)
325 return D3DRMERR_BADOBJECT
;
328 if (viewport
->d3d_viewport
)
329 return D3DRMERR_BADOBJECT
;
331 IDirect3DRM_AddRef(viewport
->d3drm
);
333 if (FAILED(hr
= IDirect3DRMDevice3_GetDirect3DDevice(device
, &d3d_device
)))
336 if (FAILED(hr
= IDirect3DDevice_GetDirect3D(d3d_device
, &d3d1
)))
339 if (FAILED(hr
= IDirect3D_CreateViewport(d3d1
, &viewport
->d3d_viewport
, NULL
)))
342 vp
.dwSize
= sizeof(vp
);
344 vp
.dwHeight
= height
;
347 scale
= width
> height
? (float)width
/ 2.0f
: (float)height
/ 2.0f
;
350 vp
.dvMaxX
= vp
.dwWidth
/ (2.0f
* vp
.dvScaleX
);
351 vp
.dvMaxY
= vp
.dwHeight
/ (2.0f
* vp
.dvScaleY
);
355 if (FAILED(hr
= IDirect3DViewport_SetViewport(viewport
->d3d_viewport
, &vp
)))
358 if (FAILED(hr
= IDirect3DDevice_AddViewport(d3d_device
, viewport
->d3d_viewport
)))
361 if (FAILED(hr
= IDirect3DRMFrame3_QueryInterface(camera
, &IID_IDirect3DRMFrame
, (void **)&viewport
->camera
)))
364 if (FAILED(hr
= IDirect3D_CreateMaterial(d3d1
, &material
, NULL
)))
367 if (FAILED(hr
= IDirect3DMaterial_GetHandle(material
, d3d_device
, &hmat
)))
370 hr
= IDirect3DViewport_SetBackground(viewport
->d3d_viewport
, hmat
);
371 viewport
->material
= material
;
372 viewport
->device
= device_obj
;
378 if (viewport
->d3d_viewport
)
380 IDirect3DViewport_Release(viewport
->d3d_viewport
);
381 viewport
->d3d_viewport
= NULL
;
383 if (viewport
->camera
)
384 IDirect3DRMFrame_Release(viewport
->camera
);
386 IDirect3DMaterial_Release(material
);
387 IDirect3DRM_Release(viewport
->d3drm
);
390 IDirect3DDevice_Release(d3d_device
);
392 IDirect3D_Release(d3d1
);
397 static HRESULT WINAPI
d3drm_viewport1_Init(IDirect3DRMViewport
*iface
, IDirect3DRMDevice
*device
,
398 IDirect3DRMFrame
*camera
, DWORD x
, DWORD y
, DWORD width
, DWORD height
)
400 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
401 struct d3drm_frame
*frame
= unsafe_impl_from_IDirect3DRMFrame(camera
);
402 IDirect3DRMDevice3
*device3
;
405 TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u.\n",
406 iface
, device
, camera
, x
, y
, width
, height
);
408 if (!device
|| !frame
)
409 return D3DRMERR_BADOBJECT
;
411 if (FAILED(hr
= IDirect3DRMDevice_QueryInterface(device
, &IID_IDirect3DRMDevice3
, (void **)&device3
)))
414 hr
= d3drm_viewport2_Init(&viewport
->IDirect3DRMViewport2_iface
, device3
, &frame
->IDirect3DRMFrame3_iface
,
415 x
, y
, width
, height
);
416 IDirect3DRMDevice3_Release(device3
);
421 static HRESULT WINAPI
d3drm_viewport2_Clear(IDirect3DRMViewport2
*iface
, DWORD flags
)
423 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
424 DDSCAPS caps
= { DDSCAPS_ZBUFFER
};
427 IDirectDrawSurface
*ds
;
428 DWORD clear_flags
= 0;
430 TRACE("iface %p, flags %#x.\n", iface
, flags
);
432 clear_rect
.u1
.x1
= clear_rect
.u2
.y1
= 0;
433 clear_rect
.u3
.x2
= viewport
->device
->width
;
434 clear_rect
.u4
.y2
= viewport
->device
->height
;
436 if (flags
& D3DRMCLEAR_TARGET
)
438 clear_flags
|= D3DCLEAR_TARGET
;
439 d3drm_update_background_material(viewport
);
441 if (flags
& D3DRMCLEAR_ZBUFFER
)
443 hr
= IDirectDrawSurface_GetAttachedSurface(viewport
->device
->render_target
, &caps
, &ds
);
446 clear_flags
|= D3DCLEAR_ZBUFFER
;
447 IDirectDrawSurface_Release(ds
);
450 if (flags
& D3DRMCLEAR_DIRTYRECTS
)
451 FIXME("Flag D3DRMCLEAR_DIRTYRECT not implemented yet.\n");
453 if (FAILED(hr
= IDirect3DViewport_Clear(viewport
->d3d_viewport
, 1, &clear_rect
, clear_flags
)))
459 static HRESULT WINAPI
d3drm_viewport1_Clear(IDirect3DRMViewport
*iface
)
461 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
463 TRACE("iface %p.\n", iface
);
465 return d3drm_viewport2_Clear(&viewport
->IDirect3DRMViewport2_iface
, D3DRMCLEAR_ALL
);
468 static HRESULT WINAPI
d3drm_viewport2_Render(IDirect3DRMViewport2
*iface
, IDirect3DRMFrame3
*frame
)
470 FIXME("iface %p, frame %p stub!\n", iface
, frame
);
475 static HRESULT WINAPI
d3drm_viewport1_Render(IDirect3DRMViewport
*iface
, IDirect3DRMFrame
*frame
)
477 FIXME("iface %p, frame %p stub!\n", iface
, frame
);
482 static HRESULT WINAPI
d3drm_viewport2_SetFront(IDirect3DRMViewport2
*iface
, D3DVALUE front
)
484 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
486 TRACE("iface %p, front %.8e.\n", iface
, front
);
488 viewport
->front
= front
;
493 static HRESULT WINAPI
d3drm_viewport1_SetFront(IDirect3DRMViewport
*iface
, D3DVALUE front
)
495 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
497 TRACE("iface %p, front %.8e.\n", iface
, front
);
499 return d3drm_viewport2_SetFront(&viewport
->IDirect3DRMViewport2_iface
, front
);
502 static HRESULT WINAPI
d3drm_viewport2_SetBack(IDirect3DRMViewport2
*iface
, D3DVALUE back
)
504 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
506 TRACE("iface %p, back %.8e.\n", iface
, back
);
508 viewport
->back
= back
;
513 static HRESULT WINAPI
d3drm_viewport1_SetBack(IDirect3DRMViewport
*iface
, D3DVALUE back
)
515 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
517 TRACE("iface %p, back %.8e.\n", iface
, back
);
519 return d3drm_viewport2_SetBack(&viewport
->IDirect3DRMViewport2_iface
, back
);
522 static HRESULT WINAPI
d3drm_viewport2_SetField(IDirect3DRMViewport2
*iface
, D3DVALUE field
)
524 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
526 TRACE("iface %p, field %.8e.\n", iface
, field
);
528 viewport
->field
= field
;
533 static HRESULT WINAPI
d3drm_viewport1_SetField(IDirect3DRMViewport
*iface
, D3DVALUE field
)
535 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
537 TRACE("iface %p, field %.8e.\n", iface
, field
);
539 return d3drm_viewport2_SetField(&viewport
->IDirect3DRMViewport2_iface
, field
);
542 static HRESULT WINAPI
d3drm_viewport2_SetUniformScaling(IDirect3DRMViewport2
*iface
, BOOL b
)
544 FIXME("iface %p, b %#x stub!\n", iface
, b
);
549 static HRESULT WINAPI
d3drm_viewport1_SetUniformScaling(IDirect3DRMViewport
*iface
, BOOL b
)
551 FIXME("iface %p, b %#x stub!\n", iface
, b
);
556 static HRESULT WINAPI
d3drm_viewport2_SetCamera(IDirect3DRMViewport2
*iface
, IDirect3DRMFrame3
*camera
)
558 FIXME("iface %p, camera %p stub!\n", iface
, camera
);
563 static HRESULT WINAPI
d3drm_viewport1_SetCamera(IDirect3DRMViewport
*iface
, IDirect3DRMFrame
*camera
)
565 FIXME("iface %p, camera %p stub!\n", iface
, camera
);
570 static HRESULT WINAPI
d3drm_viewport2_SetProjection(IDirect3DRMViewport2
*iface
, D3DRMPROJECTIONTYPE type
)
572 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
574 TRACE("iface %p, type %#x.\n", iface
, type
);
576 viewport
->projection
= type
;
581 static HRESULT WINAPI
d3drm_viewport1_SetProjection(IDirect3DRMViewport
*iface
, D3DRMPROJECTIONTYPE type
)
583 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
585 TRACE("iface %p, type %#x.\n", iface
, type
);
587 return d3drm_viewport2_SetProjection(&viewport
->IDirect3DRMViewport2_iface
, type
);
590 static HRESULT WINAPI
d3drm_viewport2_Transform(IDirect3DRMViewport2
*iface
, D3DRMVECTOR4D
*d
, D3DVECTOR
*s
)
592 FIXME("iface %p, d %p, s %p stub!\n", iface
, d
, s
);
597 static HRESULT WINAPI
d3drm_viewport1_Transform(IDirect3DRMViewport
*iface
, D3DRMVECTOR4D
*d
, D3DVECTOR
*s
)
599 FIXME("iface %p, d %p, s %p stub!\n", iface
, d
, s
);
604 static HRESULT WINAPI
d3drm_viewport2_InverseTransform(IDirect3DRMViewport2
*iface
, D3DVECTOR
*d
, D3DRMVECTOR4D
*s
)
606 FIXME("iface %p, d %p, s %p stub!\n", iface
, d
, s
);
611 static HRESULT WINAPI
d3drm_viewport1_InverseTransform(IDirect3DRMViewport
*iface
, D3DVECTOR
*d
, D3DRMVECTOR4D
*s
)
613 FIXME("iface %p, d %p, s %p stub!\n", iface
, d
, s
);
618 static HRESULT WINAPI
d3drm_viewport2_Configure(IDirect3DRMViewport2
*iface
,
619 LONG x
, LONG y
, DWORD width
, DWORD height
)
621 FIXME("iface %p, x %d, y %d, width %u, height %u stub!\n", iface
, x
, y
, width
, height
);
626 static HRESULT WINAPI
d3drm_viewport1_Configure(IDirect3DRMViewport
*iface
,
627 LONG x
, LONG y
, DWORD width
, DWORD height
)
629 FIXME("iface %p, x %d, y %d, width %u, height %u stub!\n", iface
, x
, y
, width
, height
);
634 static HRESULT WINAPI
d3drm_viewport2_ForceUpdate(IDirect3DRMViewport2
* iface
,
635 DWORD x1
, DWORD y1
, DWORD x2
, DWORD y2
)
637 FIXME("iface %p, x1 %u, y1 %u, x2 %u, y2 %u stub!\n", iface
, x1
, y1
, x2
, y2
);
642 static HRESULT WINAPI
d3drm_viewport1_ForceUpdate(IDirect3DRMViewport
*iface
,
643 DWORD x1
, DWORD y1
, DWORD x2
, DWORD y2
)
645 FIXME("iface %p, x1 %u, y1 %u, x2 %u, y2 %u stub!\n", iface
, x1
, y1
, x2
, y2
);
650 static HRESULT WINAPI
d3drm_viewport2_SetPlane(IDirect3DRMViewport2
*iface
,
651 D3DVALUE left
, D3DVALUE right
, D3DVALUE bottom
, D3DVALUE top
)
653 FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
654 iface
, left
, right
, bottom
, top
);
659 static HRESULT WINAPI
d3drm_viewport1_SetPlane(IDirect3DRMViewport
*iface
,
660 D3DVALUE left
, D3DVALUE right
, D3DVALUE bottom
, D3DVALUE top
)
662 FIXME("iface %p, left %.8e, right %.8e, bottom %.8e, top %.8e stub!\n",
663 iface
, left
, right
, bottom
, top
);
668 static HRESULT WINAPI
d3drm_viewport2_GetCamera(IDirect3DRMViewport2
*iface
, IDirect3DRMFrame3
**camera
)
670 FIXME("iface %p, camera %p stub!\n", iface
, camera
);
675 static HRESULT WINAPI
d3drm_viewport1_GetCamera(IDirect3DRMViewport
*iface
, IDirect3DRMFrame
**camera
)
677 FIXME("iface %p, camera %p stub!\n", iface
, camera
);
682 static HRESULT WINAPI
d3drm_viewport2_GetDevice(IDirect3DRMViewport2
*iface
, IDirect3DRMDevice3
**device
)
684 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
686 TRACE("iface %p, device %p.\n", iface
, device
);
688 if (!viewport
->device
)
689 return D3DRMERR_BADOBJECT
;
691 *device
= &viewport
->device
->IDirect3DRMDevice3_iface
;
692 IDirect3DRMDevice3_AddRef(*device
);
697 static HRESULT WINAPI
d3drm_viewport1_GetDevice(IDirect3DRMViewport
*iface
, IDirect3DRMDevice
**device
)
699 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
701 TRACE("iface %p, device %p.\n\n", iface
, device
);
703 if (!viewport
->device
)
704 return D3DRMERR_BADOBJECT
;
706 *device
= &viewport
->device
->IDirect3DRMDevice_iface
;
707 IDirect3DRMDevice_AddRef(*device
);
712 static HRESULT WINAPI
d3drm_viewport2_GetPlane(IDirect3DRMViewport2
*iface
,
713 D3DVALUE
*left
, D3DVALUE
*right
, D3DVALUE
*bottom
, D3DVALUE
*top
)
715 FIXME("iface %p, left %p, right %p, bottom %p, top %p stub!\n",
716 iface
, left
, right
, bottom
, top
);
721 static HRESULT WINAPI
d3drm_viewport1_GetPlane(IDirect3DRMViewport
*iface
,
722 D3DVALUE
*left
, D3DVALUE
*right
, D3DVALUE
*bottom
, D3DVALUE
*top
)
724 FIXME("iface %p, left %p, right %p, bottom %p, top %p stub!\n",
725 iface
, left
, right
, bottom
, top
);
730 static HRESULT WINAPI
d3drm_viewport2_Pick(IDirect3DRMViewport2
*iface
,
731 LONG x
, LONG y
, IDirect3DRMPickedArray
**visuals
)
733 FIXME("iface %p, x %d, y %d, visuals %p stub!\n", iface
, x
, y
, visuals
);
738 static HRESULT WINAPI
d3drm_viewport1_Pick(IDirect3DRMViewport
*iface
,
739 LONG x
, LONG y
, IDirect3DRMPickedArray
**visuals
)
741 FIXME("iface %p, x %d, y %d, visuals %p stub!\n", iface
, x
, y
, visuals
);
746 static BOOL WINAPI
d3drm_viewport2_GetUniformScaling(IDirect3DRMViewport2
*iface
)
748 FIXME("iface %p stub!\n", iface
);
753 static BOOL WINAPI
d3drm_viewport1_GetUniformScaling(IDirect3DRMViewport
*iface
)
755 FIXME("iface %p stub!\n", iface
);
760 static LONG WINAPI
d3drm_viewport2_GetX(IDirect3DRMViewport2
*iface
)
762 FIXME("iface %p stub!\n", iface
);
767 static LONG WINAPI
d3drm_viewport1_GetX(IDirect3DRMViewport
*iface
)
769 FIXME("iface %p stub!\n", iface
);
774 static LONG WINAPI
d3drm_viewport2_GetY(IDirect3DRMViewport2
*iface
)
776 FIXME("iface %p stub!\n", iface
);
781 static LONG WINAPI
d3drm_viewport1_GetY(IDirect3DRMViewport
*iface
)
783 FIXME("iface %p stub!\n", iface
);
788 static DWORD WINAPI
d3drm_viewport2_GetWidth(IDirect3DRMViewport2
*iface
)
790 FIXME("iface %p stub!\n", iface
);
795 static DWORD WINAPI
d3drm_viewport1_GetWidth(IDirect3DRMViewport
*iface
)
797 FIXME("iface %p stub!\n", iface
);
802 static DWORD WINAPI
d3drm_viewport2_GetHeight(IDirect3DRMViewport2
*iface
)
804 FIXME("iface %p stub!\n", iface
);
809 static DWORD WINAPI
d3drm_viewport1_GetHeight(IDirect3DRMViewport
*iface
)
811 FIXME("iface %p stub!\n", iface
);
816 static D3DVALUE WINAPI
d3drm_viewport2_GetField(IDirect3DRMViewport2
*iface
)
818 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
820 TRACE("iface %p.\n", iface
);
822 return viewport
->field
;
825 static D3DVALUE WINAPI
d3drm_viewport1_GetField(IDirect3DRMViewport
*iface
)
827 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
829 TRACE("iface %p.\n", iface
);
831 return d3drm_viewport2_GetField(&viewport
->IDirect3DRMViewport2_iface
);
834 static D3DVALUE WINAPI
d3drm_viewport2_GetBack(IDirect3DRMViewport2
*iface
)
836 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
838 TRACE("iface %p.\n", iface
);
840 return viewport
->back
;
843 static D3DVALUE WINAPI
d3drm_viewport1_GetBack(IDirect3DRMViewport
*iface
)
845 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
847 TRACE("iface %p.\n", iface
);
849 return d3drm_viewport2_GetBack(&viewport
->IDirect3DRMViewport2_iface
);
852 static D3DVALUE WINAPI
d3drm_viewport2_GetFront(IDirect3DRMViewport2
*iface
)
854 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
856 TRACE("iface %p.\n", iface
);
858 return viewport
->front
;
861 static D3DVALUE WINAPI
d3drm_viewport1_GetFront(IDirect3DRMViewport
*iface
)
863 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
865 TRACE("iface %p.\n", iface
);
867 return d3drm_viewport2_GetFront(&viewport
->IDirect3DRMViewport2_iface
);
870 static D3DRMPROJECTIONTYPE WINAPI
d3drm_viewport2_GetProjection(IDirect3DRMViewport2
*iface
)
872 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport2(iface
);
874 TRACE("iface %p.\n", iface
);
876 return viewport
->projection
;
879 static D3DRMPROJECTIONTYPE WINAPI
d3drm_viewport1_GetProjection(IDirect3DRMViewport
*iface
)
881 struct d3drm_viewport
*viewport
= impl_from_IDirect3DRMViewport(iface
);
883 TRACE("iface %p.\n", iface
);
885 return d3drm_viewport2_GetProjection(&viewport
->IDirect3DRMViewport2_iface
);
888 static HRESULT WINAPI
d3drm_viewport2_GetDirect3DViewport(IDirect3DRMViewport2
*iface
,
889 IDirect3DViewport
**viewport
)
891 struct d3drm_viewport
*viewport_object
= impl_from_IDirect3DRMViewport2(iface
);
893 TRACE("iface %p, viewport %p.\n", iface
, viewport
);
895 if (!viewport_object
->d3d_viewport
)
896 return D3DRMERR_BADOBJECT
;
898 *viewport
= viewport_object
->d3d_viewport
;
899 IDirect3DViewport_AddRef(*viewport
);
904 static HRESULT WINAPI
d3drm_viewport1_GetDirect3DViewport(IDirect3DRMViewport
*iface
,
905 IDirect3DViewport
**viewport
)
907 struct d3drm_viewport
*viewport_object
= impl_from_IDirect3DRMViewport(iface
);
909 TRACE("iface %p, viewport %p.\n", iface
, viewport
);
911 return d3drm_viewport2_GetDirect3DViewport(&viewport_object
->IDirect3DRMViewport2_iface
, viewport
);
914 static HRESULT WINAPI
d3drm_viewport2_TransformVectors(IDirect3DRMViewport2
*iface
,
915 DWORD vector_count
, D3DRMVECTOR4D
*dst
, D3DVECTOR
*src
)
917 FIXME("iface %p, vector_count %u, dst %p, src %p stub!\n", iface
, vector_count
, dst
, src
);
922 static HRESULT WINAPI
d3drm_viewport2_InverseTransformVectors(IDirect3DRMViewport2
*iface
,
923 DWORD vector_count
, D3DVECTOR
*dst
, D3DRMVECTOR4D
*src
)
925 FIXME("iface %p, vector_count %u, dst %p, src %p stub!\n", iface
, vector_count
, dst
, src
);
930 static const struct IDirect3DRMViewport2Vtbl d3drm_viewport2_vtbl
=
932 d3drm_viewport2_QueryInterface
,
933 d3drm_viewport2_AddRef
,
934 d3drm_viewport2_Release
,
935 d3drm_viewport2_Clone
,
936 d3drm_viewport2_AddDestroyCallback
,
937 d3drm_viewport2_DeleteDestroyCallback
,
938 d3drm_viewport2_SetAppData
,
939 d3drm_viewport2_GetAppData
,
940 d3drm_viewport2_SetName
,
941 d3drm_viewport2_GetName
,
942 d3drm_viewport2_GetClassName
,
943 d3drm_viewport2_Init
,
944 d3drm_viewport2_Clear
,
945 d3drm_viewport2_Render
,
946 d3drm_viewport2_SetFront
,
947 d3drm_viewport2_SetBack
,
948 d3drm_viewport2_SetField
,
949 d3drm_viewport2_SetUniformScaling
,
950 d3drm_viewport2_SetCamera
,
951 d3drm_viewport2_SetProjection
,
952 d3drm_viewport2_Transform
,
953 d3drm_viewport2_InverseTransform
,
954 d3drm_viewport2_Configure
,
955 d3drm_viewport2_ForceUpdate
,
956 d3drm_viewport2_SetPlane
,
957 d3drm_viewport2_GetCamera
,
958 d3drm_viewport2_GetDevice
,
959 d3drm_viewport2_GetPlane
,
960 d3drm_viewport2_Pick
,
961 d3drm_viewport2_GetUniformScaling
,
962 d3drm_viewport2_GetX
,
963 d3drm_viewport2_GetY
,
964 d3drm_viewport2_GetWidth
,
965 d3drm_viewport2_GetHeight
,
966 d3drm_viewport2_GetField
,
967 d3drm_viewport2_GetBack
,
968 d3drm_viewport2_GetFront
,
969 d3drm_viewport2_GetProjection
,
970 d3drm_viewport2_GetDirect3DViewport
,
971 d3drm_viewport2_TransformVectors
,
972 d3drm_viewport2_InverseTransformVectors
,
975 static const struct IDirect3DRMViewportVtbl d3drm_viewport1_vtbl
=
977 d3drm_viewport1_QueryInterface
,
978 d3drm_viewport1_AddRef
,
979 d3drm_viewport1_Release
,
980 d3drm_viewport1_Clone
,
981 d3drm_viewport1_AddDestroyCallback
,
982 d3drm_viewport1_DeleteDestroyCallback
,
983 d3drm_viewport1_SetAppData
,
984 d3drm_viewport1_GetAppData
,
985 d3drm_viewport1_SetName
,
986 d3drm_viewport1_GetName
,
987 d3drm_viewport1_GetClassName
,
988 d3drm_viewport1_Init
,
989 d3drm_viewport1_Clear
,
990 d3drm_viewport1_Render
,
991 d3drm_viewport1_SetFront
,
992 d3drm_viewport1_SetBack
,
993 d3drm_viewport1_SetField
,
994 d3drm_viewport1_SetUniformScaling
,
995 d3drm_viewport1_SetCamera
,
996 d3drm_viewport1_SetProjection
,
997 d3drm_viewport1_Transform
,
998 d3drm_viewport1_InverseTransform
,
999 d3drm_viewport1_Configure
,
1000 d3drm_viewport1_ForceUpdate
,
1001 d3drm_viewport1_SetPlane
,
1002 d3drm_viewport1_GetCamera
,
1003 d3drm_viewport1_GetDevice
,
1004 d3drm_viewport1_GetPlane
,
1005 d3drm_viewport1_Pick
,
1006 d3drm_viewport1_GetUniformScaling
,
1007 d3drm_viewport1_GetX
,
1008 d3drm_viewport1_GetY
,
1009 d3drm_viewport1_GetWidth
,
1010 d3drm_viewport1_GetHeight
,
1011 d3drm_viewport1_GetField
,
1012 d3drm_viewport1_GetBack
,
1013 d3drm_viewport1_GetFront
,
1014 d3drm_viewport1_GetProjection
,
1015 d3drm_viewport1_GetDirect3DViewport
,
1018 HRESULT
d3drm_viewport_create(struct d3drm_viewport
**viewport
, IDirect3DRM
*d3drm
)
1020 static const char classname
[] = "Viewport";
1021 struct d3drm_viewport
*object
;
1023 TRACE("viewport %p, d3drm %p.\n", viewport
, d3drm
);
1025 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
1026 return E_OUTOFMEMORY
;
1028 object
->IDirect3DRMViewport_iface
.lpVtbl
= &d3drm_viewport1_vtbl
;
1029 object
->IDirect3DRMViewport2_iface
.lpVtbl
= &d3drm_viewport2_vtbl
;
1030 object
->d3drm
= d3drm
;
1031 d3drm_object_init(&object
->obj
, classname
);