d3drm: Avoid LPD3DVECTOR.
[wine] / dlls / d3drm / viewport.c
1 /*
2  * Implementation of IDirect3DRMViewport Interface
3  *
4  * Copyright 2012 AndrĂ© Hentschel
5  *
6  * This file contains the (internal) driver registration functions,
7  * driver enumeration APIs and DirectDraw creation functions.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23
24 #include "wine/debug.h"
25
26 #define COBJMACROS
27
28 #include "winbase.h"
29 #include "wingdi.h"
30
31 #include "d3drm_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
34
35 typedef struct {
36     IDirect3DRMViewport IDirect3DRMViewport_iface;
37     IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
38     LONG ref;
39     D3DVALUE back;
40     D3DVALUE front;
41     D3DVALUE field;
42     D3DRMPROJECTIONTYPE projection;
43 } IDirect3DRMViewportImpl;
44
45 static inline IDirect3DRMViewportImpl *impl_from_IDirect3DRMViewport(IDirect3DRMViewport *iface)
46 {
47     return CONTAINING_RECORD(iface, IDirect3DRMViewportImpl, IDirect3DRMViewport_iface);
48 }
49
50 static inline IDirect3DRMViewportImpl *impl_from_IDirect3DRMViewport2(IDirect3DRMViewport2 *iface)
51 {
52     return CONTAINING_RECORD(iface, IDirect3DRMViewportImpl, IDirect3DRMViewport2_iface);
53 }
54
55 /*** IUnknown methods ***/
56 static HRESULT WINAPI IDirect3DRMViewportImpl_QueryInterface(IDirect3DRMViewport* iface,
57                                                              REFIID riid, void** object)
58 {
59     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
60
61     TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
62
63     *object = NULL;
64
65     if (IsEqualGUID(riid, &IID_IUnknown) ||
66         IsEqualGUID(riid, &IID_IDirect3DRMViewport))
67     {
68         *object = &This->IDirect3DRMViewport_iface;
69     }
70     else if(IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
71     {
72         *object = &This->IDirect3DRMViewport2_iface;
73     }
74     else
75     {
76         FIXME("interface %s not implemented\n", debugstr_guid(riid));
77         return E_NOINTERFACE;
78     }
79
80     IDirect3DRMViewport_AddRef(iface);
81     return S_OK;
82 }
83
84 static ULONG WINAPI IDirect3DRMViewportImpl_AddRef(IDirect3DRMViewport* iface)
85 {
86     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
87     ULONG ref = InterlockedIncrement(&This->ref);
88
89     TRACE("(%p)->(): new ref = %d\n", This, ref);
90
91     return ref;
92 }
93
94 static ULONG WINAPI IDirect3DRMViewportImpl_Release(IDirect3DRMViewport* iface)
95 {
96     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
97     ULONG ref = InterlockedDecrement(&This->ref);
98
99     TRACE("(%p)->(): new ref = %d\n", This, ref);
100
101     if (!ref)
102         HeapFree(GetProcessHeap(), 0, This);
103
104     return ref;
105 }
106
107 /*** IDirect3DRMObject methods ***/
108 static HRESULT WINAPI IDirect3DRMViewportImpl_Clone(IDirect3DRMViewport* iface,
109                                                         LPUNKNOWN unkwn, REFIID riid,
110                                                         LPVOID* object)
111 {
112     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
113
114     FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
115
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI IDirect3DRMViewportImpl_AddDestroyCallback(IDirect3DRMViewport* iface,
120                                                                      D3DRMOBJECTCALLBACK cb,
121                                                                      LPVOID argument)
122 {
123     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
124
125     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
126
127     return E_NOTIMPL;
128 }
129
130 static HRESULT WINAPI IDirect3DRMViewportImpl_DeleteDestroyCallback(IDirect3DRMViewport* iface,
131                                                                         D3DRMOBJECTCALLBACK cb,
132                                                                         LPVOID argument)
133 {
134     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
135
136     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
137
138     return E_NOTIMPL;
139 }
140
141 static HRESULT WINAPI IDirect3DRMViewportImpl_SetAppData(IDirect3DRMViewport* iface,
142                                                              DWORD data)
143 {
144     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
145
146     FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
147
148     return E_NOTIMPL;
149 }
150
151 static DWORD WINAPI IDirect3DRMViewportImpl_GetAppData(IDirect3DRMViewport* iface)
152 {
153     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
154
155     FIXME("(%p/%p)->(): stub\n", iface, This);
156
157     return 0;
158 }
159
160 static HRESULT WINAPI IDirect3DRMViewportImpl_SetName(IDirect3DRMViewport* iface, LPCSTR name)
161 {
162     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
163
164     FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
165
166     return E_NOTIMPL;
167 }
168
169 static HRESULT WINAPI IDirect3DRMViewportImpl_GetName(IDirect3DRMViewport* iface,
170                                                           LPDWORD size, LPSTR name)
171 {
172     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
173
174     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
175
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI IDirect3DRMViewportImpl_GetClassName(IDirect3DRMViewport* iface,
180                                                            LPDWORD size, LPSTR name)
181 {
182     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
183
184     TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
185
186     return IDirect3DRMViewport2_GetClassName(&This->IDirect3DRMViewport2_iface, size, name);
187 }
188
189 /*** IDirect3DRMViewport methods ***/
190 static HRESULT WINAPI IDirect3DRMViewportImpl_Init(IDirect3DRMViewport* iface,
191                                                    LPDIRECT3DRMDEVICE dev, LPDIRECT3DRMFRAME camera,
192                                                    DWORD xpos, DWORD ypos,
193                                                    DWORD width, DWORD height)
194 {
195     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
196
197     FIXME("(%p/%p)->(%p, %p, %u, %u, %u, %u): stub\n", iface, This, dev, camera,
198           xpos, ypos, width, height);
199
200     return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI IDirect3DRMViewportImpl_Clear(IDirect3DRMViewport* iface)
204 {
205     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
206
207     FIXME("(%p/%p)->(): stub\n", iface, This);
208
209     return D3DRM_OK;
210 }
211
212 static HRESULT WINAPI IDirect3DRMViewportImpl_Render(IDirect3DRMViewport* iface,
213                                                      LPDIRECT3DRMFRAME frame)
214 {
215     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
216
217     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
218
219     return D3DRM_OK;
220 }
221
222 static HRESULT WINAPI IDirect3DRMViewportImpl_SetFront(IDirect3DRMViewport* iface, D3DVALUE front)
223 {
224     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
225
226     TRACE("(%p/%p)->(%f)\n", iface, This, front);
227
228     return IDirect3DRMViewport2_SetFront(&This->IDirect3DRMViewport2_iface, front);
229 }
230
231 static HRESULT WINAPI IDirect3DRMViewportImpl_SetBack(IDirect3DRMViewport* iface, D3DVALUE back)
232 {
233     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
234
235     TRACE("(%p/%p)->(%f)\n", iface, This, back);
236
237     return IDirect3DRMViewport2_SetBack(&This->IDirect3DRMViewport2_iface, back);
238 }
239
240 static HRESULT WINAPI IDirect3DRMViewportImpl_SetField(IDirect3DRMViewport* iface, D3DVALUE field)
241 {
242     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
243
244     TRACE("(%p/%p)->(%f)\n", iface, This, field);
245
246     return IDirect3DRMViewport2_SetField(&This->IDirect3DRMViewport2_iface, field);
247 }
248
249 static HRESULT WINAPI IDirect3DRMViewportImpl_SetUniformScaling(IDirect3DRMViewport* iface, BOOL b)
250 {
251     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
252
253     FIXME("(%p/%p)->(%d): stub\n", iface, This, b);
254
255     return E_NOTIMPL;
256 }
257
258 static HRESULT WINAPI IDirect3DRMViewportImpl_SetCamera(IDirect3DRMViewport* iface,
259                                                         LPDIRECT3DRMFRAME frame)
260 {
261     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
262
263     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
264
265     return E_NOTIMPL;
266 }
267
268 static HRESULT WINAPI IDirect3DRMViewportImpl_SetProjection(IDirect3DRMViewport* iface,
269                                                             D3DRMPROJECTIONTYPE type)
270 {
271     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
272
273     TRACE("(%p/%p)->(%u)\n", iface, This, type);
274
275     return IDirect3DRMViewport2_SetProjection(&This->IDirect3DRMViewport2_iface, type);
276 }
277
278 static HRESULT WINAPI IDirect3DRMViewportImpl_Transform(IDirect3DRMViewport* iface,
279                                                         D3DRMVECTOR4D *d, D3DVECTOR *s)
280 {
281     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
282
283     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, d, s);
284
285     return E_NOTIMPL;
286 }
287
288 static HRESULT WINAPI IDirect3DRMViewportImpl_InverseTransform(IDirect3DRMViewport* iface,
289                                                                D3DVECTOR *d, D3DRMVECTOR4D *s)
290 {
291     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
292
293     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, d, s);
294
295     return E_NOTIMPL;
296 }
297
298 static HRESULT WINAPI IDirect3DRMViewportImpl_Configure(IDirect3DRMViewport* iface, LONG x, LONG y,
299                                                         DWORD width, DWORD height)
300 {
301     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
302
303     FIXME("(%p/%p)->(%u, %u, %u, %u): stub\n", iface, This, x, y, width, height);
304
305     return E_NOTIMPL;
306 }
307
308 static HRESULT WINAPI IDirect3DRMViewportImpl_ForceUpdate(IDirect3DRMViewport* iface,
309                                                           DWORD x1, DWORD y1, DWORD x2, DWORD y2)
310 {
311     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
312
313     FIXME("(%p/%p)->(%u, %u, %u, %u): stub\n", iface, This, x1, y1, x2, y2);
314
315     return E_NOTIMPL;
316 }
317
318 static HRESULT WINAPI IDirect3DRMViewportImpl_SetPlane(IDirect3DRMViewport* iface,
319                                                        D3DVALUE left, D3DVALUE right,
320                                                        D3DVALUE bottom, D3DVALUE top)
321 {
322     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
323
324     FIXME("(%p/%p)->(%f, %f, %f, %f): stub\n", iface, This, left, right, bottom, top);
325
326     return E_NOTIMPL;
327 }
328
329 static HRESULT WINAPI IDirect3DRMViewportImpl_GetCamera(IDirect3DRMViewport* iface,
330                                                         LPDIRECT3DRMFRAME * frame)
331 {
332     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
333
334     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
335
336     return E_NOTIMPL;
337 }
338
339 static HRESULT WINAPI IDirect3DRMViewportImpl_GetDevice(IDirect3DRMViewport* iface,
340                                                         LPDIRECT3DRMDEVICE * device)
341 {
342     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
343
344     FIXME("(%p/%p)->(%p): stub\n", iface, This, device);
345
346     return E_NOTIMPL;
347 }
348
349 static HRESULT WINAPI IDirect3DRMViewportImpl_GetPlane(IDirect3DRMViewport* iface,
350                                                        D3DVALUE *left, D3DVALUE *right,
351                                                        D3DVALUE *bottom, D3DVALUE *top)
352 {
353     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
354
355     FIXME("(%p/%p)->(%p, %p, %p, %p): stub\n", iface, This, left, right, bottom, top);
356
357     return E_NOTIMPL;
358 }
359
360 static HRESULT WINAPI IDirect3DRMViewportImpl_Pick(IDirect3DRMViewport* iface, LONG x, LONG y,
361                                                    LPDIRECT3DRMPICKEDARRAY *return_visuals)
362 {
363     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
364
365     FIXME("(%p/%p)->(%u, %u, %p): stub\n", iface, This, x, y, return_visuals);
366
367     return E_NOTIMPL;
368 }
369
370 static BOOL WINAPI IDirect3DRMViewportImpl_GetUniformScaling(IDirect3DRMViewport* iface)
371 {
372     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
373
374     FIXME("(%p/%p)->(): stub\n", iface, This);
375
376     return E_NOTIMPL;
377 }
378
379 static LONG WINAPI IDirect3DRMViewportImpl_GetX(IDirect3DRMViewport* iface)
380 {
381     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
382
383     FIXME("(%p/%p)->(): stub\n", iface, This);
384
385     return E_NOTIMPL;
386 }
387
388 static LONG WINAPI IDirect3DRMViewportImpl_GetY(IDirect3DRMViewport* iface)
389 {
390     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
391
392     FIXME("(%p/%p)->(): stub\n", iface, This);
393
394     return E_NOTIMPL;
395 }
396
397 static DWORD WINAPI IDirect3DRMViewportImpl_GetWidth(IDirect3DRMViewport* iface)
398 {
399     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
400
401     FIXME("(%p/%p)->(): stub\n", iface, This);
402
403     return E_NOTIMPL;
404 }
405
406 static DWORD WINAPI IDirect3DRMViewportImpl_GetHeight(IDirect3DRMViewport* iface)
407 {
408     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
409
410     FIXME("(%p/%p)->(): stub\n", iface, This);
411
412     return E_NOTIMPL;
413 }
414
415 static D3DVALUE WINAPI IDirect3DRMViewportImpl_GetField(IDirect3DRMViewport* iface)
416 {
417     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
418
419     TRACE("(%p/%p)->()\n", iface, This);
420
421     return IDirect3DRMViewport2_GetField(&This->IDirect3DRMViewport2_iface);
422 }
423
424 static D3DVALUE WINAPI IDirect3DRMViewportImpl_GetBack(IDirect3DRMViewport* iface)
425 {
426     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
427
428     TRACE("(%p/%p)->()\n", iface, This);
429
430     return IDirect3DRMViewport2_GetBack(&This->IDirect3DRMViewport2_iface);
431 }
432
433 static D3DVALUE WINAPI IDirect3DRMViewportImpl_GetFront(IDirect3DRMViewport* iface)
434 {
435     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
436
437     TRACE("(%p/%p)->()\n", iface, This);
438
439     return IDirect3DRMViewport2_GetFront(&This->IDirect3DRMViewport2_iface);
440 }
441
442 static D3DRMPROJECTIONTYPE WINAPI IDirect3DRMViewportImpl_GetProjection(IDirect3DRMViewport* iface)
443 {
444     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
445
446     TRACE("(%p/%p)->()\n", iface, This);
447
448     return IDirect3DRMViewport2_GetProjection(&This->IDirect3DRMViewport2_iface);
449 }
450
451 static HRESULT WINAPI IDirect3DRMViewportImpl_GetDirect3DViewport(IDirect3DRMViewport *iface,
452         IDirect3DViewport **viewport)
453 {
454     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport(iface);
455
456     FIXME("(%p/%p)->(%p): stub\n", iface, This, This);
457
458     return E_NOTIMPL;
459 }
460
461 static const struct IDirect3DRMViewportVtbl Direct3DRMViewport_Vtbl =
462 {
463     /*** IUnknown methods ***/
464     IDirect3DRMViewportImpl_QueryInterface,
465     IDirect3DRMViewportImpl_AddRef,
466     IDirect3DRMViewportImpl_Release,
467     /*** IDirect3DRMObject methods ***/
468     IDirect3DRMViewportImpl_Clone,
469     IDirect3DRMViewportImpl_AddDestroyCallback,
470     IDirect3DRMViewportImpl_DeleteDestroyCallback,
471     IDirect3DRMViewportImpl_SetAppData,
472     IDirect3DRMViewportImpl_GetAppData,
473     IDirect3DRMViewportImpl_SetName,
474     IDirect3DRMViewportImpl_GetName,
475     IDirect3DRMViewportImpl_GetClassName,
476     /*** IDirect3DRMViewport methods ***/
477     IDirect3DRMViewportImpl_Init,
478     IDirect3DRMViewportImpl_Clear,
479     IDirect3DRMViewportImpl_Render,
480     IDirect3DRMViewportImpl_SetFront,
481     IDirect3DRMViewportImpl_SetBack,
482     IDirect3DRMViewportImpl_SetField,
483     IDirect3DRMViewportImpl_SetUniformScaling,
484     IDirect3DRMViewportImpl_SetCamera,
485     IDirect3DRMViewportImpl_SetProjection,
486     IDirect3DRMViewportImpl_Transform,
487     IDirect3DRMViewportImpl_InverseTransform,
488     IDirect3DRMViewportImpl_Configure,
489     IDirect3DRMViewportImpl_ForceUpdate,
490     IDirect3DRMViewportImpl_SetPlane,
491     IDirect3DRMViewportImpl_GetCamera,
492     IDirect3DRMViewportImpl_GetDevice,
493     IDirect3DRMViewportImpl_GetPlane,
494     IDirect3DRMViewportImpl_Pick,
495     IDirect3DRMViewportImpl_GetUniformScaling,
496     IDirect3DRMViewportImpl_GetX,
497     IDirect3DRMViewportImpl_GetY,
498     IDirect3DRMViewportImpl_GetWidth,
499     IDirect3DRMViewportImpl_GetHeight,
500     IDirect3DRMViewportImpl_GetField,
501     IDirect3DRMViewportImpl_GetBack,
502     IDirect3DRMViewportImpl_GetFront,
503     IDirect3DRMViewportImpl_GetProjection,
504     IDirect3DRMViewportImpl_GetDirect3DViewport
505 };
506
507
508 /*** IUnknown methods ***/
509 static HRESULT WINAPI IDirect3DRMViewport2Impl_QueryInterface(IDirect3DRMViewport2* iface,
510                                                              REFIID riid, void** object)
511 {
512     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
513     return IDirect3DRMViewport_QueryInterface(&This->IDirect3DRMViewport_iface, riid, object);
514 }
515
516 static ULONG WINAPI IDirect3DRMViewport2Impl_AddRef(IDirect3DRMViewport2* iface)
517 {
518     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
519     return IDirect3DRMViewport_AddRef(&This->IDirect3DRMViewport_iface);
520 }
521
522 static ULONG WINAPI IDirect3DRMViewport2Impl_Release(IDirect3DRMViewport2* iface)
523 {
524     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
525     return IDirect3DRMViewport_Release(&This->IDirect3DRMViewport_iface);
526 }
527
528 /*** IDirect3DRMObject methods ***/
529 static HRESULT WINAPI IDirect3DRMViewport2Impl_Clone(IDirect3DRMViewport2* iface,
530                                                         LPUNKNOWN unkwn, REFIID riid,
531                                                         LPVOID* object)
532 {
533     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
534
535     FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
536
537     return E_NOTIMPL;
538 }
539
540 static HRESULT WINAPI IDirect3DRMViewport2Impl_AddDestroyCallback(IDirect3DRMViewport2* iface,
541                                                                      D3DRMOBJECTCALLBACK cb,
542                                                                      LPVOID argument)
543 {
544     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
545
546     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
547
548     return E_NOTIMPL;
549 }
550
551 static HRESULT WINAPI IDirect3DRMViewport2Impl_DeleteDestroyCallback(IDirect3DRMViewport2* iface,
552                                                                         D3DRMOBJECTCALLBACK cb,
553                                                                         LPVOID argument)
554 {
555     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
556
557     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
558
559     return E_NOTIMPL;
560 }
561
562 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetAppData(IDirect3DRMViewport2* iface,
563                                                              DWORD data)
564 {
565     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
566
567     FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
568
569     return E_NOTIMPL;
570 }
571
572 static DWORD WINAPI IDirect3DRMViewport2Impl_GetAppData(IDirect3DRMViewport2* iface)
573 {
574     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
575
576     FIXME("(%p/%p)->(): stub\n", iface, This);
577
578     return 0;
579 }
580
581 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetName(IDirect3DRMViewport2* iface, LPCSTR name)
582 {
583     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
584
585     FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
586
587     return E_NOTIMPL;
588 }
589
590 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetName(IDirect3DRMViewport2* iface,
591                                                           LPDWORD size, LPSTR name)
592 {
593     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
594
595     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
596
597     return E_NOTIMPL;
598 }
599
600 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetClassName(IDirect3DRMViewport2* iface,
601                                                             LPDWORD size, LPSTR name)
602 {
603     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
604
605     TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
606
607     if (!size || *size < strlen("Viewport") || !name)
608         return E_INVALIDARG;
609
610     strcpy(name, "Viewport");
611     *size = sizeof("Viewport");
612
613     return D3DRM_OK;
614 }
615
616 /*** IDirect3DRMViewport methods ***/
617 static HRESULT WINAPI IDirect3DRMViewport2Impl_Init(IDirect3DRMViewport2* iface,
618                                                    LPDIRECT3DRMDEVICE3 dev, LPDIRECT3DRMFRAME3 camera,
619                                                    DWORD xpos, DWORD ypos,
620                                                    DWORD width, DWORD height)
621 {
622     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
623
624     FIXME("(%p/%p)->(%p, %p, %u, %u, %u, %u): stub\n", iface, This, dev, camera,
625           xpos, ypos, width, height);
626
627     return E_NOTIMPL;
628 }
629
630 static HRESULT WINAPI IDirect3DRMViewport2Impl_Clear(IDirect3DRMViewport2* iface, DWORD flags)
631 {
632     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
633
634     FIXME("(%p/%p)->(): stub\n", iface, This);
635
636     return D3DRM_OK;
637 }
638
639 static HRESULT WINAPI IDirect3DRMViewport2Impl_Render(IDirect3DRMViewport2* iface,
640                                                      LPDIRECT3DRMFRAME3 frame)
641 {
642     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
643
644     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
645
646     return D3DRM_OK;
647 }
648
649 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetFront(IDirect3DRMViewport2* iface, D3DVALUE front)
650 {
651     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
652
653     TRACE("(%p/%p)->(%f):\n", iface, This, front);
654
655     This->front = front;
656
657     return D3DRM_OK;
658 }
659
660 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetBack(IDirect3DRMViewport2* iface, D3DVALUE back)
661 {
662     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
663
664     TRACE("(%p/%p)->(%f)\n", iface, This, back);
665
666     This->back = back;
667
668     return D3DRM_OK;
669 }
670
671 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetField(IDirect3DRMViewport2* iface, D3DVALUE field)
672 {
673     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
674
675     TRACE("(%p/%p)->(%f)\n", iface, This, field);
676
677     This->field = field;
678
679     return D3DRM_OK;
680 }
681
682 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetUniformScaling(IDirect3DRMViewport2* iface, BOOL b)
683 {
684     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
685
686     FIXME("(%p/%p)->(%d): stub\n", iface, This, b);
687
688     return E_NOTIMPL;
689 }
690
691 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetCamera(IDirect3DRMViewport2* iface,
692                                                         LPDIRECT3DRMFRAME3 frame)
693 {
694     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
695
696     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
697
698     return E_NOTIMPL;
699 }
700
701 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetProjection(IDirect3DRMViewport2* iface,
702                                                             D3DRMPROJECTIONTYPE type)
703 {
704     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
705
706     TRACE("(%p/%p)->(%u)\n", iface, This, type);
707
708     This->projection = type;
709
710     return D3DRM_OK;
711 }
712
713 static HRESULT WINAPI IDirect3DRMViewport2Impl_Transform(IDirect3DRMViewport2* iface,
714                                                         D3DRMVECTOR4D *d, D3DVECTOR *s)
715 {
716     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
717
718     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, d, s);
719
720     return E_NOTIMPL;
721 }
722
723 static HRESULT WINAPI IDirect3DRMViewport2Impl_InverseTransform(IDirect3DRMViewport2* iface,
724                                                                D3DVECTOR *d, D3DRMVECTOR4D *s)
725 {
726     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
727
728     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, d, s);
729
730     return E_NOTIMPL;
731 }
732
733 static HRESULT WINAPI IDirect3DRMViewport2Impl_Configure(IDirect3DRMViewport2* iface, LONG x, LONG y,
734                                                         DWORD width, DWORD height)
735 {
736     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
737
738     FIXME("(%p/%p)->(%u, %u, %u, %u): stub\n", iface, This, x, y, width, height);
739
740     return E_NOTIMPL;
741 }
742
743 static HRESULT WINAPI IDirect3DRMViewport2Impl_ForceUpdate(IDirect3DRMViewport2* iface,
744                                                           DWORD x1, DWORD y1, DWORD x2, DWORD y2)
745 {
746     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
747
748     FIXME("(%p/%p)->(%u, %u, %u, %u): stub\n", iface, This, x1, y1, x2, y2);
749
750     return E_NOTIMPL;
751 }
752
753 static HRESULT WINAPI IDirect3DRMViewport2Impl_SetPlane(IDirect3DRMViewport2* iface,
754                                                        D3DVALUE left, D3DVALUE right,
755                                                        D3DVALUE bottom, D3DVALUE top)
756 {
757     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
758
759     FIXME("(%p/%p)->(%f, %f, %f, %f): stub\n", iface, This, left, right, bottom, top);
760
761     return E_NOTIMPL;
762 }
763
764 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetCamera(IDirect3DRMViewport2* iface,
765                                                         LPDIRECT3DRMFRAME3 * frame)
766 {
767     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
768
769     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
770
771     return E_NOTIMPL;
772 }
773
774 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetDevice(IDirect3DRMViewport2* iface,
775                                                         LPDIRECT3DRMDEVICE3 * device)
776 {
777     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
778
779     FIXME("(%p/%p)->(%p): stub\n", iface, This, device);
780
781     return E_NOTIMPL;
782 }
783
784 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetPlane(IDirect3DRMViewport2* iface,
785                                                        D3DVALUE *left, D3DVALUE *right,
786                                                        D3DVALUE *bottom, D3DVALUE *top)
787 {
788     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
789
790     FIXME("(%p/%p)->(%p, %p, %p, %p): stub\n", iface, This, left, right, bottom, top);
791
792     return E_NOTIMPL;
793 }
794
795 static HRESULT WINAPI IDirect3DRMViewport2Impl_Pick(IDirect3DRMViewport2* iface, LONG x, LONG y,
796                                                    LPDIRECT3DRMPICKEDARRAY *return_visuals)
797 {
798     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
799
800     FIXME("(%p/%p)->(%u, %u, %p): stub\n", iface, This, x, y, return_visuals);
801
802     return E_NOTIMPL;
803 }
804
805 static BOOL WINAPI IDirect3DRMViewport2Impl_GetUniformScaling(IDirect3DRMViewport2* iface)
806 {
807     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
808
809     FIXME("(%p/%p)->(): stub\n", iface, This);
810
811     return E_NOTIMPL;
812 }
813
814 static LONG WINAPI IDirect3DRMViewport2Impl_GetX(IDirect3DRMViewport2* iface)
815 {
816     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
817
818     FIXME("(%p/%p)->(): stub\n", iface, This);
819
820     return E_NOTIMPL;
821 }
822
823 static LONG WINAPI IDirect3DRMViewport2Impl_GetY(IDirect3DRMViewport2* iface)
824 {
825     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
826
827     FIXME("(%p/%p)->(): stub\n", iface, This);
828
829     return E_NOTIMPL;
830 }
831
832 static DWORD WINAPI IDirect3DRMViewport2Impl_GetWidth(IDirect3DRMViewport2* iface)
833 {
834     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
835
836     FIXME("(%p/%p)->(): stub\n", iface, This);
837
838     return E_NOTIMPL;
839 }
840
841 static DWORD WINAPI IDirect3DRMViewport2Impl_GetHeight(IDirect3DRMViewport2* iface)
842 {
843     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
844
845     FIXME("(%p/%p)->(): stub\n", iface, This);
846
847     return E_NOTIMPL;
848 }
849
850 static D3DVALUE WINAPI IDirect3DRMViewport2Impl_GetField(IDirect3DRMViewport2* iface)
851 {
852     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
853
854     TRACE("(%p/%p)->()\n", iface, This);
855
856     return This->field;
857 }
858
859 static D3DVALUE WINAPI IDirect3DRMViewport2Impl_GetBack(IDirect3DRMViewport2* iface)
860 {
861     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
862
863     TRACE("(%p/%p)->()\n", iface, This);
864
865     return This->back;
866 }
867
868 static D3DVALUE WINAPI IDirect3DRMViewport2Impl_GetFront(IDirect3DRMViewport2* iface)
869 {
870     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
871
872     TRACE("(%p/%p)->()\n", iface, This);
873
874     return This->front;
875 }
876
877 static D3DRMPROJECTIONTYPE WINAPI IDirect3DRMViewport2Impl_GetProjection(IDirect3DRMViewport2* iface)
878 {
879     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
880
881     TRACE("(%p/%p)->()\n", iface, This);
882
883     return This->projection;
884 }
885
886 static HRESULT WINAPI IDirect3DRMViewport2Impl_GetDirect3DViewport(IDirect3DRMViewport2 *iface,
887         IDirect3DViewport **viewport)
888 {
889     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
890
891     FIXME("(%p/%p)->(%p): stub\n", iface, This, This);
892
893     return E_NOTIMPL;
894 }
895
896 /*** IDirect3DRMViewport2 methods ***/
897 static HRESULT WINAPI IDirect3DRMViewport2Impl_TransformVectors(IDirect3DRMViewport2 *iface,
898         DWORD numvectors, D3DRMVECTOR4D *dstvectors, D3DVECTOR *srcvectors)
899 {
900     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
901
902     FIXME("(%p/%p)->(%u, %p, %p): stub\n", iface, This, numvectors, dstvectors, srcvectors);
903
904     return E_NOTIMPL;
905 }
906
907 static HRESULT WINAPI IDirect3DRMViewport2Impl_InverseTransformVectors(IDirect3DRMViewport2 *iface,
908         DWORD numvectors, D3DVECTOR *dstvectors, D3DRMVECTOR4D *srcvectors)
909 {
910     IDirect3DRMViewportImpl *This = impl_from_IDirect3DRMViewport2(iface);
911
912     FIXME("(%p/%p)->(%u, %p, %p): stub\n", iface, This, numvectors, dstvectors, srcvectors);
913
914     return E_NOTIMPL;
915 }
916
917 static const struct IDirect3DRMViewport2Vtbl Direct3DRMViewport2_Vtbl =
918 {
919     /*** IUnknown methods ***/
920     IDirect3DRMViewport2Impl_QueryInterface,
921     IDirect3DRMViewport2Impl_AddRef,
922     IDirect3DRMViewport2Impl_Release,
923     /*** IDirect3DRMObject methods ***/
924     IDirect3DRMViewport2Impl_Clone,
925     IDirect3DRMViewport2Impl_AddDestroyCallback,
926     IDirect3DRMViewport2Impl_DeleteDestroyCallback,
927     IDirect3DRMViewport2Impl_SetAppData,
928     IDirect3DRMViewport2Impl_GetAppData,
929     IDirect3DRMViewport2Impl_SetName,
930     IDirect3DRMViewport2Impl_GetName,
931     IDirect3DRMViewport2Impl_GetClassName,
932     /*** IDirect3DRMViewport methods ***/
933     IDirect3DRMViewport2Impl_Init,
934     IDirect3DRMViewport2Impl_Clear,
935     IDirect3DRMViewport2Impl_Render,
936     IDirect3DRMViewport2Impl_SetFront,
937     IDirect3DRMViewport2Impl_SetBack,
938     IDirect3DRMViewport2Impl_SetField,
939     IDirect3DRMViewport2Impl_SetUniformScaling,
940     IDirect3DRMViewport2Impl_SetCamera,
941     IDirect3DRMViewport2Impl_SetProjection,
942     IDirect3DRMViewport2Impl_Transform,
943     IDirect3DRMViewport2Impl_InverseTransform,
944     IDirect3DRMViewport2Impl_Configure,
945     IDirect3DRMViewport2Impl_ForceUpdate,
946     IDirect3DRMViewport2Impl_SetPlane,
947     IDirect3DRMViewport2Impl_GetCamera,
948     IDirect3DRMViewport2Impl_GetDevice,
949     IDirect3DRMViewport2Impl_GetPlane,
950     IDirect3DRMViewport2Impl_Pick,
951     IDirect3DRMViewport2Impl_GetUniformScaling,
952     IDirect3DRMViewport2Impl_GetX,
953     IDirect3DRMViewport2Impl_GetY,
954     IDirect3DRMViewport2Impl_GetWidth,
955     IDirect3DRMViewport2Impl_GetHeight,
956     IDirect3DRMViewport2Impl_GetField,
957     IDirect3DRMViewport2Impl_GetBack,
958     IDirect3DRMViewport2Impl_GetFront,
959     IDirect3DRMViewport2Impl_GetProjection,
960     IDirect3DRMViewport2Impl_GetDirect3DViewport,
961     /*** IDirect3DRMViewport2 methods ***/
962     IDirect3DRMViewport2Impl_TransformVectors,
963     IDirect3DRMViewport2Impl_InverseTransformVectors
964 };
965
966 HRESULT Direct3DRMViewport_create(REFIID riid, IUnknown** ppObj)
967 {
968     IDirect3DRMViewportImpl* object;
969
970     TRACE("(%p)\n", ppObj);
971
972     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMViewportImpl));
973     if (!object)
974     {
975         ERR("Out of memory\n");
976         return E_OUTOFMEMORY;
977     }
978
979     object->IDirect3DRMViewport_iface.lpVtbl = &Direct3DRMViewport_Vtbl;
980     object->IDirect3DRMViewport2_iface.lpVtbl = &Direct3DRMViewport2_Vtbl;
981     object->ref = 1;
982
983     if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
984         *ppObj = (IUnknown*)&object->IDirect3DRMViewport2_iface;
985     else
986         *ppObj = (IUnknown*)&object->IDirect3DRMViewport_iface;
987
988     return S_OK;
989 }