d3drm/tests: Destroy window after use.
[wine] / dlls / d3drm / frame.c
1 /*
2  * Implementation of IDirect3DRMFrame Interface
3  *
4  * Copyright 2011, 2012 AndrĂ© Hentschel
5  * Copyright 2012 Christian Costa
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include <assert.h>
23 #include "wine/debug.h"
24
25 #define COBJMACROS
26
27 #include "winbase.h"
28 #include "wingdi.h"
29
30 #include "d3drm_private.h"
31
32 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
33
34 static D3DRMMATRIX4D identity = {
35     { 1.0f, 0.0f, 0.0f, 0.0f },
36     { 0.0f, 1.0f, 0.0f, 0.0f },
37     { 0.0f, 0.0f, 1.0f, 0.0f },
38     { 0.0f, 0.0f, 0.0f, 1.0f }
39 };
40
41 typedef struct IDirect3DRMFrameImpl IDirect3DRMFrameImpl;
42
43 struct IDirect3DRMFrameImpl {
44     IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
45     IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
46     LONG ref;
47     IDirect3DRMFrameImpl* parent;
48     ULONG nb_children;
49     ULONG children_capacity;
50     IDirect3DRMFrame3** children;
51     ULONG nb_visuals;
52     ULONG visuals_capacity;
53     IDirect3DRMVisual** visuals;
54     ULONG nb_lights;
55     ULONG lights_capacity;
56     IDirect3DRMLight** lights;
57     D3DRMMATRIX4D transform;
58 };
59
60 typedef struct {
61     IDirect3DRMFrameArray IDirect3DRMFrameArray_iface;
62     LONG ref;
63     ULONG size;
64     LPDIRECT3DRMFRAME* frames;
65 } IDirect3DRMFrameArrayImpl;
66
67 typedef struct {
68     IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
69     LONG ref;
70     ULONG size;
71     LPDIRECT3DRMVISUAL* visuals;
72 } IDirect3DRMVisualArrayImpl;
73
74 typedef struct {
75     IDirect3DRMLightArray IDirect3DRMLightArray_iface;
76     LONG ref;
77     ULONG size;
78     LPDIRECT3DRMLIGHT* lights;
79 } IDirect3DRMLightArrayImpl;
80
81 static inline IDirect3DRMFrameImpl *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
82 {
83     return CONTAINING_RECORD(iface, IDirect3DRMFrameImpl, IDirect3DRMFrame2_iface);
84 }
85
86 static inline IDirect3DRMFrameImpl *impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
87 {
88     return CONTAINING_RECORD(iface, IDirect3DRMFrameImpl, IDirect3DRMFrame3_iface);
89 }
90
91 static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface);
92 static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface);
93
94 static inline IDirect3DRMLightArrayImpl *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
95 {
96     return CONTAINING_RECORD(iface, IDirect3DRMLightArrayImpl, IDirect3DRMLightArray_iface);
97 }
98
99 /*** IUnknown methods ***/
100 static HRESULT WINAPI IDirect3DRMFrameArrayImpl_QueryInterface(IDirect3DRMFrameArray* iface,
101                                                                REFIID riid, void** object)
102 {
103     IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
104
105     TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
106
107     *object = NULL;
108
109     if (IsEqualGUID(riid, &IID_IUnknown) ||
110         IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
111     {
112         *object = &This->IDirect3DRMFrameArray_iface;
113     }
114     else
115     {
116         FIXME("interface %s not implemented\n", debugstr_guid(riid));
117         return E_NOINTERFACE;
118     }
119
120     IDirect3DRMFrameArray_AddRef(iface);
121     return S_OK;
122 }
123
124 static ULONG WINAPI IDirect3DRMFrameArrayImpl_AddRef(IDirect3DRMFrameArray* iface)
125 {
126     IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
127     ULONG ref = InterlockedIncrement(&This->ref);
128
129     TRACE("(%p)->(): new ref = %u\n", This, ref);
130
131     return ref;
132 }
133
134 static ULONG WINAPI IDirect3DRMFrameArrayImpl_Release(IDirect3DRMFrameArray* iface)
135 {
136     IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
137     ULONG ref = InterlockedDecrement(&This->ref);
138     ULONG i;
139
140     TRACE("(%p)->(): new ref = %u\n", This, ref);
141
142     if (!ref)
143     {
144         for (i = 0; i < This->size; i++)
145             IDirect3DRMFrame_Release(This->frames[i]);
146         HeapFree(GetProcessHeap(), 0, This->frames);
147         HeapFree(GetProcessHeap(), 0, This);
148     }
149
150     return ref;
151 }
152
153 /*** IDirect3DRMArray methods ***/
154 static DWORD WINAPI IDirect3DRMFrameArrayImpl_GetSize(IDirect3DRMFrameArray* iface)
155 {
156     IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
157
158     TRACE("(%p)->() = %d\n", This,  This->size);
159
160     return This->size;
161 }
162
163 /*** IDirect3DRMFrameArray methods ***/
164 static HRESULT WINAPI IDirect3DRMFrameArrayImpl_GetElement(IDirect3DRMFrameArray* iface, DWORD index, LPDIRECT3DRMFRAME* frame)
165 {
166     IDirect3DRMFrameArrayImpl *This = (IDirect3DRMFrameArrayImpl*)iface;
167
168     TRACE("(%p)->(%u, %p)\n", This, index, frame);
169
170     if (!frame)
171         return D3DRMERR_BADVALUE;
172
173     *frame = NULL;
174
175     if (index >= This->size)
176         return D3DRMERR_BADVALUE;
177
178     IDirect3DRMFrame_AddRef(This->frames[index]);
179     *frame = This->frames[index];
180
181     return D3DRM_OK;
182 }
183
184 static const struct IDirect3DRMFrameArrayVtbl Direct3DRMFrameArray_Vtbl =
185 {
186     /*** IUnknown methods ***/
187     IDirect3DRMFrameArrayImpl_QueryInterface,
188     IDirect3DRMFrameArrayImpl_AddRef,
189     IDirect3DRMFrameArrayImpl_Release,
190     /*** IDirect3DRMArray methods ***/
191     IDirect3DRMFrameArrayImpl_GetSize,
192     /*** IDirect3DRMFrameArray methods ***/
193     IDirect3DRMFrameArrayImpl_GetElement
194 };
195
196 static HRESULT Direct3DRMFrameArray_create(IDirect3DRMFrameArray** obj)
197 {
198     IDirect3DRMFrameArrayImpl* object;
199
200     TRACE("(%p)\n", obj);
201
202     *obj = NULL;
203
204     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameArrayImpl));
205     if (!object)
206     {
207         ERR("Out of memory\n");
208         return E_OUTOFMEMORY;
209     }
210
211     object->IDirect3DRMFrameArray_iface.lpVtbl = &Direct3DRMFrameArray_Vtbl;
212     object->ref = 1;
213
214     *obj = &object->IDirect3DRMFrameArray_iface;
215
216     return S_OK;
217 }
218
219 /*** IUnknown methods ***/
220 static HRESULT WINAPI IDirect3DRMVisualArrayImpl_QueryInterface(IDirect3DRMVisualArray* iface,
221                                                                 REFIID riid, void** ret_iface)
222 {
223     TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
224
225     if (IsEqualGUID(riid, &IID_IUnknown) ||
226         IsEqualGUID(riid, &IID_IDirect3DRMFrameArray))
227     {
228         *ret_iface = iface;
229         IDirect3DRMVisualArray_AddRef(iface);
230         return S_OK;
231     }
232
233     *ret_iface = NULL;
234
235     WARN("Interface %s not implemented\n", debugstr_guid(riid));
236
237     return E_NOINTERFACE;
238 }
239
240 static ULONG WINAPI IDirect3DRMVisualArrayImpl_AddRef(IDirect3DRMVisualArray* iface)
241 {
242     IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
243     ULONG ref = InterlockedIncrement(&This->ref);
244
245     TRACE("(%p)->(): new ref = %u\n", iface, ref);
246
247     return ref;
248 }
249
250 static ULONG WINAPI IDirect3DRMVisualArrayImpl_Release(IDirect3DRMVisualArray* iface)
251 {
252     IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
253     ULONG ref = InterlockedDecrement(&This->ref);
254     ULONG i;
255
256     TRACE("(%p)->(): new ref = %u\n", iface, ref);
257
258     if (!ref)
259     {
260         for (i = 0; i < This->size; i++)
261             IDirect3DRMVisual_Release(This->visuals[i]);
262         HeapFree(GetProcessHeap(), 0, This->visuals);
263         HeapFree(GetProcessHeap(), 0, This);
264     }
265
266     return ref;
267 }
268
269 /*** IDirect3DRMArray methods ***/
270 static DWORD WINAPI IDirect3DRMVisualArrayImpl_GetSize(IDirect3DRMVisualArray* iface)
271 {
272     IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
273
274     TRACE("(%p)->() = %d\n", iface,  This->size);
275
276     return This->size;
277 }
278
279 /*** IDirect3DRMVisualArray methods ***/
280 static HRESULT WINAPI IDirect3DRMVisualArrayImpl_GetElement(IDirect3DRMVisualArray* iface, DWORD index, LPDIRECT3DRMVISUAL* visual)
281 {
282     IDirect3DRMVisualArrayImpl *This = (IDirect3DRMVisualArrayImpl*)iface;
283
284     TRACE("(%p)->(%u, %p)\n", iface, index, visual);
285
286     if (!visual)
287         return D3DRMERR_BADVALUE;
288
289     *visual = NULL;
290
291     if (index >= This->size)
292         return D3DRMERR_BADVALUE;
293
294     IDirect3DRMVisual_AddRef(This->visuals[index]);
295     *visual = This->visuals[index];
296
297     return D3DRM_OK;
298 }
299
300 static const struct IDirect3DRMVisualArrayVtbl Direct3DRMVisualArray_Vtbl =
301 {
302     /*** IUnknown methods ***/
303     IDirect3DRMVisualArrayImpl_QueryInterface,
304     IDirect3DRMVisualArrayImpl_AddRef,
305     IDirect3DRMVisualArrayImpl_Release,
306     /*** IDirect3DRMArray methods ***/
307     IDirect3DRMVisualArrayImpl_GetSize,
308     /*** IDirect3DRMVisualArray methods ***/
309     IDirect3DRMVisualArrayImpl_GetElement
310 };
311
312 static HRESULT Direct3DRMVisualArray_create(IDirect3DRMVisualArray** ret_iface)
313 {
314     IDirect3DRMVisualArrayImpl* object;
315
316     TRACE("(%p)\n", ret_iface);
317
318     *ret_iface = NULL;
319
320     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMVisualArrayImpl));
321     if (!object)
322     {
323         ERR("Out of memory\n");
324         return E_OUTOFMEMORY;
325     }
326
327     object->IDirect3DRMVisualArray_iface.lpVtbl = &Direct3DRMVisualArray_Vtbl;
328     object->ref = 1;
329
330     *ret_iface = &object->IDirect3DRMVisualArray_iface;
331
332     return S_OK;
333 }
334
335 /*** IUnknown methods ***/
336 static HRESULT WINAPI IDirect3DRMLightArrayImpl_QueryInterface(IDirect3DRMLightArray* iface,
337                                                                REFIID riid, void** object)
338 {
339     IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
340
341     TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
342
343     *object = NULL;
344
345     if (IsEqualGUID(riid, &IID_IUnknown) ||
346         IsEqualGUID(riid, &IID_IDirect3DRMLightArray))
347     {
348         *object = &This->IDirect3DRMLightArray_iface;
349     }
350     else
351     {
352         FIXME("interface %s not implemented\n", debugstr_guid(riid));
353         return E_NOINTERFACE;
354     }
355
356     IDirect3DRMLightArray_AddRef(iface);
357     return S_OK;
358 }
359
360 static ULONG WINAPI IDirect3DRMLightArrayImpl_AddRef(IDirect3DRMLightArray* iface)
361 {
362     IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
363     ULONG ref = InterlockedIncrement(&This->ref);
364
365     TRACE("(%p)->(): new ref = %u\n", This, ref);
366
367     return ref;
368 }
369
370 static ULONG WINAPI IDirect3DRMLightArrayImpl_Release(IDirect3DRMLightArray* iface)
371 {
372     IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
373     ULONG ref = InterlockedDecrement(&This->ref);
374     ULONG i;
375
376     TRACE("(%p)->(): new ref = %u\n", This, ref);
377
378     if (!ref)
379     {
380         for (i = 0; i < This->size; i++)
381             IDirect3DRMLight_Release(This->lights[i]);
382         HeapFree(GetProcessHeap(), 0, This->lights);
383         HeapFree(GetProcessHeap(), 0, This);
384     }
385
386     return ref;
387 }
388
389 /*** IDirect3DRMArray methods ***/
390 static DWORD WINAPI IDirect3DRMLightArrayImpl_GetSize(IDirect3DRMLightArray* iface)
391 {
392     IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
393
394     TRACE("(%p)->() = %d\n", This,  This->size);
395
396     return This->size;
397 }
398
399 /*** IDirect3DRMLightArray methods ***/
400 static HRESULT WINAPI IDirect3DRMLightArrayImpl_GetElement(IDirect3DRMLightArray* iface, DWORD index, LPDIRECT3DRMLIGHT* light)
401 {
402     IDirect3DRMLightArrayImpl *This = impl_from_IDirect3DRMLightArray(iface);
403
404     TRACE("(%p)->(%u, %p)\n", This, index, light);
405
406     if (!light)
407         return D3DRMERR_BADVALUE;
408
409     *light = NULL;
410
411     if (index >= This->size)
412         return D3DRMERR_BADVALUE;
413
414     IDirect3DRMLight_AddRef(This->lights[index]);
415     *light = This->lights[index];
416
417     return D3DRM_OK;
418 }
419
420 static const struct IDirect3DRMLightArrayVtbl Direct3DRMLightArray_Vtbl =
421 {
422     /*** IUnknown methods ***/
423     IDirect3DRMLightArrayImpl_QueryInterface,
424     IDirect3DRMLightArrayImpl_AddRef,
425     IDirect3DRMLightArrayImpl_Release,
426     /*** IDirect3DRMArray methods ***/
427     IDirect3DRMLightArrayImpl_GetSize,
428     /*** IDirect3DRMLightArray methods ***/
429     IDirect3DRMLightArrayImpl_GetElement
430 };
431
432 static HRESULT Direct3DRMLightArray_create(IDirect3DRMLightArray** obj)
433 {
434     IDirect3DRMLightArrayImpl* object;
435
436     TRACE("(%p)\n", obj);
437
438     *obj = NULL;
439
440     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMLightArrayImpl));
441     if (!object)
442     {
443         ERR("Out of memory\n");
444         return E_OUTOFMEMORY;
445     }
446
447     object->IDirect3DRMLightArray_iface.lpVtbl = &Direct3DRMLightArray_Vtbl;
448     object->ref = 1;
449
450     *obj = &object->IDirect3DRMLightArray_iface;
451
452     return S_OK;
453 }
454
455 /*** IUnknown methods ***/
456 static HRESULT WINAPI IDirect3DRMFrame2Impl_QueryInterface(IDirect3DRMFrame2* iface,
457                                                            REFIID riid, void** object)
458 {
459     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
460
461     TRACE("(%p/%p)->(%s, %p)\n", iface, This, debugstr_guid(riid), object);
462
463     *object = NULL;
464
465     if(IsEqualGUID(riid, &IID_IUnknown) ||
466        IsEqualGUID(riid, &IID_IDirect3DRMFrame) ||
467        IsEqualGUID(riid, &IID_IDirect3DRMFrame2))
468     {
469         *object = &This->IDirect3DRMFrame2_iface;
470     }
471     else if(IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
472     {
473         *object = &This->IDirect3DRMFrame3_iface;
474     }
475     else
476     {
477         FIXME("interface %s not implemented\n", debugstr_guid(riid));
478         return E_NOINTERFACE;
479     }
480
481     IDirect3DRMFrame2_AddRef(iface);
482     return S_OK;
483 }
484
485 static ULONG WINAPI IDirect3DRMFrame2Impl_AddRef(IDirect3DRMFrame2* iface)
486 {
487     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
488     ULONG ref = InterlockedIncrement(&This->ref);
489
490     TRACE("(%p)->(): new ref = %d\n", This, ref);
491
492     return ref;
493 }
494
495 static ULONG WINAPI IDirect3DRMFrame2Impl_Release(IDirect3DRMFrame2* iface)
496 {
497     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
498     ULONG ref = InterlockedDecrement(&This->ref);
499     ULONG i;
500
501     TRACE("(%p)->(): new ref = %d\n", This, ref);
502
503     if (!ref)
504     {
505         for (i = 0; i < This->nb_children; i++)
506             IDirect3DRMFrame3_Release(This->children[i]);
507         HeapFree(GetProcessHeap(), 0, This->children);
508         for (i = 0; i < This->nb_visuals; i++)
509             IDirect3DRMVisual_Release(This->visuals[i]);
510         HeapFree(GetProcessHeap(), 0, This->visuals);
511         for (i = 0; i < This->nb_lights; i++)
512             IDirect3DRMLight_Release(This->lights[i]);
513         HeapFree(GetProcessHeap(), 0, This->lights);
514         HeapFree(GetProcessHeap(), 0, This);
515     }
516
517     return ref;
518 }
519
520 /*** IDirect3DRMObject methods ***/
521 static HRESULT WINAPI IDirect3DRMFrame2Impl_Clone(IDirect3DRMFrame2* iface,
522                                                   LPUNKNOWN unkwn, REFIID riid,
523                                                   LPVOID* object)
524 {
525     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
526
527     FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
528
529     return E_NOTIMPL;
530 }
531
532 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddDestroyCallback(IDirect3DRMFrame2* iface,
533                                                                D3DRMOBJECTCALLBACK cb,
534                                                                LPVOID argument)
535 {
536     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
537
538     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
539
540     return E_NOTIMPL;
541 }
542
543 static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteDestroyCallback(IDirect3DRMFrame2* iface,
544                                                                   D3DRMOBJECTCALLBACK cb,
545                                                                   LPVOID argument)
546 {
547     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
548
549     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
550
551     return E_NOTIMPL;
552 }
553
554 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetAppData(IDirect3DRMFrame2* iface,
555                                                        DWORD data)
556 {
557     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
558
559     FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
560
561     return E_NOTIMPL;
562 }
563
564 static DWORD WINAPI IDirect3DRMFrame2Impl_GetAppData(IDirect3DRMFrame2* iface)
565 {
566     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
567
568     FIXME("(%p/%p)->(): stub\n", iface, This);
569
570     return 0;
571 }
572
573 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetName(IDirect3DRMFrame2* iface, LPCSTR name)
574 {
575     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
576
577     FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
578
579     return E_NOTIMPL;
580 }
581
582 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetName(IDirect3DRMFrame2* iface,
583                                                     LPDWORD size, LPSTR name)
584 {
585     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
586
587     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
588
589     return E_NOTIMPL;
590 }
591
592 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetClassName(IDirect3DRMFrame2* iface,
593                                                          LPDWORD size, LPSTR name)
594 {
595     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
596
597     TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
598
599     return IDirect3DRMFrame3_GetClassName(&This->IDirect3DRMFrame3_iface, size, name);
600 }
601
602 /*** IDirect3DRMFrame methods ***/
603 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddChild(IDirect3DRMFrame2* iface,
604                                                      LPDIRECT3DRMFRAME child)
605 {
606     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
607     IDirect3DRMFrameImpl *frame = unsafe_impl_from_IDirect3DRMFrame2((LPDIRECT3DRMFRAME2)child);
608
609     TRACE("(%p/%p)->(%p)\n", iface, This, child);
610
611     if (!frame)
612         return D3DRMERR_BADOBJECT;
613
614     return IDirect3DRMFrame3_AddChild(&This->IDirect3DRMFrame3_iface, &frame->IDirect3DRMFrame3_iface);
615 }
616
617 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddLight(IDirect3DRMFrame2* iface,
618                                                        LPDIRECT3DRMLIGHT light)
619 {
620     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
621
622     TRACE("(%p/%p)->(%p)\n", iface, This, light);
623
624     return IDirect3DRMFrame3_AddLight(&This->IDirect3DRMFrame3_iface, light);
625 }
626
627 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback(IDirect3DRMFrame2* iface,
628                                                             D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
629 {
630     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
631
632     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
633
634     return E_NOTIMPL;
635 }
636
637 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTransform(IDirect3DRMFrame2* iface,
638                                                          D3DRMCOMBINETYPE type,
639                                                          D3DRMMATRIX4D matrix)
640 {
641     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
642
643     TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);
644
645     return IDirect3DRMFrame3_AddTransform(&This->IDirect3DRMFrame3_iface, type, matrix);
646 }
647
648 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddTranslation(IDirect3DRMFrame2* iface,
649                                                            D3DRMCOMBINETYPE type,
650                                                            D3DVALUE x, D3DVALUE y, D3DVALUE z)
651 {
652     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
653
654     FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);
655
656     return E_NOTIMPL;
657 }
658
659 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddScale(IDirect3DRMFrame2* iface,
660                                                      D3DRMCOMBINETYPE type,
661                                                      D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
662 {
663     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
664
665     FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);
666
667     return E_NOTIMPL;
668 }
669
670 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddRotation(IDirect3DRMFrame2* iface,
671                                                         D3DRMCOMBINETYPE type,
672                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
673                                                         D3DVALUE theta)
674 {
675     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
676
677     FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);
678
679     return E_NOTIMPL;
680 }
681
682 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddVisual(IDirect3DRMFrame2* iface,
683                                                       LPDIRECT3DRMVISUAL vis)
684 {
685     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
686
687     TRACE("(%p/%p)->(%p)\n", iface, This, vis);
688
689     return IDirect3DRMFrame3_AddVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
690 }
691
692 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetChildren(IDirect3DRMFrame2* iface,
693                                                         LPDIRECT3DRMFRAMEARRAY *children)
694 {
695     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
696
697     TRACE("(%p/%p)->(%p)\n", iface, This, children);
698
699     return IDirect3DRMFrame3_GetChildren(&This->IDirect3DRMFrame3_iface, children);
700 }
701
702 static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetColor(IDirect3DRMFrame2* iface)
703 {
704     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
705
706     FIXME("(%p/%p)->(): stub\n", iface, This);
707
708     return 0;
709 }
710
711 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetLights(IDirect3DRMFrame2* iface,
712                                                       LPDIRECT3DRMLIGHTARRAY *lights)
713 {
714     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
715
716     TRACE("(%p/%p)->(%p)\n", iface, This, lights);
717
718     return IDirect3DRMFrame3_GetLights(&This->IDirect3DRMFrame3_iface, lights);
719 }
720
721 static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame2Impl_GetMaterialMode(IDirect3DRMFrame2* iface)
722 {
723     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
724
725     FIXME("(%p/%p)->(): stub\n", iface, This);
726
727     return D3DRMMATERIAL_FROMPARENT;
728 }
729
730 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetParent(IDirect3DRMFrame2* iface,
731                                                       LPDIRECT3DRMFRAME * frame)
732 {
733     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
734
735     TRACE("(%p/%p)->(%p)\n", iface, This, frame);
736
737     if (!frame)
738         return D3DRMERR_BADVALUE;
739
740     if (This->parent)
741     {
742         *frame = (LPDIRECT3DRMFRAME)&This->parent->IDirect3DRMFrame2_iface;
743         IDirect3DRMFrame_AddRef(*frame);
744     }
745     else
746     {
747         *frame = NULL;
748     }
749
750     return D3DRM_OK;
751 }
752
753 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetPosition(IDirect3DRMFrame2* iface,
754                                                         LPDIRECT3DRMFRAME reference,
755                                                         LPD3DVECTOR return_position)
756 {
757     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
758
759     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);
760
761     return E_NOTIMPL;
762 }
763
764 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetRotation(IDirect3DRMFrame2* iface,
765                                                         LPDIRECT3DRMFRAME reference,
766                                                         LPD3DVECTOR axis, LPD3DVALUE return_theta)
767 {
768     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
769
770     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);
771
772     return E_NOTIMPL;
773 }
774
775 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetScene(IDirect3DRMFrame2* iface,
776                                                      LPDIRECT3DRMFRAME * frame)
777 {
778     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
779
780     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
781
782     return E_NOTIMPL;
783 }
784
785 static D3DRMSORTMODE WINAPI IDirect3DRMFrame2Impl_GetSortMode(IDirect3DRMFrame2* iface)
786 {
787     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
788
789     FIXME("(%p/%p)->(): stub\n", iface, This);
790
791     return D3DRMSORT_FROMPARENT;
792 }
793
794 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTexture(IDirect3DRMFrame2* iface,
795                                                        LPDIRECT3DRMTEXTURE * tex)
796 {
797     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
798
799     FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);
800
801     return E_NOTIMPL;
802 }
803
804 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTransform(IDirect3DRMFrame2* iface,
805                                                          D3DRMMATRIX4D return_matrix)
806 {
807     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
808
809     TRACE("(%p/%p)->(%p)\n", iface, This, return_matrix);
810
811     memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
812
813     return D3DRM_OK;
814 }
815
816 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVelocity(IDirect3DRMFrame2* iface,
817                                                         LPDIRECT3DRMFRAME reference,
818                                                         LPD3DVECTOR return_velocity,
819                                                         BOOL with_rotation)
820 {
821     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
822
823     FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);
824
825     return E_NOTIMPL;
826 }
827
828 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetOrientation(IDirect3DRMFrame2* iface,
829                                                            LPDIRECT3DRMFRAME reference,
830                                                            LPD3DVECTOR dir, LPD3DVECTOR up)
831 {
832     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
833
834     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);
835
836     return E_NOTIMPL;
837 }
838
839 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetVisuals(IDirect3DRMFrame2* iface,
840                                                        LPDIRECT3DRMVISUALARRAY *visuals)
841 {
842     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
843     IDirect3DRMVisualArrayImpl* obj;
844     HRESULT hr;
845
846     TRACE("(%p/%p)->(%p)\n", iface, This, visuals);
847
848     if (!visuals)
849         return D3DRMERR_BADVALUE;
850
851     hr = Direct3DRMVisualArray_create(visuals);
852
853     if (hr != D3DRM_OK)
854         return hr;
855
856     obj = (IDirect3DRMVisualArrayImpl*)*visuals;
857
858     obj->size = This->nb_visuals;
859     if (This->nb_visuals)
860     {
861         ULONG i;
862         obj->visuals = HeapAlloc(GetProcessHeap(), 0, This->nb_visuals * sizeof(LPDIRECT3DRMVISUAL));
863         if (!obj->visuals)
864             return E_OUTOFMEMORY;
865         for (i = 0; i < This->nb_visuals; i++)
866         {
867             obj->visuals[i] = This->visuals[i];
868             IDirect3DRMVisual_AddRef(This->visuals[i]);
869         }
870     }
871
872     return D3DRM_OK;
873 }
874
875 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetTextureTopology(IDirect3DRMFrame2* iface,
876                                                                BOOL *wrap_u, BOOL *wrap_v)
877 {
878     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
879
880     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, wrap_u, wrap_v);
881
882     return E_NOTIMPL;
883 }
884
885 static HRESULT WINAPI IDirect3DRMFrame2Impl_InverseTransform(IDirect3DRMFrame2* iface,
886                                                              D3DVECTOR *d, D3DVECTOR *s)
887 {
888     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
889
890     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);
891
892     return E_NOTIMPL;
893 }
894
895 static HRESULT WINAPI IDirect3DRMFrame2Impl_Load(IDirect3DRMFrame2* iface, LPVOID filename,
896                                                  LPVOID name, D3DRMLOADOPTIONS loadflags,
897                                                  D3DRMLOADTEXTURECALLBACK cb, LPVOID lpArg)
898 {
899     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
900
901     FIXME("(%p/%p)->(%p,%p,%u,%p,%p): stub\n", iface, This, filename, name, loadflags, cb, lpArg);
902
903     return E_NOTIMPL;
904 }
905
906 static HRESULT WINAPI IDirect3DRMFrame2Impl_LookAt(IDirect3DRMFrame2* iface,
907                                                    LPDIRECT3DRMFRAME target,
908                                                    LPDIRECT3DRMFRAME reference,
909                                                    D3DRMFRAMECONSTRAINT constraint)
910 {
911     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
912
913     FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, target, reference, constraint);
914
915     return E_NOTIMPL;
916 }
917
918 static HRESULT WINAPI IDirect3DRMFrame2Impl_Move(IDirect3DRMFrame2* iface, D3DVALUE delta)
919 {
920     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
921
922     FIXME("(%p/%p)->(%f): stub\n", iface, This, delta);
923
924     return E_NOTIMPL;
925 }
926
927 static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteChild(IDirect3DRMFrame2* iface,
928                                                         LPDIRECT3DRMFRAME frame)
929 {
930     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
931     IDirect3DRMFrameImpl *child = unsafe_impl_from_IDirect3DRMFrame2((LPDIRECT3DRMFRAME2)frame);
932
933     TRACE("(%p/%p)->(%p)\n", iface, This, frame);
934
935     if (!child)
936         return D3DRMERR_BADOBJECT;
937
938     return IDirect3DRMFrame3_DeleteChild(&This->IDirect3DRMFrame3_iface, &child->IDirect3DRMFrame3_iface);
939 }
940
941 static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteLight(IDirect3DRMFrame2* iface,
942                                                           LPDIRECT3DRMLIGHT light)
943 {
944     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
945
946     TRACE("(%p/%p)->(%p)\n", iface, This, light);
947
948     return IDirect3DRMFrame3_DeleteLight(&This->IDirect3DRMFrame3_iface, light);
949 }
950
951 static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteMoveCallback(IDirect3DRMFrame2* iface,
952                                                                D3DRMFRAMEMOVECALLBACK cb, VOID *arg)
953 {
954     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
955
956     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
957
958     return E_NOTIMPL;
959 }
960
961 static HRESULT WINAPI IDirect3DRMFrame2Impl_DeleteVisual(IDirect3DRMFrame2* iface,
962                                                          LPDIRECT3DRMVISUAL vis)
963 {
964     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
965
966     TRACE("(%p/%p)->(%p)\n", iface, This, vis);
967
968     return IDirect3DRMFrame3_DeleteVisual(&This->IDirect3DRMFrame3_iface, (LPUNKNOWN)vis);
969 }
970
971 static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetSceneBackground(IDirect3DRMFrame2* iface)
972 {
973     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
974
975     FIXME("(%p/%p)->(): stub\n", iface, This);
976
977     return 0;
978 }
979
980 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
981                                                                     LPDIRECTDRAWSURFACE * surface)
982 {
983     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
984
985     FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);
986
987     return E_NOTIMPL;
988 }
989
990 static D3DCOLOR WINAPI IDirect3DRMFrame2Impl_GetSceneFogColor(IDirect3DRMFrame2* iface)
991 {
992     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
993
994     FIXME("(%p/%p)->(): stub\n", iface, This);
995
996     return 0;
997 }
998
999 static BOOL WINAPI IDirect3DRMFrame2Impl_GetSceneFogEnable(IDirect3DRMFrame2* iface)
1000 {
1001     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1002
1003     FIXME("(%p/%p)->(): stub\n", iface, This);
1004
1005     return FALSE;
1006 }
1007
1008 static D3DRMFOGMODE WINAPI IDirect3DRMFrame2Impl_GetSceneFogMode(IDirect3DRMFrame2* iface)
1009 {
1010     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1011
1012     FIXME("(%p/%p)->(): stub\n", iface, This);
1013
1014     return D3DRMFOG_LINEAR;
1015 }
1016
1017 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetSceneFogParams(IDirect3DRMFrame2* iface,
1018                                                               D3DVALUE *return_start,
1019                                                               D3DVALUE *return_end,
1020                                                               D3DVALUE *return_density)
1021 {
1022     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1023
1024     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, return_start, return_end, return_density);
1025
1026     return E_NOTIMPL;
1027 }
1028
1029 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackground(IDirect3DRMFrame2* iface,
1030                                                                D3DCOLOR color)
1031 {
1032     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1033
1034     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
1035
1036     return E_NOTIMPL;
1037 }
1038
1039 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundRGB(IDirect3DRMFrame2* iface,
1040                                                                   D3DVALUE red, D3DVALUE green,
1041                                                                   D3DVALUE blue)
1042 {
1043     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1044
1045     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);
1046
1047     return E_NOTIMPL;
1048 }
1049
1050 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundDepth(IDirect3DRMFrame2* iface,
1051                                                                     LPDIRECTDRAWSURFACE surface)
1052 {
1053     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1054
1055     FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);
1056
1057     return E_NOTIMPL;
1058 }
1059
1060 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneBackgroundImage(IDirect3DRMFrame2* iface,
1061                                                                     LPDIRECT3DRMTEXTURE texture)
1062 {
1063     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1064
1065     FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);
1066
1067     return E_NOTIMPL;
1068 }
1069
1070 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogEnable(IDirect3DRMFrame2* iface, BOOL enable)
1071 {
1072     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1073
1074     FIXME("(%p/%p)->(%d): stub\n", iface, This, enable);
1075
1076     return E_NOTIMPL;
1077 }
1078
1079 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogColor(IDirect3DRMFrame2* iface,
1080                                                              D3DCOLOR color)
1081 {
1082     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1083
1084     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
1085
1086     return E_NOTIMPL;
1087 }
1088
1089 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogMode(IDirect3DRMFrame2* iface,
1090                                                             D3DRMFOGMODE mode)
1091 {
1092     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1093
1094     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
1095
1096     return E_NOTIMPL;
1097 }
1098
1099 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSceneFogParams(IDirect3DRMFrame2* iface,
1100                                                               D3DVALUE start, D3DVALUE end,
1101                                                               D3DVALUE density)
1102 {
1103     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1104
1105     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, start, end, density);
1106
1107     return E_NOTIMPL;
1108 }
1109
1110 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetColor(IDirect3DRMFrame2* iface, D3DCOLOR color)
1111 {
1112     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1113
1114     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
1115
1116     return E_NOTIMPL;
1117 }
1118
1119 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetColorRGB(IDirect3DRMFrame2* iface, D3DVALUE red,
1120                                                         D3DVALUE green, D3DVALUE blue)
1121 {
1122     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1123
1124     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);
1125
1126     return E_NOTIMPL;
1127 }
1128
1129 static D3DRMZBUFFERMODE WINAPI IDirect3DRMFrame2Impl_GetZbufferMode(IDirect3DRMFrame2* iface)
1130 {
1131     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1132
1133     FIXME("(%p/%p)->(): stub\n", iface, This);
1134
1135     return D3DRMZBUFFER_FROMPARENT;
1136 }
1137
1138 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetMaterialMode(IDirect3DRMFrame2* iface,
1139                                                             D3DRMMATERIALMODE mode)
1140 {
1141     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1142
1143     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
1144
1145     return E_NOTIMPL;
1146 }
1147
1148 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetOrientation(IDirect3DRMFrame2* iface,
1149                                                            LPDIRECT3DRMFRAME reference,
1150                                                            D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
1151                                                            D3DVALUE ux, D3DVALUE uy, D3DVALUE uz )
1152 {
1153     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1154
1155     FIXME("(%p/%p)->(%p,%f,%f,%f,%f,%f,%f): stub\n", iface, This, reference,
1156           dx, dy, dz, ux, uy, uz);
1157
1158     return E_NOTIMPL;
1159 }
1160
1161 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetPosition(IDirect3DRMFrame2* iface,
1162                                                         LPDIRECT3DRMFRAME reference,
1163                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z)
1164 {
1165     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1166
1167     FIXME("(%p/%p)->(%p,%f,%f,%f): stub\n", iface, This, reference, x, y, z);
1168
1169     return E_NOTIMPL;
1170 }
1171
1172 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetRotation(IDirect3DRMFrame2* iface,
1173                                                         LPDIRECT3DRMFRAME reference,
1174                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
1175                                                         D3DVALUE theta)
1176 {
1177     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1178
1179     FIXME("(%p/%p)->(%p,%f,%f,%f,%f): stub\n", iface, This, reference, x, y, z, theta);
1180
1181     return E_NOTIMPL;
1182 }
1183
1184 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetSortMode(IDirect3DRMFrame2* iface,
1185                                                         D3DRMSORTMODE mode)
1186 {
1187     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1188
1189     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
1190
1191     return E_NOTIMPL;
1192 }
1193
1194 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetTexture(IDirect3DRMFrame2* iface,
1195                                                        LPDIRECT3DRMTEXTURE texture)
1196 {
1197     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1198
1199     FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);
1200
1201     return E_NOTIMPL;
1202 }
1203
1204 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetTextureTopology(IDirect3DRMFrame2* iface,
1205                                                                BOOL wrap_u, BOOL wrap_v)
1206 {
1207     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1208
1209     FIXME("(%p/%p)->(%d,%d): stub\n", iface, This, wrap_u, wrap_v);
1210
1211     return E_NOTIMPL;
1212 }
1213
1214 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetVelocity(IDirect3DRMFrame2* iface,
1215                                                         LPDIRECT3DRMFRAME reference,
1216                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
1217                                                         BOOL with_rotation)
1218 {
1219     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1220
1221     FIXME("(%p/%p)->(%p,%f,%f,%f,%d): stub\n", iface, This, reference, x, y, z, with_rotation);
1222
1223     return E_NOTIMPL;
1224 }
1225
1226 static HRESULT WINAPI IDirect3DRMFrame2Impl_SetZbufferMode(IDirect3DRMFrame2* iface,
1227                                                            D3DRMZBUFFERMODE mode)
1228 {
1229     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1230
1231     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
1232
1233     return E_NOTIMPL;
1234 }
1235
1236 static HRESULT WINAPI IDirect3DRMFrame2Impl_Transform(IDirect3DRMFrame2* iface, D3DVECTOR *d,
1237                                                       D3DVECTOR *s)
1238 {
1239     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1240
1241     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);
1242
1243     return E_NOTIMPL;
1244 }
1245
1246 /*** IDirect3DRMFrame2 methods ***/
1247 static HRESULT WINAPI IDirect3DRMFrame2Impl_AddMoveCallback2(IDirect3DRMFrame2* iface,
1248                                                              D3DRMFRAMEMOVECALLBACK cb, VOID *arg,
1249                                                              DWORD flags)
1250 {
1251     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1252
1253     FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, cb, arg, flags);
1254
1255     return E_NOTIMPL;
1256 }
1257
1258 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetBox(IDirect3DRMFrame2* iface, LPD3DRMBOX box)
1259 {
1260     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1261
1262     FIXME("(%p/%p)->(%p): stub\n", iface, This, box);
1263
1264     return E_NOTIMPL;
1265 }
1266
1267 static BOOL WINAPI IDirect3DRMFrame2Impl_GetBoxEnable(IDirect3DRMFrame2* iface)
1268 {
1269     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1270
1271     FIXME("(%p/%p)->(): stub\n", iface, This);
1272
1273     return E_NOTIMPL;
1274 }
1275
1276 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetAxes(IDirect3DRMFrame2* iface,
1277                                                     LPD3DVECTOR dir, LPD3DVECTOR up)
1278 {
1279     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1280
1281     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, dir, up);
1282
1283     return E_NOTIMPL;
1284 }
1285
1286 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetMaterial(IDirect3DRMFrame2* iface,
1287                                                         LPDIRECT3DRMMATERIAL *material)
1288 {
1289     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1290
1291     FIXME("(%p/%p)->(%p): stub\n", iface, This, material);
1292
1293     return E_NOTIMPL;
1294 }
1295
1296 static BOOL WINAPI IDirect3DRMFrame2Impl_GetInheritAxes(IDirect3DRMFrame2* iface)
1297 {
1298     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1299
1300     FIXME("(%p/%p)->(): stub\n", iface, This);
1301
1302     return E_NOTIMPL;
1303 }
1304
1305 static HRESULT WINAPI IDirect3DRMFrame2Impl_GetHierarchyBox(IDirect3DRMFrame2* iface,
1306                                                             LPD3DRMBOX box)
1307 {
1308     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame2(iface);
1309
1310     FIXME("(%p/%p)->(%p): stub\n", iface, This, box);
1311
1312     return E_NOTIMPL;
1313 }
1314
1315 static const struct IDirect3DRMFrame2Vtbl Direct3DRMFrame2_Vtbl =
1316 {
1317     /*** IUnknown methods ***/
1318     IDirect3DRMFrame2Impl_QueryInterface,
1319     IDirect3DRMFrame2Impl_AddRef,
1320     IDirect3DRMFrame2Impl_Release,
1321     /*** IDirect3DRMObject methods ***/
1322     IDirect3DRMFrame2Impl_Clone,
1323     IDirect3DRMFrame2Impl_AddDestroyCallback,
1324     IDirect3DRMFrame2Impl_DeleteDestroyCallback,
1325     IDirect3DRMFrame2Impl_SetAppData,
1326     IDirect3DRMFrame2Impl_GetAppData,
1327     IDirect3DRMFrame2Impl_SetName,
1328     IDirect3DRMFrame2Impl_GetName,
1329     IDirect3DRMFrame2Impl_GetClassName,
1330     /*** IDirect3DRMFrame methods ***/
1331     IDirect3DRMFrame2Impl_AddChild,
1332     IDirect3DRMFrame2Impl_AddLight,
1333     IDirect3DRMFrame2Impl_AddMoveCallback,
1334     IDirect3DRMFrame2Impl_AddTransform,
1335     IDirect3DRMFrame2Impl_AddTranslation,
1336     IDirect3DRMFrame2Impl_AddScale,
1337     IDirect3DRMFrame2Impl_AddRotation,
1338     IDirect3DRMFrame2Impl_AddVisual,
1339     IDirect3DRMFrame2Impl_GetChildren,
1340     IDirect3DRMFrame2Impl_GetColor,
1341     IDirect3DRMFrame2Impl_GetLights,
1342     IDirect3DRMFrame2Impl_GetMaterialMode,
1343     IDirect3DRMFrame2Impl_GetParent,
1344     IDirect3DRMFrame2Impl_GetPosition,
1345     IDirect3DRMFrame2Impl_GetRotation,
1346     IDirect3DRMFrame2Impl_GetScene,
1347     IDirect3DRMFrame2Impl_GetSortMode,
1348     IDirect3DRMFrame2Impl_GetTexture,
1349     IDirect3DRMFrame2Impl_GetTransform,
1350     IDirect3DRMFrame2Impl_GetVelocity,
1351     IDirect3DRMFrame2Impl_GetOrientation,
1352     IDirect3DRMFrame2Impl_GetVisuals,
1353     IDirect3DRMFrame2Impl_GetTextureTopology,
1354     IDirect3DRMFrame2Impl_InverseTransform,
1355     IDirect3DRMFrame2Impl_Load,
1356     IDirect3DRMFrame2Impl_LookAt,
1357     IDirect3DRMFrame2Impl_Move,
1358     IDirect3DRMFrame2Impl_DeleteChild,
1359     IDirect3DRMFrame2Impl_DeleteLight,
1360     IDirect3DRMFrame2Impl_DeleteMoveCallback,
1361     IDirect3DRMFrame2Impl_DeleteVisual,
1362     IDirect3DRMFrame2Impl_GetSceneBackground,
1363     IDirect3DRMFrame2Impl_GetSceneBackgroundDepth,
1364     IDirect3DRMFrame2Impl_GetSceneFogColor,
1365     IDirect3DRMFrame2Impl_GetSceneFogEnable,
1366     IDirect3DRMFrame2Impl_GetSceneFogMode,
1367     IDirect3DRMFrame2Impl_GetSceneFogParams,
1368     IDirect3DRMFrame2Impl_SetSceneBackground,
1369     IDirect3DRMFrame2Impl_SetSceneBackgroundRGB,
1370     IDirect3DRMFrame2Impl_SetSceneBackgroundDepth,
1371     IDirect3DRMFrame2Impl_SetSceneBackgroundImage,
1372     IDirect3DRMFrame2Impl_SetSceneFogEnable,
1373     IDirect3DRMFrame2Impl_SetSceneFogColor,
1374     IDirect3DRMFrame2Impl_SetSceneFogMode,
1375     IDirect3DRMFrame2Impl_SetSceneFogParams,
1376     IDirect3DRMFrame2Impl_SetColor,
1377     IDirect3DRMFrame2Impl_SetColorRGB,
1378     IDirect3DRMFrame2Impl_GetZbufferMode,
1379     IDirect3DRMFrame2Impl_SetMaterialMode,
1380     IDirect3DRMFrame2Impl_SetOrientation,
1381     IDirect3DRMFrame2Impl_SetPosition,
1382     IDirect3DRMFrame2Impl_SetRotation,
1383     IDirect3DRMFrame2Impl_SetSortMode,
1384     IDirect3DRMFrame2Impl_SetTexture,
1385     IDirect3DRMFrame2Impl_SetTextureTopology,
1386     IDirect3DRMFrame2Impl_SetVelocity,
1387     IDirect3DRMFrame2Impl_SetZbufferMode,
1388     IDirect3DRMFrame2Impl_Transform,
1389     /*** IDirect3DRMFrame2 methods ***/
1390     IDirect3DRMFrame2Impl_AddMoveCallback2,
1391     IDirect3DRMFrame2Impl_GetBox,
1392     IDirect3DRMFrame2Impl_GetBoxEnable,
1393     IDirect3DRMFrame2Impl_GetAxes,
1394     IDirect3DRMFrame2Impl_GetMaterial,
1395     IDirect3DRMFrame2Impl_GetInheritAxes,
1396     IDirect3DRMFrame2Impl_GetHierarchyBox
1397 };
1398
1399 /*** IUnknown methods ***/
1400 static HRESULT WINAPI IDirect3DRMFrame3Impl_QueryInterface(IDirect3DRMFrame3* iface,
1401                                                            REFIID riid, void** object)
1402 {
1403     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1404     return IDirect3DRMFrame_QueryInterface(&This->IDirect3DRMFrame2_iface, riid, object);
1405 }
1406
1407 static ULONG WINAPI IDirect3DRMFrame3Impl_AddRef(IDirect3DRMFrame3* iface)
1408 {
1409     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1410     return IDirect3DRMFrame2_AddRef(&This->IDirect3DRMFrame2_iface);
1411 }
1412
1413 static ULONG WINAPI IDirect3DRMFrame3Impl_Release(IDirect3DRMFrame3* iface)
1414 {
1415     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1416     return IDirect3DRMFrame2_Release(&This->IDirect3DRMFrame2_iface);
1417 }
1418
1419 /*** IDirect3DRMObject methods ***/
1420 static HRESULT WINAPI IDirect3DRMFrame3Impl_Clone(IDirect3DRMFrame3* iface,
1421                                                   LPUNKNOWN unkwn, REFIID riid,
1422                                                   LPVOID* object)
1423 {
1424     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1425
1426     FIXME("(%p/%p)->(%p, %s, %p): stub\n", iface, This, unkwn, debugstr_guid(riid), object);
1427
1428     return E_NOTIMPL;
1429 }
1430
1431 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddDestroyCallback(IDirect3DRMFrame3* iface,
1432                                                                D3DRMOBJECTCALLBACK cb,
1433                                                                LPVOID argument)
1434 {
1435     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1436
1437     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
1438
1439     return E_NOTIMPL;
1440 }
1441
1442 static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteDestroyCallback(IDirect3DRMFrame3* iface,
1443                                                                   D3DRMOBJECTCALLBACK cb,
1444                                                                   LPVOID argument)
1445 {
1446     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1447
1448     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, cb, argument);
1449
1450     return E_NOTIMPL;
1451 }
1452
1453 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetAppData(IDirect3DRMFrame3* iface,
1454                                                        DWORD data)
1455 {
1456     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1457
1458     FIXME("(%p/%p)->(%u): stub\n", iface, This, data);
1459
1460     return E_NOTIMPL;
1461 }
1462
1463 static DWORD WINAPI IDirect3DRMFrame3Impl_GetAppData(IDirect3DRMFrame3* iface)
1464 {
1465     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1466
1467     FIXME("(%p/%p)->(): stub\n", iface, This);
1468
1469     return 0;
1470 }
1471
1472 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetName(IDirect3DRMFrame3* iface, LPCSTR name)
1473 {
1474     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1475
1476     FIXME("(%p/%p)->(%s): stub\n", iface, This, name);
1477
1478     return E_NOTIMPL;
1479 }
1480
1481 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetName(IDirect3DRMFrame3* iface,
1482                                                     LPDWORD size, LPSTR name)
1483 {
1484     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1485
1486     FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name);
1487
1488     return E_NOTIMPL;
1489 }
1490
1491 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetClassName(IDirect3DRMFrame3* iface,
1492                                                          LPDWORD size, LPSTR name)
1493 {
1494     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1495
1496     TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
1497
1498     if (!size || *size < strlen("Frame") || !name)
1499         return E_INVALIDARG;
1500
1501     strcpy(name, "Frame");
1502     *size = sizeof("Frame");
1503
1504     return D3DRM_OK;
1505 }
1506
1507 /*** IDirect3DRMFrame methods ***/
1508 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddChild(IDirect3DRMFrame3* iface,
1509                                                      LPDIRECT3DRMFRAME3 child)
1510 {
1511     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1512     IDirect3DRMFrameImpl *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child);
1513
1514     TRACE("(%p/%p)->(%p)\n", iface, This, child);
1515
1516     if (!child_obj)
1517         return D3DRMERR_BADOBJECT;
1518
1519     if (child_obj->parent)
1520     {
1521         IDirect3DRMFrame3* parent = &child_obj->parent->IDirect3DRMFrame3_iface;
1522
1523         if (parent == iface)
1524         {
1525             /* Passed frame is already a child so return success */
1526             return D3DRM_OK;
1527         }
1528         else
1529         {
1530             /* Remove parent and continue */
1531             IDirect3DRMFrame3_DeleteChild(parent, child);
1532         }
1533     }
1534
1535     if ((This->nb_children + 1) > This->children_capacity)
1536     {
1537         ULONG new_capacity;
1538         IDirect3DRMFrame3** children;
1539
1540         if (!This->children_capacity)
1541         {
1542             new_capacity = 16;
1543             children = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMFrame3*));
1544         }
1545         else
1546         {
1547             new_capacity = This->children_capacity * 2;
1548             children = HeapReAlloc(GetProcessHeap(), 0, This->children, new_capacity * sizeof(IDirect3DRMFrame3*));
1549         }
1550
1551         if (!children)
1552             return E_OUTOFMEMORY;
1553
1554         This->children_capacity = new_capacity;
1555         This->children = children;
1556     }
1557
1558     This->children[This->nb_children++] = child;
1559     IDirect3DRMFrame3_AddRef(child);
1560     child_obj->parent = This;
1561
1562     return D3DRM_OK;
1563 }
1564
1565 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddLight(IDirect3DRMFrame3* iface,
1566                                                        LPDIRECT3DRMLIGHT light)
1567 {
1568     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1569     ULONG i;
1570     IDirect3DRMLight** lights;
1571
1572     TRACE("(%p/%p)->(%p)\n", iface, This, light);
1573
1574     if (!light)
1575         return D3DRMERR_BADOBJECT;
1576
1577     /* Check if already existing and return gracefully without increasing ref count */
1578     for (i = 0; i < This->nb_lights; i++)
1579         if (This->lights[i] == light)
1580             return D3DRM_OK;
1581
1582     if ((This->nb_lights + 1) > This->lights_capacity)
1583     {
1584         ULONG new_capacity;
1585
1586         if (!This->lights_capacity)
1587         {
1588             new_capacity = 16;
1589             lights = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMLight*));
1590         }
1591         else
1592         {
1593             new_capacity = This->lights_capacity * 2;
1594             lights = HeapReAlloc(GetProcessHeap(), 0, This->lights, new_capacity * sizeof(IDirect3DRMLight*));
1595         }
1596
1597         if (!lights)
1598             return E_OUTOFMEMORY;
1599
1600         This->lights_capacity = new_capacity;
1601         This->lights = lights;
1602     }
1603
1604     This->lights[This->nb_lights++] = light;
1605     IDirect3DRMLight_AddRef(light);
1606
1607     return D3DRM_OK;
1608 }
1609
1610 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddMoveCallback(IDirect3DRMFrame3* iface,
1611                                                             D3DRMFRAME3MOVECALLBACK cb, VOID *arg,
1612                                                             DWORD flags)
1613 {
1614     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1615
1616     FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, cb, arg, flags);
1617
1618     return E_NOTIMPL;
1619 }
1620
1621 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddTransform(IDirect3DRMFrame3* iface,
1622                                                          D3DRMCOMBINETYPE type,
1623                                                          D3DRMMATRIX4D matrix)
1624 {
1625     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1626
1627     TRACE("(%p/%p)->(%u,%p)\n", iface, This, type, matrix);
1628
1629     switch (type)
1630     {
1631         case D3DRMCOMBINE_REPLACE:
1632             memcpy(&This->transform[0][0], &matrix[0][0], sizeof(D3DRMMATRIX4D));
1633             break;
1634
1635         case D3DRMCOMBINE_BEFORE:
1636             FIXME("D3DRMCOMBINE_BEFORE not supported yed\n");
1637             break;
1638
1639         case D3DRMCOMBINE_AFTER:
1640             FIXME("D3DRMCOMBINE_AFTER not supported yed\n");
1641             break;
1642
1643         default:
1644             WARN("Unknown Combine Type %u\n", type);
1645             return D3DRMERR_BADVALUE;
1646     }
1647
1648     return S_OK;
1649 }
1650
1651 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddTranslation(IDirect3DRMFrame3* iface,
1652                                                            D3DRMCOMBINETYPE type,
1653                                                            D3DVALUE x, D3DVALUE y, D3DVALUE z)
1654 {
1655     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1656
1657     FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, x, y, z);
1658
1659     return E_NOTIMPL;
1660 }
1661
1662 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddScale(IDirect3DRMFrame3* iface,
1663                                                      D3DRMCOMBINETYPE type,
1664                                                      D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1665 {
1666     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1667
1668     FIXME("(%p/%p)->(%u,%f,%f,%f): stub\n", iface, This, type, sx, sy, sz);
1669
1670     return E_NOTIMPL;
1671 }
1672
1673 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddRotation(IDirect3DRMFrame3* iface,
1674                                                         D3DRMCOMBINETYPE type,
1675                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
1676                                                         D3DVALUE theta)
1677 {
1678     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1679
1680     FIXME("(%p/%p)->(%u,%f,%f,%f,%f): stub\n", iface, This, type, x, y, z, theta);
1681
1682     return E_NOTIMPL;
1683 }
1684
1685 static HRESULT WINAPI IDirect3DRMFrame3Impl_AddVisual(IDirect3DRMFrame3* iface, LPUNKNOWN vis)
1686 {
1687     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1688     ULONG i;
1689     IDirect3DRMVisual** visuals;
1690
1691     TRACE("(%p/%p)->(%p)\n", iface, This, vis);
1692
1693     if (!vis)
1694         return D3DRMERR_BADOBJECT;
1695
1696     /* Check if already existing and return gracefully without increasing ref count */
1697     for (i = 0; i < This->nb_visuals; i++)
1698         if (This->visuals[i] == (IDirect3DRMVisual*)vis)
1699             return D3DRM_OK;
1700
1701     if ((This->nb_visuals + 1) > This->visuals_capacity)
1702     {
1703         ULONG new_capacity;
1704
1705         if (!This->visuals_capacity)
1706         {
1707             new_capacity = 16;
1708             visuals = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMVisual*));
1709         }
1710         else
1711         {
1712             new_capacity = This->visuals_capacity * 2;
1713             visuals = HeapReAlloc(GetProcessHeap(), 0, This->visuals, new_capacity * sizeof(IDirect3DRMVisual*));
1714         }
1715
1716         if (!visuals)
1717             return E_OUTOFMEMORY;
1718
1719         This->visuals_capacity = new_capacity;
1720         This->visuals = visuals;
1721     }
1722
1723     This->visuals[This->nb_visuals++] = (IDirect3DRMVisual*)vis;
1724     IDirect3DRMVisual_AddRef(vis);
1725
1726     return D3DRM_OK;
1727 }
1728
1729 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetChildren(IDirect3DRMFrame3* iface,
1730                                                         LPDIRECT3DRMFRAMEARRAY *children)
1731 {
1732     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1733     IDirect3DRMFrameArrayImpl* obj;
1734     HRESULT hr;
1735
1736     TRACE("(%p/%p)->(%p)\n", iface, This, children);
1737
1738     if (!children)
1739         return D3DRMERR_BADVALUE;
1740
1741     hr = Direct3DRMFrameArray_create(children);
1742
1743     if (hr != D3DRM_OK)
1744         return hr;
1745
1746     obj = (IDirect3DRMFrameArrayImpl*)*children;
1747
1748     obj->size = This->nb_children;
1749     if (This->nb_children)
1750     {
1751         ULONG i;
1752         obj->frames = HeapAlloc(GetProcessHeap(), 0, This->nb_children * sizeof(LPDIRECT3DRMFRAME));
1753         if (!obj->frames)
1754             return E_OUTOFMEMORY;
1755         for (i = 0; i < This->nb_children; i++)
1756             IDirect3DRMFrame3_QueryInterface(This->children[i], &IID_IDirect3DRMFrame, (void**)&obj->frames[i]);
1757     }
1758
1759     return D3DRM_OK;
1760 }
1761
1762 static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetColor(IDirect3DRMFrame3* iface)
1763 {
1764     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1765
1766     FIXME("(%p/%p)->(): stub\n", iface, This);
1767
1768     return 0;
1769 }
1770
1771 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetLights(IDirect3DRMFrame3* iface,
1772                                                       LPDIRECT3DRMLIGHTARRAY *lights)
1773 {
1774     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1775     IDirect3DRMLightArrayImpl* obj;
1776     HRESULT hr;
1777
1778     TRACE("(%p/%p)->(%p)\n", iface, This, lights);
1779
1780     if (!lights)
1781         return D3DRMERR_BADVALUE;
1782
1783     hr = Direct3DRMLightArray_create(lights);
1784
1785     if (hr != D3DRM_OK)
1786         return hr;
1787
1788     obj = (IDirect3DRMLightArrayImpl*)*lights;
1789
1790     obj->size = This->nb_lights;
1791     if (This->nb_lights)
1792     {
1793         ULONG i;
1794         obj->lights = HeapAlloc(GetProcessHeap(), 0, This->nb_lights * sizeof(LPDIRECT3DRMLIGHT));
1795         if (!obj->lights)
1796             return E_OUTOFMEMORY;
1797         for (i = 0; i < This->nb_lights; i++)
1798             IDirect3DRMLight_QueryInterface(This->lights[i], &IID_IDirect3DRMLight, (void**)&obj->lights[i]);
1799     }
1800
1801     return D3DRM_OK;
1802 }
1803
1804 static D3DRMMATERIALMODE WINAPI IDirect3DRMFrame3Impl_GetMaterialMode(IDirect3DRMFrame3* iface)
1805 {
1806     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1807
1808     FIXME("(%p/%p)->(): stub\n", iface, This);
1809
1810     return D3DRMMATERIAL_FROMPARENT;
1811 }
1812
1813 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetParent(IDirect3DRMFrame3* iface,
1814                                                       LPDIRECT3DRMFRAME3 * frame)
1815 {
1816     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1817
1818     TRACE("(%p/%p)->(%p)\n", iface, This, frame);
1819
1820     if (!frame)
1821         return D3DRMERR_BADVALUE;
1822
1823     if (This->parent)
1824     {
1825         *frame = &This->parent->IDirect3DRMFrame3_iface;
1826         IDirect3DRMFrame_AddRef(*frame);
1827     }
1828     else
1829     {
1830         *frame = NULL;
1831     }
1832
1833     return D3DRM_OK;
1834 }
1835
1836 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetPosition(IDirect3DRMFrame3* iface,
1837                                                         LPDIRECT3DRMFRAME3 reference,
1838                                                         LPD3DVECTOR return_position)
1839 {
1840     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1841
1842     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, return_position);
1843
1844     return E_NOTIMPL;
1845 }
1846
1847 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetRotation(IDirect3DRMFrame3* iface,
1848                                                         LPDIRECT3DRMFRAME3 reference,
1849                                                         LPD3DVECTOR axis, LPD3DVALUE return_theta)
1850 {
1851     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1852
1853     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, axis, return_theta);
1854
1855     return E_NOTIMPL;
1856 }
1857
1858 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetScene(IDirect3DRMFrame3* iface,
1859                                                      LPDIRECT3DRMFRAME3 * frame)
1860 {
1861     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1862
1863     FIXME("(%p/%p)->(%p): stub\n", iface, This, frame);
1864
1865     return E_NOTIMPL;
1866 }
1867
1868 static D3DRMSORTMODE WINAPI IDirect3DRMFrame3Impl_GetSortMode(IDirect3DRMFrame3* iface)
1869 {
1870     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1871
1872     FIXME("(%p/%p)->(): stub\n", iface, This);
1873
1874     return D3DRMSORT_FROMPARENT;
1875 }
1876
1877 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTexture(IDirect3DRMFrame3* iface,
1878                                                        LPDIRECT3DRMTEXTURE3 * tex)
1879 {
1880     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1881
1882     FIXME("(%p/%p)->(%p): stub\n", iface, This, tex);
1883
1884     return E_NOTIMPL;
1885 }
1886
1887 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTransform(IDirect3DRMFrame3* iface,
1888                                                          LPDIRECT3DRMFRAME3 reference,
1889                                                          D3DRMMATRIX4D return_matrix)
1890 {
1891     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1892
1893     TRACE("(%p/%p)->(%p,%p)\n", iface, This, reference, return_matrix);
1894
1895     if (reference)
1896         FIXME("Specifying a frame as the root of the scene different from the current root frame is not supported yet\n");
1897
1898     memcpy(&return_matrix[0][0], &This->transform[0][0], sizeof(D3DRMMATRIX4D));
1899
1900     return D3DRM_OK;
1901 }
1902
1903 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVelocity(IDirect3DRMFrame3* iface,
1904                                                         LPDIRECT3DRMFRAME3 reference,
1905                                                         LPD3DVECTOR return_velocity,
1906                                                         BOOL with_rotation)
1907 {
1908     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1909
1910     FIXME("(%p/%p)->(%p,%p,%d): stub\n", iface, This, reference, return_velocity, with_rotation);
1911
1912     return E_NOTIMPL;
1913 }
1914
1915 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetOrientation(IDirect3DRMFrame3* iface,
1916                                                            LPDIRECT3DRMFRAME3 reference,
1917                                                            LPD3DVECTOR dir, LPD3DVECTOR up)
1918 {
1919     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1920
1921     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, reference, dir, up);
1922
1923     return E_NOTIMPL;
1924 }
1925
1926 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetVisuals(IDirect3DRMFrame3* iface, LPDWORD num,
1927                                                        LPUNKNOWN *visuals)
1928 {
1929     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1930
1931     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, num, visuals);
1932
1933     return E_NOTIMPL;
1934 }
1935
1936 static HRESULT WINAPI IDirect3DRMFrame3Impl_InverseTransform(IDirect3DRMFrame3* iface,
1937                                                              D3DVECTOR *d, D3DVECTOR *s)
1938 {
1939     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1940
1941     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);
1942
1943     return E_NOTIMPL;
1944 }
1945
1946 static HRESULT WINAPI IDirect3DRMFrame3Impl_Load(IDirect3DRMFrame3* iface, LPVOID filename,
1947                                                  LPVOID name, D3DRMLOADOPTIONS loadflags,
1948                                                  D3DRMLOADTEXTURE3CALLBACK cb, LPVOID lpArg)
1949 {
1950     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1951
1952     FIXME("(%p/%p)->(%p,%p,%u,%p,%p): stub\n", iface, This, filename, name, loadflags, cb, lpArg);
1953
1954     return E_NOTIMPL;
1955 }
1956
1957 static HRESULT WINAPI IDirect3DRMFrame3Impl_LookAt(IDirect3DRMFrame3* iface,
1958                                                    LPDIRECT3DRMFRAME3 target,
1959                                                    LPDIRECT3DRMFRAME3 reference,
1960                                                    D3DRMFRAMECONSTRAINT constraint)
1961 {
1962     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1963
1964     FIXME("(%p/%p)->(%p,%p,%u): stub\n", iface, This, target, reference, constraint);
1965
1966     return E_NOTIMPL;
1967 }
1968
1969 static HRESULT WINAPI IDirect3DRMFrame3Impl_Move(IDirect3DRMFrame3* iface, D3DVALUE delta)
1970 {
1971     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1972
1973     FIXME("(%p/%p)->(%f): stub\n", iface, This, delta);
1974
1975     return E_NOTIMPL;
1976 }
1977
1978 static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteChild(IDirect3DRMFrame3* iface,
1979                                                         LPDIRECT3DRMFRAME3 frame)
1980 {
1981     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
1982     IDirect3DRMFrameImpl *frame_obj = unsafe_impl_from_IDirect3DRMFrame3(frame);
1983     ULONG i;
1984
1985     TRACE("(%p/%p)->(%p)\n", iface, This, frame);
1986
1987     if (!frame_obj)
1988         return D3DRMERR_BADOBJECT;
1989
1990     /* Check if child exists */
1991     for (i = 0; i < This->nb_children; i++)
1992         if (This->children[i] == frame)
1993             break;
1994
1995     if (i == This->nb_children)
1996         return D3DRMERR_BADVALUE;
1997
1998     memmove(This->children + i, This->children + i + 1, sizeof(IDirect3DRMFrame3*) * (This->nb_children - 1 - i));
1999     IDirect3DRMFrame3_Release(frame);
2000     frame_obj->parent = NULL;
2001     This->nb_children--;
2002
2003     return D3DRM_OK;
2004 }
2005
2006 static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteLight(IDirect3DRMFrame3* iface,
2007                                                           LPDIRECT3DRMLIGHT light)
2008 {
2009     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2010     ULONG i;
2011
2012     TRACE("(%p/%p)->(%p)\n", iface, This, light);
2013
2014     if (!light)
2015         return D3DRMERR_BADOBJECT;
2016
2017     /* Check if visual exists */
2018     for (i = 0; i < This->nb_lights; i++)
2019         if (This->lights[i] == light)
2020             break;
2021
2022     if (i == This->nb_lights)
2023         return D3DRMERR_BADVALUE;
2024
2025     memmove(This->lights + i, This->lights + i + 1, sizeof(IDirect3DRMLight*) * (This->nb_lights - 1 - i));
2026     IDirect3DRMLight_Release(light);
2027     This->nb_lights--;
2028
2029     return D3DRM_OK;
2030 }
2031
2032 static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteMoveCallback(IDirect3DRMFrame3* iface,
2033                                                                D3DRMFRAME3MOVECALLBACK cb,
2034                                                                VOID *arg)
2035 {
2036     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2037
2038     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, arg);
2039
2040     return E_NOTIMPL;
2041 }
2042
2043 static HRESULT WINAPI IDirect3DRMFrame3Impl_DeleteVisual(IDirect3DRMFrame3* iface, LPUNKNOWN vis)
2044 {
2045     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2046     ULONG i;
2047
2048     TRACE("(%p/%p)->(%p)\n", iface, This, vis);
2049
2050     if (!vis)
2051         return D3DRMERR_BADOBJECT;
2052
2053     /* Check if visual exists */
2054     for (i = 0; i < This->nb_visuals; i++)
2055         if (This->visuals[i] == (IDirect3DRMVisual*)vis)
2056             break;
2057
2058     if (i == This->nb_visuals)
2059         return D3DRMERR_BADVALUE;
2060
2061     memmove(This->visuals + i, This->visuals + i + 1, sizeof(IDirect3DRMVisual*) * (This->nb_visuals - 1 - i));
2062     IDirect3DRMVisual_Release(vis);
2063     This->nb_visuals--;
2064
2065     return D3DRM_OK;
2066 }
2067
2068 static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetSceneBackground(IDirect3DRMFrame3* iface)
2069 {
2070     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2071
2072     FIXME("(%p/%p)->(): stub\n", iface, This);
2073
2074     return 0;
2075 }
2076
2077 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
2078                                                                     LPDIRECTDRAWSURFACE * surface)
2079 {
2080     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2081
2082     FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);
2083
2084     return E_NOTIMPL;
2085 }
2086
2087 static D3DCOLOR WINAPI IDirect3DRMFrame3Impl_GetSceneFogColor(IDirect3DRMFrame3* iface)
2088 {
2089     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2090
2091     FIXME("(%p/%p)->(): stub\n", iface, This);
2092
2093     return 0;
2094 }
2095
2096 static BOOL WINAPI IDirect3DRMFrame3Impl_GetSceneFogEnable(IDirect3DRMFrame3* iface)
2097 {
2098     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2099
2100     FIXME("(%p/%p)->(): stub\n", iface, This);
2101
2102     return FALSE;
2103 }
2104
2105 static D3DRMFOGMODE WINAPI IDirect3DRMFrame3Impl_GetSceneFogMode(IDirect3DRMFrame3* iface)
2106 {
2107     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2108
2109     FIXME("(%p/%p)->(): stub\n", iface, This);
2110
2111     return D3DRMFOG_LINEAR;
2112 }
2113
2114 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneFogParams(IDirect3DRMFrame3* iface,
2115                                                               D3DVALUE *return_start,
2116                                                               D3DVALUE *return_end,
2117                                                               D3DVALUE *return_density)
2118 {
2119     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2120
2121     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, return_start, return_end, return_density);
2122
2123     return E_NOTIMPL;
2124 }
2125
2126 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackground(IDirect3DRMFrame3* iface,
2127                                                                D3DCOLOR color)
2128 {
2129     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2130
2131     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
2132
2133     return E_NOTIMPL;
2134 }
2135
2136 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundRGB(IDirect3DRMFrame3* iface,
2137                                                                   D3DVALUE red, D3DVALUE green,
2138                                                                   D3DVALUE blue)
2139 {
2140     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2141
2142     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);
2143
2144     return E_NOTIMPL;
2145 }
2146
2147 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundDepth(IDirect3DRMFrame3* iface,
2148                                                                     LPDIRECTDRAWSURFACE surface)
2149 {
2150     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2151
2152     FIXME("(%p/%p)->(%p): stub\n", iface, This, surface);
2153
2154     return E_NOTIMPL;
2155 }
2156
2157 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneBackgroundImage(IDirect3DRMFrame3* iface,
2158                                                                     LPDIRECT3DRMTEXTURE3 texture)
2159 {
2160     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2161
2162     FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);
2163
2164     return E_NOTIMPL;
2165 }
2166
2167 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogEnable(IDirect3DRMFrame3* iface, BOOL enable)
2168 {
2169     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2170
2171     FIXME("(%p/%p)->(%d): stub\n", iface, This, enable);
2172
2173     return E_NOTIMPL;
2174 }
2175
2176 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogColor(IDirect3DRMFrame3* iface,
2177                                                              D3DCOLOR color)
2178 {
2179     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2180
2181     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
2182
2183     return E_NOTIMPL;
2184 }
2185
2186 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogMode(IDirect3DRMFrame3* iface,
2187                                                             D3DRMFOGMODE mode)
2188 {
2189     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2190
2191     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
2192
2193     return E_NOTIMPL;
2194 }
2195
2196 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogParams(IDirect3DRMFrame3* iface,
2197                                                               D3DVALUE start, D3DVALUE end,
2198                                                               D3DVALUE density)
2199 {
2200     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2201
2202     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, start, end, density);
2203
2204     return E_NOTIMPL;
2205 }
2206
2207 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetColor(IDirect3DRMFrame3* iface, D3DCOLOR color)
2208 {
2209     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2210
2211     FIXME("(%p/%p)->(%u): stub\n", iface, This, color);
2212
2213     return E_NOTIMPL;
2214 }
2215
2216 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetColorRGB(IDirect3DRMFrame3* iface, D3DVALUE red,
2217                                                         D3DVALUE green, D3DVALUE blue)
2218 {
2219     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2220
2221     FIXME("(%p/%p)->(%f,%f,%f): stub\n", iface, This, red, green, blue);
2222
2223     return E_NOTIMPL;
2224 }
2225
2226 static D3DRMZBUFFERMODE WINAPI IDirect3DRMFrame3Impl_GetZbufferMode(IDirect3DRMFrame3* iface)
2227 {
2228     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2229
2230     FIXME("(%p/%p)->(): stub\n", iface, This);
2231
2232     return D3DRMZBUFFER_FROMPARENT;
2233 }
2234
2235 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterialMode(IDirect3DRMFrame3* iface,
2236                                                             D3DRMMATERIALMODE mode)
2237 {
2238     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2239
2240     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
2241
2242     return E_NOTIMPL;
2243 }
2244
2245 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetOrientation(IDirect3DRMFrame3* iface,
2246                                                            LPDIRECT3DRMFRAME3 reference,
2247                                                            D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
2248                                                            D3DVALUE ux, D3DVALUE uy, D3DVALUE uz )
2249 {
2250     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2251
2252     FIXME("(%p/%p)->(%p,%f,%f,%f,%f,%f,%f): stub\n", iface, This, reference,
2253           dx, dy, dz, ux, uy, uz);
2254
2255     return E_NOTIMPL;
2256 }
2257
2258 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetPosition(IDirect3DRMFrame3* iface,
2259                                                         LPDIRECT3DRMFRAME3 reference,
2260                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z)
2261 {
2262     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2263
2264     FIXME("(%p/%p)->(%p,%f,%f,%f): stub\n", iface, This, reference, x, y, z);
2265
2266     return E_NOTIMPL;
2267 }
2268
2269 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetRotation(IDirect3DRMFrame3* iface,
2270                                                         LPDIRECT3DRMFRAME3 reference,
2271                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
2272                                                         D3DVALUE theta)
2273 {
2274     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2275
2276     FIXME("(%p/%p)->(%p,%f,%f,%f,%f): stub\n", iface, This, reference, x, y, z, theta);
2277
2278     return E_NOTIMPL;
2279 }
2280
2281 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSortMode(IDirect3DRMFrame3* iface,
2282                                                         D3DRMSORTMODE mode)
2283 {
2284     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2285
2286     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
2287
2288     return E_NOTIMPL;
2289 }
2290
2291 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetTexture(IDirect3DRMFrame3* iface,
2292                                                        LPDIRECT3DRMTEXTURE3 texture)
2293 {
2294     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2295
2296     FIXME("(%p/%p)->(%p): stub\n", iface, This, texture);
2297
2298     return E_NOTIMPL;
2299 }
2300
2301 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetVelocity(IDirect3DRMFrame3* iface,
2302                                                         LPDIRECT3DRMFRAME3 reference,
2303                                                         D3DVALUE x, D3DVALUE y, D3DVALUE z,
2304                                                         BOOL with_rotation)
2305 {
2306     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2307
2308     FIXME("(%p/%p)->(%p,%f,%f,%f,%d): stub\n", iface, This, reference, x, y, z, with_rotation);
2309
2310     return E_NOTIMPL;
2311 }
2312
2313 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetZbufferMode(IDirect3DRMFrame3* iface,
2314                                                            D3DRMZBUFFERMODE mode)
2315 {
2316     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2317
2318     FIXME("(%p/%p)->(%u): stub\n", iface, This, mode);
2319
2320     return E_NOTIMPL;
2321 }
2322
2323 static HRESULT WINAPI IDirect3DRMFrame3Impl_Transform(IDirect3DRMFrame3* iface, D3DVECTOR *d,
2324                                                       D3DVECTOR *s)
2325 {
2326     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2327
2328     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, d, s);
2329
2330     return E_NOTIMPL;
2331 }
2332
2333 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetBox(IDirect3DRMFrame3* iface, LPD3DRMBOX box)
2334 {
2335     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2336
2337     FIXME("(%p/%p)->(%p): stub\n", iface, This, box);
2338
2339     return E_NOTIMPL;
2340 }
2341
2342 static BOOL WINAPI IDirect3DRMFrame3Impl_GetBoxEnable(IDirect3DRMFrame3* iface)
2343 {
2344     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2345
2346     FIXME("(%p/%p)->(): stub\n", iface, This);
2347
2348     return E_NOTIMPL;
2349 }
2350
2351 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetAxes(IDirect3DRMFrame3* iface,
2352                                                     LPD3DVECTOR dir, LPD3DVECTOR up)
2353 {
2354     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2355
2356     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, dir, up);
2357
2358     return E_NOTIMPL;
2359 }
2360
2361 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterial(IDirect3DRMFrame3* iface,
2362                                                         LPDIRECT3DRMMATERIAL2 *material)
2363 {
2364     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2365
2366     FIXME("(%p/%p)->(%p): stub\n", iface, This, material);
2367
2368     return E_NOTIMPL;
2369 }
2370
2371 static BOOL WINAPI IDirect3DRMFrame3Impl_GetInheritAxes(IDirect3DRMFrame3* iface)
2372 {
2373     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2374
2375     FIXME("(%p/%p)->(): stub\n", iface, This);
2376
2377     return E_NOTIMPL;
2378 }
2379
2380 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetHierarchyBox(IDirect3DRMFrame3* iface,
2381                                                             LPD3DRMBOX box)
2382 {
2383     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2384
2385     FIXME("(%p/%p)->(%p): stub\n", iface, This, box);
2386
2387     return E_NOTIMPL;
2388 }
2389
2390 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetBox(IDirect3DRMFrame3* iface, LPD3DRMBOX box)
2391 {
2392     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2393
2394     FIXME("(%p/%p)->(%p): stub\n", iface, This, box);
2395
2396     return E_NOTIMPL;
2397 }
2398
2399 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetBoxEnable(IDirect3DRMFrame3* iface, BOOL enable)
2400 {
2401     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2402
2403     FIXME("(%p/%p)->(%u): stub\n", iface, This, enable);
2404
2405     return E_NOTIMPL;
2406 }
2407
2408 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetAxes(IDirect3DRMFrame3* iface,
2409                                                     D3DVALUE dx, D3DVALUE dy, D3DVALUE dz,
2410                                                     D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2411 {
2412     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2413
2414     FIXME("(%p/%p)->(%f,%f,%f,%f,%f,%f): stub\n", iface, This, dx, dy, dz, ux, uy, uz);
2415
2416     return E_NOTIMPL;
2417 }
2418
2419 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetInheritAxes(IDirect3DRMFrame3* iface,
2420                                                            BOOL inherit_from_parent)
2421 {
2422     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2423
2424     FIXME("(%p/%p)->(%u): stub\n", iface, This, inherit_from_parent);
2425
2426     return E_NOTIMPL;
2427 }
2428
2429 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterial(IDirect3DRMFrame3* iface,
2430                                                         LPDIRECT3DRMMATERIAL2 material)
2431 {
2432     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2433
2434     FIXME("(%p/%p)->(%p): stub\n", iface, This, material);
2435
2436     return E_NOTIMPL;
2437 }
2438
2439 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetQuaternion(IDirect3DRMFrame3* iface,
2440                                                           LPDIRECT3DRMFRAME3 reference,
2441                                                           D3DRMQUATERNION *q)
2442 {
2443     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2444
2445     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, reference, q);
2446
2447     return E_NOTIMPL;
2448 }
2449
2450 static HRESULT WINAPI IDirect3DRMFrame3Impl_RayPick(IDirect3DRMFrame3* iface,
2451                                                     LPDIRECT3DRMFRAME3 reference, LPD3DRMRAY ray,
2452                                                     DWORD flags,
2453                                                     LPDIRECT3DRMPICKED2ARRAY *return_visuals)
2454 {
2455     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2456
2457     FIXME("(%p/%p)->(%p,%p,%u,%p): stub\n", iface, This, reference, ray, flags, return_visuals);
2458
2459     return E_NOTIMPL;
2460 }
2461
2462 static HRESULT WINAPI IDirect3DRMFrame3Impl_Save(IDirect3DRMFrame3* iface, LPCSTR filename,
2463                                                  D3DRMXOFFORMAT d3dFormat,
2464                                                  D3DRMSAVEOPTIONS d3dSaveFlags)
2465 {
2466     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2467
2468     FIXME("(%p/%p)->(%p,%u,%u): stub\n", iface, This, filename, d3dFormat, d3dSaveFlags);
2469
2470     return E_NOTIMPL;
2471 }
2472
2473 static HRESULT WINAPI IDirect3DRMFrame3Impl_TransformVectors(IDirect3DRMFrame3* iface,
2474                                                              LPDIRECT3DRMFRAME3 reference,
2475                                                              DWORD num, LPD3DVECTOR dst,
2476                                                              LPD3DVECTOR src)
2477 {
2478     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2479
2480     FIXME("(%p/%p)->(%p,%u,%p,%p): stub\n", iface, This, reference, num, dst, src);
2481
2482     return E_NOTIMPL;
2483 }
2484
2485 static HRESULT WINAPI IDirect3DRMFrame3Impl_InverseTransformVectors(IDirect3DRMFrame3* iface,
2486                                                                     LPDIRECT3DRMFRAME3 reference,
2487                                                                     DWORD num, LPD3DVECTOR dst,
2488                                                                     LPD3DVECTOR src)
2489 {
2490     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2491
2492     FIXME("(%p/%p)->(%p,%u,%p,%p): stub\n", iface, This, reference, num, dst, src);
2493
2494     return E_NOTIMPL;
2495 }
2496
2497 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetTraversalOptions(IDirect3DRMFrame3* iface,
2498                                                                 DWORD flags)
2499 {
2500     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2501
2502     FIXME("(%p/%p)->(%u): stub\n", iface, This, flags);
2503
2504     return E_NOTIMPL;
2505 }
2506
2507 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetTraversalOptions(IDirect3DRMFrame3* iface,
2508                                                                 LPDWORD flags)
2509 {
2510     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2511
2512     FIXME("(%p/%p)->(%p): stub\n", iface, This, flags);
2513
2514     return E_NOTIMPL;
2515 }
2516
2517 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetSceneFogMethod(IDirect3DRMFrame3* iface,
2518                                                               DWORD flags)
2519 {
2520     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2521
2522     FIXME("(%p/%p)->(%u): stub\n", iface, This, flags);
2523
2524     return E_NOTIMPL;
2525 }
2526
2527 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetSceneFogMethod(IDirect3DRMFrame3* iface,
2528                                                               LPDWORD flags)
2529 {
2530     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2531
2532     FIXME("(%p/%p)->(%p): stub\n", iface, This, flags);
2533
2534     return E_NOTIMPL;
2535 }
2536
2537 static HRESULT WINAPI IDirect3DRMFrame3Impl_SetMaterialOverride(IDirect3DRMFrame3* iface,
2538                                                                 LPD3DRMMATERIALOVERRIDE override)
2539 {
2540     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2541
2542     FIXME("(%p/%p)->(%p): stub\n", iface, This, override);
2543
2544     return E_NOTIMPL;
2545 }
2546
2547 static HRESULT WINAPI IDirect3DRMFrame3Impl_GetMaterialOverride(IDirect3DRMFrame3* iface,
2548                                                                 LPD3DRMMATERIALOVERRIDE override)
2549 {
2550     IDirect3DRMFrameImpl *This = impl_from_IDirect3DRMFrame3(iface);
2551
2552     FIXME("(%p/%p)->(%p): stub\n", iface, This, override);
2553
2554     return E_NOTIMPL;
2555 }
2556
2557 static const struct IDirect3DRMFrame3Vtbl Direct3DRMFrame3_Vtbl =
2558 {
2559     /*** IUnknown methods ***/
2560     IDirect3DRMFrame3Impl_QueryInterface,
2561     IDirect3DRMFrame3Impl_AddRef,
2562     IDirect3DRMFrame3Impl_Release,
2563     /*** IDirect3DRMObject methods ***/
2564     IDirect3DRMFrame3Impl_Clone,
2565     IDirect3DRMFrame3Impl_AddDestroyCallback,
2566     IDirect3DRMFrame3Impl_DeleteDestroyCallback,
2567     IDirect3DRMFrame3Impl_SetAppData,
2568     IDirect3DRMFrame3Impl_GetAppData,
2569     IDirect3DRMFrame3Impl_SetName,
2570     IDirect3DRMFrame3Impl_GetName,
2571     IDirect3DRMFrame3Impl_GetClassName,
2572     /*** IDirect3DRMFrame3 methods ***/
2573     IDirect3DRMFrame3Impl_AddChild,
2574     IDirect3DRMFrame3Impl_AddLight,
2575     IDirect3DRMFrame3Impl_AddMoveCallback,
2576     IDirect3DRMFrame3Impl_AddTransform,
2577     IDirect3DRMFrame3Impl_AddTranslation,
2578     IDirect3DRMFrame3Impl_AddScale,
2579     IDirect3DRMFrame3Impl_AddRotation,
2580     IDirect3DRMFrame3Impl_AddVisual,
2581     IDirect3DRMFrame3Impl_GetChildren,
2582     IDirect3DRMFrame3Impl_GetColor,
2583     IDirect3DRMFrame3Impl_GetLights,
2584     IDirect3DRMFrame3Impl_GetMaterialMode,
2585     IDirect3DRMFrame3Impl_GetParent,
2586     IDirect3DRMFrame3Impl_GetPosition,
2587     IDirect3DRMFrame3Impl_GetRotation,
2588     IDirect3DRMFrame3Impl_GetScene,
2589     IDirect3DRMFrame3Impl_GetSortMode,
2590     IDirect3DRMFrame3Impl_GetTexture,
2591     IDirect3DRMFrame3Impl_GetTransform,
2592     IDirect3DRMFrame3Impl_GetVelocity,
2593     IDirect3DRMFrame3Impl_GetOrientation,
2594     IDirect3DRMFrame3Impl_GetVisuals,
2595     IDirect3DRMFrame3Impl_InverseTransform,
2596     IDirect3DRMFrame3Impl_Load,
2597     IDirect3DRMFrame3Impl_LookAt,
2598     IDirect3DRMFrame3Impl_Move,
2599     IDirect3DRMFrame3Impl_DeleteChild,
2600     IDirect3DRMFrame3Impl_DeleteLight,
2601     IDirect3DRMFrame3Impl_DeleteMoveCallback,
2602     IDirect3DRMFrame3Impl_DeleteVisual,
2603     IDirect3DRMFrame3Impl_GetSceneBackground,
2604     IDirect3DRMFrame3Impl_GetSceneBackgroundDepth,
2605     IDirect3DRMFrame3Impl_GetSceneFogColor,
2606     IDirect3DRMFrame3Impl_GetSceneFogEnable,
2607     IDirect3DRMFrame3Impl_GetSceneFogMode,
2608     IDirect3DRMFrame3Impl_GetSceneFogParams,
2609     IDirect3DRMFrame3Impl_SetSceneBackground,
2610     IDirect3DRMFrame3Impl_SetSceneBackgroundRGB,
2611     IDirect3DRMFrame3Impl_SetSceneBackgroundDepth,
2612     IDirect3DRMFrame3Impl_SetSceneBackgroundImage,
2613     IDirect3DRMFrame3Impl_SetSceneFogEnable,
2614     IDirect3DRMFrame3Impl_SetSceneFogColor,
2615     IDirect3DRMFrame3Impl_SetSceneFogMode,
2616     IDirect3DRMFrame3Impl_SetSceneFogParams,
2617     IDirect3DRMFrame3Impl_SetColor,
2618     IDirect3DRMFrame3Impl_SetColorRGB,
2619     IDirect3DRMFrame3Impl_GetZbufferMode,
2620     IDirect3DRMFrame3Impl_SetMaterialMode,
2621     IDirect3DRMFrame3Impl_SetOrientation,
2622     IDirect3DRMFrame3Impl_SetPosition,
2623     IDirect3DRMFrame3Impl_SetRotation,
2624     IDirect3DRMFrame3Impl_SetSortMode,
2625     IDirect3DRMFrame3Impl_SetTexture,
2626     IDirect3DRMFrame3Impl_SetVelocity,
2627     IDirect3DRMFrame3Impl_SetZbufferMode,
2628     IDirect3DRMFrame3Impl_Transform,
2629     IDirect3DRMFrame3Impl_GetBox,
2630     IDirect3DRMFrame3Impl_GetBoxEnable,
2631     IDirect3DRMFrame3Impl_GetAxes,
2632     IDirect3DRMFrame3Impl_GetMaterial,
2633     IDirect3DRMFrame3Impl_GetInheritAxes,
2634     IDirect3DRMFrame3Impl_GetHierarchyBox,
2635     IDirect3DRMFrame3Impl_SetBox,
2636     IDirect3DRMFrame3Impl_SetBoxEnable,
2637     IDirect3DRMFrame3Impl_SetAxes,
2638     IDirect3DRMFrame3Impl_SetInheritAxes,
2639     IDirect3DRMFrame3Impl_SetMaterial,
2640     IDirect3DRMFrame3Impl_SetQuaternion,
2641     IDirect3DRMFrame3Impl_RayPick,
2642     IDirect3DRMFrame3Impl_Save,
2643     IDirect3DRMFrame3Impl_TransformVectors,
2644     IDirect3DRMFrame3Impl_InverseTransformVectors,
2645     IDirect3DRMFrame3Impl_SetTraversalOptions,
2646     IDirect3DRMFrame3Impl_GetTraversalOptions,
2647     IDirect3DRMFrame3Impl_SetSceneFogMethod,
2648     IDirect3DRMFrame3Impl_GetSceneFogMethod,
2649     IDirect3DRMFrame3Impl_SetMaterialOverride,
2650     IDirect3DRMFrame3Impl_GetMaterialOverride
2651 };
2652
2653 static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
2654 {
2655     if (!iface)
2656         return NULL;
2657     assert(iface->lpVtbl == &Direct3DRMFrame2_Vtbl);
2658
2659     return impl_from_IDirect3DRMFrame2(iface);
2660 }
2661
2662 static inline IDirect3DRMFrameImpl *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
2663 {
2664     if (!iface)
2665         return NULL;
2666     assert(iface->lpVtbl == &Direct3DRMFrame3_Vtbl);
2667
2668     return impl_from_IDirect3DRMFrame3(iface);
2669 }
2670
2671 HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown* parent, IUnknown** ret_iface)
2672 {
2673     IDirect3DRMFrameImpl* object;
2674
2675     TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), parent, ret_iface);
2676
2677     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMFrameImpl));
2678     if (!object)
2679     {
2680         ERR("Out of memory\n");
2681         return E_OUTOFMEMORY;
2682     }
2683
2684     object->IDirect3DRMFrame2_iface.lpVtbl = &Direct3DRMFrame2_Vtbl;
2685     object->IDirect3DRMFrame3_iface.lpVtbl = &Direct3DRMFrame3_Vtbl;
2686     object->ref = 1;
2687
2688     memcpy(&object->transform[0][0], &identity[0][0], sizeof(D3DRMMATRIX4D));
2689
2690     if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
2691     {
2692         if (parent)
2693             IDirect3DRMFrame3_AddChild((IDirect3DRMFrame3*)parent, &object->IDirect3DRMFrame3_iface);
2694         *ret_iface = (IUnknown*)&object->IDirect3DRMFrame3_iface;
2695     }
2696     else
2697     {
2698         if (parent)
2699             IDirect3DRMFrame2_AddChild((IDirect3DRMFrame2*)parent, (IDirect3DRMFrame*)&object->IDirect3DRMFrame2_iface);
2700         *ret_iface = (IUnknown*)&object->IDirect3DRMFrame2_iface;
2701     }
2702
2703     return S_OK;
2704 }