[D3DRM] Sync with Wine Staging 1.7.55. CORE-10536
[reactos.git] / reactos / dll / directx / wine / 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 "d3drm_private.h"
23
24 #include <assert.h>
25
26 static D3DRMMATRIX4D identity = {
27 { 1.0f, 0.0f, 0.0f, 0.0f },
28 { 0.0f, 1.0f, 0.0f, 0.0f },
29 { 0.0f, 0.0f, 1.0f, 0.0f },
30 { 0.0f, 0.0f, 0.0f, 1.0f }
31 };
32
33 struct d3drm_frame
34 {
35 IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
36 IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
37 LONG ref;
38 struct d3drm_frame *parent;
39 ULONG nb_children;
40 ULONG children_capacity;
41 IDirect3DRMFrame3** children;
42 ULONG nb_visuals;
43 ULONG visuals_capacity;
44 IDirect3DRMVisual** visuals;
45 ULONG nb_lights;
46 ULONG lights_capacity;
47 IDirect3DRMLight** lights;
48 D3DRMMATRIX4D transform;
49 D3DCOLOR scenebackground;
50 };
51
52 struct d3drm_frame_array
53 {
54 IDirect3DRMFrameArray IDirect3DRMFrameArray_iface;
55 LONG ref;
56 ULONG size;
57 IDirect3DRMFrame **frames;
58 };
59
60 struct d3drm_visual_array
61 {
62 IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
63 LONG ref;
64 ULONG size;
65 IDirect3DRMVisual **visuals;
66 };
67
68 struct d3drm_light_array
69 {
70 IDirect3DRMLightArray IDirect3DRMLightArray_iface;
71 LONG ref;
72 ULONG size;
73 IDirect3DRMLight **lights;
74 };
75
76 static inline struct d3drm_frame *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
77 {
78 return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame2_iface);
79 }
80
81 static inline struct d3drm_frame *impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
82 {
83 return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame3_iface);
84 }
85
86 static inline struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface);
87
88 static inline struct d3drm_frame_array *impl_from_IDirect3DRMFrameArray(IDirect3DRMFrameArray *iface)
89 {
90 return CONTAINING_RECORD(iface, struct d3drm_frame_array, IDirect3DRMFrameArray_iface);
91 }
92
93 static inline struct d3drm_visual_array *impl_from_IDirect3DRMVisualArray(IDirect3DRMVisualArray *iface)
94 {
95 return CONTAINING_RECORD(iface, struct d3drm_visual_array, IDirect3DRMVisualArray_iface);
96 }
97
98 static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
99 {
100 return CONTAINING_RECORD(iface, struct d3drm_light_array, IDirect3DRMLightArray_iface);
101 }
102
103 static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out)
104 {
105 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
106
107 if (IsEqualGUID(riid, &IID_IDirect3DRMFrameArray)
108 || IsEqualGUID(riid, &IID_IUnknown))
109 {
110 IDirect3DRMFrameArray_AddRef(iface);
111 *out = iface;
112 return S_OK;
113 }
114
115 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
116
117 *out = NULL;
118 return E_NOINTERFACE;
119 }
120
121 static ULONG WINAPI d3drm_frame_array_AddRef(IDirect3DRMFrameArray *iface)
122 {
123 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
124 ULONG refcount = InterlockedIncrement(&array->ref);
125
126 TRACE("%p increasing refcount to %u.\n", iface, refcount);
127
128 return refcount;
129 }
130
131 static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface)
132 {
133 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
134 ULONG refcount = InterlockedDecrement(&array->ref);
135 ULONG i;
136
137 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
138
139 if (!refcount)
140 {
141 for (i = 0; i < array->size; ++i)
142 {
143 IDirect3DRMFrame_Release(array->frames[i]);
144 }
145 HeapFree(GetProcessHeap(), 0, array->frames);
146 HeapFree(GetProcessHeap(), 0, array);
147 }
148
149 return refcount;
150 }
151
152 static DWORD WINAPI d3drm_frame_array_GetSize(IDirect3DRMFrameArray *iface)
153 {
154 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
155
156 TRACE("iface %p.\n", iface);
157
158 return array->size;
159 }
160
161 static HRESULT WINAPI d3drm_frame_array_GetElement(IDirect3DRMFrameArray *iface,
162 DWORD index, IDirect3DRMFrame **frame)
163 {
164 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
165
166 TRACE("iface %p, index %u, frame %p.\n", iface, index, frame);
167
168 if (!frame)
169 return D3DRMERR_BADVALUE;
170
171 if (index >= array->size)
172 {
173 *frame = NULL;
174 return D3DRMERR_BADVALUE;
175 }
176
177 IDirect3DRMFrame_AddRef(array->frames[index]);
178 *frame = array->frames[index];
179
180 return D3DRM_OK;
181 }
182
183 static const struct IDirect3DRMFrameArrayVtbl d3drm_frame_array_vtbl =
184 {
185 d3drm_frame_array_QueryInterface,
186 d3drm_frame_array_AddRef,
187 d3drm_frame_array_Release,
188 d3drm_frame_array_GetSize,
189 d3drm_frame_array_GetElement,
190 };
191
192 static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_count, IDirect3DRMFrame3 **frames)
193 {
194 struct d3drm_frame_array *array;
195 unsigned int i;
196
197 if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
198 return NULL;
199
200 array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
201 array->ref = 1;
202 array->size = frame_count;
203
204 if (frame_count)
205 {
206 if (!(array->frames = HeapAlloc(GetProcessHeap(), 0, frame_count * sizeof(*array->frames))))
207 {
208 HeapFree(GetProcessHeap(), 0, array);
209 return NULL;
210 }
211
212 for (i = 0; i < frame_count; ++i)
213 {
214 IDirect3DRMFrame3_QueryInterface(frames[i], &IID_IDirect3DRMFrame, (void **)&array->frames[i]);
215 }
216 }
217
218 return array;
219 }
220
221 static HRESULT WINAPI d3drm_visual_array_QueryInterface(IDirect3DRMVisualArray *iface, REFIID riid, void **out)
222 {
223 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
224
225 if (IsEqualGUID(riid, &IID_IDirect3DRMVisualArray)
226 || IsEqualGUID(riid, &IID_IUnknown))
227 {
228 IDirect3DRMVisualArray_AddRef(iface);
229 *out = iface;
230 return S_OK;
231 }
232
233 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
234
235 *out = NULL;
236 return E_NOINTERFACE;
237 }
238
239 static ULONG WINAPI d3drm_visual_array_AddRef(IDirect3DRMVisualArray *iface)
240 {
241 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
242 ULONG refcount = InterlockedIncrement(&array->ref);
243
244 TRACE("%p increasing refcount to %u.\n", iface, refcount);
245
246 return refcount;
247 }
248
249 static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
250 {
251 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
252 ULONG refcount = InterlockedDecrement(&array->ref);
253 ULONG i;
254
255 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
256
257 if (!refcount)
258 {
259 for (i = 0; i < array->size; ++i)
260 {
261 IDirect3DRMVisual_Release(array->visuals[i]);
262 }
263 HeapFree(GetProcessHeap(), 0, array->visuals);
264 HeapFree(GetProcessHeap(), 0, array);
265 }
266
267 return refcount;
268 }
269
270 static DWORD WINAPI d3drm_visual_array_GetSize(IDirect3DRMVisualArray *iface)
271 {
272 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
273
274 TRACE("iface %p.\n", iface);
275
276 return array->size;
277 }
278
279 static HRESULT WINAPI d3drm_visual_array_GetElement(IDirect3DRMVisualArray *iface,
280 DWORD index, IDirect3DRMVisual **visual)
281 {
282 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
283
284 TRACE("iface %p, index %u, visual %p.\n", iface, index, visual);
285
286 if (!visual)
287 return D3DRMERR_BADVALUE;
288
289 if (index >= array->size)
290 {
291 *visual = NULL;
292 return D3DRMERR_BADVALUE;
293 }
294
295 IDirect3DRMVisual_AddRef(array->visuals[index]);
296 *visual = array->visuals[index];
297
298 return D3DRM_OK;
299 }
300
301 static const struct IDirect3DRMVisualArrayVtbl d3drm_visual_array_vtbl =
302 {
303 d3drm_visual_array_QueryInterface,
304 d3drm_visual_array_AddRef,
305 d3drm_visual_array_Release,
306 d3drm_visual_array_GetSize,
307 d3drm_visual_array_GetElement,
308 };
309
310 static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_count, IDirect3DRMVisual **visuals)
311 {
312 struct d3drm_visual_array *array;
313 unsigned int i;
314
315 if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
316 return NULL;
317
318 array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
319 array->ref = 1;
320 array->size = visual_count;
321
322 if (visual_count)
323 {
324 if (!(array->visuals = HeapAlloc(GetProcessHeap(), 0, visual_count * sizeof(*array->visuals))))
325 {
326 HeapFree(GetProcessHeap(), 0, array);
327 return NULL;
328 }
329
330 for (i = 0; i < visual_count; ++i)
331 {
332 array->visuals[i] = visuals[i];
333 IDirect3DRMVisual_AddRef(array->visuals[i]);
334 }
335 }
336
337 return array;
338 }
339
340 static HRESULT WINAPI d3drm_light_array_QueryInterface(IDirect3DRMLightArray *iface, REFIID riid, void **out)
341 {
342 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
343
344 if (IsEqualGUID(riid, &IID_IDirect3DRMLightArray)
345 || IsEqualGUID(riid, &IID_IUnknown))
346 {
347 IDirect3DRMLightArray_AddRef(iface);
348 *out = iface;
349 return S_OK;
350 }
351
352 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
353
354 *out = NULL;
355 return E_NOINTERFACE;
356 }
357
358 static ULONG WINAPI d3drm_light_array_AddRef(IDirect3DRMLightArray *iface)
359 {
360 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
361 ULONG refcount = InterlockedIncrement(&array->ref);
362
363 TRACE("%p increasing refcount to %u.\n", iface, refcount);
364
365 return refcount;
366 }
367
368 static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface)
369 {
370 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
371 ULONG refcount = InterlockedDecrement(&array->ref);
372 ULONG i;
373
374 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
375
376 if (!refcount)
377 {
378 for (i = 0; i < array->size; ++i)
379 {
380 IDirect3DRMLight_Release(array->lights[i]);
381 }
382 HeapFree(GetProcessHeap(), 0, array->lights);
383 HeapFree(GetProcessHeap(), 0, array);
384 }
385
386 return refcount;
387 }
388
389 static DWORD WINAPI d3drm_light_array_GetSize(IDirect3DRMLightArray *iface)
390 {
391 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
392
393 TRACE("iface %p.\n", iface);
394
395 return array->size;
396 }
397
398 static HRESULT WINAPI d3drm_light_array_GetElement(IDirect3DRMLightArray *iface,
399 DWORD index, IDirect3DRMLight **light)
400 {
401 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
402
403 TRACE("iface %p, index %u, light %p.\n", iface, index, light);
404
405 if (!light)
406 return D3DRMERR_BADVALUE;
407
408 if (index >= array->size)
409 {
410 *light = NULL;
411 return D3DRMERR_BADVALUE;
412 }
413
414 IDirect3DRMLight_AddRef(array->lights[index]);
415 *light = array->lights[index];
416
417 return D3DRM_OK;
418 }
419
420 static const struct IDirect3DRMLightArrayVtbl d3drm_light_array_vtbl =
421 {
422 d3drm_light_array_QueryInterface,
423 d3drm_light_array_AddRef,
424 d3drm_light_array_Release,
425 d3drm_light_array_GetSize,
426 d3drm_light_array_GetElement,
427 };
428
429 static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_count, IDirect3DRMLight **lights)
430 {
431 struct d3drm_light_array *array;
432 unsigned int i;
433
434 if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
435 return NULL;
436
437 array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
438 array->ref = 1;
439 array->size = light_count;
440
441 if (light_count)
442 {
443 if (!(array->lights = HeapAlloc(GetProcessHeap(), 0, light_count * sizeof(*array->lights))))
444 {
445 HeapFree(GetProcessHeap(), 0, array);
446 return NULL;
447 }
448
449 for (i = 0; i < light_count; ++i)
450 {
451 array->lights[i] = lights[i];
452 IDirect3DRMLight_AddRef(array->lights[i]);
453 }
454 }
455
456 return array;
457 }
458
459 static HRESULT WINAPI d3drm_frame2_QueryInterface(IDirect3DRMFrame2 *iface, REFIID riid, void **out)
460 {
461 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
462
463 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
464
465 return IDirect3DRMFrame3_QueryInterface(&frame->IDirect3DRMFrame3_iface, riid, out);
466 }
467
468 static ULONG WINAPI d3drm_frame2_AddRef(IDirect3DRMFrame2 *iface)
469 {
470 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
471
472 TRACE("iface %p.\n", iface);
473
474 return IDirect3DRMFrame3_AddRef(&frame->IDirect3DRMFrame3_iface);
475 }
476
477 static ULONG WINAPI d3drm_frame2_Release(IDirect3DRMFrame2 *iface)
478 {
479 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
480
481 TRACE("iface %p.\n", iface);
482
483 return IDirect3DRMFrame3_Release(&frame->IDirect3DRMFrame3_iface);
484 }
485
486 static HRESULT WINAPI d3drm_frame2_Clone(IDirect3DRMFrame2 *iface,
487 IUnknown *outer, REFIID iid, void **out)
488 {
489 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
490
491 return E_NOTIMPL;
492 }
493
494 static HRESULT WINAPI d3drm_frame2_AddDestroyCallback(IDirect3DRMFrame2 *iface,
495 D3DRMOBJECTCALLBACK cb, void *ctx)
496 {
497 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
498
499 return E_NOTIMPL;
500 }
501
502 static HRESULT WINAPI d3drm_frame2_DeleteDestroyCallback(IDirect3DRMFrame2 *iface,
503 D3DRMOBJECTCALLBACK cb, void *ctx)
504 {
505 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
506
507 return E_NOTIMPL;
508 }
509
510 static HRESULT WINAPI d3drm_frame2_SetAppData(IDirect3DRMFrame2 *iface, DWORD data)
511 {
512 FIXME("iface %p, data %#x stub!\n", iface, data);
513
514 return E_NOTIMPL;
515 }
516
517 static DWORD WINAPI d3drm_frame2_GetAppData(IDirect3DRMFrame2 *iface)
518 {
519 FIXME("iface %p stub!\n", iface);
520
521 return 0;
522 }
523
524 static HRESULT WINAPI d3drm_frame2_SetName(IDirect3DRMFrame2 *iface, const char *name)
525 {
526 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
527
528 return E_NOTIMPL;
529 }
530
531 static HRESULT WINAPI d3drm_frame2_GetName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
532 {
533 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
534
535 return E_NOTIMPL;
536 }
537
538 static HRESULT WINAPI d3drm_frame2_GetClassName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
539 {
540 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
541
542 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
543
544 return IDirect3DRMFrame3_GetClassName(&frame->IDirect3DRMFrame3_iface, size, name);
545 }
546
547 static HRESULT WINAPI d3drm_frame2_AddChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child)
548 {
549 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
550 IDirect3DRMFrame3 *child3;
551 HRESULT hr;
552
553 TRACE("iface %p, child %p.\n", iface, child);
554
555 if (!child)
556 return D3DRMERR_BADOBJECT;
557 hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3);
558 if (hr != S_OK)
559 return D3DRMERR_BADOBJECT;
560 IDirect3DRMFrame_Release(child);
561
562 return IDirect3DRMFrame3_AddChild(&frame->IDirect3DRMFrame3_iface, child3);
563 }
564
565 static HRESULT WINAPI d3drm_frame2_AddLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light)
566 {
567 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
568
569 TRACE("iface %p, light %p.\n", iface, light);
570
571 return IDirect3DRMFrame3_AddLight(&frame->IDirect3DRMFrame3_iface, light);
572 }
573
574 static HRESULT WINAPI d3drm_frame2_AddMoveCallback(IDirect3DRMFrame2 *iface,
575 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
576 {
577 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
578
579 return E_NOTIMPL;
580 }
581
582 static HRESULT WINAPI d3drm_frame2_AddTransform(IDirect3DRMFrame2 *iface, D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix)
583 {
584 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
585
586 TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix);
587
588 return IDirect3DRMFrame3_AddTransform(&frame->IDirect3DRMFrame3_iface, type, matrix);
589 }
590
591 static HRESULT WINAPI d3drm_frame2_AddTranslation(IDirect3DRMFrame2 *iface,
592 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
593 {
594 FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e stub!\n", iface, type, x, y, z);
595
596 return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI d3drm_frame2_AddScale(IDirect3DRMFrame2 *iface,
600 D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
601 {
602 FIXME("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, type, sx, sy, sz);
603
604 return E_NOTIMPL;
605 }
606
607 static HRESULT WINAPI d3drm_frame2_AddRotation(IDirect3DRMFrame2 *iface,
608 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
609 {
610 FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n", iface, type, x, y, z, theta);
611
612 return E_NOTIMPL;
613 }
614
615 static HRESULT WINAPI d3drm_frame2_AddVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual)
616 {
617 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
618
619 TRACE("iface %p, visual %p.\n", iface, visual);
620
621 return IDirect3DRMFrame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
622 }
623
624 static HRESULT WINAPI d3drm_frame2_GetChildren(IDirect3DRMFrame2 *iface, IDirect3DRMFrameArray **children)
625 {
626 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
627
628 TRACE("iface %p, children %p.\n", iface, children);
629
630 return IDirect3DRMFrame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children);
631 }
632
633 static D3DCOLOR WINAPI d3drm_frame2_GetColor(IDirect3DRMFrame2 *iface)
634 {
635 FIXME("iface %p stub!\n", iface);
636
637 return 0;
638 }
639
640 static HRESULT WINAPI d3drm_frame2_GetLights(IDirect3DRMFrame2 *iface, IDirect3DRMLightArray **lights)
641 {
642 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
643
644 TRACE("iface %p, lights %p.\n", iface, lights);
645
646 return IDirect3DRMFrame3_GetLights(&frame->IDirect3DRMFrame3_iface, lights);
647 }
648
649 static D3DRMMATERIALMODE WINAPI d3drm_frame2_GetMaterialMode(IDirect3DRMFrame2 *iface)
650 {
651 FIXME("iface %p stub!\n", iface);
652
653 return D3DRMMATERIAL_FROMPARENT;
654 }
655
656 static HRESULT WINAPI d3drm_frame2_GetParent(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **parent)
657 {
658 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
659
660 TRACE("iface %p, parent %p.\n", iface, parent);
661
662 if (!parent)
663 return D3DRMERR_BADVALUE;
664
665 if (frame->parent)
666 {
667 *parent = (IDirect3DRMFrame *)&frame->parent->IDirect3DRMFrame2_iface;
668 IDirect3DRMFrame_AddRef(*parent);
669 }
670 else
671 {
672 *parent = NULL;
673 }
674
675 return D3DRM_OK;
676 }
677
678 static HRESULT WINAPI d3drm_frame2_GetPosition(IDirect3DRMFrame2 *iface,
679 IDirect3DRMFrame *reference, D3DVECTOR *position)
680 {
681 FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position);
682
683 return E_NOTIMPL;
684 }
685
686 static HRESULT WINAPI d3drm_frame2_GetRotation(IDirect3DRMFrame2 *iface,
687 IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *theta)
688 {
689 FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta);
690
691 return E_NOTIMPL;
692 }
693
694 static HRESULT WINAPI d3drm_frame2_GetScene(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **scene)
695 {
696 FIXME("iface %p, scene %p stub!\n", iface, scene);
697
698 return E_NOTIMPL;
699 }
700
701 static D3DRMSORTMODE WINAPI d3drm_frame2_GetSortMode(IDirect3DRMFrame2 *iface)
702 {
703 FIXME("iface %p stub!\n", iface);
704
705 return D3DRMSORT_FROMPARENT;
706 }
707
708 static HRESULT WINAPI d3drm_frame2_GetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture **texture)
709 {
710 FIXME("iface %p, texture %p stub!\n", iface, texture);
711
712 return E_NOTIMPL;
713 }
714
715 static HRESULT WINAPI d3drm_frame2_GetTransform(IDirect3DRMFrame2 *iface, D3DRMMATRIX4D matrix)
716 {
717 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
718
719 TRACE("iface %p, matrix %p.\n", iface, matrix);
720
721 memcpy(matrix, frame->transform, sizeof(D3DRMMATRIX4D));
722
723 return D3DRM_OK;
724 }
725
726 static HRESULT WINAPI d3drm_frame2_GetVelocity(IDirect3DRMFrame2 *iface,
727 IDirect3DRMFrame *reference, D3DVECTOR *velocity, BOOL with_rotation)
728 {
729 FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n",
730 iface, reference, velocity, with_rotation);
731
732 return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI d3drm_frame2_GetOrientation(IDirect3DRMFrame2 *iface,
736 IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up)
737 {
738 FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up);
739
740 return E_NOTIMPL;
741 }
742
743 static HRESULT WINAPI d3drm_frame2_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3DRMVisualArray **visuals)
744 {
745 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
746 struct d3drm_visual_array *array;
747
748 TRACE("iface %p, visuals %p.\n", iface, visuals);
749
750 if (!visuals)
751 return D3DRMERR_BADVALUE;
752
753 if (!(array = d3drm_visual_array_create(frame->nb_visuals, frame->visuals)))
754 return E_OUTOFMEMORY;
755
756 *visuals = &array->IDirect3DRMVisualArray_iface;
757
758 return D3DRM_OK;
759 }
760
761 static HRESULT WINAPI d3drm_frame2_GetTextureTopology(IDirect3DRMFrame2 *iface, BOOL *wrap_u, BOOL *wrap_v)
762 {
763 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
764
765 return E_NOTIMPL;
766 }
767
768 static HRESULT WINAPI d3drm_frame2_InverseTransform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s)
769 {
770 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
771
772 return E_NOTIMPL;
773 }
774
775 static HRESULT WINAPI d3drm_frame2_Load(IDirect3DRMFrame2 *iface, void *filename,
776 void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx)
777 {
778 FIXME("iface %p, filename %p, name %p, flags %#x, cb %p, ctx %p stub!\n",
779 iface, filename, name, flags, cb, ctx);
780
781 return E_NOTIMPL;
782 }
783
784 static HRESULT WINAPI d3drm_frame2_LookAt(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *target,
785 IDirect3DRMFrame *reference, D3DRMFRAMECONSTRAINT constraint)
786 {
787 FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint);
788
789 return E_NOTIMPL;
790 }
791
792 static HRESULT WINAPI d3drm_frame2_Move(IDirect3DRMFrame2 *iface, D3DVALUE delta)
793 {
794 FIXME("iface %p, delta %.8e stub!\n", iface, delta);
795
796 return E_NOTIMPL;
797 }
798
799 static HRESULT WINAPI d3drm_frame2_DeleteChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child)
800 {
801 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
802 IDirect3DRMFrame3 *child3;
803 HRESULT hr;
804
805 TRACE("iface %p, child %p.\n", iface, child);
806
807 if (!child)
808 return D3DRMERR_BADOBJECT;
809 if (FAILED(hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3)))
810 return D3DRMERR_BADOBJECT;
811 IDirect3DRMFrame_Release(child);
812
813 return IDirect3DRMFrame3_DeleteChild(&frame->IDirect3DRMFrame3_iface, child3);
814 }
815
816 static HRESULT WINAPI d3drm_frame2_DeleteLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light)
817 {
818 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
819
820 TRACE("iface %p, light %p.\n", iface, light);
821
822 return IDirect3DRMFrame3_DeleteLight(&frame->IDirect3DRMFrame3_iface, light);
823 }
824
825 static HRESULT WINAPI d3drm_frame2_DeleteMoveCallback(IDirect3DRMFrame2 *iface,
826 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
827 {
828 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
829
830 return E_NOTIMPL;
831 }
832
833 static HRESULT WINAPI d3drm_frame2_DeleteVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual)
834 {
835 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
836
837 TRACE("iface %p, visual %p.\n", iface, visual);
838
839 return IDirect3DRMFrame3_DeleteVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
840 }
841
842 static D3DCOLOR WINAPI d3drm_frame2_GetSceneBackground(IDirect3DRMFrame2 *iface)
843 {
844 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
845
846 TRACE("iface %p.\n", iface);
847
848 return IDirect3DRMFrame3_GetSceneBackground(&frame->IDirect3DRMFrame3_iface);
849 }
850
851 static HRESULT WINAPI d3drm_frame2_GetSceneBackgroundDepth(IDirect3DRMFrame2 *iface,
852 IDirectDrawSurface **surface)
853 {
854 FIXME("iface %p, surface %p stub!\n", iface, surface);
855
856 return E_NOTIMPL;
857 }
858
859 static D3DCOLOR WINAPI d3drm_frame2_GetSceneFogColor(IDirect3DRMFrame2 *iface)
860 {
861 FIXME("iface %p stub!\n", iface);
862
863 return 0;
864 }
865
866 static BOOL WINAPI d3drm_frame2_GetSceneFogEnable(IDirect3DRMFrame2 *iface)
867 {
868 FIXME("iface %p stub!\n", iface);
869
870 return FALSE;
871 }
872
873 static D3DRMFOGMODE WINAPI d3drm_frame2_GetSceneFogMode(IDirect3DRMFrame2 *iface)
874 {
875 FIXME("iface %p stub!\n", iface);
876
877 return D3DRMFOG_LINEAR;
878 }
879
880 static HRESULT WINAPI d3drm_frame2_GetSceneFogParams(IDirect3DRMFrame2 *iface,
881 D3DVALUE *start, D3DVALUE *end, D3DVALUE *density)
882 {
883 FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density);
884
885 return E_NOTIMPL;
886 }
887
888 static HRESULT WINAPI d3drm_frame2_SetSceneBackground(IDirect3DRMFrame2 *iface, D3DCOLOR color)
889 {
890 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
891
892 TRACE("iface %p, color 0x%08x.\n", iface, color);
893
894 return IDirect3DRMFrame3_SetSceneBackground(&frame->IDirect3DRMFrame3_iface, color);
895 }
896
897 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundRGB(IDirect3DRMFrame2 *iface,
898 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
899 {
900 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
901
902 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
903
904 return IDirect3DRMFrame3_SetSceneBackgroundRGB(&frame->IDirect3DRMFrame3_iface, red, green, blue);
905 }
906
907 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundDepth(IDirect3DRMFrame2 *iface, IDirectDrawSurface *surface)
908 {
909 FIXME("iface %p, surface %p stub!\n", iface, surface);
910
911 return E_NOTIMPL;
912 }
913
914 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundImage(IDirect3DRMFrame2 *iface, IDirect3DRMTexture *texture)
915 {
916 FIXME("iface %p, texture %p stub!\n", iface, texture);
917
918 return E_NOTIMPL;
919 }
920
921 static HRESULT WINAPI d3drm_frame2_SetSceneFogEnable(IDirect3DRMFrame2 *iface, BOOL enable)
922 {
923 FIXME("iface %p, enable %#x stub!\n", iface, enable);
924
925 return E_NOTIMPL;
926 }
927
928 static HRESULT WINAPI d3drm_frame2_SetSceneFogColor(IDirect3DRMFrame2 *iface, D3DCOLOR color)
929 {
930 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
931
932 return E_NOTIMPL;
933 }
934
935 static HRESULT WINAPI d3drm_frame2_SetSceneFogMode(IDirect3DRMFrame2 *iface, D3DRMFOGMODE mode)
936 {
937 FIXME("iface %p, mode %#x stub!\n", iface, mode);
938
939 return E_NOTIMPL;
940 }
941
942 static HRESULT WINAPI d3drm_frame2_SetSceneFogParams(IDirect3DRMFrame2 *iface,
943 D3DVALUE start, D3DVALUE end, D3DVALUE density)
944 {
945 FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density);
946
947 return E_NOTIMPL;
948 }
949
950 static HRESULT WINAPI d3drm_frame2_SetColor(IDirect3DRMFrame2 *iface, D3DCOLOR color)
951 {
952 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
953
954 return E_NOTIMPL;
955 }
956
957 static HRESULT WINAPI d3drm_frame2_SetColorRGB(IDirect3DRMFrame2 *iface,
958 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
959 {
960 FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
961
962 return E_NOTIMPL;
963 }
964
965 static D3DRMZBUFFERMODE WINAPI d3drm_frame2_GetZbufferMode(IDirect3DRMFrame2 *iface)
966 {
967 FIXME("iface %p stub!\n", iface);
968
969 return D3DRMZBUFFER_FROMPARENT;
970 }
971
972 static HRESULT WINAPI d3drm_frame2_SetMaterialMode(IDirect3DRMFrame2 *iface, D3DRMMATERIALMODE mode)
973 {
974 FIXME("iface %p, mode %#x stub!\n", iface, mode);
975
976 return E_NOTIMPL;
977 }
978
979 static HRESULT WINAPI d3drm_frame2_SetOrientation(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *reference,
980 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
981 {
982 FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
983 iface, reference, dx, dy, dz, ux, uy, uz);
984
985 return E_NOTIMPL;
986 }
987
988 static HRESULT WINAPI d3drm_frame2_SetPosition(IDirect3DRMFrame2 *iface,
989 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z)
990 {
991 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z);
992
993 return E_NOTIMPL;
994 }
995
996 static HRESULT WINAPI d3drm_frame2_SetRotation(IDirect3DRMFrame2 *iface,
997 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
998 {
999 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
1000 iface, reference, x, y, z, theta);
1001
1002 return E_NOTIMPL;
1003 }
1004
1005 static HRESULT WINAPI d3drm_frame2_SetSortMode(IDirect3DRMFrame2 *iface, D3DRMSORTMODE mode)
1006 {
1007 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1008
1009 return E_NOTIMPL;
1010 }
1011
1012 static HRESULT WINAPI d3drm_frame2_SetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture *texture)
1013 {
1014 FIXME("iface %p, texture %p stub!\n", iface, texture);
1015
1016 return E_NOTIMPL;
1017 }
1018
1019 static HRESULT WINAPI d3drm_frame2_SetTextureTopology(IDirect3DRMFrame2 *iface, BOOL wrap_u, BOOL wrap_v)
1020 {
1021 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
1022
1023 return E_NOTIMPL;
1024 }
1025
1026 static HRESULT WINAPI d3drm_frame2_SetVelocity(IDirect3DRMFrame2 *iface,
1027 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation)
1028 {
1029 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x stub!\n",
1030 iface, reference, x, y, z, with_rotation);
1031
1032 return E_NOTIMPL;
1033 }
1034
1035 static HRESULT WINAPI d3drm_frame2_SetZbufferMode(IDirect3DRMFrame2 *iface, D3DRMZBUFFERMODE mode)
1036 {
1037 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1038
1039 return E_NOTIMPL;
1040 }
1041
1042 static HRESULT WINAPI d3drm_frame2_Transform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s)
1043 {
1044 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1045
1046 return E_NOTIMPL;
1047 }
1048
1049 static HRESULT WINAPI d3drm_frame2_AddMoveCallback2(IDirect3DRMFrame2 *iface,
1050 D3DRMFRAMEMOVECALLBACK cb, void *ctx, DWORD flags)
1051 {
1052 FIXME("iface %p, cb %p, ctx %p, flags %#x stub!\n", iface, cb, ctx, flags);
1053
1054 return E_NOTIMPL;
1055 }
1056
1057 static HRESULT WINAPI d3drm_frame2_GetBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box)
1058 {
1059 FIXME("iface %p, box %p stub!\n", iface, box);
1060
1061 return E_NOTIMPL;
1062 }
1063
1064 static BOOL WINAPI d3drm_frame2_GetBoxEnable(IDirect3DRMFrame2 *iface)
1065 {
1066 FIXME("iface %p stub!\n", iface);
1067
1068 return FALSE;
1069 }
1070
1071 static HRESULT WINAPI d3drm_frame2_GetAxes(IDirect3DRMFrame2 *iface, D3DVECTOR *dir, D3DVECTOR *up)
1072 {
1073 FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up);
1074
1075 return E_NOTIMPL;
1076 }
1077
1078 static HRESULT WINAPI d3drm_frame2_GetMaterial(IDirect3DRMFrame2 *iface, IDirect3DRMMaterial **material)
1079 {
1080 FIXME("iface %p, material %p stub!\n", iface, material);
1081
1082 return E_NOTIMPL;
1083 }
1084
1085 static BOOL WINAPI d3drm_frame2_GetInheritAxes(IDirect3DRMFrame2 *iface)
1086 {
1087 FIXME("iface %p stub!\n", iface);
1088
1089 return FALSE;
1090 }
1091
1092 static HRESULT WINAPI d3drm_frame2_GetHierarchyBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box)
1093 {
1094 FIXME("iface %p, box %p stub!\n", iface, box);
1095
1096 return E_NOTIMPL;
1097 }
1098
1099 static const struct IDirect3DRMFrame2Vtbl d3drm_frame2_vtbl =
1100 {
1101 d3drm_frame2_QueryInterface,
1102 d3drm_frame2_AddRef,
1103 d3drm_frame2_Release,
1104 d3drm_frame2_Clone,
1105 d3drm_frame2_AddDestroyCallback,
1106 d3drm_frame2_DeleteDestroyCallback,
1107 d3drm_frame2_SetAppData,
1108 d3drm_frame2_GetAppData,
1109 d3drm_frame2_SetName,
1110 d3drm_frame2_GetName,
1111 d3drm_frame2_GetClassName,
1112 d3drm_frame2_AddChild,
1113 d3drm_frame2_AddLight,
1114 d3drm_frame2_AddMoveCallback,
1115 d3drm_frame2_AddTransform,
1116 d3drm_frame2_AddTranslation,
1117 d3drm_frame2_AddScale,
1118 d3drm_frame2_AddRotation,
1119 d3drm_frame2_AddVisual,
1120 d3drm_frame2_GetChildren,
1121 d3drm_frame2_GetColor,
1122 d3drm_frame2_GetLights,
1123 d3drm_frame2_GetMaterialMode,
1124 d3drm_frame2_GetParent,
1125 d3drm_frame2_GetPosition,
1126 d3drm_frame2_GetRotation,
1127 d3drm_frame2_GetScene,
1128 d3drm_frame2_GetSortMode,
1129 d3drm_frame2_GetTexture,
1130 d3drm_frame2_GetTransform,
1131 d3drm_frame2_GetVelocity,
1132 d3drm_frame2_GetOrientation,
1133 d3drm_frame2_GetVisuals,
1134 d3drm_frame2_GetTextureTopology,
1135 d3drm_frame2_InverseTransform,
1136 d3drm_frame2_Load,
1137 d3drm_frame2_LookAt,
1138 d3drm_frame2_Move,
1139 d3drm_frame2_DeleteChild,
1140 d3drm_frame2_DeleteLight,
1141 d3drm_frame2_DeleteMoveCallback,
1142 d3drm_frame2_DeleteVisual,
1143 d3drm_frame2_GetSceneBackground,
1144 d3drm_frame2_GetSceneBackgroundDepth,
1145 d3drm_frame2_GetSceneFogColor,
1146 d3drm_frame2_GetSceneFogEnable,
1147 d3drm_frame2_GetSceneFogMode,
1148 d3drm_frame2_GetSceneFogParams,
1149 d3drm_frame2_SetSceneBackground,
1150 d3drm_frame2_SetSceneBackgroundRGB,
1151 d3drm_frame2_SetSceneBackgroundDepth,
1152 d3drm_frame2_SetSceneBackgroundImage,
1153 d3drm_frame2_SetSceneFogEnable,
1154 d3drm_frame2_SetSceneFogColor,
1155 d3drm_frame2_SetSceneFogMode,
1156 d3drm_frame2_SetSceneFogParams,
1157 d3drm_frame2_SetColor,
1158 d3drm_frame2_SetColorRGB,
1159 d3drm_frame2_GetZbufferMode,
1160 d3drm_frame2_SetMaterialMode,
1161 d3drm_frame2_SetOrientation,
1162 d3drm_frame2_SetPosition,
1163 d3drm_frame2_SetRotation,
1164 d3drm_frame2_SetSortMode,
1165 d3drm_frame2_SetTexture,
1166 d3drm_frame2_SetTextureTopology,
1167 d3drm_frame2_SetVelocity,
1168 d3drm_frame2_SetZbufferMode,
1169 d3drm_frame2_Transform,
1170 d3drm_frame2_AddMoveCallback2,
1171 d3drm_frame2_GetBox,
1172 d3drm_frame2_GetBoxEnable,
1173 d3drm_frame2_GetAxes,
1174 d3drm_frame2_GetMaterial,
1175 d3drm_frame2_GetInheritAxes,
1176 d3drm_frame2_GetHierarchyBox,
1177 };
1178
1179 static HRESULT WINAPI d3drm_frame3_QueryInterface(IDirect3DRMFrame3 *iface, REFIID riid, void **out)
1180 {
1181 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1182
1183 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
1184
1185 if (IsEqualGUID(riid, &IID_IDirect3DRMFrame2)
1186 || IsEqualGUID(riid, &IID_IDirect3DRMFrame)
1187 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
1188 || IsEqualGUID(riid, &IID_IDirect3DRMVisual)
1189 || IsEqualGUID(riid, &IID_IUnknown))
1190 {
1191 *out = &frame->IDirect3DRMFrame2_iface;
1192 }
1193 else if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
1194 {
1195 *out = &frame->IDirect3DRMFrame3_iface;
1196 }
1197 else
1198 {
1199 *out = NULL;
1200 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
1201 return CLASS_E_CLASSNOTAVAILABLE;
1202 }
1203
1204 IUnknown_AddRef((IUnknown *)*out);
1205 return S_OK;
1206 }
1207
1208 static ULONG WINAPI d3drm_frame3_AddRef(IDirect3DRMFrame3 *iface)
1209 {
1210 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1211 ULONG refcount = InterlockedIncrement(&frame->ref);
1212
1213 TRACE("%p increasing refcount to %u.\n", iface, refcount);
1214
1215 return refcount;
1216 }
1217
1218 static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface)
1219 {
1220 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1221 ULONG refcount = InterlockedDecrement(&frame->ref);
1222 ULONG i;
1223
1224 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
1225
1226 if (!refcount)
1227 {
1228 for (i = 0; i < frame->nb_children; ++i)
1229 {
1230 IDirect3DRMFrame3_Release(frame->children[i]);
1231 }
1232 HeapFree(GetProcessHeap(), 0, frame->children);
1233 for (i = 0; i < frame->nb_visuals; ++i)
1234 {
1235 IDirect3DRMVisual_Release(frame->visuals[i]);
1236 }
1237 HeapFree(GetProcessHeap(), 0, frame->visuals);
1238 for (i = 0; i < frame->nb_lights; ++i)
1239 {
1240 IDirect3DRMLight_Release(frame->lights[i]);
1241 }
1242 HeapFree(GetProcessHeap(), 0, frame->lights);
1243 HeapFree(GetProcessHeap(), 0, frame);
1244 }
1245
1246 return refcount;
1247 }
1248
1249 static HRESULT WINAPI d3drm_frame3_Clone(IDirect3DRMFrame3 *iface,
1250 IUnknown *outer, REFIID iid, void **out)
1251 {
1252 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
1253
1254 return E_NOTIMPL;
1255 }
1256
1257 static HRESULT WINAPI d3drm_frame3_AddDestroyCallback(IDirect3DRMFrame3 *iface,
1258 D3DRMOBJECTCALLBACK cb, void *ctx)
1259 {
1260 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1261
1262 return E_NOTIMPL;
1263 }
1264
1265 static HRESULT WINAPI d3drm_frame3_DeleteDestroyCallback(IDirect3DRMFrame3 *iface,
1266 D3DRMOBJECTCALLBACK cb, void *ctx)
1267 {
1268 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1269
1270 return E_NOTIMPL;
1271 }
1272
1273 static HRESULT WINAPI d3drm_frame3_SetAppData(IDirect3DRMFrame3 *iface, DWORD data)
1274 {
1275 FIXME("iface %p, data %#x stub!\n", iface, data);
1276
1277 return E_NOTIMPL;
1278 }
1279
1280 static DWORD WINAPI d3drm_frame3_GetAppData(IDirect3DRMFrame3 *iface)
1281 {
1282 FIXME("iface %p stub!\n", iface);
1283
1284 return 0;
1285 }
1286
1287 static HRESULT WINAPI d3drm_frame3_SetName(IDirect3DRMFrame3 *iface, const char *name)
1288 {
1289 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
1290
1291 return E_NOTIMPL;
1292 }
1293
1294 static HRESULT WINAPI d3drm_frame3_GetName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
1295 {
1296 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
1297
1298 return E_NOTIMPL;
1299 }
1300
1301 static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
1302 {
1303 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
1304
1305 if (!size || *size < strlen("Frame") || !name)
1306 return E_INVALIDARG;
1307
1308 strcpy(name, "Frame");
1309 *size = sizeof("Frame");
1310
1311 return D3DRM_OK;
1312 }
1313
1314 static HRESULT WINAPI d3drm_frame3_AddChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child)
1315 {
1316 struct d3drm_frame *This = impl_from_IDirect3DRMFrame3(iface);
1317 struct d3drm_frame *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child);
1318
1319 TRACE("iface %p, child %p.\n", iface, child);
1320
1321 if (!child_obj)
1322 return D3DRMERR_BADOBJECT;
1323
1324 if (child_obj->parent)
1325 {
1326 IDirect3DRMFrame3* parent = &child_obj->parent->IDirect3DRMFrame3_iface;
1327
1328 if (parent == iface)
1329 {
1330 /* Passed frame is already a child so return success */
1331 return D3DRM_OK;
1332 }
1333 else
1334 {
1335 /* Remove parent and continue */
1336 IDirect3DRMFrame3_DeleteChild(parent, child);
1337 }
1338 }
1339
1340 if ((This->nb_children + 1) > This->children_capacity)
1341 {
1342 ULONG new_capacity;
1343 IDirect3DRMFrame3** children;
1344
1345 if (!This->children_capacity)
1346 {
1347 new_capacity = 16;
1348 children = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMFrame3*));
1349 }
1350 else
1351 {
1352 new_capacity = This->children_capacity * 2;
1353 children = HeapReAlloc(GetProcessHeap(), 0, This->children, new_capacity * sizeof(IDirect3DRMFrame3*));
1354 }
1355
1356 if (!children)
1357 return E_OUTOFMEMORY;
1358
1359 This->children_capacity = new_capacity;
1360 This->children = children;
1361 }
1362
1363 This->children[This->nb_children++] = child;
1364 IDirect3DRMFrame3_AddRef(child);
1365 child_obj->parent = This;
1366
1367 return D3DRM_OK;
1368 }
1369
1370 static HRESULT WINAPI d3drm_frame3_AddLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light)
1371 {
1372 struct d3drm_frame *This = impl_from_IDirect3DRMFrame3(iface);
1373 ULONG i;
1374 IDirect3DRMLight** lights;
1375
1376 TRACE("iface %p, light %p.\n", iface, light);
1377
1378 if (!light)
1379 return D3DRMERR_BADOBJECT;
1380
1381 /* Check if already existing and return gracefully without increasing ref count */
1382 for (i = 0; i < This->nb_lights; i++)
1383 if (This->lights[i] == light)
1384 return D3DRM_OK;
1385
1386 if ((This->nb_lights + 1) > This->lights_capacity)
1387 {
1388 ULONG new_capacity;
1389
1390 if (!This->lights_capacity)
1391 {
1392 new_capacity = 16;
1393 lights = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMLight*));
1394 }
1395 else
1396 {
1397 new_capacity = This->lights_capacity * 2;
1398 lights = HeapReAlloc(GetProcessHeap(), 0, This->lights, new_capacity * sizeof(IDirect3DRMLight*));
1399 }
1400
1401 if (!lights)
1402 return E_OUTOFMEMORY;
1403
1404 This->lights_capacity = new_capacity;
1405 This->lights = lights;
1406 }
1407
1408 This->lights[This->nb_lights++] = light;
1409 IDirect3DRMLight_AddRef(light);
1410
1411 return D3DRM_OK;
1412 }
1413
1414 static HRESULT WINAPI d3drm_frame3_AddMoveCallback(IDirect3DRMFrame3 *iface,
1415 D3DRMFRAME3MOVECALLBACK cb, void *ctx, DWORD flags)
1416 {
1417 FIXME("iface %p, cb %p, ctx %p flags %#x stub!\n", iface, cb, ctx, flags);
1418
1419 return E_NOTIMPL;
1420 }
1421
1422 static HRESULT WINAPI d3drm_frame3_AddTransform(IDirect3DRMFrame3 *iface,
1423 D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix)
1424 {
1425 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1426
1427 TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix);
1428
1429 switch (type)
1430 {
1431 case D3DRMCOMBINE_REPLACE:
1432 memcpy(frame->transform, matrix, sizeof(D3DRMMATRIX4D));
1433 break;
1434
1435 case D3DRMCOMBINE_BEFORE:
1436 FIXME("D3DRMCOMBINE_BEFORE not supported yet\n");
1437 break;
1438
1439 case D3DRMCOMBINE_AFTER:
1440 FIXME("D3DRMCOMBINE_AFTER not supported yet\n");
1441 break;
1442
1443 default:
1444 WARN("Unknown Combine Type %u\n", type);
1445 return D3DRMERR_BADVALUE;
1446 }
1447
1448 return S_OK;
1449 }
1450
1451 static HRESULT WINAPI d3drm_frame3_AddTranslation(IDirect3DRMFrame3 *iface,
1452 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
1453 {
1454 FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e stub!\n", iface, type, x, y, z);
1455
1456 return E_NOTIMPL;
1457 }
1458
1459 static HRESULT WINAPI d3drm_frame3_AddScale(IDirect3DRMFrame3 *iface,
1460 D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1461 {
1462 FIXME("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e stub!\n", iface, type, sx, sy, sz);
1463
1464 return E_NOTIMPL;
1465 }
1466
1467 static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface,
1468 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
1469 {
1470 FIXME("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
1471 iface, type, x, y, z, theta);
1472
1473 return E_NOTIMPL;
1474 }
1475
1476 static HRESULT WINAPI d3drm_frame3_AddVisual(IDirect3DRMFrame3 *iface, IUnknown *visual)
1477 {
1478 struct d3drm_frame *This = impl_from_IDirect3DRMFrame3(iface);
1479 ULONG i;
1480 IDirect3DRMVisual** visuals;
1481
1482 TRACE("iface %p, visual %p.\n", iface, visual);
1483
1484 if (!visual)
1485 return D3DRMERR_BADOBJECT;
1486
1487 /* Check if already existing and return gracefully without increasing ref count */
1488 for (i = 0; i < This->nb_visuals; i++)
1489 if (This->visuals[i] == (IDirect3DRMVisual *)visual)
1490 return D3DRM_OK;
1491
1492 if ((This->nb_visuals + 1) > This->visuals_capacity)
1493 {
1494 ULONG new_capacity;
1495
1496 if (!This->visuals_capacity)
1497 {
1498 new_capacity = 16;
1499 visuals = HeapAlloc(GetProcessHeap(), 0, new_capacity * sizeof(IDirect3DRMVisual*));
1500 }
1501 else
1502 {
1503 new_capacity = This->visuals_capacity * 2;
1504 visuals = HeapReAlloc(GetProcessHeap(), 0, This->visuals, new_capacity * sizeof(IDirect3DRMVisual*));
1505 }
1506
1507 if (!visuals)
1508 return E_OUTOFMEMORY;
1509
1510 This->visuals_capacity = new_capacity;
1511 This->visuals = visuals;
1512 }
1513
1514 This->visuals[This->nb_visuals++] = (IDirect3DRMVisual *)visual;
1515 IDirect3DRMVisual_AddRef(visual);
1516
1517 return D3DRM_OK;
1518 }
1519
1520 static HRESULT WINAPI d3drm_frame3_GetChildren(IDirect3DRMFrame3 *iface, IDirect3DRMFrameArray **children)
1521 {
1522 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1523 struct d3drm_frame_array *array;
1524
1525 TRACE("iface %p, children %p.\n", iface, children);
1526
1527 if (!children)
1528 return D3DRMERR_BADVALUE;
1529
1530 if (!(array = d3drm_frame_array_create(frame->nb_children, frame->children)))
1531 return E_OUTOFMEMORY;
1532
1533 *children = &array->IDirect3DRMFrameArray_iface;
1534
1535 return D3DRM_OK;
1536 }
1537
1538 static D3DCOLOR WINAPI d3drm_frame3_GetColor(IDirect3DRMFrame3 *iface)
1539 {
1540 FIXME("iface %p stub!\n", iface);
1541
1542 return 0;
1543 }
1544
1545 static HRESULT WINAPI d3drm_frame3_GetLights(IDirect3DRMFrame3 *iface, IDirect3DRMLightArray **lights)
1546 {
1547 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1548 struct d3drm_light_array *array;
1549
1550 TRACE("iface %p, lights %p.\n", iface, lights);
1551
1552 if (!lights)
1553 return D3DRMERR_BADVALUE;
1554
1555 if (!(array = d3drm_light_array_create(frame->nb_lights, frame->lights)))
1556 return E_OUTOFMEMORY;
1557
1558 *lights = &array->IDirect3DRMLightArray_iface;
1559
1560 return D3DRM_OK;
1561 }
1562
1563 static D3DRMMATERIALMODE WINAPI d3drm_frame3_GetMaterialMode(IDirect3DRMFrame3 *iface)
1564 {
1565 FIXME("iface %p stub!\n", iface);
1566
1567 return D3DRMMATERIAL_FROMPARENT;
1568 }
1569
1570 static HRESULT WINAPI d3drm_frame3_GetParent(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **parent)
1571 {
1572 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1573
1574 TRACE("iface %p, parent %p.\n", iface, parent);
1575
1576 if (!parent)
1577 return D3DRMERR_BADVALUE;
1578
1579 if (frame->parent)
1580 {
1581 *parent = &frame->parent->IDirect3DRMFrame3_iface;
1582 IDirect3DRMFrame_AddRef(*parent);
1583 }
1584 else
1585 {
1586 *parent = NULL;
1587 }
1588
1589 return D3DRM_OK;
1590 }
1591
1592 static HRESULT WINAPI d3drm_frame3_GetPosition(IDirect3DRMFrame3 *iface,
1593 IDirect3DRMFrame3 *reference, D3DVECTOR *position)
1594 {
1595 FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position);
1596
1597 return E_NOTIMPL;
1598 }
1599
1600 static HRESULT WINAPI d3drm_frame3_GetRotation(IDirect3DRMFrame3 *iface,
1601 IDirect3DRMFrame3 *reference, D3DVECTOR *axis, D3DVALUE *theta)
1602 {
1603 FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta);
1604
1605 return E_NOTIMPL;
1606 }
1607
1608 static HRESULT WINAPI d3drm_frame3_GetScene(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **scene)
1609 {
1610 FIXME("iface %p, scene %p stub!\n", iface, scene);
1611
1612 return E_NOTIMPL;
1613 }
1614
1615 static D3DRMSORTMODE WINAPI d3drm_frame3_GetSortMode(IDirect3DRMFrame3 *iface)
1616 {
1617 FIXME("iface %p stub!\n", iface);
1618
1619 return D3DRMSORT_FROMPARENT;
1620 }
1621
1622 static HRESULT WINAPI d3drm_frame3_GetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 **texture)
1623 {
1624 FIXME("iface %p, texture %p stub!\n", iface, texture);
1625
1626 return E_NOTIMPL;
1627 }
1628
1629 static HRESULT WINAPI d3drm_frame3_GetTransform(IDirect3DRMFrame3 *iface,
1630 IDirect3DRMFrame3 *reference, D3DRMMATRIX4D matrix)
1631 {
1632 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1633
1634 TRACE("iface %p, reference %p, matrix %p.\n", iface, reference, matrix);
1635
1636 if (reference)
1637 FIXME("Specifying a frame as the root of the scene different from the current root frame is not supported yet\n");
1638
1639 memcpy(matrix, frame->transform, sizeof(D3DRMMATRIX4D));
1640
1641 return D3DRM_OK;
1642 }
1643
1644 static HRESULT WINAPI d3drm_frame3_GetVelocity(IDirect3DRMFrame3 *iface,
1645 IDirect3DRMFrame3 *reference, D3DVECTOR *velocity, BOOL with_rotation)
1646 {
1647 FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n",
1648 iface, reference, velocity, with_rotation);
1649
1650 return E_NOTIMPL;
1651 }
1652
1653 static HRESULT WINAPI d3drm_frame3_GetOrientation(IDirect3DRMFrame3 *iface,
1654 IDirect3DRMFrame3 *reference, D3DVECTOR *dir, D3DVECTOR *up)
1655 {
1656 FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up);
1657
1658 return E_NOTIMPL;
1659 }
1660
1661 static HRESULT WINAPI d3drm_frame3_GetVisuals(IDirect3DRMFrame3 *iface,
1662 DWORD *count, IUnknown **visuals)
1663 {
1664 FIXME("iface %p, count %p, visuals %p stub!\n", iface, count, visuals);
1665
1666 return E_NOTIMPL;
1667 }
1668
1669 static HRESULT WINAPI d3drm_frame3_InverseTransform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s)
1670 {
1671 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1672
1673 return E_NOTIMPL;
1674 }
1675
1676 static HRESULT WINAPI d3drm_frame3_Load(IDirect3DRMFrame3 *iface, void *filename,
1677 void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURE3CALLBACK cb, void *ctx)
1678 {
1679 FIXME("iface %p, filename %p, name %p, flags %#x, cb %p, ctx %p stub!\n",
1680 iface, filename, name, flags, cb, ctx);
1681
1682 return E_NOTIMPL;
1683 }
1684
1685 static HRESULT WINAPI d3drm_frame3_LookAt(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *target,
1686 IDirect3DRMFrame3 *reference, D3DRMFRAMECONSTRAINT constraint)
1687 {
1688 FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint);
1689
1690 return E_NOTIMPL;
1691 }
1692
1693 static HRESULT WINAPI d3drm_frame3_Move(IDirect3DRMFrame3 *iface, D3DVALUE delta)
1694 {
1695 FIXME("iface %p, delta %.8e stub!\n", iface, delta);
1696
1697 return E_NOTIMPL;
1698 }
1699
1700 static HRESULT WINAPI d3drm_frame3_DeleteChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child)
1701 {
1702 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1703 struct d3drm_frame *child_impl = unsafe_impl_from_IDirect3DRMFrame3(child);
1704 ULONG i;
1705
1706 TRACE("iface %p, child %p.\n", iface, child);
1707
1708 if (!child_impl)
1709 return D3DRMERR_BADOBJECT;
1710
1711 /* Check if child exists */
1712 for (i = 0; i < frame->nb_children; ++i)
1713 {
1714 if (frame->children[i] == child)
1715 break;
1716 }
1717
1718 if (i == frame->nb_children)
1719 return D3DRMERR_BADVALUE;
1720
1721 memmove(frame->children + i, frame->children + i + 1, sizeof(*frame->children) * (frame->nb_children - 1 - i));
1722 IDirect3DRMFrame3_Release(child);
1723 child_impl->parent = NULL;
1724 --frame->nb_children;
1725
1726 return D3DRM_OK;
1727 }
1728
1729 static HRESULT WINAPI d3drm_frame3_DeleteLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light)
1730 {
1731 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1732 ULONG i;
1733
1734 TRACE("iface %p, light %p.\n", iface, light);
1735
1736 if (!light)
1737 return D3DRMERR_BADOBJECT;
1738
1739 /* Check if visual exists */
1740 for (i = 0; i < frame->nb_lights; ++i)
1741 {
1742 if (frame->lights[i] == light)
1743 break;
1744 }
1745
1746 if (i == frame->nb_lights)
1747 return D3DRMERR_BADVALUE;
1748
1749 memmove(frame->lights + i, frame->lights + i + 1, sizeof(*frame->lights) * (frame->nb_lights - 1 - i));
1750 IDirect3DRMLight_Release(light);
1751 --frame->nb_lights;
1752
1753 return D3DRM_OK;
1754 }
1755
1756 static HRESULT WINAPI d3drm_frame3_DeleteMoveCallback(IDirect3DRMFrame3 *iface,
1757 D3DRMFRAME3MOVECALLBACK cb, void *ctx)
1758 {
1759 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1760
1761 return E_NOTIMPL;
1762 }
1763
1764 static HRESULT WINAPI d3drm_frame3_DeleteVisual(IDirect3DRMFrame3 *iface, IUnknown *visual)
1765 {
1766 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1767 ULONG i;
1768
1769 TRACE("iface %p, visual %p.\n", iface, visual);
1770
1771 if (!visual)
1772 return D3DRMERR_BADOBJECT;
1773
1774 /* Check if visual exists */
1775 for (i = 0; i < frame->nb_visuals; ++i)
1776 {
1777 if (frame->visuals[i] == (IDirect3DRMVisual *)visual)
1778 break;
1779 }
1780
1781 if (i == frame->nb_visuals)
1782 return D3DRMERR_BADVALUE;
1783
1784 memmove(frame->visuals + i, frame->visuals + i + 1, sizeof(*frame->visuals) * (frame->nb_visuals - 1 - i));
1785 IDirect3DRMVisual_Release(visual);
1786 --frame->nb_visuals;
1787
1788 return D3DRM_OK;
1789 }
1790
1791 static D3DCOLOR WINAPI d3drm_frame3_GetSceneBackground(IDirect3DRMFrame3 *iface)
1792 {
1793 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1794
1795 TRACE("iface %p.\n", iface);
1796
1797 return frame->scenebackground;
1798 }
1799
1800 static HRESULT WINAPI d3drm_frame3_GetSceneBackgroundDepth(IDirect3DRMFrame3 *iface,
1801 IDirectDrawSurface **surface)
1802 {
1803 FIXME("iface %p, surface %p stub!\n", iface, surface);
1804
1805 return E_NOTIMPL;
1806 }
1807
1808 static D3DCOLOR WINAPI d3drm_frame3_GetSceneFogColor(IDirect3DRMFrame3 *iface)
1809 {
1810 FIXME("iface %p stub!\n", iface);
1811
1812 return 0;
1813 }
1814
1815 static BOOL WINAPI d3drm_frame3_GetSceneFogEnable(IDirect3DRMFrame3 *iface)
1816 {
1817 FIXME("iface %p stub!\n", iface);
1818
1819 return FALSE;
1820 }
1821
1822 static D3DRMFOGMODE WINAPI d3drm_frame3_GetSceneFogMode(IDirect3DRMFrame3 *iface)
1823 {
1824 FIXME("iface %p stub!\n", iface);
1825
1826 return D3DRMFOG_LINEAR;
1827 }
1828
1829 static HRESULT WINAPI d3drm_frame3_GetSceneFogParams(IDirect3DRMFrame3 *iface,
1830 D3DVALUE *start, D3DVALUE *end, D3DVALUE *density)
1831 {
1832 FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density);
1833
1834 return E_NOTIMPL;
1835 }
1836
1837 static HRESULT WINAPI d3drm_frame3_SetSceneBackground(IDirect3DRMFrame3 *iface, D3DCOLOR color)
1838 {
1839 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1840
1841 TRACE("iface %p, color 0x%08x.\n", iface, color);
1842
1843 frame->scenebackground = color;
1844
1845 return D3DRM_OK;
1846 }
1847
1848 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundRGB(IDirect3DRMFrame3 *iface,
1849 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
1850 {
1851 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1852
1853 TRACE("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
1854
1855 frame->scenebackground = RGBA_MAKE((BYTE)(red * 255.0f),
1856 (BYTE)(green * 255.0f), (BYTE)(blue * 255.0f), 0xff);
1857
1858 return D3DRM_OK;
1859 }
1860
1861 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundDepth(IDirect3DRMFrame3 *iface,
1862 IDirectDrawSurface *surface)
1863 {
1864 FIXME("iface %p, surface %p stub!\n", iface, surface);
1865
1866 return E_NOTIMPL;
1867 }
1868
1869 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundImage(IDirect3DRMFrame3 *iface,
1870 IDirect3DRMTexture3 *texture)
1871 {
1872 FIXME("iface %p, texture %p stub!\n", iface, texture);
1873
1874 return E_NOTIMPL;
1875 }
1876
1877 static HRESULT WINAPI d3drm_frame3_SetSceneFogEnable(IDirect3DRMFrame3 *iface, BOOL enable)
1878 {
1879 FIXME("iface %p, enable %#x stub!\n", iface, enable);
1880
1881 return E_NOTIMPL;
1882 }
1883
1884 static HRESULT WINAPI d3drm_frame3_SetSceneFogColor(IDirect3DRMFrame3 *iface, D3DCOLOR color)
1885 {
1886 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
1887
1888 return E_NOTIMPL;
1889 }
1890
1891 static HRESULT WINAPI d3drm_frame3_SetSceneFogMode(IDirect3DRMFrame3 *iface, D3DRMFOGMODE mode)
1892 {
1893 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1894
1895 return E_NOTIMPL;
1896 }
1897
1898 static HRESULT WINAPI d3drm_frame3_SetSceneFogParams(IDirect3DRMFrame3 *iface,
1899 D3DVALUE start, D3DVALUE end, D3DVALUE density)
1900 {
1901 FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density);
1902
1903 return E_NOTIMPL;
1904 }
1905
1906 static HRESULT WINAPI d3drm_frame3_SetColor(IDirect3DRMFrame3 *iface, D3DCOLOR color)
1907 {
1908 FIXME("iface %p, color 0x%08x stub!\n", iface, color);
1909
1910 return E_NOTIMPL;
1911 }
1912
1913 static HRESULT WINAPI d3drm_frame3_SetColorRGB(IDirect3DRMFrame3 *iface,
1914 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
1915 {
1916 FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
1917
1918 return E_NOTIMPL;
1919 }
1920
1921 static D3DRMZBUFFERMODE WINAPI d3drm_frame3_GetZbufferMode(IDirect3DRMFrame3 *iface)
1922 {
1923 FIXME("iface %p stub!\n", iface);
1924
1925 return D3DRMZBUFFER_FROMPARENT;
1926 }
1927
1928 static HRESULT WINAPI d3drm_frame3_SetMaterialMode(IDirect3DRMFrame3 *iface, D3DRMMATERIALMODE mode)
1929 {
1930 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1931
1932 return E_NOTIMPL;
1933 }
1934
1935 static HRESULT WINAPI d3drm_frame3_SetOrientation(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference,
1936 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
1937 {
1938 FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
1939 iface, reference, dx, dy, dz, ux, uy, uz);
1940
1941 return E_NOTIMPL;
1942 }
1943
1944 static HRESULT WINAPI d3drm_frame3_SetPosition(IDirect3DRMFrame3 *iface,
1945 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z)
1946 {
1947 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z);
1948
1949 return E_NOTIMPL;
1950 }
1951
1952 static HRESULT WINAPI d3drm_frame3_SetRotation(IDirect3DRMFrame3 *iface,
1953 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
1954 {
1955 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
1956 iface, reference, x, y, z, theta);
1957
1958 return E_NOTIMPL;
1959 }
1960
1961 static HRESULT WINAPI d3drm_frame3_SetSortMode(IDirect3DRMFrame3 *iface, D3DRMSORTMODE mode)
1962 {
1963 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1964
1965 return E_NOTIMPL;
1966 }
1967
1968 static HRESULT WINAPI d3drm_frame3_SetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 *texture)
1969 {
1970 FIXME("iface %p, texture %p stub!\n", iface, texture);
1971
1972 return E_NOTIMPL;
1973 }
1974
1975 static HRESULT WINAPI d3drm_frame3_SetVelocity(IDirect3DRMFrame3 *iface,
1976 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation)
1977 {
1978 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x.\n",
1979 iface, reference, x, y, z, with_rotation);
1980
1981 return E_NOTIMPL;
1982 }
1983
1984 static HRESULT WINAPI d3drm_frame3_SetZbufferMode(IDirect3DRMFrame3 *iface, D3DRMZBUFFERMODE mode)
1985 {
1986 FIXME("iface %p, mode %#x stub!\n", iface, mode);
1987
1988 return E_NOTIMPL;
1989 }
1990
1991 static HRESULT WINAPI d3drm_frame3_Transform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s)
1992 {
1993 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1994
1995 return E_NOTIMPL;
1996 }
1997
1998 static HRESULT WINAPI d3drm_frame3_GetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
1999 {
2000 FIXME("iface %p, box %p stub!\n", iface, box);
2001
2002 return E_NOTIMPL;
2003 }
2004
2005 static BOOL WINAPI d3drm_frame3_GetBoxEnable(IDirect3DRMFrame3 *iface)
2006 {
2007 FIXME("iface %p stub!\n", iface);
2008
2009 return FALSE;
2010 }
2011
2012 static HRESULT WINAPI d3drm_frame3_GetAxes(IDirect3DRMFrame3 *iface, D3DVECTOR *dir, D3DVECTOR *up)
2013 {
2014 FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up);
2015
2016 return E_NOTIMPL;
2017 }
2018
2019 static HRESULT WINAPI d3drm_frame3_GetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 **material)
2020 {
2021 FIXME("iface %p, material %p stub!\n", iface, material);
2022
2023 return E_NOTIMPL;
2024 }
2025
2026 static BOOL WINAPI d3drm_frame3_GetInheritAxes(IDirect3DRMFrame3 *iface)
2027 {
2028 FIXME("iface %p stub!\n", iface);
2029
2030 return FALSE;
2031 }
2032
2033 static HRESULT WINAPI d3drm_frame3_GetHierarchyBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
2034 {
2035 FIXME("iface %p, box %p stub!\n", iface, box);
2036
2037 return E_NOTIMPL;
2038 }
2039
2040 static HRESULT WINAPI d3drm_frame3_SetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
2041 {
2042 FIXME("iface %p, box %p stub!\n", iface, box);
2043
2044 return E_NOTIMPL;
2045 }
2046
2047 static HRESULT WINAPI d3drm_frame3_SetBoxEnable(IDirect3DRMFrame3 *iface, BOOL enable)
2048 {
2049 FIXME("iface %p, enable %#x stub!\n", iface, enable);
2050
2051 return E_NOTIMPL;
2052 }
2053
2054 static HRESULT WINAPI d3drm_frame3_SetAxes(IDirect3DRMFrame3 *iface,
2055 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2056 {
2057 FIXME("iface %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
2058 iface, dx, dy, dz, ux, uy, uz);
2059
2060 return E_NOTIMPL;
2061 }
2062
2063 static HRESULT WINAPI d3drm_frame3_SetInheritAxes(IDirect3DRMFrame3 *iface, BOOL inherit)
2064 {
2065 FIXME("iface %p, inherit %#x stub!\n", iface, inherit);
2066
2067 return E_NOTIMPL;
2068 }
2069
2070 static HRESULT WINAPI d3drm_frame3_SetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 *material)
2071 {
2072 FIXME("iface %p, material %p stub!\n", iface, material);
2073
2074 return E_NOTIMPL;
2075 }
2076
2077 static HRESULT WINAPI d3drm_frame3_SetQuaternion(IDirect3DRMFrame3 *iface,
2078 IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q)
2079 {
2080 FIXME("iface %p, reference %p, q %p stub!\n", iface, reference, q);
2081
2082 return E_NOTIMPL;
2083 }
2084
2085 static HRESULT WINAPI d3drm_frame3_RayPick(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference,
2086 D3DRMRAY *ray, DWORD flags, IDirect3DRMPicked2Array **visuals)
2087 {
2088 FIXME("iface %p, reference %p, ray %p, flags %#x, visuals %p stub!\n",
2089 iface, reference, ray, flags, visuals);
2090
2091 return E_NOTIMPL;
2092 }
2093
2094 static HRESULT WINAPI d3drm_frame3_Save(IDirect3DRMFrame3 *iface,
2095 const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags)
2096 {
2097 FIXME("iface %p, filename %s, format %#x, flags %#x stub!\n",
2098 iface, debugstr_a(filename), format, flags);
2099
2100 return E_NOTIMPL;
2101 }
2102
2103 static HRESULT WINAPI d3drm_frame3_TransformVectors(IDirect3DRMFrame3 *iface,
2104 IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src)
2105 {
2106 FIXME("iface %p, reference %p, num %u, dst %p, src %p stub!\n", iface, reference, num, dst, src);
2107
2108 return E_NOTIMPL;
2109 }
2110
2111 static HRESULT WINAPI d3drm_frame3_InverseTransformVectors(IDirect3DRMFrame3 *iface,
2112 IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src)
2113 {
2114 FIXME("iface %p, reference %p, num %u, dst %p, src %p stub!\n", iface, reference, num, dst, src);
2115
2116 return E_NOTIMPL;
2117 }
2118
2119 static HRESULT WINAPI d3drm_frame3_SetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD flags)
2120 {
2121 FIXME("iface %p, flags %#x stub!\n", iface, flags);
2122
2123 return E_NOTIMPL;
2124 }
2125
2126 static HRESULT WINAPI d3drm_frame3_GetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD *flags)
2127 {
2128 FIXME("iface %p, flags %p stub!\n", iface, flags);
2129
2130 return E_NOTIMPL;
2131 }
2132
2133 static HRESULT WINAPI d3drm_frame3_SetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD flags)
2134 {
2135 FIXME("iface %p, flags %#x stub!\n", iface, flags);
2136
2137 return E_NOTIMPL;
2138 }
2139
2140 static HRESULT WINAPI d3drm_frame3_GetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD *fog_mode)
2141 {
2142 FIXME("iface %p, fog_mode %p stub!\n", iface, fog_mode);
2143
2144 return E_NOTIMPL;
2145 }
2146
2147 static HRESULT WINAPI d3drm_frame3_SetMaterialOverride(IDirect3DRMFrame3 *iface,
2148 D3DRMMATERIALOVERRIDE *override)
2149 {
2150 FIXME("iface %p, override %p stub!\n", iface, override);
2151
2152 return E_NOTIMPL;
2153 }
2154
2155 static HRESULT WINAPI d3drm_frame3_GetMaterialOverride(IDirect3DRMFrame3 *iface,
2156 D3DRMMATERIALOVERRIDE *override)
2157 {
2158 FIXME("iface %p, override %p stub!\n", iface, override);
2159
2160 return E_NOTIMPL;
2161 }
2162
2163 static const struct IDirect3DRMFrame3Vtbl d3drm_frame3_vtbl =
2164 {
2165 d3drm_frame3_QueryInterface,
2166 d3drm_frame3_AddRef,
2167 d3drm_frame3_Release,
2168 d3drm_frame3_Clone,
2169 d3drm_frame3_AddDestroyCallback,
2170 d3drm_frame3_DeleteDestroyCallback,
2171 d3drm_frame3_SetAppData,
2172 d3drm_frame3_GetAppData,
2173 d3drm_frame3_SetName,
2174 d3drm_frame3_GetName,
2175 d3drm_frame3_GetClassName,
2176 d3drm_frame3_AddChild,
2177 d3drm_frame3_AddLight,
2178 d3drm_frame3_AddMoveCallback,
2179 d3drm_frame3_AddTransform,
2180 d3drm_frame3_AddTranslation,
2181 d3drm_frame3_AddScale,
2182 d3drm_frame3_AddRotation,
2183 d3drm_frame3_AddVisual,
2184 d3drm_frame3_GetChildren,
2185 d3drm_frame3_GetColor,
2186 d3drm_frame3_GetLights,
2187 d3drm_frame3_GetMaterialMode,
2188 d3drm_frame3_GetParent,
2189 d3drm_frame3_GetPosition,
2190 d3drm_frame3_GetRotation,
2191 d3drm_frame3_GetScene,
2192 d3drm_frame3_GetSortMode,
2193 d3drm_frame3_GetTexture,
2194 d3drm_frame3_GetTransform,
2195 d3drm_frame3_GetVelocity,
2196 d3drm_frame3_GetOrientation,
2197 d3drm_frame3_GetVisuals,
2198 d3drm_frame3_InverseTransform,
2199 d3drm_frame3_Load,
2200 d3drm_frame3_LookAt,
2201 d3drm_frame3_Move,
2202 d3drm_frame3_DeleteChild,
2203 d3drm_frame3_DeleteLight,
2204 d3drm_frame3_DeleteMoveCallback,
2205 d3drm_frame3_DeleteVisual,
2206 d3drm_frame3_GetSceneBackground,
2207 d3drm_frame3_GetSceneBackgroundDepth,
2208 d3drm_frame3_GetSceneFogColor,
2209 d3drm_frame3_GetSceneFogEnable,
2210 d3drm_frame3_GetSceneFogMode,
2211 d3drm_frame3_GetSceneFogParams,
2212 d3drm_frame3_SetSceneBackground,
2213 d3drm_frame3_SetSceneBackgroundRGB,
2214 d3drm_frame3_SetSceneBackgroundDepth,
2215 d3drm_frame3_SetSceneBackgroundImage,
2216 d3drm_frame3_SetSceneFogEnable,
2217 d3drm_frame3_SetSceneFogColor,
2218 d3drm_frame3_SetSceneFogMode,
2219 d3drm_frame3_SetSceneFogParams,
2220 d3drm_frame3_SetColor,
2221 d3drm_frame3_SetColorRGB,
2222 d3drm_frame3_GetZbufferMode,
2223 d3drm_frame3_SetMaterialMode,
2224 d3drm_frame3_SetOrientation,
2225 d3drm_frame3_SetPosition,
2226 d3drm_frame3_SetRotation,
2227 d3drm_frame3_SetSortMode,
2228 d3drm_frame3_SetTexture,
2229 d3drm_frame3_SetVelocity,
2230 d3drm_frame3_SetZbufferMode,
2231 d3drm_frame3_Transform,
2232 d3drm_frame3_GetBox,
2233 d3drm_frame3_GetBoxEnable,
2234 d3drm_frame3_GetAxes,
2235 d3drm_frame3_GetMaterial,
2236 d3drm_frame3_GetInheritAxes,
2237 d3drm_frame3_GetHierarchyBox,
2238 d3drm_frame3_SetBox,
2239 d3drm_frame3_SetBoxEnable,
2240 d3drm_frame3_SetAxes,
2241 d3drm_frame3_SetInheritAxes,
2242 d3drm_frame3_SetMaterial,
2243 d3drm_frame3_SetQuaternion,
2244 d3drm_frame3_RayPick,
2245 d3drm_frame3_Save,
2246 d3drm_frame3_TransformVectors,
2247 d3drm_frame3_InverseTransformVectors,
2248 d3drm_frame3_SetTraversalOptions,
2249 d3drm_frame3_GetTraversalOptions,
2250 d3drm_frame3_SetSceneFogMethod,
2251 d3drm_frame3_GetSceneFogMethod,
2252 d3drm_frame3_SetMaterialOverride,
2253 d3drm_frame3_GetMaterialOverride,
2254 };
2255
2256 static inline struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
2257 {
2258 if (!iface)
2259 return NULL;
2260 assert(iface->lpVtbl == &d3drm_frame3_vtbl);
2261
2262 return impl_from_IDirect3DRMFrame3(iface);
2263 }
2264
2265 HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown *parent, IUnknown **out)
2266 {
2267 struct d3drm_frame *object;
2268 HRESULT hr;
2269
2270 TRACE("riid %s, parent %p, out %p.\n", debugstr_guid(riid), parent, out);
2271
2272 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
2273 return E_OUTOFMEMORY;
2274
2275 object->IDirect3DRMFrame2_iface.lpVtbl = &d3drm_frame2_vtbl;
2276 object->IDirect3DRMFrame3_iface.lpVtbl = &d3drm_frame3_vtbl;
2277 object->ref = 1;
2278 object->scenebackground = RGBA_MAKE(0, 0, 0, 0xff);
2279
2280 memcpy(object->transform, identity, sizeof(D3DRMMATRIX4D));
2281
2282 if (parent)
2283 {
2284 IDirect3DRMFrame3 *p;
2285
2286 hr = IDirect3DRMFrame_QueryInterface(parent, &IID_IDirect3DRMFrame3, (void**)&p);
2287 if (hr != S_OK)
2288 {
2289 HeapFree(GetProcessHeap(), 0, object);
2290 return hr;
2291 }
2292 IDirect3DRMFrame_Release(parent);
2293 IDirect3DRMFrame3_AddChild(p, &object->IDirect3DRMFrame3_iface);
2294 }
2295
2296 hr = IDirect3DRMFrame3_QueryInterface(&object->IDirect3DRMFrame3_iface, riid, (void **)out);
2297 IDirect3DRMFrame3_Release(&object->IDirect3DRMFrame3_iface);
2298 return hr;
2299 }