widl: Add support for function parameter flags to SLTG typelib generator.
[wine.git] / dlls / d3drm / frame.c
blob7a5bd18cd33d1b3c4719890e21a6fd4e36b0186a
1 /*
2 * Implementation of IDirect3DRMFrame Interface
4 * Copyright 2011, 2012 André Hentschel
5 * Copyright 2012 Christian Costa
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.
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.
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
22 #include "d3drm_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
26 static const struct d3drm_matrix identity =
28 1.0f, 0.0f, 0.0f, 0.0f,
29 0.0f, 1.0f, 0.0f, 0.0f,
30 0.0f, 0.0f, 1.0f, 0.0f,
31 0.0f, 0.0f, 0.0f, 1.0f,
34 struct d3drm_frame_array
36 IDirect3DRMFrameArray IDirect3DRMFrameArray_iface;
37 LONG ref;
38 ULONG size;
39 IDirect3DRMFrame **frames;
42 struct d3drm_visual_array
44 IDirect3DRMVisualArray IDirect3DRMVisualArray_iface;
45 LONG ref;
46 ULONG size;
47 IDirect3DRMVisual **visuals;
50 struct d3drm_light_array
52 IDirect3DRMLightArray IDirect3DRMLightArray_iface;
53 LONG ref;
54 ULONG size;
55 IDirect3DRMLight **lights;
58 static inline struct d3drm_frame *impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface)
60 return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame_iface);
63 static inline struct d3drm_frame *impl_from_IDirect3DRMFrame2(IDirect3DRMFrame2 *iface)
65 return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame2_iface);
68 static inline struct d3drm_frame *impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
70 return CONTAINING_RECORD(iface, struct d3drm_frame, IDirect3DRMFrame3_iface);
73 static inline struct d3drm_frame_array *impl_from_IDirect3DRMFrameArray(IDirect3DRMFrameArray *iface)
75 return CONTAINING_RECORD(iface, struct d3drm_frame_array, IDirect3DRMFrameArray_iface);
78 static inline struct d3drm_visual_array *impl_from_IDirect3DRMVisualArray(IDirect3DRMVisualArray *iface)
80 return CONTAINING_RECORD(iface, struct d3drm_visual_array, IDirect3DRMVisualArray_iface);
83 static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3DRMLightArray *iface)
85 return CONTAINING_RECORD(iface, struct d3drm_light_array, IDirect3DRMLightArray_iface);
88 static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation(IDirect3DRMAnimation *iface)
90 return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation_iface);
93 static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation2(IDirect3DRMAnimation2 *iface)
95 return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation2_iface);
98 static void d3drm_matrix_multiply_affine(struct d3drm_matrix *dst,
99 const struct d3drm_matrix *src1, const struct d3drm_matrix *src2)
101 struct d3drm_matrix tmp;
103 tmp._11 = src1->_11 * src2->_11 + src1->_12 * src2->_21 + src1->_13 * src2->_31;
104 tmp._12 = src1->_11 * src2->_12 + src1->_12 * src2->_22 + src1->_13 * src2->_32;
105 tmp._13 = src1->_11 * src2->_13 + src1->_12 * src2->_23 + src1->_13 * src2->_33;
106 tmp._14 = 0.0f;
108 tmp._21 = src1->_21 * src2->_11 + src1->_22 * src2->_21 + src1->_23 * src2->_31;
109 tmp._22 = src1->_21 * src2->_12 + src1->_22 * src2->_22 + src1->_23 * src2->_32;
110 tmp._23 = src1->_21 * src2->_13 + src1->_22 * src2->_23 + src1->_23 * src2->_33;
111 tmp._24 = 0.0f;
113 tmp._31 = src1->_31 * src2->_11 + src1->_32 * src2->_21 + src1->_33 * src2->_31;
114 tmp._32 = src1->_31 * src2->_12 + src1->_32 * src2->_22 + src1->_33 * src2->_32;
115 tmp._33 = src1->_31 * src2->_13 + src1->_32 * src2->_23 + src1->_33 * src2->_33;
116 tmp._34 = 0.0f;
118 tmp._41 = src1->_41 * src2->_11 + src1->_42 * src2->_21 + src1->_43 * src2->_31 + src2->_41;
119 tmp._42 = src1->_41 * src2->_12 + src1->_42 * src2->_22 + src1->_43 * src2->_32 + src2->_42;
120 tmp._43 = src1->_41 * src2->_13 + src1->_42 * src2->_23 + src1->_43 * src2->_33 + src2->_43;
121 tmp._44 = 1.0f;
123 *dst = tmp;
126 static void d3drm_matrix_set_rotation(struct d3drm_matrix *matrix, D3DVECTOR *axis, float theta)
128 float sin_theta, cos_theta, vers_theta;
130 D3DRMVectorNormalize(axis);
131 sin_theta = sinf(theta);
132 cos_theta = cosf(theta);
133 vers_theta = 1.0f - cos_theta;
135 matrix->_11 = vers_theta * axis->x * axis->x + cos_theta;
136 matrix->_21 = vers_theta * axis->x * axis->y - sin_theta * axis->z;
137 matrix->_31 = vers_theta * axis->x * axis->z + sin_theta * axis->y;
138 matrix->_41 = 0.0f;
140 matrix->_12 = vers_theta * axis->y * axis->x + sin_theta * axis->z;
141 matrix->_22 = vers_theta * axis->y * axis->y + cos_theta;
142 matrix->_32 = vers_theta * axis->y * axis->z - sin_theta * axis->x;
143 matrix->_42 = 0.0f;
145 matrix->_13 = vers_theta * axis->z * axis->x - sin_theta * axis->y;
146 matrix->_23 = vers_theta * axis->z * axis->y + sin_theta * axis->x;
147 matrix->_33 = vers_theta * axis->z * axis->z + cos_theta;
148 matrix->_43 = 0.0f;
150 matrix->_14 = 0.0f;
151 matrix->_24 = 0.0f;
152 matrix->_34 = 0.0f;
153 matrix->_44 = 1.0f;
156 static void d3drm_vector_transform_affine(D3DVECTOR *dst, const D3DVECTOR *v, const struct d3drm_matrix *m)
158 D3DVECTOR tmp;
160 tmp.x = v->x * m->_11 + v->y * m->_21 + v->z * m->_31 + m->_41;
161 tmp.y = v->x * m->_12 + v->y * m->_22 + v->z * m->_32 + m->_42;
162 tmp.z = v->x * m->_13 + v->y * m->_23 + v->z * m->_33 + m->_43;
164 *dst = tmp;
167 static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out)
169 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
171 if (IsEqualGUID(riid, &IID_IDirect3DRMFrameArray)
172 || IsEqualGUID(riid, &IID_IUnknown))
174 IDirect3DRMFrameArray_AddRef(iface);
175 *out = iface;
176 return S_OK;
179 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
181 *out = NULL;
182 return E_NOINTERFACE;
185 static ULONG WINAPI d3drm_frame_array_AddRef(IDirect3DRMFrameArray *iface)
187 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
188 ULONG refcount = InterlockedIncrement(&array->ref);
190 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
192 return refcount;
195 static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface)
197 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
198 ULONG refcount = InterlockedDecrement(&array->ref);
199 ULONG i;
201 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
203 if (!refcount)
205 for (i = 0; i < array->size; ++i)
207 IDirect3DRMFrame_Release(array->frames[i]);
209 free(array->frames);
210 free(array);
213 return refcount;
216 static DWORD WINAPI d3drm_frame_array_GetSize(IDirect3DRMFrameArray *iface)
218 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
220 TRACE("iface %p.\n", iface);
222 return array->size;
225 static HRESULT WINAPI d3drm_frame_array_GetElement(IDirect3DRMFrameArray *iface,
226 DWORD index, IDirect3DRMFrame **frame)
228 struct d3drm_frame_array *array = impl_from_IDirect3DRMFrameArray(iface);
230 TRACE("iface %p, index %lu, frame %p.\n", iface, index, frame);
232 if (!frame)
233 return D3DRMERR_BADVALUE;
235 if (index >= array->size)
237 *frame = NULL;
238 return D3DRMERR_BADVALUE;
241 IDirect3DRMFrame_AddRef(array->frames[index]);
242 *frame = array->frames[index];
244 return D3DRM_OK;
247 static const struct IDirect3DRMFrameArrayVtbl d3drm_frame_array_vtbl =
249 d3drm_frame_array_QueryInterface,
250 d3drm_frame_array_AddRef,
251 d3drm_frame_array_Release,
252 d3drm_frame_array_GetSize,
253 d3drm_frame_array_GetElement,
256 static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_count, IDirect3DRMFrame3 **frames)
258 struct d3drm_frame_array *array;
259 unsigned int i;
261 if (!(array = calloc(1, sizeof(*array))))
262 return NULL;
264 array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
265 array->ref = 1;
266 array->size = frame_count;
268 if (frame_count)
270 if (!(array->frames = calloc(frame_count, sizeof(*array->frames))))
272 free(array);
273 return NULL;
276 for (i = 0; i < frame_count; ++i)
278 IDirect3DRMFrame3_QueryInterface(frames[i], &IID_IDirect3DRMFrame, (void **)&array->frames[i]);
282 return array;
285 static HRESULT WINAPI d3drm_visual_array_QueryInterface(IDirect3DRMVisualArray *iface, REFIID riid, void **out)
287 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
289 if (IsEqualGUID(riid, &IID_IDirect3DRMVisualArray)
290 || IsEqualGUID(riid, &IID_IUnknown))
292 IDirect3DRMVisualArray_AddRef(iface);
293 *out = iface;
294 return S_OK;
297 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
299 *out = NULL;
300 return E_NOINTERFACE;
303 static ULONG WINAPI d3drm_visual_array_AddRef(IDirect3DRMVisualArray *iface)
305 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
306 ULONG refcount = InterlockedIncrement(&array->ref);
308 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
310 return refcount;
313 static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
315 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
316 ULONG refcount = InterlockedDecrement(&array->ref);
317 ULONG i;
319 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
321 if (!refcount)
323 for (i = 0; i < array->size; ++i)
325 IDirect3DRMVisual_Release(array->visuals[i]);
327 free(array->visuals);
328 free(array);
331 return refcount;
334 static DWORD WINAPI d3drm_visual_array_GetSize(IDirect3DRMVisualArray *iface)
336 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
338 TRACE("iface %p.\n", iface);
340 return array->size;
343 static HRESULT WINAPI d3drm_visual_array_GetElement(IDirect3DRMVisualArray *iface,
344 DWORD index, IDirect3DRMVisual **visual)
346 struct d3drm_visual_array *array = impl_from_IDirect3DRMVisualArray(iface);
348 TRACE("iface %p, index %lu, visual %p.\n", iface, index, visual);
350 if (!visual)
351 return D3DRMERR_BADVALUE;
353 if (index >= array->size)
355 *visual = NULL;
356 return D3DRMERR_BADVALUE;
359 IDirect3DRMVisual_AddRef(array->visuals[index]);
360 *visual = array->visuals[index];
362 return D3DRM_OK;
365 static const struct IDirect3DRMVisualArrayVtbl d3drm_visual_array_vtbl =
367 d3drm_visual_array_QueryInterface,
368 d3drm_visual_array_AddRef,
369 d3drm_visual_array_Release,
370 d3drm_visual_array_GetSize,
371 d3drm_visual_array_GetElement,
374 static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_count, IDirect3DRMVisual **visuals)
376 struct d3drm_visual_array *array;
377 unsigned int i;
379 if (!(array = calloc(1, sizeof(*array))))
380 return NULL;
382 array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
383 array->ref = 1;
384 array->size = visual_count;
386 if (visual_count)
388 if (!(array->visuals = calloc(visual_count, sizeof(*array->visuals))))
390 free(array);
391 return NULL;
394 for (i = 0; i < visual_count; ++i)
396 array->visuals[i] = visuals[i];
397 IDirect3DRMVisual_AddRef(array->visuals[i]);
401 return array;
404 static HRESULT WINAPI d3drm_light_array_QueryInterface(IDirect3DRMLightArray *iface, REFIID riid, void **out)
406 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
408 if (IsEqualGUID(riid, &IID_IDirect3DRMLightArray)
409 || IsEqualGUID(riid, &IID_IUnknown))
411 IDirect3DRMLightArray_AddRef(iface);
412 *out = iface;
413 return S_OK;
416 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
418 *out = NULL;
419 return E_NOINTERFACE;
422 static ULONG WINAPI d3drm_light_array_AddRef(IDirect3DRMLightArray *iface)
424 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
425 ULONG refcount = InterlockedIncrement(&array->ref);
427 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
429 return refcount;
432 static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface)
434 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
435 ULONG refcount = InterlockedDecrement(&array->ref);
436 ULONG i;
438 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
440 if (!refcount)
442 for (i = 0; i < array->size; ++i)
444 IDirect3DRMLight_Release(array->lights[i]);
446 free(array->lights);
447 free(array);
450 return refcount;
453 static DWORD WINAPI d3drm_light_array_GetSize(IDirect3DRMLightArray *iface)
455 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
457 TRACE("iface %p.\n", iface);
459 return array->size;
462 static HRESULT WINAPI d3drm_light_array_GetElement(IDirect3DRMLightArray *iface,
463 DWORD index, IDirect3DRMLight **light)
465 struct d3drm_light_array *array = impl_from_IDirect3DRMLightArray(iface);
467 TRACE("iface %p, index %lu, light %p.\n", iface, index, light);
469 if (!light)
470 return D3DRMERR_BADVALUE;
472 if (index >= array->size)
474 *light = NULL;
475 return D3DRMERR_BADVALUE;
478 IDirect3DRMLight_AddRef(array->lights[index]);
479 *light = array->lights[index];
481 return D3DRM_OK;
484 static const struct IDirect3DRMLightArrayVtbl d3drm_light_array_vtbl =
486 d3drm_light_array_QueryInterface,
487 d3drm_light_array_AddRef,
488 d3drm_light_array_Release,
489 d3drm_light_array_GetSize,
490 d3drm_light_array_GetElement,
493 static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_count, IDirect3DRMLight **lights)
495 struct d3drm_light_array *array;
496 unsigned int i;
498 if (!(array = calloc(1, sizeof(*array))))
499 return NULL;
501 array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
502 array->ref = 1;
503 array->size = light_count;
505 if (light_count)
507 if (!(array->lights = calloc(light_count, sizeof(*array->lights))))
509 free(array);
510 return NULL;
513 for (i = 0; i < light_count; ++i)
515 array->lights[i] = lights[i];
516 IDirect3DRMLight_AddRef(array->lights[i]);
520 return array;
523 static HRESULT WINAPI d3drm_frame3_QueryInterface(IDirect3DRMFrame3 *iface, REFIID riid, void **out)
525 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
527 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
529 if (IsEqualGUID(riid, &IID_IDirect3DRMFrame)
530 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
531 || IsEqualGUID(riid, &IID_IDirect3DRMVisual)
532 || IsEqualGUID(riid, &IID_IUnknown))
534 *out = &frame->IDirect3DRMFrame_iface;
536 else if (IsEqualGUID(riid, &IID_IDirect3DRMFrame2))
538 *out = &frame->IDirect3DRMFrame2_iface;
540 else if (IsEqualGUID(riid, &IID_IDirect3DRMFrame3))
542 *out = &frame->IDirect3DRMFrame3_iface;
544 else
546 *out = NULL;
547 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
548 return CLASS_E_CLASSNOTAVAILABLE;
551 IUnknown_AddRef((IUnknown *)*out);
552 return S_OK;
555 static HRESULT WINAPI d3drm_frame2_QueryInterface(IDirect3DRMFrame2 *iface, REFIID riid, void **out)
557 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
559 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
561 return d3drm_frame3_QueryInterface(&frame->IDirect3DRMFrame3_iface, riid, out);
564 static HRESULT WINAPI d3drm_frame1_QueryInterface(IDirect3DRMFrame *iface, REFIID riid, void **out)
566 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
568 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
570 return d3drm_frame3_QueryInterface(&frame->IDirect3DRMFrame3_iface, riid, out);
573 static ULONG WINAPI d3drm_frame3_AddRef(IDirect3DRMFrame3 *iface)
575 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
576 ULONG refcount = InterlockedIncrement(&frame->ref);
578 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
580 return refcount;
583 static ULONG WINAPI d3drm_frame2_AddRef(IDirect3DRMFrame2 *iface)
585 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
587 TRACE("iface %p.\n", iface);
589 return d3drm_frame3_AddRef(&frame->IDirect3DRMFrame3_iface);
592 static ULONG WINAPI d3drm_frame1_AddRef(IDirect3DRMFrame *iface)
594 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
596 TRACE("iface %p.\n", iface);
598 return d3drm_frame3_AddRef(&frame->IDirect3DRMFrame3_iface);
601 static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface)
603 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
604 ULONG refcount = InterlockedDecrement(&frame->ref);
605 ULONG i;
607 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
609 if (!refcount)
611 d3drm_object_cleanup((IDirect3DRMObject *)&frame->IDirect3DRMFrame_iface, &frame->obj);
612 for (i = 0; i < frame->nb_children; ++i)
614 IDirect3DRMFrame3_Release(frame->children[i]);
616 free(frame->children);
617 for (i = 0; i < frame->nb_visuals; ++i)
619 IDirect3DRMVisual_Release(frame->visuals[i]);
621 free(frame->visuals);
622 for (i = 0; i < frame->nb_lights; ++i)
624 IDirect3DRMLight_Release(frame->lights[i]);
626 free(frame->lights);
627 IDirect3DRM_Release(frame->d3drm);
628 free(frame);
631 return refcount;
634 static ULONG WINAPI d3drm_frame2_Release(IDirect3DRMFrame2 *iface)
636 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
638 TRACE("iface %p.\n", iface);
640 return d3drm_frame3_Release(&frame->IDirect3DRMFrame3_iface);
643 static ULONG WINAPI d3drm_frame1_Release(IDirect3DRMFrame *iface)
645 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
647 TRACE("iface %p.\n", iface);
649 return d3drm_frame3_Release(&frame->IDirect3DRMFrame3_iface);
652 static HRESULT WINAPI d3drm_frame3_Clone(IDirect3DRMFrame3 *iface,
653 IUnknown *outer, REFIID iid, void **out)
655 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
657 return E_NOTIMPL;
660 static HRESULT WINAPI d3drm_frame2_Clone(IDirect3DRMFrame2 *iface,
661 IUnknown *outer, REFIID iid, void **out)
663 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
665 return E_NOTIMPL;
668 static HRESULT WINAPI d3drm_frame1_Clone(IDirect3DRMFrame *iface,
669 IUnknown *outer, REFIID iid, void **out)
671 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
673 return E_NOTIMPL;
676 static HRESULT WINAPI d3drm_frame3_AddDestroyCallback(IDirect3DRMFrame3 *iface,
677 D3DRMOBJECTCALLBACK cb, void *ctx)
679 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
681 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
683 return d3drm_object_add_destroy_callback(&frame->obj, cb, ctx);
686 static HRESULT WINAPI d3drm_frame2_AddDestroyCallback(IDirect3DRMFrame2 *iface,
687 D3DRMOBJECTCALLBACK cb, void *ctx)
689 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
691 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
693 return IDirect3DRMFrame3_AddDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx);
696 static HRESULT WINAPI d3drm_frame1_AddDestroyCallback(IDirect3DRMFrame *iface,
697 D3DRMOBJECTCALLBACK cb, void *ctx)
699 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
701 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
703 return IDirect3DRMFrame3_AddDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx);
706 static HRESULT WINAPI d3drm_frame3_DeleteDestroyCallback(IDirect3DRMFrame3 *iface,
707 D3DRMOBJECTCALLBACK cb, void *ctx)
709 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
711 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
713 return d3drm_object_delete_destroy_callback(&frame->obj, cb, ctx);
716 static HRESULT WINAPI d3drm_frame2_DeleteDestroyCallback(IDirect3DRMFrame2 *iface,
717 D3DRMOBJECTCALLBACK cb, void *ctx)
719 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
721 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
723 return IDirect3DRMFrame3_DeleteDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx);
726 static HRESULT WINAPI d3drm_frame1_DeleteDestroyCallback(IDirect3DRMFrame *iface,
727 D3DRMOBJECTCALLBACK cb, void *ctx)
729 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
731 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
733 return IDirect3DRMFrame3_DeleteDestroyCallback(&frame->IDirect3DRMFrame3_iface, cb, ctx);
736 static HRESULT WINAPI d3drm_frame3_SetAppData(IDirect3DRMFrame3 *iface, DWORD data)
738 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
740 TRACE("iface %p, data %#lx.\n", iface, data);
742 frame->obj.appdata = data;
744 return D3DRM_OK;
747 static HRESULT WINAPI d3drm_frame2_SetAppData(IDirect3DRMFrame2 *iface, DWORD data)
749 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
751 TRACE("iface %p, data %#lx.\n", iface, data);
753 return d3drm_frame3_SetAppData(&frame->IDirect3DRMFrame3_iface, data);
756 static HRESULT WINAPI d3drm_frame1_SetAppData(IDirect3DRMFrame *iface, DWORD data)
758 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
760 TRACE("iface %p, data %#lx.\n", iface, data);
762 return d3drm_frame3_SetAppData(&frame->IDirect3DRMFrame3_iface, data);
765 static DWORD WINAPI d3drm_frame3_GetAppData(IDirect3DRMFrame3 *iface)
767 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
769 TRACE("iface %p.\n", iface);
771 return frame->obj.appdata;
774 static DWORD WINAPI d3drm_frame2_GetAppData(IDirect3DRMFrame2 *iface)
776 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
778 TRACE("iface %p.\n", iface);
780 return d3drm_frame3_GetAppData(&frame->IDirect3DRMFrame3_iface);
783 static DWORD WINAPI d3drm_frame1_GetAppData(IDirect3DRMFrame *iface)
785 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
787 TRACE("iface %p.\n", iface);
789 return d3drm_frame3_GetAppData(&frame->IDirect3DRMFrame3_iface);
792 static HRESULT WINAPI d3drm_frame3_SetName(IDirect3DRMFrame3 *iface, const char *name)
794 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
796 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
798 return d3drm_object_set_name(&frame->obj, name);
801 static HRESULT WINAPI d3drm_frame2_SetName(IDirect3DRMFrame2 *iface, const char *name)
803 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
805 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
807 return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name);
810 static HRESULT WINAPI d3drm_frame1_SetName(IDirect3DRMFrame *iface, const char *name)
812 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
814 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
816 return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name);
819 static HRESULT WINAPI d3drm_frame3_GetName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
821 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
823 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
825 return d3drm_object_get_name(&frame->obj, size, name);
828 static HRESULT WINAPI d3drm_frame2_GetName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
830 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
832 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
834 return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name);
837 static HRESULT WINAPI d3drm_frame1_GetName(IDirect3DRMFrame *iface, DWORD *size, char *name)
839 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
841 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
843 return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name);
846 static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
848 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
850 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
852 return d3drm_object_get_class_name(&frame->obj, size, name);
855 static HRESULT WINAPI d3drm_frame2_GetClassName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
857 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
859 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
861 return d3drm_frame3_GetClassName(&frame->IDirect3DRMFrame3_iface, size, name);
864 static HRESULT WINAPI d3drm_frame1_GetClassName(IDirect3DRMFrame *iface, DWORD *size, char *name)
866 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
868 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
870 return d3drm_frame3_GetClassName(&frame->IDirect3DRMFrame3_iface, size, name);
873 static HRESULT WINAPI d3drm_frame3_AddChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child)
875 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
876 struct d3drm_frame *child_obj = unsafe_impl_from_IDirect3DRMFrame3(child);
878 TRACE("iface %p, child %p.\n", iface, child);
880 if (!child_obj)
881 return D3DRMERR_BADOBJECT;
883 if (child_obj->parent)
885 IDirect3DRMFrame3* parent = &child_obj->parent->IDirect3DRMFrame3_iface;
887 if (parent == iface)
889 /* Passed frame is already a child so return success */
890 return D3DRM_OK;
892 else
894 /* Remove parent and continue */
895 IDirect3DRMFrame3_DeleteChild(parent, child);
899 if (!d3drm_array_reserve((void **)&frame->children, &frame->children_size,
900 frame->nb_children + 1, sizeof(*frame->children)))
901 return E_OUTOFMEMORY;
903 frame->children[frame->nb_children++] = child;
904 IDirect3DRMFrame3_AddRef(child);
905 child_obj->parent = frame;
907 return D3DRM_OK;
910 static HRESULT WINAPI d3drm_frame2_AddChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child)
912 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
913 IDirect3DRMFrame3 *child3;
914 HRESULT hr;
916 TRACE("iface %p, child %p.\n", iface, child);
918 if (!child)
919 return D3DRMERR_BADOBJECT;
920 hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3);
921 if (hr != S_OK)
922 return D3DRMERR_BADOBJECT;
923 IDirect3DRMFrame_Release(child);
925 return d3drm_frame3_AddChild(&frame->IDirect3DRMFrame3_iface, child3);
928 static HRESULT WINAPI d3drm_frame1_AddChild(IDirect3DRMFrame *iface, IDirect3DRMFrame *child)
930 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
931 struct d3drm_frame *child_frame = unsafe_impl_from_IDirect3DRMFrame(child);
933 TRACE("iface %p, child %p.\n", iface, child);
935 if (!child_frame)
936 return D3DRMERR_BADOBJECT;
938 return d3drm_frame3_AddChild(&frame->IDirect3DRMFrame3_iface, &child_frame->IDirect3DRMFrame3_iface);
941 static HRESULT WINAPI d3drm_frame3_AddLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light)
943 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
944 ULONG i;
946 TRACE("iface %p, light %p.\n", iface, light);
948 if (!light)
949 return D3DRMERR_BADOBJECT;
951 /* Check if already existing and return gracefully without increasing ref count */
952 for (i = 0; i < frame->nb_lights; i++)
953 if (frame->lights[i] == light)
954 return D3DRM_OK;
956 if (!d3drm_array_reserve((void **)&frame->lights, &frame->lights_size,
957 frame->nb_lights + 1, sizeof(*frame->lights)))
958 return E_OUTOFMEMORY;
960 frame->lights[frame->nb_lights++] = light;
961 IDirect3DRMLight_AddRef(light);
963 return D3DRM_OK;
966 static HRESULT WINAPI d3drm_frame2_AddLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light)
968 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
970 TRACE("iface %p, light %p.\n", iface, light);
972 return d3drm_frame3_AddLight(&frame->IDirect3DRMFrame3_iface, light);
975 static HRESULT WINAPI d3drm_frame1_AddLight(IDirect3DRMFrame *iface, IDirect3DRMLight *light)
977 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
979 TRACE("iface %p, light %p.\n", iface, light);
981 return d3drm_frame3_AddLight(&frame->IDirect3DRMFrame3_iface, light);
984 static HRESULT WINAPI d3drm_frame3_AddMoveCallback(IDirect3DRMFrame3 *iface,
985 D3DRMFRAME3MOVECALLBACK cb, void *ctx, DWORD flags)
987 FIXME("iface %p, cb %p, ctx %p flags %#lx stub!\n", iface, cb, ctx, flags);
989 return E_NOTIMPL;
992 static HRESULT WINAPI d3drm_frame2_AddMoveCallback(IDirect3DRMFrame2 *iface,
993 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
995 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
997 return E_NOTIMPL;
1000 static HRESULT WINAPI d3drm_frame1_AddMoveCallback(IDirect3DRMFrame *iface,
1001 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
1003 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1005 return E_NOTIMPL;
1008 static HRESULT WINAPI d3drm_frame3_AddTransform(IDirect3DRMFrame3 *iface,
1009 D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix)
1011 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1012 const struct d3drm_matrix *m = d3drm_matrix(matrix);
1014 TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix);
1016 if (m->_14 != 0.0f || m->_24 != 0.0f || m->_34 != 0.0f || m->_44 != 1.0f)
1017 return D3DRMERR_BADVALUE;
1019 switch (type)
1021 case D3DRMCOMBINE_REPLACE:
1022 frame->transform = *m;
1023 break;
1025 case D3DRMCOMBINE_BEFORE:
1026 d3drm_matrix_multiply_affine(&frame->transform, m, &frame->transform);
1027 break;
1029 case D3DRMCOMBINE_AFTER:
1030 d3drm_matrix_multiply_affine(&frame->transform, &frame->transform, m);
1031 break;
1033 default:
1034 FIXME("Unhandled type %#x.\n", type);
1035 return D3DRMERR_BADVALUE;
1038 return S_OK;
1041 static HRESULT WINAPI d3drm_frame2_AddTransform(IDirect3DRMFrame2 *iface,
1042 D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix)
1044 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1046 TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix);
1048 return d3drm_frame3_AddTransform(&frame->IDirect3DRMFrame3_iface, type, matrix);
1051 static HRESULT WINAPI d3drm_frame1_AddTransform(IDirect3DRMFrame *iface,
1052 D3DRMCOMBINETYPE type, D3DRMMATRIX4D matrix)
1054 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1056 TRACE("iface %p, type %#x, matrix %p.\n", iface, type, matrix);
1058 return d3drm_frame3_AddTransform(&frame->IDirect3DRMFrame3_iface, type, matrix);
1061 static HRESULT WINAPI d3drm_frame3_AddTranslation(IDirect3DRMFrame3 *iface,
1062 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
1064 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1066 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
1068 switch (type)
1070 case D3DRMCOMBINE_REPLACE:
1071 frame->transform = identity;
1072 frame->transform._41 = x;
1073 frame->transform._42 = y;
1074 frame->transform._43 = z;
1075 break;
1077 case D3DRMCOMBINE_BEFORE:
1078 frame->transform._41 += x * frame->transform._11 + y * frame->transform._21 + z * frame->transform._31;
1079 frame->transform._42 += x * frame->transform._12 + y * frame->transform._22 + z * frame->transform._32;
1080 frame->transform._43 += x * frame->transform._13 + y * frame->transform._23 + z * frame->transform._33;
1081 break;
1083 case D3DRMCOMBINE_AFTER:
1084 frame->transform._41 += x;
1085 frame->transform._42 += y;
1086 frame->transform._43 += z;
1087 break;
1089 default:
1090 FIXME("Unhandled type %#x.\n", type);
1091 return D3DRMERR_BADVALUE;
1094 return D3DRM_OK;
1097 static HRESULT WINAPI d3drm_frame2_AddTranslation(IDirect3DRMFrame2 *iface,
1098 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
1100 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1102 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
1104 return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z);
1107 static HRESULT WINAPI d3drm_frame1_AddTranslation(IDirect3DRMFrame *iface,
1108 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z)
1110 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1112 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e.\n", iface, type, x, y, z);
1114 return d3drm_frame3_AddTranslation(&frame->IDirect3DRMFrame3_iface, type, x, y, z);
1117 static HRESULT WINAPI d3drm_frame3_AddScale(IDirect3DRMFrame3 *iface,
1118 D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1120 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1122 TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz);
1124 switch (type)
1126 case D3DRMCOMBINE_REPLACE:
1127 frame->transform = identity;
1128 frame->transform._11 = sx;
1129 frame->transform._22 = sy;
1130 frame->transform._33 = sz;
1131 break;
1133 case D3DRMCOMBINE_BEFORE:
1134 frame->transform._11 *= sx;
1135 frame->transform._12 *= sx;
1136 frame->transform._13 *= sx;
1137 frame->transform._21 *= sy;
1138 frame->transform._22 *= sy;
1139 frame->transform._23 *= sy;
1140 frame->transform._31 *= sz;
1141 frame->transform._32 *= sz;
1142 frame->transform._33 *= sz;
1143 break;
1145 case D3DRMCOMBINE_AFTER:
1146 frame->transform._11 *= sx;
1147 frame->transform._12 *= sy;
1148 frame->transform._13 *= sz;
1149 frame->transform._21 *= sx;
1150 frame->transform._22 *= sy;
1151 frame->transform._23 *= sz;
1152 frame->transform._31 *= sx;
1153 frame->transform._32 *= sy;
1154 frame->transform._33 *= sz;
1155 frame->transform._41 *= sx;
1156 frame->transform._42 *= sy;
1157 frame->transform._43 *= sz;
1158 break;
1160 default:
1161 FIXME("Unhandled type %#x.\n", type);
1162 return D3DRMERR_BADVALUE;
1165 return D3DRM_OK;
1168 static HRESULT WINAPI d3drm_frame2_AddScale(IDirect3DRMFrame2 *iface,
1169 D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1171 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1173 TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz);
1175 return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz);
1178 static HRESULT WINAPI d3drm_frame1_AddScale(IDirect3DRMFrame *iface,
1179 D3DRMCOMBINETYPE type, D3DVALUE sx, D3DVALUE sy, D3DVALUE sz)
1181 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1183 TRACE("iface %p, type %#x, sx %.8e, sy %.8e, sz %.8e.\n", iface, type, sx, sy, sz);
1185 return d3drm_frame3_AddScale(&frame->IDirect3DRMFrame3_iface, type, sx, sy, sz);
1188 static HRESULT WINAPI d3drm_frame3_AddRotation(IDirect3DRMFrame3 *iface,
1189 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
1191 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1192 struct d3drm_matrix m;
1193 D3DVECTOR axis;
1195 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta);
1197 axis.x = x;
1198 axis.y = y;
1199 axis.z = z;
1201 switch (type)
1203 case D3DRMCOMBINE_REPLACE:
1204 d3drm_matrix_set_rotation(&frame->transform, &axis, theta);
1205 break;
1207 case D3DRMCOMBINE_BEFORE:
1208 d3drm_matrix_set_rotation(&m, &axis, theta);
1209 d3drm_matrix_multiply_affine(&frame->transform, &m, &frame->transform);
1210 break;
1212 case D3DRMCOMBINE_AFTER:
1213 d3drm_matrix_set_rotation(&m, &axis, theta);
1214 d3drm_matrix_multiply_affine(&frame->transform, &frame->transform, &m);
1215 break;
1217 default:
1218 FIXME("Unhandled type %#x.\n", type);
1219 return D3DRMERR_BADVALUE;
1222 return D3DRM_OK;
1225 static HRESULT WINAPI d3drm_frame2_AddRotation(IDirect3DRMFrame2 *iface,
1226 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
1228 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1230 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta);
1232 return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta);
1235 static HRESULT WINAPI d3drm_frame1_AddRotation(IDirect3DRMFrame *iface,
1236 D3DRMCOMBINETYPE type, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
1238 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1240 TRACE("iface %p, type %#x, x %.8e, y %.8e, z %.8e, theta %.8e.\n", iface, type, x, y, z, theta);
1242 return d3drm_frame3_AddRotation(&frame->IDirect3DRMFrame3_iface, type, x, y, z, theta);
1245 static HRESULT WINAPI d3drm_frame3_AddVisual(IDirect3DRMFrame3 *iface, IUnknown *visual)
1247 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1248 ULONG i;
1250 TRACE("iface %p, visual %p.\n", iface, visual);
1252 if (!visual)
1253 return D3DRMERR_BADOBJECT;
1255 /* Check if already existing and return gracefully without increasing ref count */
1256 for (i = 0; i < frame->nb_visuals; i++)
1257 if (frame->visuals[i] == (IDirect3DRMVisual *)visual)
1258 return D3DRM_OK;
1260 if (!d3drm_array_reserve((void **)&frame->visuals, &frame->visuals_size,
1261 frame->nb_visuals + 1, sizeof(*frame->visuals)))
1262 return E_OUTOFMEMORY;
1264 frame->visuals[frame->nb_visuals++] = (IDirect3DRMVisual *)visual;
1265 IDirect3DRMVisual_AddRef(visual);
1267 return D3DRM_OK;
1270 static HRESULT WINAPI d3drm_frame2_AddVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual)
1272 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1274 TRACE("iface %p, visual %p.\n", iface, visual);
1276 return d3drm_frame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
1279 static HRESULT WINAPI d3drm_frame1_AddVisual(IDirect3DRMFrame *iface, IDirect3DRMVisual *visual)
1281 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1283 TRACE("iface %p, visual %p.\n", iface, visual);
1285 return d3drm_frame3_AddVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
1288 static HRESULT WINAPI d3drm_frame3_GetChildren(IDirect3DRMFrame3 *iface, IDirect3DRMFrameArray **children)
1290 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1291 struct d3drm_frame_array *array;
1293 TRACE("iface %p, children %p.\n", iface, children);
1295 if (!children)
1296 return D3DRMERR_BADVALUE;
1298 if (!(array = d3drm_frame_array_create(frame->nb_children, frame->children)))
1299 return E_OUTOFMEMORY;
1301 *children = &array->IDirect3DRMFrameArray_iface;
1303 return D3DRM_OK;
1306 static HRESULT WINAPI d3drm_frame2_GetChildren(IDirect3DRMFrame2 *iface, IDirect3DRMFrameArray **children)
1308 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1310 TRACE("iface %p, children %p.\n", iface, children);
1312 return d3drm_frame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children);
1315 static HRESULT WINAPI d3drm_frame1_GetChildren(IDirect3DRMFrame *iface, IDirect3DRMFrameArray **children)
1317 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1319 TRACE("iface %p, children %p.\n", iface, children);
1321 return d3drm_frame3_GetChildren(&frame->IDirect3DRMFrame3_iface, children);
1324 static D3DCOLOR WINAPI d3drm_frame3_GetColor(IDirect3DRMFrame3 *iface)
1326 FIXME("iface %p stub!\n", iface);
1328 return 0;
1331 static D3DCOLOR WINAPI d3drm_frame2_GetColor(IDirect3DRMFrame2 *iface)
1333 FIXME("iface %p stub!\n", iface);
1335 return 0;
1338 static D3DCOLOR WINAPI d3drm_frame1_GetColor(IDirect3DRMFrame *iface)
1340 FIXME("iface %p stub!\n", iface);
1342 return 0;
1345 static HRESULT WINAPI d3drm_frame3_GetLights(IDirect3DRMFrame3 *iface, IDirect3DRMLightArray **lights)
1347 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1348 struct d3drm_light_array *array;
1350 TRACE("iface %p, lights %p.\n", iface, lights);
1352 if (!lights)
1353 return D3DRMERR_BADVALUE;
1355 if (!(array = d3drm_light_array_create(frame->nb_lights, frame->lights)))
1356 return E_OUTOFMEMORY;
1358 *lights = &array->IDirect3DRMLightArray_iface;
1360 return D3DRM_OK;
1363 static HRESULT WINAPI d3drm_frame2_GetLights(IDirect3DRMFrame2 *iface, IDirect3DRMLightArray **lights)
1365 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1367 TRACE("iface %p, lights %p.\n", iface, lights);
1369 return d3drm_frame3_GetLights(&frame->IDirect3DRMFrame3_iface, lights);
1372 static HRESULT WINAPI d3drm_frame1_GetLights(IDirect3DRMFrame *iface, IDirect3DRMLightArray **lights)
1374 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1376 TRACE("iface %p, lights %p.\n", iface, lights);
1378 return d3drm_frame3_GetLights(&frame->IDirect3DRMFrame3_iface, lights);
1381 static D3DRMMATERIALMODE WINAPI d3drm_frame3_GetMaterialMode(IDirect3DRMFrame3 *iface)
1383 FIXME("iface %p stub!\n", iface);
1385 return D3DRMMATERIAL_FROMPARENT;
1388 static D3DRMMATERIALMODE WINAPI d3drm_frame2_GetMaterialMode(IDirect3DRMFrame2 *iface)
1390 FIXME("iface %p stub!\n", iface);
1392 return D3DRMMATERIAL_FROMPARENT;
1395 static D3DRMMATERIALMODE WINAPI d3drm_frame1_GetMaterialMode(IDirect3DRMFrame *iface)
1397 FIXME("iface %p stub!\n", iface);
1399 return D3DRMMATERIAL_FROMPARENT;
1402 static HRESULT WINAPI d3drm_frame3_GetParent(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **parent)
1404 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1406 TRACE("iface %p, parent %p.\n", iface, parent);
1408 if (!parent)
1409 return D3DRMERR_BADVALUE;
1411 if (frame->parent)
1413 *parent = &frame->parent->IDirect3DRMFrame3_iface;
1414 IDirect3DRMFrame_AddRef(*parent);
1416 else
1418 *parent = NULL;
1421 return D3DRM_OK;
1424 static HRESULT WINAPI d3drm_frame2_GetParent(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **parent)
1426 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1428 TRACE("iface %p, parent %p.\n", iface, parent);
1430 if (!parent)
1431 return D3DRMERR_BADVALUE;
1433 if (frame->parent)
1435 *parent = &frame->parent->IDirect3DRMFrame_iface;
1436 IDirect3DRMFrame_AddRef(*parent);
1438 else
1440 *parent = NULL;
1443 return D3DRM_OK;
1446 static HRESULT WINAPI d3drm_frame1_GetParent(IDirect3DRMFrame *iface, IDirect3DRMFrame **parent)
1448 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1450 TRACE("iface %p, parent %p.\n", iface, parent);
1452 return d3drm_frame2_GetParent(&frame->IDirect3DRMFrame2_iface, parent);
1455 static HRESULT WINAPI d3drm_frame3_GetPosition(IDirect3DRMFrame3 *iface,
1456 IDirect3DRMFrame3 *reference, D3DVECTOR *position)
1458 FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position);
1460 return E_NOTIMPL;
1463 static HRESULT WINAPI d3drm_frame2_GetPosition(IDirect3DRMFrame2 *iface,
1464 IDirect3DRMFrame *reference, D3DVECTOR *position)
1466 FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position);
1468 return E_NOTIMPL;
1471 static HRESULT WINAPI d3drm_frame1_GetPosition(IDirect3DRMFrame *iface,
1472 IDirect3DRMFrame *reference, D3DVECTOR *position)
1474 FIXME("iface %p, reference %p, position %p stub!\n", iface, reference, position);
1476 return E_NOTIMPL;
1480 static HRESULT WINAPI d3drm_frame3_GetRotation(IDirect3DRMFrame3 *iface,
1481 IDirect3DRMFrame3 *reference, D3DVECTOR *axis, D3DVALUE *theta)
1483 FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta);
1485 return E_NOTIMPL;
1488 static HRESULT WINAPI d3drm_frame2_GetRotation(IDirect3DRMFrame2 *iface,
1489 IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *theta)
1491 FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta);
1493 return E_NOTIMPL;
1496 static HRESULT WINAPI d3drm_frame1_GetRotation(IDirect3DRMFrame *iface,
1497 IDirect3DRMFrame *reference, D3DVECTOR *axis, D3DVALUE *theta)
1499 FIXME("iface %p, reference %p, axis %p, theta %p stub!\n", iface, reference, axis, theta);
1501 return E_NOTIMPL;
1504 static HRESULT WINAPI d3drm_frame3_GetScene(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 **scene)
1506 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1508 TRACE("iface %p, scene %p.\n", iface, scene);
1510 if (!scene)
1511 return D3DRMERR_BADVALUE;
1513 while (frame->parent)
1514 frame = frame->parent;
1516 *scene = &frame->IDirect3DRMFrame3_iface;
1517 IDirect3DRMFrame3_AddRef(*scene);
1519 return D3DRM_OK;
1522 static HRESULT WINAPI d3drm_frame2_GetScene(IDirect3DRMFrame2 *iface, IDirect3DRMFrame **scene)
1524 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1525 IDirect3DRMFrame3 *frame3;
1526 HRESULT hr;
1528 TRACE("iface %p, scene %p.\n", iface, scene);
1530 if (!scene)
1531 return D3DRMERR_BADVALUE;
1533 hr = IDirect3DRMFrame3_GetScene(&frame->IDirect3DRMFrame3_iface, &frame3);
1534 if (FAILED(hr) || !frame3)
1536 *scene = NULL;
1537 return hr;
1540 hr = IDirect3DRMFrame3_QueryInterface(frame3, &IID_IDirect3DRMFrame, (void **)scene);
1541 IDirect3DRMFrame3_Release(frame3);
1543 return hr;
1546 static HRESULT WINAPI d3drm_frame1_GetScene(IDirect3DRMFrame *iface, IDirect3DRMFrame **scene)
1548 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1550 TRACE("iface %p, scene %p.\n", iface, scene);
1552 return d3drm_frame2_GetScene(&frame->IDirect3DRMFrame2_iface, scene);
1555 static D3DRMSORTMODE WINAPI d3drm_frame3_GetSortMode(IDirect3DRMFrame3 *iface)
1557 FIXME("iface %p stub!\n", iface);
1559 return D3DRMSORT_FROMPARENT;
1562 static D3DRMSORTMODE WINAPI d3drm_frame2_GetSortMode(IDirect3DRMFrame2 *iface)
1564 FIXME("iface %p stub!\n", iface);
1566 return D3DRMSORT_FROMPARENT;
1569 static D3DRMSORTMODE WINAPI d3drm_frame1_GetSortMode(IDirect3DRMFrame *iface)
1571 FIXME("iface %p stub!\n", iface);
1573 return D3DRMSORT_FROMPARENT;
1576 static HRESULT WINAPI d3drm_frame3_GetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 **texture)
1578 FIXME("iface %p, texture %p stub!\n", iface, texture);
1580 return E_NOTIMPL;
1583 static HRESULT WINAPI d3drm_frame2_GetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture **texture)
1585 FIXME("iface %p, texture %p stub!\n", iface, texture);
1587 return E_NOTIMPL;
1590 static HRESULT WINAPI d3drm_frame1_GetTexture(IDirect3DRMFrame *iface, IDirect3DRMTexture **texture)
1592 FIXME("iface %p, texture %p stub!\n", iface, texture);
1594 return E_NOTIMPL;
1597 static HRESULT WINAPI d3drm_frame3_GetTransform(IDirect3DRMFrame3 *iface,
1598 IDirect3DRMFrame3 *reference, D3DRMMATRIX4D matrix)
1600 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1601 struct d3drm_matrix *m = d3drm_matrix(matrix);
1603 TRACE("iface %p, reference %p, matrix %p.\n", iface, reference, matrix);
1605 if (reference)
1606 FIXME("Ignoring reference frame %p.\n", reference);
1608 *m = frame->transform;
1610 return D3DRM_OK;
1613 static HRESULT WINAPI d3drm_frame2_GetTransform(IDirect3DRMFrame2 *iface, D3DRMMATRIX4D matrix)
1615 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1616 struct d3drm_matrix *m = d3drm_matrix(matrix);
1618 TRACE("iface %p, matrix %p.\n", iface, matrix);
1620 *m = frame->transform;
1622 return D3DRM_OK;
1625 static HRESULT WINAPI d3drm_frame1_GetTransform(IDirect3DRMFrame *iface, D3DRMMATRIX4D matrix)
1627 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1629 TRACE("iface %p, matrix %p.\n", iface, matrix);
1631 return d3drm_frame2_GetTransform(&frame->IDirect3DRMFrame2_iface, matrix);
1634 static HRESULT WINAPI d3drm_frame3_GetVelocity(IDirect3DRMFrame3 *iface,
1635 IDirect3DRMFrame3 *reference, D3DVECTOR *velocity, BOOL with_rotation)
1637 FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n",
1638 iface, reference, velocity, with_rotation);
1640 return E_NOTIMPL;
1643 static HRESULT WINAPI d3drm_frame2_GetVelocity(IDirect3DRMFrame2 *iface,
1644 IDirect3DRMFrame *reference, D3DVECTOR *velocity, BOOL with_rotation)
1646 FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n",
1647 iface, reference, velocity, with_rotation);
1649 return E_NOTIMPL;
1652 static HRESULT WINAPI d3drm_frame1_GetVelocity(IDirect3DRMFrame *iface,
1653 IDirect3DRMFrame *reference, D3DVECTOR *velocity, BOOL with_rotation)
1655 FIXME("iface %p, reference %p, velocity %p, with_rotation %#x stub!\n",
1656 iface, reference, velocity, with_rotation);
1658 return E_NOTIMPL;
1661 static HRESULT WINAPI d3drm_frame3_GetOrientation(IDirect3DRMFrame3 *iface,
1662 IDirect3DRMFrame3 *reference, D3DVECTOR *dir, D3DVECTOR *up)
1664 FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up);
1666 return E_NOTIMPL;
1669 static HRESULT WINAPI d3drm_frame2_GetOrientation(IDirect3DRMFrame2 *iface,
1670 IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up)
1672 FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up);
1674 return E_NOTIMPL;
1677 static HRESULT WINAPI d3drm_frame1_GetOrientation(IDirect3DRMFrame *iface,
1678 IDirect3DRMFrame *reference, D3DVECTOR *dir, D3DVECTOR *up)
1680 FIXME("iface %p, reference %p, dir %p, up %p stub!\n", iface, reference, dir, up);
1682 return E_NOTIMPL;
1685 static HRESULT WINAPI d3drm_frame3_GetVisuals(IDirect3DRMFrame3 *iface, DWORD *count, IUnknown **visuals)
1687 FIXME("iface %p, count %p, visuals %p stub!\n", iface, count, visuals);
1689 return E_NOTIMPL;
1692 static HRESULT WINAPI d3drm_frame2_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3DRMVisualArray **visuals)
1694 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1695 struct d3drm_visual_array *array;
1697 TRACE("iface %p, visuals %p.\n", iface, visuals);
1699 if (!visuals)
1700 return D3DRMERR_BADVALUE;
1702 if (!(array = d3drm_visual_array_create(frame->nb_visuals, frame->visuals)))
1703 return E_OUTOFMEMORY;
1705 *visuals = &array->IDirect3DRMVisualArray_iface;
1707 return D3DRM_OK;
1710 static HRESULT WINAPI d3drm_frame1_GetVisuals(IDirect3DRMFrame *iface, IDirect3DRMVisualArray **visuals)
1712 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1714 TRACE("iface %p, visuals %p.\n", iface, visuals);
1716 return d3drm_frame2_GetVisuals(&frame->IDirect3DRMFrame2_iface, visuals);
1719 static HRESULT WINAPI d3drm_frame2_GetTextureTopology(IDirect3DRMFrame2 *iface, BOOL *wrap_u, BOOL *wrap_v)
1721 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
1723 return E_NOTIMPL;
1726 static HRESULT WINAPI d3drm_frame1_GetTextureTopology(IDirect3DRMFrame *iface, BOOL *wrap_u, BOOL *wrap_v)
1728 FIXME("iface %p, wrap_u %p, wrap_v %p stub!\n", iface, wrap_u, wrap_v);
1730 return E_NOTIMPL;
1733 static HRESULT WINAPI d3drm_frame3_InverseTransform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s)
1735 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1737 return E_NOTIMPL;
1740 static HRESULT WINAPI d3drm_frame2_InverseTransform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s)
1742 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1744 return E_NOTIMPL;
1747 static HRESULT WINAPI d3drm_frame1_InverseTransform(IDirect3DRMFrame *iface, D3DVECTOR *d, D3DVECTOR *s)
1749 FIXME("iface %p, d %p, s %p stub!\n", iface, d, s);
1751 return E_NOTIMPL;
1754 static HRESULT WINAPI d3drm_frame3_Load(IDirect3DRMFrame3 *iface, void *filename,
1755 void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURE3CALLBACK cb, void *ctx)
1757 FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n",
1758 iface, filename, name, flags, cb, ctx);
1760 return E_NOTIMPL;
1763 static HRESULT WINAPI d3drm_frame2_Load(IDirect3DRMFrame2 *iface, void *filename,
1764 void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx)
1766 FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n",
1767 iface, filename, name, flags, cb, ctx);
1769 return E_NOTIMPL;
1772 static HRESULT WINAPI d3drm_frame1_Load(IDirect3DRMFrame *iface, void *filename,
1773 void *name, D3DRMLOADOPTIONS flags, D3DRMLOADTEXTURECALLBACK cb, void *ctx)
1775 FIXME("iface %p, filename %p, name %p, flags %#lx, cb %p, ctx %p stub!\n",
1776 iface, filename, name, flags, cb, ctx);
1778 return E_NOTIMPL;
1781 static HRESULT WINAPI d3drm_frame3_LookAt(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *target,
1782 IDirect3DRMFrame3 *reference, D3DRMFRAMECONSTRAINT constraint)
1784 FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint);
1786 return E_NOTIMPL;
1789 static HRESULT WINAPI d3drm_frame2_LookAt(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *target,
1790 IDirect3DRMFrame *reference, D3DRMFRAMECONSTRAINT constraint)
1792 FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint);
1794 return E_NOTIMPL;
1797 static HRESULT WINAPI d3drm_frame1_LookAt(IDirect3DRMFrame *iface, IDirect3DRMFrame *target,
1798 IDirect3DRMFrame *reference, D3DRMFRAMECONSTRAINT constraint)
1800 FIXME("iface %p, target %p, reference %p, constraint %#x stub!\n", iface, target, reference, constraint);
1802 return E_NOTIMPL;
1805 static HRESULT WINAPI d3drm_frame3_Move(IDirect3DRMFrame3 *iface, D3DVALUE delta)
1807 FIXME("iface %p, delta %.8e stub!\n", iface, delta);
1809 return E_NOTIMPL;
1812 static HRESULT WINAPI d3drm_frame2_Move(IDirect3DRMFrame2 *iface, D3DVALUE delta)
1814 FIXME("iface %p, delta %.8e stub!\n", iface, delta);
1816 return E_NOTIMPL;
1819 static HRESULT WINAPI d3drm_frame1_Move(IDirect3DRMFrame *iface, D3DVALUE delta)
1821 FIXME("iface %p, delta %.8e stub!\n", iface, delta);
1823 return E_NOTIMPL;
1826 static HRESULT WINAPI d3drm_frame3_DeleteChild(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *child)
1828 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1829 struct d3drm_frame *child_impl = unsafe_impl_from_IDirect3DRMFrame3(child);
1830 ULONG i;
1832 TRACE("iface %p, child %p.\n", iface, child);
1834 if (!child_impl)
1835 return D3DRMERR_BADOBJECT;
1837 /* Check if child exists */
1838 for (i = 0; i < frame->nb_children; ++i)
1840 if (frame->children[i] == child)
1841 break;
1844 if (i == frame->nb_children)
1845 return D3DRMERR_BADVALUE;
1847 memmove(frame->children + i, frame->children + i + 1, sizeof(*frame->children) * (frame->nb_children - 1 - i));
1848 IDirect3DRMFrame3_Release(child);
1849 child_impl->parent = NULL;
1850 --frame->nb_children;
1852 return D3DRM_OK;
1855 static HRESULT WINAPI d3drm_frame2_DeleteChild(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *child)
1857 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1858 IDirect3DRMFrame3 *child3;
1859 HRESULT hr;
1861 TRACE("iface %p, child %p.\n", iface, child);
1863 if (!child)
1864 return D3DRMERR_BADOBJECT;
1865 if (FAILED(hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3)))
1866 return D3DRMERR_BADOBJECT;
1867 IDirect3DRMFrame_Release(child);
1869 return d3drm_frame3_DeleteChild(&frame->IDirect3DRMFrame3_iface, child3);
1872 static HRESULT WINAPI d3drm_frame1_DeleteChild(IDirect3DRMFrame *iface, IDirect3DRMFrame *child)
1874 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1875 struct d3drm_frame *child_frame = unsafe_impl_from_IDirect3DRMFrame(child);
1877 TRACE("iface %p, child %p.\n", iface, child);
1879 if (!child_frame)
1880 return D3DRMERR_BADOBJECT;
1882 return d3drm_frame3_DeleteChild(&frame->IDirect3DRMFrame3_iface, &child_frame->IDirect3DRMFrame3_iface);
1885 static HRESULT WINAPI d3drm_frame3_DeleteLight(IDirect3DRMFrame3 *iface, IDirect3DRMLight *light)
1887 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1888 ULONG i;
1890 TRACE("iface %p, light %p.\n", iface, light);
1892 if (!light)
1893 return D3DRMERR_BADOBJECT;
1895 /* Check if visual exists */
1896 for (i = 0; i < frame->nb_lights; ++i)
1898 if (frame->lights[i] == light)
1899 break;
1902 if (i == frame->nb_lights)
1903 return D3DRMERR_BADVALUE;
1905 memmove(frame->lights + i, frame->lights + i + 1, sizeof(*frame->lights) * (frame->nb_lights - 1 - i));
1906 IDirect3DRMLight_Release(light);
1907 --frame->nb_lights;
1909 return D3DRM_OK;
1912 static HRESULT WINAPI d3drm_frame2_DeleteLight(IDirect3DRMFrame2 *iface, IDirect3DRMLight *light)
1914 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1916 TRACE("iface %p, light %p.\n", iface, light);
1918 return d3drm_frame3_DeleteLight(&frame->IDirect3DRMFrame3_iface, light);
1921 static HRESULT WINAPI d3drm_frame1_DeleteLight(IDirect3DRMFrame *iface, IDirect3DRMLight *light)
1923 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1925 TRACE("iface %p, light %p.\n", iface, light);
1927 return d3drm_frame3_DeleteLight(&frame->IDirect3DRMFrame3_iface, light);
1930 static HRESULT WINAPI d3drm_frame3_DeleteMoveCallback(IDirect3DRMFrame3 *iface,
1931 D3DRMFRAME3MOVECALLBACK cb, void *ctx)
1933 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1935 return E_NOTIMPL;
1938 static HRESULT WINAPI d3drm_frame2_DeleteMoveCallback(IDirect3DRMFrame2 *iface,
1939 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
1941 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1943 return E_NOTIMPL;
1946 static HRESULT WINAPI d3drm_frame1_DeleteMoveCallback(IDirect3DRMFrame *iface,
1947 D3DRMFRAMEMOVECALLBACK cb, void *ctx)
1949 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
1951 return E_NOTIMPL;
1954 static HRESULT WINAPI d3drm_frame3_DeleteVisual(IDirect3DRMFrame3 *iface, IUnknown *visual)
1956 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
1957 ULONG i;
1959 TRACE("iface %p, visual %p.\n", iface, visual);
1961 if (!visual)
1962 return D3DRMERR_BADOBJECT;
1964 /* Check if visual exists */
1965 for (i = 0; i < frame->nb_visuals; ++i)
1967 if (frame->visuals[i] == (IDirect3DRMVisual *)visual)
1968 break;
1971 if (i == frame->nb_visuals)
1972 return D3DRMERR_BADVALUE;
1974 memmove(frame->visuals + i, frame->visuals + i + 1, sizeof(*frame->visuals) * (frame->nb_visuals - 1 - i));
1975 IDirect3DRMVisual_Release(visual);
1976 --frame->nb_visuals;
1978 return D3DRM_OK;
1981 static HRESULT WINAPI d3drm_frame2_DeleteVisual(IDirect3DRMFrame2 *iface, IDirect3DRMVisual *visual)
1983 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
1985 TRACE("iface %p, visual %p.\n", iface, visual);
1987 return d3drm_frame3_DeleteVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
1990 static HRESULT WINAPI d3drm_frame1_DeleteVisual(IDirect3DRMFrame *iface, IDirect3DRMVisual *visual)
1992 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
1994 TRACE("iface %p, visual %p.\n", iface, visual);
1996 return d3drm_frame3_DeleteVisual(&frame->IDirect3DRMFrame3_iface, (IUnknown *)visual);
1999 static D3DCOLOR WINAPI d3drm_frame3_GetSceneBackground(IDirect3DRMFrame3 *iface)
2001 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2003 TRACE("iface %p.\n", iface);
2005 return frame->scenebackground;
2008 static D3DCOLOR WINAPI d3drm_frame2_GetSceneBackground(IDirect3DRMFrame2 *iface)
2010 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
2012 TRACE("iface %p.\n", iface);
2014 return d3drm_frame3_GetSceneBackground(&frame->IDirect3DRMFrame3_iface);
2017 static D3DCOLOR WINAPI d3drm_frame1_GetSceneBackground(IDirect3DRMFrame *iface)
2019 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
2021 TRACE("iface %p.\n", iface);
2023 return d3drm_frame3_GetSceneBackground(&frame->IDirect3DRMFrame3_iface);
2026 static HRESULT WINAPI d3drm_frame3_GetSceneBackgroundDepth(IDirect3DRMFrame3 *iface,
2027 IDirectDrawSurface **surface)
2029 FIXME("iface %p, surface %p stub!\n", iface, surface);
2031 return E_NOTIMPL;
2034 static HRESULT WINAPI d3drm_frame2_GetSceneBackgroundDepth(IDirect3DRMFrame2 *iface,
2035 IDirectDrawSurface **surface)
2037 FIXME("iface %p, surface %p stub!\n", iface, surface);
2039 return E_NOTIMPL;
2042 static HRESULT WINAPI d3drm_frame1_GetSceneBackgroundDepth(IDirect3DRMFrame *iface,
2043 IDirectDrawSurface **surface)
2045 FIXME("iface %p, surface %p stub!\n", iface, surface);
2047 return E_NOTIMPL;
2050 static D3DCOLOR WINAPI d3drm_frame3_GetSceneFogColor(IDirect3DRMFrame3 *iface)
2052 FIXME("iface %p stub!\n", iface);
2054 return 0;
2057 static D3DCOLOR WINAPI d3drm_frame2_GetSceneFogColor(IDirect3DRMFrame2 *iface)
2059 FIXME("iface %p stub!\n", iface);
2061 return 0;
2064 static D3DCOLOR WINAPI d3drm_frame1_GetSceneFogColor(IDirect3DRMFrame *iface)
2066 FIXME("iface %p stub!\n", iface);
2068 return 0;
2071 static BOOL WINAPI d3drm_frame3_GetSceneFogEnable(IDirect3DRMFrame3 *iface)
2073 FIXME("iface %p stub!\n", iface);
2075 return FALSE;
2078 static BOOL WINAPI d3drm_frame2_GetSceneFogEnable(IDirect3DRMFrame2 *iface)
2080 FIXME("iface %p stub!\n", iface);
2082 return FALSE;
2085 static BOOL WINAPI d3drm_frame1_GetSceneFogEnable(IDirect3DRMFrame *iface)
2087 FIXME("iface %p stub!\n", iface);
2089 return FALSE;
2092 static D3DRMFOGMODE WINAPI d3drm_frame3_GetSceneFogMode(IDirect3DRMFrame3 *iface)
2094 FIXME("iface %p stub!\n", iface);
2096 return D3DRMFOG_LINEAR;
2099 static D3DRMFOGMODE WINAPI d3drm_frame2_GetSceneFogMode(IDirect3DRMFrame2 *iface)
2101 FIXME("iface %p stub!\n", iface);
2103 return D3DRMFOG_LINEAR;
2106 static D3DRMFOGMODE WINAPI d3drm_frame1_GetSceneFogMode(IDirect3DRMFrame *iface)
2108 FIXME("iface %p stub!\n", iface);
2110 return D3DRMFOG_LINEAR;
2113 static HRESULT WINAPI d3drm_frame3_GetSceneFogParams(IDirect3DRMFrame3 *iface,
2114 D3DVALUE *start, D3DVALUE *end, D3DVALUE *density)
2116 FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density);
2118 return E_NOTIMPL;
2121 static HRESULT WINAPI d3drm_frame2_GetSceneFogParams(IDirect3DRMFrame2 *iface,
2122 D3DVALUE *start, D3DVALUE *end, D3DVALUE *density)
2124 FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density);
2126 return E_NOTIMPL;
2129 static HRESULT WINAPI d3drm_frame1_GetSceneFogParams(IDirect3DRMFrame *iface,
2130 D3DVALUE *start, D3DVALUE *end, D3DVALUE *density)
2132 FIXME("iface %p, start %p, end %p, density %p stub!\n", iface, start, end, density);
2134 return E_NOTIMPL;
2137 static HRESULT WINAPI d3drm_frame3_SetSceneBackground(IDirect3DRMFrame3 *iface, D3DCOLOR color)
2139 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2141 TRACE("iface %p, color 0x%08lx.\n", iface, color);
2143 frame->scenebackground = color;
2145 return D3DRM_OK;
2148 static HRESULT WINAPI d3drm_frame2_SetSceneBackground(IDirect3DRMFrame2 *iface, D3DCOLOR color)
2150 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
2152 TRACE("iface %p, color 0x%08lx.\n", iface, color);
2154 return d3drm_frame3_SetSceneBackground(&frame->IDirect3DRMFrame3_iface, color);
2157 static HRESULT WINAPI d3drm_frame1_SetSceneBackground(IDirect3DRMFrame *iface, D3DCOLOR color)
2159 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
2161 TRACE("iface %p, color 0x%08lx.\n", iface, color);
2163 return d3drm_frame3_SetSceneBackground(&frame->IDirect3DRMFrame3_iface, color);
2166 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundRGB(IDirect3DRMFrame3 *iface,
2167 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2169 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2171 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
2173 d3drm_set_color(&frame->scenebackground, red, green, blue, 1.0f);
2175 return D3DRM_OK;
2178 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundRGB(IDirect3DRMFrame2 *iface,
2179 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2181 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
2183 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
2185 return d3drm_frame3_SetSceneBackgroundRGB(&frame->IDirect3DRMFrame3_iface, red, green, blue);
2188 static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundRGB(IDirect3DRMFrame *iface,
2189 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2191 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
2193 TRACE("iface %p, red %.8e, green %.8e, blue %.8e.\n", iface, red, green, blue);
2195 return d3drm_frame3_SetSceneBackgroundRGB(&frame->IDirect3DRMFrame3_iface, red, green, blue);
2198 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundDepth(IDirect3DRMFrame3 *iface,
2199 IDirectDrawSurface *surface)
2201 FIXME("iface %p, surface %p stub!\n", iface, surface);
2203 return E_NOTIMPL;
2206 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundDepth(IDirect3DRMFrame2 *iface,
2207 IDirectDrawSurface *surface)
2209 FIXME("iface %p, surface %p stub!\n", iface, surface);
2211 return E_NOTIMPL;
2214 static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundDepth(IDirect3DRMFrame *iface,
2215 IDirectDrawSurface *surface)
2217 FIXME("iface %p, surface %p stub!\n", iface, surface);
2219 return E_NOTIMPL;
2222 static HRESULT WINAPI d3drm_frame3_SetSceneBackgroundImage(IDirect3DRMFrame3 *iface,
2223 IDirect3DRMTexture3 *texture)
2225 FIXME("iface %p, texture %p stub!\n", iface, texture);
2227 return E_NOTIMPL;
2230 static HRESULT WINAPI d3drm_frame2_SetSceneBackgroundImage(IDirect3DRMFrame2 *iface,
2231 IDirect3DRMTexture *texture)
2233 FIXME("iface %p, texture %p stub!\n", iface, texture);
2235 return E_NOTIMPL;
2238 static HRESULT WINAPI d3drm_frame1_SetSceneBackgroundImage(IDirect3DRMFrame *iface,
2239 IDirect3DRMTexture *texture)
2241 FIXME("iface %p, texture %p stub!\n", iface, texture);
2243 return E_NOTIMPL;
2246 static HRESULT WINAPI d3drm_frame3_SetSceneFogEnable(IDirect3DRMFrame3 *iface, BOOL enable)
2248 FIXME("iface %p, enable %#x stub!\n", iface, enable);
2250 return E_NOTIMPL;
2253 static HRESULT WINAPI d3drm_frame2_SetSceneFogEnable(IDirect3DRMFrame2 *iface, BOOL enable)
2255 FIXME("iface %p, enable %#x stub!\n", iface, enable);
2257 return E_NOTIMPL;
2260 static HRESULT WINAPI d3drm_frame1_SetSceneFogEnable(IDirect3DRMFrame *iface, BOOL enable)
2262 FIXME("iface %p, enable %#x stub!\n", iface, enable);
2264 return E_NOTIMPL;
2267 static HRESULT WINAPI d3drm_frame3_SetSceneFogColor(IDirect3DRMFrame3 *iface, D3DCOLOR color)
2269 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2271 return E_NOTIMPL;
2274 static HRESULT WINAPI d3drm_frame2_SetSceneFogColor(IDirect3DRMFrame2 *iface, D3DCOLOR color)
2276 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2278 return E_NOTIMPL;
2281 static HRESULT WINAPI d3drm_frame1_SetSceneFogColor(IDirect3DRMFrame *iface, D3DCOLOR color)
2283 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2285 return E_NOTIMPL;
2288 static HRESULT WINAPI d3drm_frame3_SetSceneFogMode(IDirect3DRMFrame3 *iface, D3DRMFOGMODE mode)
2290 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2292 return E_NOTIMPL;
2295 static HRESULT WINAPI d3drm_frame2_SetSceneFogMode(IDirect3DRMFrame2 *iface, D3DRMFOGMODE mode)
2297 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2299 return E_NOTIMPL;
2302 static HRESULT WINAPI d3drm_frame1_SetSceneFogMode(IDirect3DRMFrame *iface, D3DRMFOGMODE mode)
2304 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2306 return E_NOTIMPL;
2309 static HRESULT WINAPI d3drm_frame3_SetSceneFogParams(IDirect3DRMFrame3 *iface,
2310 D3DVALUE start, D3DVALUE end, D3DVALUE density)
2312 FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density);
2314 return E_NOTIMPL;
2317 static HRESULT WINAPI d3drm_frame2_SetSceneFogParams(IDirect3DRMFrame2 *iface,
2318 D3DVALUE start, D3DVALUE end, D3DVALUE density)
2320 FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density);
2322 return E_NOTIMPL;
2325 static HRESULT WINAPI d3drm_frame1_SetSceneFogParams(IDirect3DRMFrame *iface,
2326 D3DVALUE start, D3DVALUE end, D3DVALUE density)
2328 FIXME("iface %p, start %.8e, end %.8e, density %.8e stub!\n", iface, start, end, density);
2330 return E_NOTIMPL;
2333 static HRESULT WINAPI d3drm_frame3_SetColor(IDirect3DRMFrame3 *iface, D3DCOLOR color)
2335 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2337 return E_NOTIMPL;
2340 static HRESULT WINAPI d3drm_frame2_SetColor(IDirect3DRMFrame2 *iface, D3DCOLOR color)
2342 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2344 return E_NOTIMPL;
2347 static HRESULT WINAPI d3drm_frame1_SetColor(IDirect3DRMFrame *iface, D3DCOLOR color)
2349 FIXME("iface %p, color 0x%08lx stub!\n", iface, color);
2351 return E_NOTIMPL;
2354 static HRESULT WINAPI d3drm_frame3_SetColorRGB(IDirect3DRMFrame3 *iface,
2355 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2357 FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
2359 return E_NOTIMPL;
2362 static HRESULT WINAPI d3drm_frame2_SetColorRGB(IDirect3DRMFrame2 *iface,
2363 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2365 FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
2367 return E_NOTIMPL;
2370 static HRESULT WINAPI d3drm_frame1_SetColorRGB(IDirect3DRMFrame *iface,
2371 D3DVALUE red, D3DVALUE green, D3DVALUE blue)
2373 FIXME("iface %p, red %.8e, green %.8e, blue %.8e stub!\n", iface, red, green, blue);
2375 return E_NOTIMPL;
2378 static D3DRMZBUFFERMODE WINAPI d3drm_frame3_GetZbufferMode(IDirect3DRMFrame3 *iface)
2380 FIXME("iface %p stub!\n", iface);
2382 return D3DRMZBUFFER_FROMPARENT;
2385 static D3DRMZBUFFERMODE WINAPI d3drm_frame2_GetZbufferMode(IDirect3DRMFrame2 *iface)
2387 FIXME("iface %p stub!\n", iface);
2389 return D3DRMZBUFFER_FROMPARENT;
2392 static D3DRMZBUFFERMODE WINAPI d3drm_frame1_GetZbufferMode(IDirect3DRMFrame *iface)
2394 FIXME("iface %p stub!\n", iface);
2396 return D3DRMZBUFFER_FROMPARENT;
2399 static HRESULT WINAPI d3drm_frame3_SetMaterialMode(IDirect3DRMFrame3 *iface, D3DRMMATERIALMODE mode)
2401 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2403 return E_NOTIMPL;
2406 static HRESULT WINAPI d3drm_frame2_SetMaterialMode(IDirect3DRMFrame2 *iface, D3DRMMATERIALMODE mode)
2408 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2410 return E_NOTIMPL;
2413 static HRESULT WINAPI d3drm_frame1_SetMaterialMode(IDirect3DRMFrame *iface, D3DRMMATERIALMODE mode)
2415 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2417 return E_NOTIMPL;
2420 static HRESULT WINAPI d3drm_frame3_SetOrientation(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference,
2421 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2423 FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
2424 iface, reference, dx, dy, dz, ux, uy, uz);
2426 return E_NOTIMPL;
2429 static HRESULT WINAPI d3drm_frame2_SetOrientation(IDirect3DRMFrame2 *iface, IDirect3DRMFrame *reference,
2430 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2432 FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
2433 iface, reference, dx, dy, dz, ux, uy, uz);
2435 return E_NOTIMPL;
2438 static HRESULT WINAPI d3drm_frame1_SetOrientation(IDirect3DRMFrame *iface, IDirect3DRMFrame *reference,
2439 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2441 FIXME("iface %p, reference %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
2442 iface, reference, dx, dy, dz, ux, uy, uz);
2444 return E_NOTIMPL;
2447 static HRESULT WINAPI d3drm_frame3_SetPosition(IDirect3DRMFrame3 *iface,
2448 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z)
2450 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z);
2452 return E_NOTIMPL;
2455 static HRESULT WINAPI d3drm_frame2_SetPosition(IDirect3DRMFrame2 *iface,
2456 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z)
2458 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z);
2460 return E_NOTIMPL;
2463 static HRESULT WINAPI d3drm_frame1_SetPosition(IDirect3DRMFrame *iface,
2464 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z)
2466 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e stub!\n", iface, reference, x, y, z);
2468 return E_NOTIMPL;
2471 static HRESULT WINAPI d3drm_frame3_SetRotation(IDirect3DRMFrame3 *iface,
2472 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
2474 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
2475 iface, reference, x, y, z, theta);
2477 return E_NOTIMPL;
2480 static HRESULT WINAPI d3drm_frame2_SetRotation(IDirect3DRMFrame2 *iface,
2481 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
2483 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
2484 iface, reference, x, y, z, theta);
2486 return E_NOTIMPL;
2489 static HRESULT WINAPI d3drm_frame1_SetRotation(IDirect3DRMFrame *iface,
2490 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, D3DVALUE theta)
2492 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, theta %.8e stub!\n",
2493 iface, reference, x, y, z, theta);
2495 return E_NOTIMPL;
2498 static HRESULT WINAPI d3drm_frame3_SetSortMode(IDirect3DRMFrame3 *iface, D3DRMSORTMODE mode)
2500 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2502 return E_NOTIMPL;
2505 static HRESULT WINAPI d3drm_frame2_SetSortMode(IDirect3DRMFrame2 *iface, D3DRMSORTMODE mode)
2507 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2509 return E_NOTIMPL;
2512 static HRESULT WINAPI d3drm_frame1_SetSortMode(IDirect3DRMFrame *iface, D3DRMSORTMODE mode)
2514 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2516 return E_NOTIMPL;
2519 static HRESULT WINAPI d3drm_frame3_SetTexture(IDirect3DRMFrame3 *iface, IDirect3DRMTexture3 *texture)
2521 FIXME("iface %p, texture %p stub!\n", iface, texture);
2523 return E_NOTIMPL;
2526 static HRESULT WINAPI d3drm_frame2_SetTexture(IDirect3DRMFrame2 *iface, IDirect3DRMTexture *texture)
2528 FIXME("iface %p, texture %p stub!\n", iface, texture);
2530 return E_NOTIMPL;
2533 static HRESULT WINAPI d3drm_frame1_SetTexture(IDirect3DRMFrame *iface, IDirect3DRMTexture *texture)
2535 FIXME("iface %p, texture %p stub!\n", iface, texture);
2537 return E_NOTIMPL;
2540 static HRESULT WINAPI d3drm_frame2_SetTextureTopology(IDirect3DRMFrame2 *iface, BOOL wrap_u, BOOL wrap_v)
2542 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
2544 return E_NOTIMPL;
2547 static HRESULT WINAPI d3drm_frame1_SetTextureTopology(IDirect3DRMFrame *iface, BOOL wrap_u, BOOL wrap_v)
2549 FIXME("iface %p, wrap_u %#x, wrap_v %#x stub!\n", iface, wrap_u, wrap_v);
2551 return E_NOTIMPL;
2554 static HRESULT WINAPI d3drm_frame3_SetVelocity(IDirect3DRMFrame3 *iface,
2555 IDirect3DRMFrame3 *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation)
2557 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x.\n",
2558 iface, reference, x, y, z, with_rotation);
2560 return E_NOTIMPL;
2563 static HRESULT WINAPI d3drm_frame2_SetVelocity(IDirect3DRMFrame2 *iface,
2564 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation)
2566 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x stub!\n",
2567 iface, reference, x, y, z, with_rotation);
2569 return E_NOTIMPL;
2572 static HRESULT WINAPI d3drm_frame1_SetVelocity(IDirect3DRMFrame *iface,
2573 IDirect3DRMFrame *reference, D3DVALUE x, D3DVALUE y, D3DVALUE z, BOOL with_rotation)
2575 FIXME("iface %p, reference %p, x %.8e, y %.8e, z %.8e, with_rotation %#x stub!\n",
2576 iface, reference, x, y, z, with_rotation);
2578 return E_NOTIMPL;
2581 static HRESULT WINAPI d3drm_frame3_SetZbufferMode(IDirect3DRMFrame3 *iface, D3DRMZBUFFERMODE mode)
2583 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2585 return E_NOTIMPL;
2588 static HRESULT WINAPI d3drm_frame2_SetZbufferMode(IDirect3DRMFrame2 *iface, D3DRMZBUFFERMODE mode)
2590 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2592 return E_NOTIMPL;
2595 static HRESULT WINAPI d3drm_frame1_SetZbufferMode(IDirect3DRMFrame *iface, D3DRMZBUFFERMODE mode)
2597 FIXME("iface %p, mode %#x stub!\n", iface, mode);
2599 return E_NOTIMPL;
2602 static HRESULT WINAPI d3drm_frame3_Transform(IDirect3DRMFrame3 *iface, D3DVECTOR *d, D3DVECTOR *s)
2604 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2606 TRACE("iface %p, d %p, s %p.\n", iface, d, s);
2608 d3drm_vector_transform_affine(d, s, &frame->transform);
2609 while ((frame = frame->parent))
2611 d3drm_vector_transform_affine(d, d, &frame->transform);
2614 return D3DRM_OK;
2617 static HRESULT WINAPI d3drm_frame2_Transform(IDirect3DRMFrame2 *iface, D3DVECTOR *d, D3DVECTOR *s)
2619 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
2621 TRACE("iface %p, d %p, s %p.\n", iface, d, s);
2623 return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s);
2626 static HRESULT WINAPI d3drm_frame1_Transform(IDirect3DRMFrame *iface, D3DVECTOR *d, D3DVECTOR *s)
2628 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
2630 TRACE("iface %p, d %p, s %p.\n", iface, d, s);
2632 return d3drm_frame3_Transform(&frame->IDirect3DRMFrame3_iface, d, s);
2635 static HRESULT WINAPI d3drm_frame2_AddMoveCallback2(IDirect3DRMFrame2 *iface,
2636 D3DRMFRAMEMOVECALLBACK cb, void *ctx, DWORD flags)
2638 FIXME("iface %p, cb %p, ctx %p, flags %#lx stub!\n", iface, cb, ctx, flags);
2640 return E_NOTIMPL;
2643 static HRESULT WINAPI d3drm_frame3_GetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
2645 FIXME("iface %p, box %p stub!\n", iface, box);
2647 return E_NOTIMPL;
2650 static HRESULT WINAPI d3drm_frame2_GetBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box)
2652 FIXME("iface %p, box %p stub!\n", iface, box);
2654 return E_NOTIMPL;
2657 static BOOL WINAPI d3drm_frame3_GetBoxEnable(IDirect3DRMFrame3 *iface)
2659 FIXME("iface %p stub!\n", iface);
2661 return FALSE;
2664 static BOOL WINAPI d3drm_frame2_GetBoxEnable(IDirect3DRMFrame2 *iface)
2666 FIXME("iface %p stub!\n", iface);
2668 return FALSE;
2671 static HRESULT WINAPI d3drm_frame3_GetAxes(IDirect3DRMFrame3 *iface, D3DVECTOR *dir, D3DVECTOR *up)
2673 FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up);
2675 return E_NOTIMPL;
2678 static HRESULT WINAPI d3drm_frame2_GetAxes(IDirect3DRMFrame2 *iface, D3DVECTOR *dir, D3DVECTOR *up)
2680 FIXME("iface %p, dir %p, up %p stub!\n", iface, dir, up);
2682 return E_NOTIMPL;
2685 static HRESULT WINAPI d3drm_frame3_GetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 **material)
2687 FIXME("iface %p, material %p stub!\n", iface, material);
2689 return E_NOTIMPL;
2692 static HRESULT WINAPI d3drm_frame2_GetMaterial(IDirect3DRMFrame2 *iface, IDirect3DRMMaterial **material)
2694 FIXME("iface %p, material %p stub!\n", iface, material);
2696 return E_NOTIMPL;
2699 static BOOL WINAPI d3drm_frame3_GetInheritAxes(IDirect3DRMFrame3 *iface)
2701 FIXME("iface %p stub!\n", iface);
2703 return FALSE;
2706 static BOOL WINAPI d3drm_frame2_GetInheritAxes(IDirect3DRMFrame2 *iface)
2708 FIXME("iface %p stub!\n", iface);
2710 return FALSE;
2713 static HRESULT WINAPI d3drm_frame3_GetHierarchyBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
2715 FIXME("iface %p, box %p stub!\n", iface, box);
2717 return E_NOTIMPL;
2720 static HRESULT WINAPI d3drm_frame2_GetHierarchyBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box)
2722 FIXME("iface %p, box %p stub!\n", iface, box);
2724 return E_NOTIMPL;
2727 static HRESULT WINAPI d3drm_frame3_SetBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box)
2729 FIXME("iface %p, box %p stub!\n", iface, box);
2731 return E_NOTIMPL;
2734 static HRESULT WINAPI d3drm_frame3_SetBoxEnable(IDirect3DRMFrame3 *iface, BOOL enable)
2736 FIXME("iface %p, enable %#x stub!\n", iface, enable);
2738 return E_NOTIMPL;
2741 static HRESULT WINAPI d3drm_frame3_SetAxes(IDirect3DRMFrame3 *iface,
2742 D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz)
2744 FIXME("iface %p, dx %.8e, dy %.8e, dz %.8e, ux %.8e, uy %.8e, uz %.8e stub!\n",
2745 iface, dx, dy, dz, ux, uy, uz);
2747 return E_NOTIMPL;
2750 static HRESULT WINAPI d3drm_frame3_SetInheritAxes(IDirect3DRMFrame3 *iface, BOOL inherit)
2752 FIXME("iface %p, inherit %#x stub!\n", iface, inherit);
2754 return E_NOTIMPL;
2757 static HRESULT WINAPI d3drm_frame3_SetMaterial(IDirect3DRMFrame3 *iface, IDirect3DRMMaterial2 *material)
2759 FIXME("iface %p, material %p stub!\n", iface, material);
2761 return E_NOTIMPL;
2764 static HRESULT WINAPI d3drm_frame3_SetQuaternion(IDirect3DRMFrame3 *iface,
2765 IDirect3DRMFrame3 *reference, D3DRMQUATERNION *q)
2767 FIXME("iface %p, reference %p, q %p stub!\n", iface, reference, q);
2769 return E_NOTIMPL;
2772 static HRESULT WINAPI d3drm_frame3_RayPick(IDirect3DRMFrame3 *iface, IDirect3DRMFrame3 *reference,
2773 D3DRMRAY *ray, DWORD flags, IDirect3DRMPicked2Array **visuals)
2775 FIXME("iface %p, reference %p, ray %p, flags %#lx, visuals %p stub!\n",
2776 iface, reference, ray, flags, visuals);
2778 return E_NOTIMPL;
2781 static HRESULT WINAPI d3drm_frame3_Save(IDirect3DRMFrame3 *iface,
2782 const char *filename, D3DRMXOFFORMAT format, D3DRMSAVEOPTIONS flags)
2784 FIXME("iface %p, filename %s, format %#x, flags %#lx stub!\n",
2785 iface, debugstr_a(filename), format, flags);
2787 return E_NOTIMPL;
2790 static HRESULT WINAPI d3drm_frame3_TransformVectors(IDirect3DRMFrame3 *iface,
2791 IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src)
2793 FIXME("iface %p, reference %p, num %lu, dst %p, src %p stub!\n", iface, reference, num, dst, src);
2795 return E_NOTIMPL;
2798 static HRESULT WINAPI d3drm_frame3_InverseTransformVectors(IDirect3DRMFrame3 *iface,
2799 IDirect3DRMFrame3 *reference, DWORD num, D3DVECTOR *dst, D3DVECTOR *src)
2801 FIXME("iface %p, reference %p, num %lu, dst %p, src %p stub!\n", iface, reference, num, dst, src);
2803 return E_NOTIMPL;
2806 static HRESULT WINAPI d3drm_frame3_SetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD options)
2808 static const DWORD supported_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE;
2809 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2811 TRACE("iface %p, options %#lx.\n", iface, options);
2813 if (options & ~supported_options)
2814 return D3DRMERR_BADVALUE;
2816 frame->traversal_options = options;
2818 return D3DRM_OK;
2821 static HRESULT WINAPI d3drm_frame3_GetTraversalOptions(IDirect3DRMFrame3 *iface, DWORD *options)
2823 struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
2825 TRACE("iface %p, options %p.\n", iface, options);
2827 if (!options)
2828 return D3DRMERR_BADVALUE;
2830 *options = frame->traversal_options;
2832 return D3DRM_OK;
2835 static HRESULT WINAPI d3drm_frame3_SetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD flags)
2837 FIXME("iface %p, flags %#lx stub!\n", iface, flags);
2839 return E_NOTIMPL;
2842 static HRESULT WINAPI d3drm_frame3_GetSceneFogMethod(IDirect3DRMFrame3 *iface, DWORD *fog_mode)
2844 FIXME("iface %p, fog_mode %p stub!\n", iface, fog_mode);
2846 return E_NOTIMPL;
2849 static HRESULT WINAPI d3drm_frame3_SetMaterialOverride(IDirect3DRMFrame3 *iface,
2850 D3DRMMATERIALOVERRIDE *override)
2852 FIXME("iface %p, override %p stub!\n", iface, override);
2854 return E_NOTIMPL;
2857 static HRESULT WINAPI d3drm_frame3_GetMaterialOverride(IDirect3DRMFrame3 *iface,
2858 D3DRMMATERIALOVERRIDE *override)
2860 FIXME("iface %p, override %p stub!\n", iface, override);
2862 return E_NOTIMPL;
2865 static const struct IDirect3DRMFrame3Vtbl d3drm_frame3_vtbl =
2867 d3drm_frame3_QueryInterface,
2868 d3drm_frame3_AddRef,
2869 d3drm_frame3_Release,
2870 d3drm_frame3_Clone,
2871 d3drm_frame3_AddDestroyCallback,
2872 d3drm_frame3_DeleteDestroyCallback,
2873 d3drm_frame3_SetAppData,
2874 d3drm_frame3_GetAppData,
2875 d3drm_frame3_SetName,
2876 d3drm_frame3_GetName,
2877 d3drm_frame3_GetClassName,
2878 d3drm_frame3_AddChild,
2879 d3drm_frame3_AddLight,
2880 d3drm_frame3_AddMoveCallback,
2881 d3drm_frame3_AddTransform,
2882 d3drm_frame3_AddTranslation,
2883 d3drm_frame3_AddScale,
2884 d3drm_frame3_AddRotation,
2885 d3drm_frame3_AddVisual,
2886 d3drm_frame3_GetChildren,
2887 d3drm_frame3_GetColor,
2888 d3drm_frame3_GetLights,
2889 d3drm_frame3_GetMaterialMode,
2890 d3drm_frame3_GetParent,
2891 d3drm_frame3_GetPosition,
2892 d3drm_frame3_GetRotation,
2893 d3drm_frame3_GetScene,
2894 d3drm_frame3_GetSortMode,
2895 d3drm_frame3_GetTexture,
2896 d3drm_frame3_GetTransform,
2897 d3drm_frame3_GetVelocity,
2898 d3drm_frame3_GetOrientation,
2899 d3drm_frame3_GetVisuals,
2900 d3drm_frame3_InverseTransform,
2901 d3drm_frame3_Load,
2902 d3drm_frame3_LookAt,
2903 d3drm_frame3_Move,
2904 d3drm_frame3_DeleteChild,
2905 d3drm_frame3_DeleteLight,
2906 d3drm_frame3_DeleteMoveCallback,
2907 d3drm_frame3_DeleteVisual,
2908 d3drm_frame3_GetSceneBackground,
2909 d3drm_frame3_GetSceneBackgroundDepth,
2910 d3drm_frame3_GetSceneFogColor,
2911 d3drm_frame3_GetSceneFogEnable,
2912 d3drm_frame3_GetSceneFogMode,
2913 d3drm_frame3_GetSceneFogParams,
2914 d3drm_frame3_SetSceneBackground,
2915 d3drm_frame3_SetSceneBackgroundRGB,
2916 d3drm_frame3_SetSceneBackgroundDepth,
2917 d3drm_frame3_SetSceneBackgroundImage,
2918 d3drm_frame3_SetSceneFogEnable,
2919 d3drm_frame3_SetSceneFogColor,
2920 d3drm_frame3_SetSceneFogMode,
2921 d3drm_frame3_SetSceneFogParams,
2922 d3drm_frame3_SetColor,
2923 d3drm_frame3_SetColorRGB,
2924 d3drm_frame3_GetZbufferMode,
2925 d3drm_frame3_SetMaterialMode,
2926 d3drm_frame3_SetOrientation,
2927 d3drm_frame3_SetPosition,
2928 d3drm_frame3_SetRotation,
2929 d3drm_frame3_SetSortMode,
2930 d3drm_frame3_SetTexture,
2931 d3drm_frame3_SetVelocity,
2932 d3drm_frame3_SetZbufferMode,
2933 d3drm_frame3_Transform,
2934 d3drm_frame3_GetBox,
2935 d3drm_frame3_GetBoxEnable,
2936 d3drm_frame3_GetAxes,
2937 d3drm_frame3_GetMaterial,
2938 d3drm_frame3_GetInheritAxes,
2939 d3drm_frame3_GetHierarchyBox,
2940 d3drm_frame3_SetBox,
2941 d3drm_frame3_SetBoxEnable,
2942 d3drm_frame3_SetAxes,
2943 d3drm_frame3_SetInheritAxes,
2944 d3drm_frame3_SetMaterial,
2945 d3drm_frame3_SetQuaternion,
2946 d3drm_frame3_RayPick,
2947 d3drm_frame3_Save,
2948 d3drm_frame3_TransformVectors,
2949 d3drm_frame3_InverseTransformVectors,
2950 d3drm_frame3_SetTraversalOptions,
2951 d3drm_frame3_GetTraversalOptions,
2952 d3drm_frame3_SetSceneFogMethod,
2953 d3drm_frame3_GetSceneFogMethod,
2954 d3drm_frame3_SetMaterialOverride,
2955 d3drm_frame3_GetMaterialOverride,
2958 static const struct IDirect3DRMFrame2Vtbl d3drm_frame2_vtbl =
2960 d3drm_frame2_QueryInterface,
2961 d3drm_frame2_AddRef,
2962 d3drm_frame2_Release,
2963 d3drm_frame2_Clone,
2964 d3drm_frame2_AddDestroyCallback,
2965 d3drm_frame2_DeleteDestroyCallback,
2966 d3drm_frame2_SetAppData,
2967 d3drm_frame2_GetAppData,
2968 d3drm_frame2_SetName,
2969 d3drm_frame2_GetName,
2970 d3drm_frame2_GetClassName,
2971 d3drm_frame2_AddChild,
2972 d3drm_frame2_AddLight,
2973 d3drm_frame2_AddMoveCallback,
2974 d3drm_frame2_AddTransform,
2975 d3drm_frame2_AddTranslation,
2976 d3drm_frame2_AddScale,
2977 d3drm_frame2_AddRotation,
2978 d3drm_frame2_AddVisual,
2979 d3drm_frame2_GetChildren,
2980 d3drm_frame2_GetColor,
2981 d3drm_frame2_GetLights,
2982 d3drm_frame2_GetMaterialMode,
2983 d3drm_frame2_GetParent,
2984 d3drm_frame2_GetPosition,
2985 d3drm_frame2_GetRotation,
2986 d3drm_frame2_GetScene,
2987 d3drm_frame2_GetSortMode,
2988 d3drm_frame2_GetTexture,
2989 d3drm_frame2_GetTransform,
2990 d3drm_frame2_GetVelocity,
2991 d3drm_frame2_GetOrientation,
2992 d3drm_frame2_GetVisuals,
2993 d3drm_frame2_GetTextureTopology,
2994 d3drm_frame2_InverseTransform,
2995 d3drm_frame2_Load,
2996 d3drm_frame2_LookAt,
2997 d3drm_frame2_Move,
2998 d3drm_frame2_DeleteChild,
2999 d3drm_frame2_DeleteLight,
3000 d3drm_frame2_DeleteMoveCallback,
3001 d3drm_frame2_DeleteVisual,
3002 d3drm_frame2_GetSceneBackground,
3003 d3drm_frame2_GetSceneBackgroundDepth,
3004 d3drm_frame2_GetSceneFogColor,
3005 d3drm_frame2_GetSceneFogEnable,
3006 d3drm_frame2_GetSceneFogMode,
3007 d3drm_frame2_GetSceneFogParams,
3008 d3drm_frame2_SetSceneBackground,
3009 d3drm_frame2_SetSceneBackgroundRGB,
3010 d3drm_frame2_SetSceneBackgroundDepth,
3011 d3drm_frame2_SetSceneBackgroundImage,
3012 d3drm_frame2_SetSceneFogEnable,
3013 d3drm_frame2_SetSceneFogColor,
3014 d3drm_frame2_SetSceneFogMode,
3015 d3drm_frame2_SetSceneFogParams,
3016 d3drm_frame2_SetColor,
3017 d3drm_frame2_SetColorRGB,
3018 d3drm_frame2_GetZbufferMode,
3019 d3drm_frame2_SetMaterialMode,
3020 d3drm_frame2_SetOrientation,
3021 d3drm_frame2_SetPosition,
3022 d3drm_frame2_SetRotation,
3023 d3drm_frame2_SetSortMode,
3024 d3drm_frame2_SetTexture,
3025 d3drm_frame2_SetTextureTopology,
3026 d3drm_frame2_SetVelocity,
3027 d3drm_frame2_SetZbufferMode,
3028 d3drm_frame2_Transform,
3029 d3drm_frame2_AddMoveCallback2,
3030 d3drm_frame2_GetBox,
3031 d3drm_frame2_GetBoxEnable,
3032 d3drm_frame2_GetAxes,
3033 d3drm_frame2_GetMaterial,
3034 d3drm_frame2_GetInheritAxes,
3035 d3drm_frame2_GetHierarchyBox,
3038 static const struct IDirect3DRMFrameVtbl d3drm_frame1_vtbl =
3040 d3drm_frame1_QueryInterface,
3041 d3drm_frame1_AddRef,
3042 d3drm_frame1_Release,
3043 d3drm_frame1_Clone,
3044 d3drm_frame1_AddDestroyCallback,
3045 d3drm_frame1_DeleteDestroyCallback,
3046 d3drm_frame1_SetAppData,
3047 d3drm_frame1_GetAppData,
3048 d3drm_frame1_SetName,
3049 d3drm_frame1_GetName,
3050 d3drm_frame1_GetClassName,
3051 d3drm_frame1_AddChild,
3052 d3drm_frame1_AddLight,
3053 d3drm_frame1_AddMoveCallback,
3054 d3drm_frame1_AddTransform,
3055 d3drm_frame1_AddTranslation,
3056 d3drm_frame1_AddScale,
3057 d3drm_frame1_AddRotation,
3058 d3drm_frame1_AddVisual,
3059 d3drm_frame1_GetChildren,
3060 d3drm_frame1_GetColor,
3061 d3drm_frame1_GetLights,
3062 d3drm_frame1_GetMaterialMode,
3063 d3drm_frame1_GetParent,
3064 d3drm_frame1_GetPosition,
3065 d3drm_frame1_GetRotation,
3066 d3drm_frame1_GetScene,
3067 d3drm_frame1_GetSortMode,
3068 d3drm_frame1_GetTexture,
3069 d3drm_frame1_GetTransform,
3070 d3drm_frame1_GetVelocity,
3071 d3drm_frame1_GetOrientation,
3072 d3drm_frame1_GetVisuals,
3073 d3drm_frame1_GetTextureTopology,
3074 d3drm_frame1_InverseTransform,
3075 d3drm_frame1_Load,
3076 d3drm_frame1_LookAt,
3077 d3drm_frame1_Move,
3078 d3drm_frame1_DeleteChild,
3079 d3drm_frame1_DeleteLight,
3080 d3drm_frame1_DeleteMoveCallback,
3081 d3drm_frame1_DeleteVisual,
3082 d3drm_frame1_GetSceneBackground,
3083 d3drm_frame1_GetSceneBackgroundDepth,
3084 d3drm_frame1_GetSceneFogColor,
3085 d3drm_frame1_GetSceneFogEnable,
3086 d3drm_frame1_GetSceneFogMode,
3087 d3drm_frame1_GetSceneFogParams,
3088 d3drm_frame1_SetSceneBackground,
3089 d3drm_frame1_SetSceneBackgroundRGB,
3090 d3drm_frame1_SetSceneBackgroundDepth,
3091 d3drm_frame1_SetSceneBackgroundImage,
3092 d3drm_frame1_SetSceneFogEnable,
3093 d3drm_frame1_SetSceneFogColor,
3094 d3drm_frame1_SetSceneFogMode,
3095 d3drm_frame1_SetSceneFogParams,
3096 d3drm_frame1_SetColor,
3097 d3drm_frame1_SetColorRGB,
3098 d3drm_frame1_GetZbufferMode,
3099 d3drm_frame1_SetMaterialMode,
3100 d3drm_frame1_SetOrientation,
3101 d3drm_frame1_SetPosition,
3102 d3drm_frame1_SetRotation,
3103 d3drm_frame1_SetSortMode,
3104 d3drm_frame1_SetTexture,
3105 d3drm_frame1_SetTextureTopology,
3106 d3drm_frame1_SetVelocity,
3107 d3drm_frame1_SetZbufferMode,
3108 d3drm_frame1_Transform,
3111 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame3(IDirect3DRMFrame3 *iface)
3113 if (!iface)
3114 return NULL;
3115 assert(iface->lpVtbl == &d3drm_frame3_vtbl);
3117 return impl_from_IDirect3DRMFrame3(iface);
3120 struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface)
3122 if (!iface)
3123 return NULL;
3124 assert(iface->lpVtbl == &d3drm_frame1_vtbl);
3126 return impl_from_IDirect3DRMFrame(iface);
3129 HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm)
3131 static const char classname[] = "Frame";
3132 struct d3drm_frame *object;
3133 HRESULT hr = D3DRM_OK;
3135 TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm);
3137 if (!(object = calloc(1, sizeof(*object))))
3138 return E_OUTOFMEMORY;
3140 object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl;
3141 object->IDirect3DRMFrame2_iface.lpVtbl = &d3drm_frame2_vtbl;
3142 object->IDirect3DRMFrame3_iface.lpVtbl = &d3drm_frame3_vtbl;
3143 object->d3drm = d3drm;
3144 object->ref = 1;
3145 d3drm_set_color(&object->scenebackground, 0.0f, 0.0f, 0.0f, 1.0f);
3146 object->traversal_options = D3DRMFRAME_RENDERENABLE | D3DRMFRAME_PICKENABLE;
3148 d3drm_object_init(&object->obj, classname);
3150 object->transform = identity;
3152 if (parent_frame)
3154 IDirect3DRMFrame3 *p;
3156 if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p)))
3158 free(object);
3159 return hr;
3161 IDirect3DRMFrame_Release(parent_frame);
3162 IDirect3DRMFrame3_AddChild(p, &object->IDirect3DRMFrame3_iface);
3165 IDirect3DRM_AddRef(object->d3drm);
3167 *frame = object;
3169 return hr;
3172 static HRESULT WINAPI d3drm_animation2_QueryInterface(IDirect3DRMAnimation2 *iface, REFIID riid, void **out)
3174 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3176 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
3178 if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation)
3179 || IsEqualGUID(riid, &IID_IDirect3DRMObject)
3180 || IsEqualGUID(riid, &IID_IUnknown))
3182 *out = &animation->IDirect3DRMAnimation_iface;
3184 else if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation2))
3186 *out = &animation->IDirect3DRMAnimation2_iface;
3188 else
3190 *out = NULL;
3191 WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
3192 return CLASS_E_CLASSNOTAVAILABLE;
3195 IUnknown_AddRef((IUnknown *)*out);
3196 return S_OK;
3199 static HRESULT WINAPI d3drm_animation1_QueryInterface(IDirect3DRMAnimation *iface, REFIID riid, void **out)
3201 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3203 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
3205 return IDirect3DRMAnimation2_QueryInterface(&animation->IDirect3DRMAnimation2_iface, riid, out);
3208 static ULONG WINAPI d3drm_animation2_AddRef(IDirect3DRMAnimation2 *iface)
3210 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3211 ULONG refcount = InterlockedIncrement(&animation->ref);
3213 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
3215 return refcount;
3218 static ULONG WINAPI d3drm_animation1_AddRef(IDirect3DRMAnimation *iface)
3220 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3221 return IDirect3DRMAnimation2_AddRef(&animation->IDirect3DRMAnimation2_iface);
3224 static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface)
3226 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3227 ULONG refcount = InterlockedDecrement(&animation->ref);
3229 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
3231 if (!refcount)
3233 d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
3234 IDirect3DRM_Release(animation->d3drm);
3235 free(animation->rotate.keys);
3236 free(animation->scale.keys);
3237 free(animation->position.keys);
3238 free(animation);
3241 return refcount;
3244 static ULONG WINAPI d3drm_animation1_Release(IDirect3DRMAnimation *iface)
3246 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3248 return IDirect3DRMAnimation2_Release(&animation->IDirect3DRMAnimation2_iface);
3251 static HRESULT WINAPI d3drm_animation2_Clone(IDirect3DRMAnimation2 *iface, IUnknown *outer, REFIID iid, void **out)
3253 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
3255 return E_NOTIMPL;
3258 static HRESULT WINAPI d3drm_animation1_Clone(IDirect3DRMAnimation *iface, IUnknown *outer, REFIID iid, void **out)
3260 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
3262 return E_NOTIMPL;
3265 static HRESULT WINAPI d3drm_animation2_AddDestroyCallback(IDirect3DRMAnimation2 *iface,
3266 D3DRMOBJECTCALLBACK cb, void *ctx)
3268 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3270 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
3272 return d3drm_object_add_destroy_callback(&animation->obj, cb, ctx);
3275 static HRESULT WINAPI d3drm_animation1_AddDestroyCallback(IDirect3DRMAnimation *iface,
3276 D3DRMOBJECTCALLBACK cb, void *ctx)
3278 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3280 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
3282 return IDirect3DRMAnimation2_AddDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx);
3285 static HRESULT WINAPI d3drm_animation2_DeleteDestroyCallback(IDirect3DRMAnimation2 *iface,
3286 D3DRMOBJECTCALLBACK cb, void *ctx)
3288 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3290 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
3292 return d3drm_object_delete_destroy_callback(&animation->obj, cb, ctx);
3295 static HRESULT WINAPI d3drm_animation1_DeleteDestroyCallback(IDirect3DRMAnimation *iface,
3296 D3DRMOBJECTCALLBACK cb, void *ctx)
3298 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3300 TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
3302 return IDirect3DRMAnimation2_DeleteDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx);
3305 static HRESULT WINAPI d3drm_animation2_SetAppData(IDirect3DRMAnimation2 *iface, DWORD data)
3307 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3309 TRACE("iface %p, data %#lx.\n", iface, data);
3311 animation->obj.appdata = data;
3313 return D3DRM_OK;
3316 static HRESULT WINAPI d3drm_animation1_SetAppData(IDirect3DRMAnimation *iface, DWORD data)
3318 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3320 TRACE("iface %p, data %#lx.\n", iface, data);
3322 return d3drm_animation2_SetAppData(&animation->IDirect3DRMAnimation2_iface, data);
3325 static DWORD WINAPI d3drm_animation2_GetAppData(IDirect3DRMAnimation2 *iface)
3327 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3329 TRACE("iface %p.\n", iface);
3331 return animation->obj.appdata;
3334 static DWORD WINAPI d3drm_animation1_GetAppData(IDirect3DRMAnimation *iface)
3336 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3338 TRACE("iface %p.\n", iface);
3340 return d3drm_animation2_GetAppData(&animation->IDirect3DRMAnimation2_iface);
3343 static HRESULT WINAPI d3drm_animation2_SetName(IDirect3DRMAnimation2 *iface, const char *name)
3345 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3347 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3349 return d3drm_object_set_name(&animation->obj, name);
3352 static HRESULT WINAPI d3drm_animation1_SetName(IDirect3DRMAnimation *iface, const char *name)
3354 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3356 TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
3358 return d3drm_animation2_SetName(&animation->IDirect3DRMAnimation2_iface, name);
3361 static HRESULT WINAPI d3drm_animation2_GetName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name)
3363 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3365 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
3367 return d3drm_object_get_name(&animation->obj, size, name);
3370 static HRESULT WINAPI d3drm_animation1_GetName(IDirect3DRMAnimation *iface, DWORD *size, char *name)
3372 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3374 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
3376 return d3drm_animation2_GetName(&animation->IDirect3DRMAnimation2_iface, size, name);
3379 static HRESULT WINAPI d3drm_animation2_GetClassName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name)
3381 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3383 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
3385 return d3drm_object_get_class_name(&animation->obj, size, name);
3388 static HRESULT WINAPI d3drm_animation1_GetClassName(IDirect3DRMAnimation *iface, DWORD *size, char *name)
3390 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3392 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
3394 return d3drm_animation2_GetClassName(&animation->IDirect3DRMAnimation2_iface, size, name);
3397 static HRESULT WINAPI d3drm_animation2_SetOptions(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONOPTIONS options)
3399 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3400 static const DWORD supported_options = D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION
3401 | D3DRMANIMATION_SPLINEPOSITION | D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION;
3403 TRACE("iface %p, options %#lx.\n", iface, options);
3405 if (!(options & supported_options))
3406 return D3DRMERR_BADVALUE;
3408 if ((options & (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED)) == (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED) ||
3409 (options & (D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION)) ==
3410 (D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION) ||
3411 (options & (D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION)) ==
3412 (D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION))
3414 return D3DRMERR_BADVALUE;
3417 animation->options = options;
3419 return D3DRM_OK;
3422 static HRESULT WINAPI d3drm_animation1_SetOptions(IDirect3DRMAnimation *iface, D3DRMANIMATIONOPTIONS options)
3424 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3426 TRACE("iface %p, %#lx.\n", iface, options);
3428 return d3drm_animation2_SetOptions(&animation->IDirect3DRMAnimation2_iface, options);
3431 static SIZE_T d3drm_animation_lookup_key(const struct d3drm_animation_key *keys,
3432 SIZE_T count, D3DVALUE time)
3434 SIZE_T start = 0, cur = 0, end = count;
3436 while (start < end)
3438 cur = start + (end - start) / 2;
3440 if (time == keys[cur].time)
3441 return cur;
3443 if (time < keys[cur].time)
3444 end = cur;
3445 else
3446 start = cur + 1;
3449 return cur;
3452 static SIZE_T d3drm_animation_get_index_min(const struct d3drm_animation_key *keys, SIZE_T count, D3DVALUE time)
3454 SIZE_T i;
3456 i = d3drm_animation_lookup_key(keys, count, time);
3457 while (i > 0 && keys[i - 1].time == time)
3458 --i;
3460 return i;
3463 static SIZE_T d3drm_animation_get_index_max(const struct d3drm_animation_key *keys, SIZE_T count, D3DVALUE time)
3465 SIZE_T i;
3467 i = d3drm_animation_lookup_key(keys, count, time);
3468 while (i < count - 1 && keys[i + 1].time == time)
3469 ++i;
3471 return i;
3474 static SIZE_T d3drm_animation_get_insert_position(const struct d3drm_animation_keys *keys, D3DVALUE time)
3476 if (!keys->count || time < keys->keys[0].time)
3477 return 0;
3479 if (time >= keys->keys[keys->count - 1].time)
3480 return keys->count;
3482 return d3drm_animation_get_index_max(keys->keys, keys->count, time);
3485 static const struct d3drm_animation_key *d3drm_animation_get_range(const struct d3drm_animation_keys *keys,
3486 D3DVALUE time_min, D3DVALUE time_max, SIZE_T *count)
3488 SIZE_T min;
3490 if (!keys->count || time_max < keys->keys[0].time
3491 || time_min > keys->keys[keys->count - 1].time)
3492 return NULL;
3494 min = d3drm_animation_get_index_min(keys->keys, keys->count, time_min);
3495 if (count)
3496 *count = d3drm_animation_get_index_max(&keys->keys[min], keys->count - min, time_max) - min + 1;
3498 return &keys->keys[min];
3501 static HRESULT WINAPI d3drm_animation2_AddKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key)
3503 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3504 struct d3drm_animation_keys *keys;
3505 SIZE_T index;
3507 TRACE("iface %p, key %p.\n", iface, key);
3509 if (!key || key->dwSize != sizeof(*key))
3510 return E_INVALIDARG;
3512 switch (key->dwKeyType)
3514 case D3DRMANIMATION_POSITIONKEY:
3515 keys = &animation->position;
3516 break;
3517 case D3DRMANIMATION_SCALEKEY:
3518 keys = &animation->scale;
3519 break;
3520 case D3DRMANIMATION_ROTATEKEY:
3521 keys = &animation->rotate;
3522 break;
3523 default:
3524 return E_INVALIDARG;
3527 index = d3drm_animation_get_insert_position(keys, key->dvTime);
3529 if (!d3drm_array_reserve((void **)&keys->keys, &keys->size, keys->count + 1, sizeof(*keys->keys)))
3530 return E_OUTOFMEMORY;
3532 if (index < keys->count)
3533 memmove(&keys->keys[index + 1], &keys->keys[index], sizeof(*keys->keys) * (keys->count - index));
3534 keys->keys[index].time = key->dvTime;
3535 switch (key->dwKeyType)
3537 case D3DRMANIMATION_POSITIONKEY:
3538 keys->keys[index].u.position = key->dvPositionKey;
3539 break;
3540 case D3DRMANIMATION_SCALEKEY:
3541 keys->keys[index].u.scale = key->dvScaleKey;
3542 break;
3543 case D3DRMANIMATION_ROTATEKEY:
3544 keys->keys[index].u.rotate = key->dqRotateKey;
3545 break;
3547 ++keys->count;
3549 return D3DRM_OK;
3552 static HRESULT WINAPI d3drm_animation2_AddRotateKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, D3DRMQUATERNION *q)
3554 D3DRMANIMATIONKEY key;
3556 TRACE("iface %p, time %.8e, q %p.\n", iface, time, q);
3558 key.dwSize = sizeof(key);
3559 key.dwKeyType = D3DRMANIMATION_ROTATEKEY;
3560 key.dvTime = time;
3561 key.dwID = 0;
3562 key.dqRotateKey = *q;
3564 return d3drm_animation2_AddKey(iface, &key);
3567 static HRESULT WINAPI d3drm_animation1_AddRotateKey(IDirect3DRMAnimation *iface, D3DVALUE time, D3DRMQUATERNION *q)
3569 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3571 TRACE("iface %p, time %.8e, q %p.\n", iface, time, q);
3573 return d3drm_animation2_AddRotateKey(&animation->IDirect3DRMAnimation2_iface, time, q);
3576 static HRESULT WINAPI d3drm_animation2_AddPositionKey(IDirect3DRMAnimation2 *iface, D3DVALUE time,
3577 D3DVALUE x, D3DVALUE y, D3DVALUE z)
3579 D3DRMANIMATIONKEY key;
3581 TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
3583 key.dwSize = sizeof(key);
3584 key.dwKeyType = D3DRMANIMATION_POSITIONKEY;
3585 key.dvTime = time;
3586 key.dwID = 0;
3587 key.dvPositionKey.x = x;
3588 key.dvPositionKey.y = y;
3589 key.dvPositionKey.z = z;
3591 return d3drm_animation2_AddKey(iface, &key);
3594 static HRESULT WINAPI d3drm_animation1_AddPositionKey(IDirect3DRMAnimation *iface, D3DVALUE time,
3595 D3DVALUE x, D3DVALUE y, D3DVALUE z)
3597 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3599 TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
3601 return d3drm_animation2_AddPositionKey(&animation->IDirect3DRMAnimation2_iface, time, x, y, z);
3604 static HRESULT WINAPI d3drm_animation2_AddScaleKey(IDirect3DRMAnimation2 *iface, D3DVALUE time,
3605 D3DVALUE x, D3DVALUE y, D3DVALUE z)
3607 D3DRMANIMATIONKEY key;
3609 TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
3611 key.dwSize = sizeof(key);
3612 key.dwKeyType = D3DRMANIMATION_SCALEKEY;
3613 key.dvTime = time;
3614 key.dwID = 0;
3615 key.dvScaleKey.x = x;
3616 key.dvScaleKey.y = y;
3617 key.dvScaleKey.z = z;
3619 return d3drm_animation2_AddKey(iface, &key);
3622 static HRESULT WINAPI d3drm_animation1_AddScaleKey(IDirect3DRMAnimation *iface, D3DVALUE time,
3623 D3DVALUE x, D3DVALUE y, D3DVALUE z)
3625 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3627 TRACE("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
3629 return d3drm_animation2_AddScaleKey(&animation->IDirect3DRMAnimation2_iface, time, x, y, z);
3632 static void d3drm_animation_delete_key(struct d3drm_animation_keys *keys, const struct d3drm_animation_key *key)
3634 SIZE_T index = key - keys->keys;
3636 if (index < keys->count - 1)
3637 memmove(&keys->keys[index], &keys->keys[index + 1], sizeof(*keys->keys) * (keys->count - index - 1));
3638 --keys->count;
3641 static HRESULT WINAPI d3drm_animation2_DeleteKey(IDirect3DRMAnimation2 *iface, D3DVALUE time)
3643 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3644 const struct d3drm_animation_key *key;
3646 TRACE("iface %p, time %.8e.\n", iface, time);
3648 if ((key = d3drm_animation_get_range(&animation->rotate, time, time, NULL)))
3649 d3drm_animation_delete_key(&animation->rotate, key);
3651 if ((key = d3drm_animation_get_range(&animation->position, time, time, NULL)))
3652 d3drm_animation_delete_key(&animation->position, key);
3654 if ((key = d3drm_animation_get_range(&animation->scale, time, time, NULL)))
3655 d3drm_animation_delete_key(&animation->scale, key);
3657 return D3DRM_OK;
3660 static HRESULT WINAPI d3drm_animation1_DeleteKey(IDirect3DRMAnimation *iface, D3DVALUE time)
3662 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3664 TRACE("iface %p, time %.8e.\n", iface, time);
3666 return d3drm_animation2_DeleteKey(&animation->IDirect3DRMAnimation2_iface, time);
3669 static HRESULT WINAPI d3drm_animation1_SetFrame(IDirect3DRMAnimation *iface, IDirect3DRMFrame *frame)
3671 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3672 HRESULT hr = D3DRM_OK;
3674 TRACE("iface %p, frame %p.\n", iface, frame);
3676 if (frame)
3678 hr = IDirect3DRMFrame_QueryInterface(frame, &IID_IDirect3DRMFrame3, (void **)&animation->frame);
3679 if (SUCCEEDED(hr))
3680 IDirect3DRMFrame3_Release(animation->frame);
3682 else
3683 animation->frame = NULL;
3685 return hr;
3688 static HRESULT WINAPI d3drm_animation1_SetTime(IDirect3DRMAnimation *iface, D3DVALUE time)
3690 FIXME("iface %p, time %.8e.\n", iface, time);
3692 return E_NOTIMPL;
3695 static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnimation2 *iface)
3697 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3699 TRACE("iface %p.\n", iface);
3701 return animation->options;
3704 static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation1_GetOptions(IDirect3DRMAnimation *iface)
3706 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
3708 TRACE("iface %p.\n", iface);
3710 return d3drm_animation2_GetOptions(&animation->IDirect3DRMAnimation2_iface);
3713 static HRESULT WINAPI d3drm_animation2_SetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 *frame)
3715 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3717 TRACE("iface %p, frame %p.\n", iface, frame);
3719 animation->frame = frame;
3721 return D3DRM_OK;
3724 static HRESULT WINAPI d3drm_animation2_SetTime(IDirect3DRMAnimation2 *iface, D3DVALUE time)
3726 FIXME("iface %p, time %.8e.\n", iface, time);
3728 return E_NOTIMPL;
3731 static HRESULT WINAPI d3drm_animation2_GetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 **frame)
3733 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3735 TRACE("iface %p, frame %p.\n", iface, frame);
3737 if (!frame)
3738 return D3DRMERR_BADVALUE;
3740 *frame = animation->frame;
3741 if (*frame)
3742 IDirect3DRMFrame3_AddRef(*frame);
3744 return D3DRM_OK;
3747 static HRESULT WINAPI d3drm_animation2_DeleteKeyByID(IDirect3DRMAnimation2 *iface, DWORD id)
3749 FIXME("iface %p, id %#lx.\n", iface, id);
3751 return E_NOTIMPL;
3754 static HRESULT WINAPI d3drm_animation2_ModifyKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key)
3756 FIXME("iface %p, key %p.\n", iface, key);
3758 return E_NOTIMPL;
3761 static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3DVALUE time_min, D3DVALUE time_max,
3762 DWORD *key_count, D3DRMANIMATIONKEY *keys)
3764 struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
3765 const struct d3drm_animation_key *key;
3766 SIZE_T count, i;
3768 TRACE("iface %p, time min %.8e, time max %.8e, key_count %p, keys %p.\n",
3769 iface, time_min, time_max, key_count, keys);
3771 if (!key_count)
3772 return D3DRMERR_BADVALUE;
3774 *key_count = 0;
3776 if ((key = d3drm_animation_get_range(&animation->rotate, time_min, time_max, &count)))
3778 if (keys)
3780 for (i = 0; i < count; ++i)
3782 keys[i].dwSize = sizeof(*keys);
3783 keys[i].dwKeyType = D3DRMANIMATION_ROTATEKEY;
3784 keys[i].dvTime = key[i].time;
3785 keys[i].dwID = 0; /* FIXME */
3786 keys[i].dqRotateKey = key[i].u.rotate;
3788 keys += count;
3790 *key_count += count;
3793 if ((key = d3drm_animation_get_range(&animation->position, time_min, time_max, &count)))
3795 if (keys)
3797 for (i = 0; i < count; ++i)
3799 keys[i].dwSize = sizeof(*keys);
3800 keys[i].dwKeyType = D3DRMANIMATION_POSITIONKEY;
3801 keys[i].dvTime = key[i].time;
3802 keys[i].dwID = 0; /* FIXME */
3803 keys[i].dvPositionKey = key[i].u.position;
3805 keys += count;
3807 *key_count += count;
3810 if ((key = d3drm_animation_get_range(&animation->scale, time_min, time_max, &count)))
3812 if (keys)
3814 for (i = 0; keys && i < count; ++i)
3816 keys[i].dwSize = sizeof(*keys);
3817 keys[i].dwKeyType = D3DRMANIMATION_SCALEKEY;
3818 keys[i].dvTime = key[i].time;
3819 keys[i].dwID = 0; /* FIXME */
3820 keys[i].dvScaleKey = key[i].u.scale;
3822 keys += count;
3824 *key_count += count;
3827 return *key_count ? D3DRM_OK : D3DRMERR_NOSUCHKEY;
3830 static const struct IDirect3DRMAnimationVtbl d3drm_animation1_vtbl =
3832 d3drm_animation1_QueryInterface,
3833 d3drm_animation1_AddRef,
3834 d3drm_animation1_Release,
3835 d3drm_animation1_Clone,
3836 d3drm_animation1_AddDestroyCallback,
3837 d3drm_animation1_DeleteDestroyCallback,
3838 d3drm_animation1_SetAppData,
3839 d3drm_animation1_GetAppData,
3840 d3drm_animation1_SetName,
3841 d3drm_animation1_GetName,
3842 d3drm_animation1_GetClassName,
3843 d3drm_animation1_SetOptions,
3844 d3drm_animation1_AddRotateKey,
3845 d3drm_animation1_AddPositionKey,
3846 d3drm_animation1_AddScaleKey,
3847 d3drm_animation1_DeleteKey,
3848 d3drm_animation1_SetFrame,
3849 d3drm_animation1_SetTime,
3850 d3drm_animation1_GetOptions,
3853 static const struct IDirect3DRMAnimation2Vtbl d3drm_animation2_vtbl =
3855 d3drm_animation2_QueryInterface,
3856 d3drm_animation2_AddRef,
3857 d3drm_animation2_Release,
3858 d3drm_animation2_Clone,
3859 d3drm_animation2_AddDestroyCallback,
3860 d3drm_animation2_DeleteDestroyCallback,
3861 d3drm_animation2_SetAppData,
3862 d3drm_animation2_GetAppData,
3863 d3drm_animation2_SetName,
3864 d3drm_animation2_GetName,
3865 d3drm_animation2_GetClassName,
3866 d3drm_animation2_SetOptions,
3867 d3drm_animation2_AddRotateKey,
3868 d3drm_animation2_AddPositionKey,
3869 d3drm_animation2_AddScaleKey,
3870 d3drm_animation2_DeleteKey,
3871 d3drm_animation2_SetFrame,
3872 d3drm_animation2_SetTime,
3873 d3drm_animation2_GetOptions,
3874 d3drm_animation2_GetFrame,
3875 d3drm_animation2_DeleteKeyByID,
3876 d3drm_animation2_AddKey,
3877 d3drm_animation2_ModifyKey,
3878 d3drm_animation2_GetKeys,
3881 HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm)
3883 static const char classname[] = "Animation";
3884 struct d3drm_animation *object;
3885 HRESULT hr = D3DRM_OK;
3887 TRACE("animation %p, d3drm %p.\n", animation, d3drm);
3889 if (!(object = calloc(1, sizeof(*object))))
3890 return E_OUTOFMEMORY;
3892 object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
3893 object->IDirect3DRMAnimation2_iface.lpVtbl = &d3drm_animation2_vtbl;
3894 object->d3drm = d3drm;
3895 object->ref = 1;
3896 object->options = D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION;
3898 d3drm_object_init(&object->obj, classname);
3900 IDirect3DRM_AddRef(object->d3drm);
3902 *animation = object;
3904 return hr;