2 * Copyright (c) 1998 Lionel ULMER
3 * Copyright (c) 2006 Stefan DÖSINGER
5 * This file contains the implementation of Direct3DViewport2.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/port.h"
31 #define NONAMELESSUNION
37 #include "wine/exception.h"
42 #include "ddraw_private.h"
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
47 /*****************************************************************************
49 *****************************************************************************/
51 /*****************************************************************************
54 * activates the viewport using IDirect3DDevice7::SetViewport
56 *****************************************************************************/
57 void viewport_activate(IDirect3DViewportImpl* This) {
58 IDirect3DLightImpl* light;
61 /* Activate all the lights associated with this context */
64 while (light != NULL) {
65 light->activate(light);
69 /* And copy the values in the structure used by the device */
71 vp.dwX = This->viewports.vp2.dwX;
72 vp.dwY = This->viewports.vp2.dwY;
73 vp.dwHeight = This->viewports.vp2.dwHeight;
74 vp.dwWidth = This->viewports.vp2.dwWidth;
75 vp.dvMinZ = This->viewports.vp2.dvMinZ;
76 vp.dvMaxZ = This->viewports.vp2.dvMaxZ;
78 vp.dwX = This->viewports.vp1.dwX;
79 vp.dwY = This->viewports.vp1.dwY;
80 vp.dwHeight = This->viewports.vp1.dwHeight;
81 vp.dwWidth = This->viewports.vp1.dwWidth;
82 vp.dvMinZ = This->viewports.vp1.dvMinZ;
83 vp.dvMaxZ = This->viewports.vp1.dvMaxZ;
86 /* And also set the viewport */
87 IDirect3DDevice7_SetViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), &vp);
90 /*****************************************************************************
91 * _dump_D3DVIEWPORT, _dump_D3DVIEWPORT2
93 * Writes viewport information to TRACE
95 *****************************************************************************/
96 static void _dump_D3DVIEWPORT(const D3DVIEWPORT *lpvp)
98 TRACE(" - dwSize = %d dwX = %d dwY = %d\n",
99 lpvp->dwSize, lpvp->dwX, lpvp->dwY);
100 TRACE(" - dwWidth = %d dwHeight = %d\n",
101 lpvp->dwWidth, lpvp->dwHeight);
102 TRACE(" - dvScaleX = %f dvScaleY = %f\n",
103 lpvp->dvScaleX, lpvp->dvScaleY);
104 TRACE(" - dvMaxX = %f dvMaxY = %f\n",
105 lpvp->dvMaxX, lpvp->dvMaxY);
106 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
107 lpvp->dvMinZ, lpvp->dvMaxZ);
110 static void _dump_D3DVIEWPORT2(const D3DVIEWPORT2 *lpvp)
112 TRACE(" - dwSize = %d dwX = %d dwY = %d\n",
113 lpvp->dwSize, lpvp->dwX, lpvp->dwY);
114 TRACE(" - dwWidth = %d dwHeight = %d\n",
115 lpvp->dwWidth, lpvp->dwHeight);
116 TRACE(" - dvClipX = %f dvClipY = %f\n",
117 lpvp->dvClipX, lpvp->dvClipY);
118 TRACE(" - dvClipWidth = %f dvClipHeight = %f\n",
119 lpvp->dvClipWidth, lpvp->dvClipHeight);
120 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
121 lpvp->dvMinZ, lpvp->dvMaxZ);
124 /*****************************************************************************
126 *****************************************************************************/
128 /*****************************************************************************
129 * IDirect3DViewport3::QueryInterface
131 * A normal QueryInterface. Can query all interface versions and the
132 * IUnknown interface. The VTables of the different versions
136 * refiid: Interface id queried for
137 * obj: Address to write the interface pointer to
141 * E_NOINTERFACE if the requested interface wasn't found
143 *****************************************************************************/
144 static HRESULT WINAPI
145 IDirect3DViewportImpl_QueryInterface(IDirect3DViewport3 *iface,
149 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
150 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), obp);
154 if ( IsEqualGUID(&IID_IUnknown, riid) ||
155 IsEqualGUID(&IID_IDirect3DViewport, riid) ||
156 IsEqualGUID(&IID_IDirect3DViewport2, riid) ||
157 IsEqualGUID(&IID_IDirect3DViewport3, riid) ) {
158 IDirect3DViewport3_AddRef(ICOM_INTERFACE(This, IDirect3DViewport3));
159 *obp = ICOM_INTERFACE(This, IDirect3DViewport3);
160 TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp);
163 FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
164 return E_NOINTERFACE;
167 /*****************************************************************************
168 * IDirect3DViewport3::AddRef
170 * Increases the refcount.
175 *****************************************************************************/
177 IDirect3DViewportImpl_AddRef(IDirect3DViewport3 *iface)
179 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
180 ULONG ref = InterlockedIncrement(&This->ref);
182 TRACE("(%p)->() incrementing from %u.\n", This, ref - 1);
187 /*****************************************************************************
188 * IDirect3DViewport3::Release
190 * Reduces the refcount. If it falls to 0, the interface is released
195 *****************************************************************************/
197 IDirect3DViewportImpl_Release(IDirect3DViewport3 *iface)
199 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
200 ULONG ref = InterlockedDecrement(&This->ref);
202 TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
205 HeapFree(GetProcessHeap(), 0, This);
211 /*****************************************************************************
212 * IDirect3DViewport Methods.
213 *****************************************************************************/
215 /*****************************************************************************
216 * IDirect3DViewport3::Initialize
218 * No-op initialization.
221 * Direct3D: The direct3D device this viewport is assigned to
224 * DDERR_ALREADYINITIALIZED
226 *****************************************************************************/
227 static HRESULT WINAPI
228 IDirect3DViewportImpl_Initialize(IDirect3DViewport3 *iface,
231 TRACE("(%p)->(%p) no-op...\n", iface, Direct3D);
232 return DDERR_ALREADYINITIALIZED;
235 /*****************************************************************************
236 * IDirect3DViewport3::GetViewport
238 * Returns the viewport data assigned to this viewport interface
241 * Data: Address to store the data
245 * DDERR_INVALIDPARAMS if Data is NULL
247 *****************************************************************************/
248 static HRESULT WINAPI
249 IDirect3DViewportImpl_GetViewport(IDirect3DViewport3 *iface,
252 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
254 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
255 if (This->use_vp2 != 0) {
256 ERR(" Requesting to get a D3DVIEWPORT struct where a D3DVIEWPORT2 was set !\n");
257 return DDERR_INVALIDPARAMS;
259 dwSize = lpData->dwSize;
260 memset(lpData, 0, dwSize);
261 memcpy(lpData, &(This->viewports.vp1), dwSize);
263 if (TRACE_ON(d3d7)) {
264 TRACE(" returning D3DVIEWPORT :\n");
265 _dump_D3DVIEWPORT(lpData);
271 /*****************************************************************************
272 * IDirect3DViewport3::SetViewport
274 * Sets the viewport information for this interface
277 * lpData: Viewport to set
281 * DDERR_INVALIDPARAMS if Data is NULL
283 *****************************************************************************/
284 static HRESULT WINAPI
285 IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
288 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
289 LPDIRECT3DVIEWPORT3 current_viewport;
290 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
292 if (TRACE_ON(d3d7)) {
293 TRACE(" getting D3DVIEWPORT :\n");
294 _dump_D3DVIEWPORT(lpData);
298 memset(&(This->viewports.vp1), 0, sizeof(This->viewports.vp1));
299 memcpy(&(This->viewports.vp1), lpData, lpData->dwSize);
301 /* Tests on two games show that these values are never used properly so override
302 them with proper ones :-)
304 This->viewports.vp1.dvMinZ = 0.0;
305 This->viewports.vp1.dvMaxZ = 1.0;
307 if (This->active_device) {
308 IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), ¤t_viewport);
309 if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
310 This->activate(This);
311 if(current_viewport) IDirect3DViewport3_Release(current_viewport);
317 /*****************************************************************************
318 * IDirect3DViewport3::TransformVertices
320 * Transforms vertices by the transformation matrix.
323 * dwVertexCount: The number of vertices to be transformed
324 * lpData: Pointer to the vertex data
325 * dwFlags: D3DTRANSFORM_CLIPPED or D3DTRANSFORM_UNCLIPPED
326 * lpOffScreen: Is set to nonzero if all vertices are off-screen
329 * D3D_OK because it's a stub
331 *****************************************************************************/
332 static HRESULT WINAPI
333 IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface,
335 D3DTRANSFORMDATA *lpData,
339 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
340 FIXME("(%p)->(%08x,%p,%08x,%p): stub!\n", This, dwVertexCount, lpData, dwFlags, lpOffScreen);
346 /*****************************************************************************
347 * IDirect3DViewport3::LightElements
349 * The DirectX 5.0 sdk says that it's not implemented
357 *****************************************************************************/
358 static HRESULT WINAPI
359 IDirect3DViewportImpl_LightElements(IDirect3DViewport3 *iface,
360 DWORD dwElementCount,
361 LPD3DLIGHTDATA lpData)
363 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
364 TRACE("(%p)->(%08x,%p): Unimplemented!\n", This, dwElementCount, lpData);
365 return DDERR_UNSUPPORTED;
368 /*****************************************************************************
369 * IDirect3DViewport3::SetBackground
371 * Sets tje background material
374 * hMat: Handle from a IDirect3DMaterial interface
379 *****************************************************************************/
380 static HRESULT WINAPI
381 IDirect3DViewportImpl_SetBackground(IDirect3DViewport3 *iface,
382 D3DMATERIALHANDLE hMat)
384 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
385 TRACE("(%p)->(%d)\n", This, (DWORD) hMat);
387 if(hMat && hMat > This->ddraw->d3ddevice->numHandles)
389 WARN("Specified Handle %d out of range\n", hMat);
390 return DDERR_INVALIDPARAMS;
392 else if(hMat && This->ddraw->d3ddevice->Handles[hMat - 1].type != DDrawHandle_Material)
394 WARN("Handle %d is not a material handle\n", hMat);
395 return DDERR_INVALIDPARAMS;
400 This->background = (IDirect3DMaterialImpl *) This->ddraw->d3ddevice->Handles[hMat - 1].ptr;
401 TRACE(" setting background color : %f %f %f %f\n",
402 This->background->mat.u.diffuse.u1.r,
403 This->background->mat.u.diffuse.u2.g,
404 This->background->mat.u.diffuse.u3.b,
405 This->background->mat.u.diffuse.u4.a);
409 This->background = NULL;
410 TRACE("Setting background to NULL\n");
416 /*****************************************************************************
417 * IDirect3DViewport3::GetBackground
419 * Returns the material handle assigned to the background of the viewport
422 * lphMat: Address to store the handle
423 * lpValid: is set to FALSE if no background is set, TRUE if one is set
428 *****************************************************************************/
429 static HRESULT WINAPI
430 IDirect3DViewportImpl_GetBackground(IDirect3DViewport3 *iface,
431 D3DMATERIALHANDLE *lphMat,
434 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
435 TRACE("(%p)->(%p,%p)\n", This, lphMat, lpValid);
439 *lpValid = This->background != NULL;
445 *lphMat = This->background->Handle;
456 /*****************************************************************************
457 * IDirect3DViewport3::SetBackgroundDepth
459 * Sets a surface that represents the background depth. It's contents are
460 * used to set the depth buffer in IDirect3DViewport3::Clear
463 * lpDDSurface: Surface to set
465 * Returns: D3D_OK, because it's a stub
467 *****************************************************************************/
468 static HRESULT WINAPI
469 IDirect3DViewportImpl_SetBackgroundDepth(IDirect3DViewport3 *iface,
470 IDirectDrawSurface *lpDDSurface)
472 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
473 FIXME("(%p)->(%p): stub!\n", This, lpDDSurface);
477 /*****************************************************************************
478 * IDirect3DViewport3::GetBackgroundDepth
480 * Returns the surface that represents the depth field
483 * lplpDDSurface: Address to store the interface pointer
484 * lpValid: Set to TRUE if a depth is asigned, FALSE otherwise
487 * D3D_OK, because it's a stub
488 * (DDERR_INVALIDPARAMS if DDSurface of Valid is NULL)
490 *****************************************************************************/
491 static HRESULT WINAPI
492 IDirect3DViewportImpl_GetBackgroundDepth(IDirect3DViewport3 *iface,
493 IDirectDrawSurface **lplpDDSurface,
496 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
497 FIXME("(%p)->(%p,%p): stub!\n", This, lplpDDSurface, lpValid);
501 /*****************************************************************************
502 * IDirect3DViewport3::Clear
504 * Clears the render target and / or the z buffer
507 * dwCount: The amount of rectangles to clear. If 0, the whole buffer is
509 * lpRects: Pointer to the array of rectangles. If NULL, Count must be 0
510 * dwFlags: D3DCLEAR_ZBUFFER and / or D3DCLEAR_TARGET
514 * D3DERR_VIEWPORTHASNODEVICE if there's no active device
515 * The return value of IDirect3DDevice7::Clear
517 *****************************************************************************/
518 static HRESULT WINAPI
519 IDirect3DViewportImpl_Clear(IDirect3DViewport3 *iface,
524 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
525 DWORD color = 0x00000000;
527 TRACE("(%p/%p)->(%08x,%p,%08x)\n", This, iface, dwCount, lpRects, dwFlags);
528 if (This->active_device == NULL) {
529 ERR(" Trying to clear a viewport not attached to a device !\n");
530 return D3DERR_VIEWPORTHASNODEVICE;
532 if (dwFlags & D3DCLEAR_TARGET) {
533 if (This->background == NULL) {
534 ERR(" Trying to clear the color buffer without background material !\n");
537 ((int) ((This->background->mat.u.diffuse.u1.r) * 255) << 16) |
538 ((int) ((This->background->mat.u.diffuse.u2.g) * 255) << 8) |
539 ((int) ((This->background->mat.u.diffuse.u3.b) * 255) << 0) |
540 ((int) ((This->background->mat.u.diffuse.u4.a) * 255) << 24);
544 return IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
547 dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET),
553 /*****************************************************************************
554 * IDirect3DViewport3::AddLight
556 * Adds an light to the viewport
559 * lpDirect3DLight: Interface of the light to add
563 * DDERR_INVALIDPARAMS if Direct3DLight is NULL
564 * DDERR_INVALIDPARAMS if there are 8 lights or more
566 *****************************************************************************/
567 static HRESULT WINAPI
568 IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface,
569 IDirect3DLight *lpDirect3DLight)
571 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
572 IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
574 DWORD map = This->map_lights;
576 TRACE("(%p)->(%p)\n", This, lpDirect3DLight);
578 if (This->num_lights >= 8)
579 return DDERR_INVALIDPARAMS;
581 /* Find a light number and update both light and viewports objects accordingly */
586 lpDirect3DLightImpl->dwLightIndex = i;
588 This->map_lights |= 1<<i;
590 /* Add the light in the 'linked' chain */
591 lpDirect3DLightImpl->next = This->lights;
592 This->lights = lpDirect3DLightImpl;
594 /* Attach the light to the viewport */
595 lpDirect3DLightImpl->active_viewport = This;
597 /* If active, activate the light */
598 if (This->active_device != NULL) {
599 lpDirect3DLightImpl->activate(lpDirect3DLightImpl);
605 /*****************************************************************************
606 * IDirect3DViewport3::DeleteLight
608 * Deletes a light from the viewports' light list
611 * lpDirect3DLight: Light to delete
615 * DDERR_INVALIDPARAMS if the light wasn't found
617 *****************************************************************************/
618 static HRESULT WINAPI
619 IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface,
620 IDirect3DLight *lpDirect3DLight)
622 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
623 IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
624 IDirect3DLightImpl *cur_light, *prev_light = NULL;
626 TRACE("(%p)->(%p)\n", This, lpDirect3DLight);
627 cur_light = This->lights;
628 while (cur_light != NULL) {
629 if (cur_light == lpDirect3DLightImpl) {
630 lpDirect3DLightImpl->desactivate(lpDirect3DLightImpl);
631 if (prev_light == NULL) This->lights = cur_light->next;
632 else prev_light->next = cur_light->next;
633 /* Detach the light to the viewport */
634 cur_light->active_viewport = NULL;
636 This->map_lights &= ~(1<<lpDirect3DLightImpl->dwLightIndex);
639 prev_light = cur_light;
640 cur_light = cur_light->next;
642 return DDERR_INVALIDPARAMS;
645 /*****************************************************************************
646 * IDirect3DViewport::NextLight
648 * Enumerates the lights associated with the viewport
651 * lpDirect3DLight: Light to start with
652 * lplpDirect3DLight: Address to store the successor to
655 * D3D_OK, because it's a stub
657 *****************************************************************************/
658 static HRESULT WINAPI
659 IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
660 IDirect3DLight *lpDirect3DLight,
661 IDirect3DLight **lplpDirect3DLight,
664 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
665 FIXME("(%p)->(%p,%p,%08x): stub!\n", This, lpDirect3DLight, lplpDirect3DLight, dwFlags);
669 /*****************************************************************************
670 * IDirect3DViewport2 Methods.
671 *****************************************************************************/
673 /*****************************************************************************
674 * IDirect3DViewport3::GetViewport2
676 * Returns the currently set viewport in a D3DVIEWPORT2 structure.
677 * Similar to IDirect3DViewport3::GetViewport
680 * lpData: Pointer to the structure to fill
684 * DDERR_INVALIDPARAMS if the viewport was set with
685 * IDirect3DViewport3::SetViewport
686 * DDERR_INVALIDPARAMS if Data is NULL
688 *****************************************************************************/
689 static HRESULT WINAPI
690 IDirect3DViewportImpl_GetViewport2(IDirect3DViewport3 *iface,
691 D3DVIEWPORT2 *lpData)
693 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
695 TRACE("(%p)->(%p)\n", This, lpData);
696 if (This->use_vp2 != 1) {
697 ERR(" Requesting to get a D3DVIEWPORT2 struct where a D3DVIEWPORT was set !\n");
698 return DDERR_INVALIDPARAMS;
700 dwSize = lpData->dwSize;
701 memset(lpData, 0, dwSize);
702 memcpy(lpData, &(This->viewports.vp2), dwSize);
704 if (TRACE_ON(d3d7)) {
705 TRACE(" returning D3DVIEWPORT2 :\n");
706 _dump_D3DVIEWPORT2(lpData);
712 /*****************************************************************************
713 * IDirect3DViewport3::SetViewport2
715 * Sets the viewport from a D3DVIEWPORT2 structure
718 * lpData: Viewport to set
723 *****************************************************************************/
724 static HRESULT WINAPI
725 IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
726 D3DVIEWPORT2 *lpData)
728 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
729 LPDIRECT3DVIEWPORT3 current_viewport;
730 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
732 if (TRACE_ON(d3d7)) {
733 TRACE(" getting D3DVIEWPORT2 :\n");
734 _dump_D3DVIEWPORT2(lpData);
738 memset(&(This->viewports.vp2), 0, sizeof(This->viewports.vp2));
739 memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
741 if (This->active_device) {
742 IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), ¤t_viewport);
743 if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
744 This->activate(This);
745 IDirect3DViewport3_Release(current_viewport);
751 /*****************************************************************************
752 * IDirect3DViewport3 Methods.
753 *****************************************************************************/
755 /*****************************************************************************
756 * IDirect3DViewport3::SetBackgroundDepth2
758 * Sets a IDirectDrawSurface4 surface as the background depth surface
761 * lpDDS: Surface to set
764 * D3D_OK, because it's stub
766 *****************************************************************************/
767 static HRESULT WINAPI
768 IDirect3DViewportImpl_SetBackgroundDepth2(IDirect3DViewport3 *iface,
769 IDirectDrawSurface4 *lpDDS)
771 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
772 FIXME("(%p)->(%p): stub!\n", This, lpDDS);
776 /*****************************************************************************
777 * IDirect3DViewport3::GetBackgroundDepth2
779 * Returns the IDirect3DSurface4 interface to the background depth surface
782 * lplpDDS: Address to store the interface pointer at
783 * lpValid: Set to true if a surface is assigned
786 * D3D_OK because it's a stub
788 *****************************************************************************/
789 static HRESULT WINAPI
790 IDirect3DViewportImpl_GetBackgroundDepth2(IDirect3DViewport3 *iface,
791 IDirectDrawSurface4 **lplpDDS,
794 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
795 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDS, lpValid);
799 /*****************************************************************************
800 * IDirect3DViewport3::Clear2
802 * Another clearing method
805 * Count: Number of rectangles to clear
806 * Rects: Rectangle array to clear
807 * Flags: Some flags :)
808 * Color: Color to fill the render target with
809 * Z: Value to fill the depth buffer with
810 * Stencil: Value to fill the stencil bits with
814 *****************************************************************************/
815 static HRESULT WINAPI
816 IDirect3DViewportImpl_Clear2(IDirect3DViewport3 *iface,
824 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
825 TRACE("(%p)->(%08x,%p,%08x,%08x,%f,%08x)\n", This, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
826 if (This->active_device == NULL) {
827 ERR(" Trying to clear a viewport not attached to a device !\n");
828 return D3DERR_VIEWPORTHASNODEVICE;
830 return IDirect3DDevice7_Clear(ICOM_INTERFACE(This->active_device, IDirect3DDevice7),
839 /*****************************************************************************
841 *****************************************************************************/
843 const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl =
845 /*** IUnknown Methods ***/
846 IDirect3DViewportImpl_QueryInterface,
847 IDirect3DViewportImpl_AddRef,
848 IDirect3DViewportImpl_Release,
849 /*** IDirect3DViewport Methods */
850 IDirect3DViewportImpl_Initialize,
851 IDirect3DViewportImpl_GetViewport,
852 IDirect3DViewportImpl_SetViewport,
853 IDirect3DViewportImpl_TransformVertices,
854 IDirect3DViewportImpl_LightElements,
855 IDirect3DViewportImpl_SetBackground,
856 IDirect3DViewportImpl_GetBackground,
857 IDirect3DViewportImpl_SetBackgroundDepth,
858 IDirect3DViewportImpl_GetBackgroundDepth,
859 IDirect3DViewportImpl_Clear,
860 IDirect3DViewportImpl_AddLight,
861 IDirect3DViewportImpl_DeleteLight,
862 IDirect3DViewportImpl_NextLight,
863 /*** IDirect3DViewport2 Methods ***/
864 IDirect3DViewportImpl_GetViewport2,
865 IDirect3DViewportImpl_SetViewport2,
866 /*** IDirect3DViewport3 Methods ***/
867 IDirect3DViewportImpl_SetBackgroundDepth2,
868 IDirect3DViewportImpl_GetBackgroundDepth2,
869 IDirect3DViewportImpl_Clear2,