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