Improved IDirect3DViewportImpl_3_2_1_TransformVertices stub.
[wine/gsoc_dplay.git] / dlls / ddraw / d3dviewport.c
blob3e67adcb51b36d875a79805c848f2a857be1f503
1 /* Direct3D Viewport
2 * Copyright (c) 1998 Lionel ULMER
4 * This file contains the implementation of Direct3DViewport2.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <stdarg.h>
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winerror.h"
30 #include "objbase.h"
31 #include "wingdi.h"
32 #include "ddraw.h"
33 #include "d3d.h"
34 #include "wine/debug.h"
36 #include "d3d_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
40 static void activate(IDirect3DViewportImpl* This) {
41 IDirect3DLightImpl* light;
42 D3DVIEWPORT7 vp;
44 /* Activate all the lights associated with this context */
45 light = This->lights;
47 while (light != NULL) {
48 light->activate(light);
49 light = light->next;
52 /* And copy the values in the structure used by the device */
53 if (This->use_vp2) {
54 vp.dwX = This->viewports.vp2.dwX;
55 vp.dwY = This->viewports.vp2.dwY;
56 vp.dwHeight = This->viewports.vp2.dwHeight;
57 vp.dwWidth = This->viewports.vp2.dwWidth;
58 vp.dvMinZ = This->viewports.vp2.dvMinZ;
59 vp.dvMaxZ = This->viewports.vp2.dvMaxZ;
60 } else {
61 vp.dwX = This->viewports.vp1.dwX;
62 vp.dwY = This->viewports.vp1.dwY;
63 vp.dwHeight = This->viewports.vp1.dwHeight;
64 vp.dwWidth = This->viewports.vp1.dwWidth;
65 vp.dvMinZ = This->viewports.vp1.dvMinZ;
66 vp.dvMaxZ = This->viewports.vp1.dvMaxZ;
69 /* And also set the viewport */
70 IDirect3DDevice7_SetViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice7), &vp);
74 static void _dump_D3DVIEWPORT(D3DVIEWPORT *lpvp)
76 TRACE(" - dwSize = %ld dwX = %ld dwY = %ld\n",
77 lpvp->dwSize, lpvp->dwX, lpvp->dwY);
78 TRACE(" - dwWidth = %ld dwHeight = %ld\n",
79 lpvp->dwWidth, lpvp->dwHeight);
80 TRACE(" - dvScaleX = %f dvScaleY = %f\n",
81 lpvp->dvScaleX, lpvp->dvScaleY);
82 TRACE(" - dvMaxX = %f dvMaxY = %f\n",
83 lpvp->dvMaxX, lpvp->dvMaxY);
84 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
85 lpvp->dvMinZ, lpvp->dvMaxZ);
88 static void _dump_D3DVIEWPORT2(D3DVIEWPORT2 *lpvp)
90 TRACE(" - dwSize = %ld dwX = %ld dwY = %ld\n",
91 lpvp->dwSize, lpvp->dwX, lpvp->dwY);
92 TRACE(" - dwWidth = %ld dwHeight = %ld\n",
93 lpvp->dwWidth, lpvp->dwHeight);
94 TRACE(" - dvClipX = %f dvClipY = %f\n",
95 lpvp->dvClipX, lpvp->dvClipY);
96 TRACE(" - dvClipWidth = %f dvClipHeight = %f\n",
97 lpvp->dvClipWidth, lpvp->dvClipHeight);
98 TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
99 lpvp->dvMinZ, lpvp->dvMaxZ);
102 HRESULT WINAPI
103 Main_IDirect3DViewportImpl_3_2_1_QueryInterface(LPDIRECT3DVIEWPORT3 iface,
104 REFIID riid,
105 LPVOID* obp)
107 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
108 TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
110 *obp = NULL;
112 if ( IsEqualGUID(&IID_IUnknown, riid) ||
113 IsEqualGUID(&IID_IDirect3DViewport, riid) ||
114 IsEqualGUID(&IID_IDirect3DViewport2, riid) ||
115 IsEqualGUID(&IID_IDirect3DViewport3, riid) ) {
116 IDirect3DViewport3_AddRef(ICOM_INTERFACE(This, IDirect3DViewport3));
117 *obp = ICOM_INTERFACE(This, IDirect3DViewport3);
118 TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp);
119 return S_OK;
121 FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
122 return OLE_E_ENUM_NOMORE;
125 ULONG WINAPI
126 Main_IDirect3DViewportImpl_3_2_1_AddRef(LPDIRECT3DVIEWPORT3 iface)
128 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
129 TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
130 return ++(This->ref);
133 ULONG WINAPI
134 Main_IDirect3DViewportImpl_3_2_1_Release(LPDIRECT3DVIEWPORT3 iface)
136 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
137 TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
138 if (!--(This->ref)) {
139 HeapFree(GetProcessHeap(), 0, This);
140 return 0;
142 return This->ref;
146 HRESULT WINAPI
147 Main_IDirect3DViewportImpl_3_2_1_Initialize(LPDIRECT3DVIEWPORT3 iface,
148 LPDIRECT3D lpDirect3D)
150 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
151 TRACE("(%p/%p)->(%p) no-op...\n", This, iface, lpDirect3D);
152 return DD_OK;
155 HRESULT WINAPI
156 Main_IDirect3DViewportImpl_3_2_1_GetViewport(LPDIRECT3DVIEWPORT3 iface,
157 LPD3DVIEWPORT lpData)
159 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
160 DWORD dwSize;
161 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
162 if (This->use_vp2 != 0) {
163 ERR(" Requesting to get a D3DVIEWPORT struct where a D3DVIEWPORT2 was set !\n");
164 return DDERR_INVALIDPARAMS;
166 dwSize = lpData->dwSize;
167 memset(lpData, 0, dwSize);
168 memcpy(lpData, &(This->viewports.vp1), dwSize);
170 if (TRACE_ON(ddraw)) {
171 TRACE(" returning D3DVIEWPORT :\n");
172 _dump_D3DVIEWPORT(lpData);
175 return DD_OK;
178 HRESULT WINAPI
179 Main_IDirect3DViewportImpl_3_2_1_SetViewport(LPDIRECT3DVIEWPORT3 iface,
180 LPD3DVIEWPORT lpData)
182 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
183 LPDIRECT3DVIEWPORT3 current_viewport;
184 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
186 if (TRACE_ON(ddraw)) {
187 TRACE(" getting D3DVIEWPORT :\n");
188 _dump_D3DVIEWPORT(lpData);
191 This->use_vp2 = 0;
192 memset(&(This->viewports.vp1), 0, sizeof(This->viewports.vp1));
193 memcpy(&(This->viewports.vp1), lpData, lpData->dwSize);
195 /* Tests on two games shows that these values are never used properly so overide
196 them with proper ones :-)
198 This->viewports.vp1.dvMinZ = 0.0;
199 This->viewports.vp1.dvMaxZ = 1.0;
201 if (This->active_device) {
202 IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
203 if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
204 This->activate(This);
205 IDirect3DViewport3_Release(current_viewport);
208 return DD_OK;
211 HRESULT WINAPI
212 Main_IDirect3DViewportImpl_3_2_1_TransformVertices(LPDIRECT3DVIEWPORT3 iface,
213 DWORD dwVertexCount,
214 LPD3DTRANSFORMDATA lpData,
215 DWORD dwFlags,
216 LPDWORD lpOffScreen)
218 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
219 FIXME("(%p/%p)->(%08lx,%p,%08lx,%p): stub!\n", This, iface, dwVertexCount, lpData, dwFlags, lpOffScreen);
220 if (lpOffScreen)
221 *lpOffScreen = 0;
222 return DD_OK;
225 HRESULT WINAPI
226 Main_IDirect3DViewportImpl_3_2_1_LightElements(LPDIRECT3DVIEWPORT3 iface,
227 DWORD dwElementCount,
228 LPD3DLIGHTDATA lpData)
230 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
231 FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwElementCount, lpData);
232 return DD_OK;
235 HRESULT WINAPI
236 Main_IDirect3DViewportImpl_3_2_1_SetBackground(LPDIRECT3DVIEWPORT3 iface,
237 D3DMATERIALHANDLE hMat)
239 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
240 TRACE("(%p/%p)->(%08lx)\n", This, iface, (DWORD) hMat);
242 This->background = (IDirect3DMaterialImpl *) hMat;
243 TRACE(" setting background color : %f %f %f %f\n",
244 This->background->mat.u.diffuse.u1.r,
245 This->background->mat.u.diffuse.u2.g,
246 This->background->mat.u.diffuse.u3.b,
247 This->background->mat.u.diffuse.u4.a);
249 return DD_OK;
252 HRESULT WINAPI
253 Main_IDirect3DViewportImpl_3_2_1_GetBackground(LPDIRECT3DVIEWPORT3 iface,
254 LPD3DMATERIALHANDLE lphMat,
255 LPBOOL lpValid)
257 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
258 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lphMat, lpValid);
259 return DD_OK;
262 HRESULT WINAPI
263 Main_IDirect3DViewportImpl_3_2_1_SetBackgroundDepth(LPDIRECT3DVIEWPORT3 iface,
264 LPDIRECTDRAWSURFACE lpDDSurface)
266 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
267 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpDDSurface);
268 return DD_OK;
271 HRESULT WINAPI
272 Main_IDirect3DViewportImpl_3_2_1_GetBackgroundDepth(LPDIRECT3DVIEWPORT3 iface,
273 LPDIRECTDRAWSURFACE* lplpDDSurface,
274 LPBOOL lpValid)
276 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
277 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDSurface, lpValid);
278 return DD_OK;
281 HRESULT WINAPI
282 Main_IDirect3DViewportImpl_3_2_1_Clear(LPDIRECT3DVIEWPORT3 iface,
283 DWORD dwCount,
284 LPD3DRECT lpRects,
285 DWORD dwFlags)
287 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
288 DWORD color = 0x00000000;
290 TRACE("(%p/%p)->(%08lx,%p,%08lx)\n", This, iface, dwCount, lpRects, dwFlags);
291 if (This->active_device == NULL) {
292 ERR(" Trying to clear a viewport not attached to a device !\n");
293 return D3DERR_VIEWPORTHASNODEVICE;
295 if (dwFlags & D3DCLEAR_TARGET) {
296 if (This->background == NULL) {
297 ERR(" Trying to clear the color buffer without background material !\n");
298 } else {
299 color =
300 ((int) ((This->background->mat.u.diffuse.u1.r) * 255) << 16) |
301 ((int) ((This->background->mat.u.diffuse.u2.g) * 255) << 8) |
302 ((int) ((This->background->mat.u.diffuse.u3.b) * 255) << 0) |
303 ((int) ((This->background->mat.u.diffuse.u4.a) * 255) << 24);
306 return This->active_device->clear(This->active_device, dwCount, lpRects,
307 dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET),
308 color, 1.0, 0x00000000);
311 HRESULT WINAPI
312 Main_IDirect3DViewportImpl_3_2_1_AddLight(LPDIRECT3DVIEWPORT3 iface,
313 LPDIRECT3DLIGHT lpDirect3DLight)
315 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
316 IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
317 DWORD i = 0;
318 DWORD map = This->map_lights;
320 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DLight);
322 if (This->num_lights >= 8)
323 return DDERR_INVALIDPARAMS;
325 /* Find a light number and update both light and viewports objects accordingly */
326 while(map&1) {
327 map>>=1;
328 i++;
330 lpDirect3DLightImpl->dwLightIndex = i;
331 This->num_lights++;
332 This->map_lights |= 1<<i;
334 /* Add the light in the 'linked' chain */
335 lpDirect3DLightImpl->next = This->lights;
336 This->lights = lpDirect3DLightImpl;
338 /* Attach the light to the viewport */
339 lpDirect3DLightImpl->active_viewport = This;
341 /* If active, activate the light */
342 if (This->active_device != NULL) {
343 lpDirect3DLightImpl->activate(lpDirect3DLightImpl);
346 return DD_OK;
349 HRESULT WINAPI
350 Main_IDirect3DViewportImpl_3_2_1_DeleteLight(LPDIRECT3DVIEWPORT3 iface,
351 LPDIRECT3DLIGHT lpDirect3DLight)
353 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
354 IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
355 IDirect3DLightImpl *cur_light, *prev_light = NULL;
357 TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DLight);
358 cur_light = This->lights;
359 while (cur_light != NULL) {
360 if (cur_light == lpDirect3DLightImpl) {
361 lpDirect3DLightImpl->desactivate(lpDirect3DLightImpl);
362 if (prev_light == NULL) This->lights = cur_light->next;
363 else prev_light->next = cur_light->next;
364 /* Detach the light to the viewport */
365 cur_light->active_viewport = NULL;
366 This->num_lights--;
367 This->map_lights &= ~(1<<lpDirect3DLightImpl->dwLightIndex);
368 return DD_OK;
370 prev_light = cur_light;
371 cur_light = cur_light->next;
373 return DDERR_INVALIDPARAMS;
376 HRESULT WINAPI
377 Main_IDirect3DViewportImpl_3_2_1_NextLight(LPDIRECT3DVIEWPORT3 iface,
378 LPDIRECT3DLIGHT lpDirect3DLight,
379 LPDIRECT3DLIGHT* lplpDirect3DLight,
380 DWORD dwFlags)
382 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
383 FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DLight, lplpDirect3DLight, dwFlags);
384 return DD_OK;
387 HRESULT WINAPI
388 Main_IDirect3DViewportImpl_3_2_GetViewport2(LPDIRECT3DVIEWPORT3 iface,
389 LPD3DVIEWPORT2 lpData)
391 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
392 DWORD dwSize;
393 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
394 if (This->use_vp2 != 1) {
395 ERR(" Requesting to get a D3DVIEWPORT2 struct where a D3DVIEWPORT was set !\n");
396 return DDERR_INVALIDPARAMS;
398 dwSize = lpData->dwSize;
399 memset(lpData, 0, dwSize);
400 memcpy(lpData, &(This->viewports.vp2), dwSize);
402 if (TRACE_ON(ddraw)) {
403 TRACE(" returning D3DVIEWPORT2 :\n");
404 _dump_D3DVIEWPORT2(lpData);
407 return DD_OK;
410 HRESULT WINAPI
411 Main_IDirect3DViewportImpl_3_2_SetViewport2(LPDIRECT3DVIEWPORT3 iface,
412 LPD3DVIEWPORT2 lpData)
414 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
415 LPDIRECT3DVIEWPORT3 current_viewport;
416 TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
418 if (TRACE_ON(ddraw)) {
419 TRACE(" getting D3DVIEWPORT2 :\n");
420 _dump_D3DVIEWPORT2(lpData);
423 This->use_vp2 = 1;
424 memset(&(This->viewports.vp2), 0, sizeof(This->viewports.vp2));
425 memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
427 if (This->active_device) {
428 IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
429 if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
430 This->activate(This);
431 IDirect3DViewport3_Release(current_viewport);
434 return DD_OK;
437 HRESULT WINAPI
438 Main_IDirect3DViewportImpl_3_SetBackgroundDepth2(LPDIRECT3DVIEWPORT3 iface,
439 LPDIRECTDRAWSURFACE4 lpDDS)
441 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
442 FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpDDS);
443 return DD_OK;
446 HRESULT WINAPI
447 Main_IDirect3DViewportImpl_3_GetBackgroundDepth2(LPDIRECT3DVIEWPORT3 iface,
448 LPDIRECTDRAWSURFACE4* lplpDDS,
449 LPBOOL lpValid)
451 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
452 FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDS, lpValid);
453 return DD_OK;
456 HRESULT WINAPI
457 Main_IDirect3DViewportImpl_3_Clear2(LPDIRECT3DVIEWPORT3 iface,
458 DWORD dwCount,
459 LPD3DRECT lpRects,
460 DWORD dwFlags,
461 DWORD dwColor,
462 D3DVALUE dvZ,
463 DWORD dwStencil)
465 ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
466 TRACE("(%p/%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, iface, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
467 if (This->active_device == NULL) {
468 ERR(" Trying to clear a viewport not attached to a device !\n");
469 return D3DERR_VIEWPORTHASNODEVICE;
471 return This->active_device->clear(This->active_device, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
474 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
475 # define XCAST(fun) (typeof(VTABLE_IDirect3DViewport3.fun))
476 #else
477 # define XCAST(fun) (void*)
478 #endif
480 ICOM_VTABLE(IDirect3DViewport3) VTABLE_IDirect3DViewport3 =
482 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
483 XCAST(QueryInterface) Main_IDirect3DViewportImpl_3_2_1_QueryInterface,
484 XCAST(AddRef) Main_IDirect3DViewportImpl_3_2_1_AddRef,
485 XCAST(Release) Main_IDirect3DViewportImpl_3_2_1_Release,
486 XCAST(Initialize) Main_IDirect3DViewportImpl_3_2_1_Initialize,
487 XCAST(GetViewport) Main_IDirect3DViewportImpl_3_2_1_GetViewport,
488 XCAST(SetViewport) Main_IDirect3DViewportImpl_3_2_1_SetViewport,
489 XCAST(TransformVertices) Main_IDirect3DViewportImpl_3_2_1_TransformVertices,
490 XCAST(LightElements) Main_IDirect3DViewportImpl_3_2_1_LightElements,
491 XCAST(SetBackground) Main_IDirect3DViewportImpl_3_2_1_SetBackground,
492 XCAST(GetBackground) Main_IDirect3DViewportImpl_3_2_1_GetBackground,
493 XCAST(SetBackgroundDepth) Main_IDirect3DViewportImpl_3_2_1_SetBackgroundDepth,
494 XCAST(GetBackgroundDepth) Main_IDirect3DViewportImpl_3_2_1_GetBackgroundDepth,
495 XCAST(Clear) Main_IDirect3DViewportImpl_3_2_1_Clear,
496 XCAST(AddLight) Main_IDirect3DViewportImpl_3_2_1_AddLight,
497 XCAST(DeleteLight) Main_IDirect3DViewportImpl_3_2_1_DeleteLight,
498 XCAST(NextLight) Main_IDirect3DViewportImpl_3_2_1_NextLight,
499 XCAST(GetViewport2) Main_IDirect3DViewportImpl_3_2_GetViewport2,
500 XCAST(SetViewport2) Main_IDirect3DViewportImpl_3_2_SetViewport2,
501 XCAST(SetBackgroundDepth2) Main_IDirect3DViewportImpl_3_SetBackgroundDepth2,
502 XCAST(GetBackgroundDepth2) Main_IDirect3DViewportImpl_3_GetBackgroundDepth2,
503 XCAST(Clear2) Main_IDirect3DViewportImpl_3_Clear2,
506 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
507 #undef XCAST
508 #endif
513 HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirectDrawImpl *d3d)
515 IDirect3DViewportImpl *object;
517 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DViewportImpl));
518 if (object == NULL) return DDERR_OUTOFMEMORY;
520 object->ref = 1;
521 object->d3d = d3d;
522 object->activate = activate;
523 object->use_vp2 = 0xFF;
524 object->next = NULL;
525 object->lights = NULL;
526 object->num_lights = 0;
527 object->map_lights = 0;
529 ICOM_INIT_INTERFACE(object, IDirect3DViewport3, VTABLE_IDirect3DViewport3);
531 *obj = object;
533 TRACE(" creating implementation at %p.\n", *obj);
535 return D3D_OK;