reg: Fail if the source and destination keys are the same when copying.
[wine.git] / dlls / d3dx9_36 / animation.c
blobd0c7c069f352d67623c6e3b97f24b97b13f21fe0
1 /*
2 * Animation Controller operations specific to D3DX9.
4 * Copyright (C) 2015 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "d3dx9_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
26 struct d3dx9_animation_controller
28 ID3DXAnimationController ID3DXAnimationController_iface;
29 LONG ref;
31 UINT max_outputs;
32 UINT max_sets;
33 UINT max_tracks;
34 UINT max_events;
37 static inline struct d3dx9_animation_controller *impl_from_ID3DXAnimationController(ID3DXAnimationController *iface)
39 return CONTAINING_RECORD(iface, struct d3dx9_animation_controller, ID3DXAnimationController_iface);
42 static HRESULT WINAPI d3dx9_animation_controller_QueryInterface(ID3DXAnimationController *iface, REFIID riid, void **out)
44 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
46 if (IsEqualGUID(riid, &IID_IUnknown) ||
47 IsEqualGUID(riid, &IID_ID3DXAnimationController))
49 iface->lpVtbl->AddRef(iface);
50 *out = iface;
51 return D3D_OK;
54 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
55 *out = NULL;
56 return E_NOINTERFACE;
59 static ULONG WINAPI d3dx9_animation_controller_AddRef(ID3DXAnimationController *iface)
61 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
62 ULONG refcount = InterlockedIncrement(&animation->ref);
64 TRACE("%p increasing refcount to %u.\n", animation, refcount);
66 return refcount;
69 static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController *iface)
71 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
72 ULONG refcount = InterlockedDecrement(&animation->ref);
74 TRACE("%p decreasing refcount to %u.\n", animation, refcount);
76 if (!refcount)
78 HeapFree(GetProcessHeap(), 0, animation);
81 return refcount;
84 static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationOutputs(ID3DXAnimationController *iface)
86 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
88 TRACE("iface %p.\n", iface);
90 return animation->max_outputs;
93 static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationSets(ID3DXAnimationController *iface)
95 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
97 TRACE("iface %p.\n", iface);
99 return animation->max_sets;
102 static UINT WINAPI d3dx9_animation_controller_GetMaxNumTracks(ID3DXAnimationController *iface)
104 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
106 TRACE("iface %p.\n", iface);
108 return animation->max_tracks;
111 static UINT WINAPI d3dx9_animation_controller_GetMaxNumEvents(ID3DXAnimationController *iface)
113 struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface);
115 TRACE("iface %p.\n", iface);
117 return animation->max_events;
120 static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationOutput(ID3DXAnimationController *iface,
121 const char *name, D3DXMATRIX *matrix, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation)
123 FIXME("iface %p, name %s, matrix %p, scale %p, rotation %p, translation %p stub.\n", iface, debugstr_a(name),
124 matrix, scale, rotation, translation);
126 return E_NOTIMPL;
129 static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationSet(ID3DXAnimationController *iface,
130 ID3DXAnimationSet *anim_set)
132 FIXME("iface %p, anim_set %p stub.\n", iface, anim_set);
134 return E_NOTIMPL;
137 static HRESULT WINAPI d3dx9_animation_controller_UnregisterAnimationSet(ID3DXAnimationController *iface,
138 ID3DXAnimationSet *anim_set)
140 FIXME("iface %p, anim_set %p stub.\n", iface, anim_set);
142 return E_NOTIMPL;
145 static UINT WINAPI d3dx9_animation_controller_GetNumAnimationSets(ID3DXAnimationController *iface)
147 FIXME("iface %p stub.\n", iface);
149 return 0;
152 static HRESULT WINAPI d3dx9_animation_controller_GetAnimationSet(ID3DXAnimationController *iface,
153 UINT index, ID3DXAnimationSet **anim_set)
155 FIXME("iface %p, index %u, anim_set %p stub.\n", iface, index, anim_set);
157 return E_NOTIMPL;
160 static HRESULT WINAPI d3dx9_animation_controller_GetAnimationSetByName(ID3DXAnimationController *iface,
161 const char *name, ID3DXAnimationSet **anim_set)
163 FIXME("iface %p, name %s, anim_set %p stub.\n", iface, debugstr_a(name), anim_set);
165 return E_NOTIMPL;
168 static HRESULT WINAPI d3dx9_animation_controller_AdvanceTime(ID3DXAnimationController *iface, double time_delta,
169 ID3DXAnimationCallbackHandler *callback_handler)
171 FIXME("iface %p, time_delta %.16e, callback_handler %p stub.\n", iface, time_delta, callback_handler);
173 return E_NOTIMPL;
176 static HRESULT WINAPI d3dx9_animation_controller_Reset(ID3DXAnimationController *iface)
178 FIXME("iface %p stub.\n", iface);
180 return E_NOTIMPL;
183 static double WINAPI d3dx9_animation_controller_GetTime(ID3DXAnimationController *iface)
185 FIXME("iface %p stub.\n", iface);
187 return 0.0;
190 static HRESULT WINAPI d3dx9_animation_controller_SetTrackAnimationSet(ID3DXAnimationController *iface,
191 UINT track, ID3DXAnimationSet *anim_set)
193 FIXME("iface %p, track %u, anim_set %p stub.\n", iface, track, anim_set);
195 return E_NOTIMPL;
198 static HRESULT WINAPI d3dx9_animation_controller_GetTrackAnimationSet(ID3DXAnimationController *iface,
199 UINT track, ID3DXAnimationSet **anim_set)
201 FIXME("iface %p, track %u, anim_set %p stub.\n", iface, track, anim_set);
203 return E_NOTIMPL;
206 static HRESULT WINAPI d3dx9_animation_controller_SetTrackPriority(ID3DXAnimationController *iface,
207 UINT track, D3DXPRIORITY_TYPE priority)
209 FIXME("iface %p, track %u, priority %u stub.\n", iface, track, priority);
211 return E_NOTIMPL;
214 static HRESULT WINAPI d3dx9_animation_controller_SetTrackSpeed(ID3DXAnimationController *iface,
215 UINT track, float speed)
217 FIXME("iface %p, track %u, speed %.8e stub.\n", iface, track, speed);
219 return E_NOTIMPL;
222 static HRESULT WINAPI d3dx9_animation_controller_SetTrackWeight(ID3DXAnimationController *iface,
223 UINT track, float weight)
225 FIXME("iface %p, track %u, weight %.8e stub.\n", iface, track, weight);
227 return E_NOTIMPL;
230 static HRESULT WINAPI d3dx9_animation_controller_SetTrackPosition(ID3DXAnimationController *iface,
231 UINT track, double position)
233 FIXME("iface %p, track %u, position %.16e stub.\n", iface, track, position);
235 return E_NOTIMPL;
238 static HRESULT WINAPI d3dx9_animation_controller_SetTrackEnable(ID3DXAnimationController *iface,
239 UINT track, BOOL enable)
241 FIXME("iface %p, track %u, enable %#x stub.\n", iface, track, enable);
243 return E_NOTIMPL;
246 static HRESULT WINAPI d3dx9_animation_controller_SetTrackDesc(ID3DXAnimationController *iface,
247 UINT track, D3DXTRACK_DESC *desc)
249 FIXME("iface %p, track %u, desc %p stub.\n", iface, track, desc);
251 return E_NOTIMPL;
254 static HRESULT WINAPI d3dx9_animation_controller_GetTrackDesc(ID3DXAnimationController *iface,
255 UINT track, D3DXTRACK_DESC *desc)
257 FIXME("iface %p, track %u, desc %p stub.\n", iface, track, desc);
259 return E_NOTIMPL;
262 static HRESULT WINAPI d3dx9_animation_controller_SetPriorityBlend(ID3DXAnimationController *iface,
263 float blend_weight)
265 FIXME("iface %p, blend_weight %.8e stub.\n", iface, blend_weight);
267 return E_NOTIMPL;
270 static float WINAPI d3dx9_animation_controller_GetPriorityBlend(ID3DXAnimationController *iface)
272 FIXME("iface %p stub.\n", iface);
274 return 0.0f;
277 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackSpeed(ID3DXAnimationController *iface,
278 UINT track, float new_speed, double start_time, double duration, D3DXTRANSITION_TYPE transition)
280 FIXME("iface %p, track %u, new_speed %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface,
281 track, new_speed, start_time, duration, transition);
283 return 0;
286 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackWeight(ID3DXAnimationController *iface,
287 UINT track, float new_weight, double start_time, double duration, D3DXTRANSITION_TYPE transition)
289 FIXME("iface %p, track %u, new_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface,
290 track, new_weight, start_time, duration, transition);
292 return 0;
295 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackPosition(ID3DXAnimationController *iface,
296 UINT track, double new_position, double start_time)
298 FIXME("iface %p, track %u, new_position %.16e, start_time %.16e stub.\n", iface,
299 track, new_position, start_time);
301 return 0;
304 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackEnable(ID3DXAnimationController *iface,
305 UINT track, BOOL new_enable, double start_time)
307 FIXME("iface %p, track %u, new_enable %#x, start_time %.16e stub.\n", iface,
308 track, new_enable, start_time);
310 return 0;
313 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackBlend(ID3DXAnimationController *iface,
314 float new_blend_weight, double start_time, double duration, D3DXTRANSITION_TYPE transition)
316 FIXME("iface %p, new_blend_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface,
317 new_blend_weight, start_time, duration, transition);
319 return 0;
322 static HRESULT WINAPI d3dx9_animation_controller_UnkeyEvent(ID3DXAnimationController *iface, D3DXEVENTHANDLE event)
324 FIXME("iface %p, event %u stub.\n", iface, event);
326 return E_NOTIMPL;
329 static HRESULT WINAPI d3dx9_animation_controller_UnkeyAllTrackEvents(ID3DXAnimationController *iface, UINT track)
331 FIXME("iface %p, track %u stub.\n", iface, track);
333 return E_NOTIMPL;
336 static HRESULT WINAPI d3dx9_animation_controller_UnkeyAllPriorityBlends(ID3DXAnimationController *iface)
338 FIXME("iface %p stub.\n", iface);
340 return E_NOTIMPL;
343 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetCurrentTrackEvent(ID3DXAnimationController *iface,
344 UINT track, D3DXEVENT_TYPE event_type)
346 FIXME("iface %p, track %u, event_type %u stub.\n", iface, track, event_type);
348 return 0;
351 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetCurrentPriorityBlend(ID3DXAnimationController *iface)
353 FIXME("iface %p stub.\n", iface);
355 return 0;
358 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetUpcomingTrackEvent(ID3DXAnimationController *iface,
359 UINT track, D3DXEVENTHANDLE event)
361 FIXME("iface %p, track %u, event %u stub.\n", iface, track, event);
363 return 0;
366 static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetUpcomingPriorityBlend(ID3DXAnimationController *iface,
367 D3DXEVENTHANDLE event)
369 FIXME("iface %p, event %u stub.\n", iface, event);
371 return 0;
374 static HRESULT WINAPI d3dx9_animation_controller_ValidateEvent(ID3DXAnimationController *iface, D3DXEVENTHANDLE event)
376 FIXME("iface %p, event %u stub.\n", iface, event);
378 return E_NOTIMPL;
381 static HRESULT WINAPI d3dx9_animation_controller_GetEventDesc(ID3DXAnimationController *iface,
382 D3DXEVENTHANDLE event, D3DXEVENT_DESC *desc)
384 FIXME("iface %p, event %u, desc %p stub.\n", iface, event, desc);
386 return E_NOTIMPL;
389 static HRESULT WINAPI d3dx9_animation_controller_CloneAnimationController(ID3DXAnimationController *iface, UINT max_outputs,
390 UINT max_sets, UINT max_tracks, UINT max_events, ID3DXAnimationController **anim_controller)
392 FIXME("iface %p, max_outputs %u, max_sets %u, max_tracks %u, max_events %u, anim_controller %p stub.\n",
393 iface, max_outputs, max_sets, max_tracks, max_events, anim_controller);
395 return E_NOTIMPL;
398 static const struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl =
400 d3dx9_animation_controller_QueryInterface,
401 d3dx9_animation_controller_AddRef,
402 d3dx9_animation_controller_Release,
403 d3dx9_animation_controller_GetMaxNumAnimationOutputs,
404 d3dx9_animation_controller_GetMaxNumAnimationSets,
405 d3dx9_animation_controller_GetMaxNumTracks,
406 d3dx9_animation_controller_GetMaxNumEvents,
407 d3dx9_animation_controller_RegisterAnimationOutput,
408 d3dx9_animation_controller_RegisterAnimationSet,
409 d3dx9_animation_controller_UnregisterAnimationSet,
410 d3dx9_animation_controller_GetNumAnimationSets,
411 d3dx9_animation_controller_GetAnimationSet,
412 d3dx9_animation_controller_GetAnimationSetByName,
413 d3dx9_animation_controller_AdvanceTime,
414 d3dx9_animation_controller_Reset,
415 d3dx9_animation_controller_GetTime,
416 d3dx9_animation_controller_SetTrackAnimationSet,
417 d3dx9_animation_controller_GetTrackAnimationSet,
418 d3dx9_animation_controller_SetTrackPriority,
419 d3dx9_animation_controller_SetTrackSpeed,
420 d3dx9_animation_controller_SetTrackWeight,
421 d3dx9_animation_controller_SetTrackPosition,
422 d3dx9_animation_controller_SetTrackEnable,
423 d3dx9_animation_controller_SetTrackDesc,
424 d3dx9_animation_controller_GetTrackDesc,
425 d3dx9_animation_controller_SetPriorityBlend,
426 d3dx9_animation_controller_GetPriorityBlend,
427 d3dx9_animation_controller_KeyTrackSpeed,
428 d3dx9_animation_controller_KeyTrackWeight,
429 d3dx9_animation_controller_KeyTrackPosition,
430 d3dx9_animation_controller_KeyTrackEnable,
431 d3dx9_animation_controller_KeyTrackBlend,
432 d3dx9_animation_controller_UnkeyEvent,
433 d3dx9_animation_controller_UnkeyAllTrackEvents,
434 d3dx9_animation_controller_UnkeyAllPriorityBlends,
435 d3dx9_animation_controller_GetCurrentTrackEvent,
436 d3dx9_animation_controller_GetCurrentPriorityBlend,
437 d3dx9_animation_controller_GetUpcomingTrackEvent,
438 d3dx9_animation_controller_GetUpcomingPriorityBlend,
439 d3dx9_animation_controller_ValidateEvent,
440 d3dx9_animation_controller_GetEventDesc,
441 d3dx9_animation_controller_CloneAnimationController
444 HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets,
445 UINT max_tracks, UINT max_events, ID3DXAnimationController **controller)
447 struct d3dx9_animation_controller *object;
449 TRACE("max_outputs %u, max_sets %u, max_tracks %u, max_events %u, controller %p.\n",
450 max_outputs, max_sets, max_tracks, max_events, controller);
452 if (!max_outputs || !max_sets || !max_tracks || !max_events || !controller)
453 return D3D_OK;
455 object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
456 if (!object)
457 return E_OUTOFMEMORY;
459 object->ID3DXAnimationController_iface.lpVtbl = &d3dx9_animation_controller_vtbl;
460 object->ref = 1;
461 object->max_outputs = max_outputs;
462 object->max_sets = max_sets;
463 object->max_tracks = max_tracks;
464 object->max_events = max_events;
466 *controller = &object->ID3DXAnimationController_iface;
468 return D3D_OK;
471 struct d3dx9_keyframed_animation_set
473 ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet_iface;
474 LONG ref;
476 const char *name;
477 double ticks_per_second;
478 D3DXPLAYBACK_TYPE playback_type;
479 unsigned int animation_count;
480 unsigned int callback_key_count;
481 const D3DXKEY_CALLBACK *callback_keys;
484 static inline struct d3dx9_keyframed_animation_set *impl_from_ID3DXKeyframedAnimationSet(ID3DXKeyframedAnimationSet *iface)
486 return CONTAINING_RECORD(iface, struct d3dx9_keyframed_animation_set, ID3DXKeyframedAnimationSet_iface);
489 static HRESULT WINAPI d3dx9_keyframed_animation_QueryInterface(ID3DXKeyframedAnimationSet *iface,
490 REFIID riid, void **obj)
492 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), obj);
494 if (IsEqualGUID(riid, &IID_IUnknown)
495 || IsEqualGUID(riid, &IID_ID3DXAnimationSet)
496 || IsEqualGUID(riid, &IID_ID3DXKeyframedAnimationSet))
498 iface->lpVtbl->AddRef(iface);
499 *obj = iface;
500 return D3D_OK;
503 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
504 *obj = NULL;
505 return E_NOINTERFACE;
508 static ULONG WINAPI d3dx9_keyframed_animation_AddRef(ID3DXKeyframedAnimationSet *iface)
510 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
511 ULONG refcount = InterlockedIncrement(&set->ref);
513 TRACE("%p increasing refcount to %u.\n", set, refcount);
515 return refcount;
518 static ULONG WINAPI d3dx9_keyframed_animation_Release(ID3DXKeyframedAnimationSet *iface)
520 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
521 ULONG refcount = InterlockedDecrement(&set->ref);
523 TRACE("%p decreasing refcount to %u.\n", set, refcount);
525 if (!refcount)
527 heap_free((char *)set->name);
528 heap_free(set);
531 return refcount;
534 static const char * WINAPI d3dx9_keyframed_animation_GetName(ID3DXKeyframedAnimationSet *iface)
536 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
538 TRACE("set %p.\n", set);
539 return set->name;
542 static double WINAPI d3dx9_keyframed_animation_GetPeriod(ID3DXKeyframedAnimationSet *iface)
544 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
546 FIXME("set %p stub.\n", set);
547 return 0.0;
550 static double WINAPI d3dx9_keyframed_animation_GetPeriodicPosition(ID3DXKeyframedAnimationSet *iface, double position)
552 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
554 FIXME("set %p, position %.16e stub.\n", set, position);
555 return 0.0;
558 static UINT WINAPI d3dx9_keyframed_animation_GetNumAnimations(ID3DXKeyframedAnimationSet *iface)
560 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
562 FIXME("set %p stub.\n", set);
563 return 0;
566 static HRESULT WINAPI d3dx9_keyframed_animation_GetAnimationNameByIndex(ID3DXKeyframedAnimationSet *iface,
567 UINT index, const char **name)
569 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
571 FIXME("set %p, index %u, name %p stub.\n", set, index, name);
572 return E_NOTIMPL;
575 static HRESULT WINAPI d3dx9_keyframed_animation_GetAnimationIndexByName(ID3DXKeyframedAnimationSet *iface,
576 const char *name, UINT *index)
578 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
580 FIXME("set %p, name %s, index %p stub.\n", set, debugstr_a(name), index);
581 return E_NOTIMPL;
584 static HRESULT WINAPI d3dx9_keyframed_animation_GetSRT(ID3DXKeyframedAnimationSet *iface, double periodic_position,
585 UINT animation, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation)
587 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
589 FIXME("set %p, periodic_position %.16e, animation %u, scale %p, rotation %p, translation %p stub.\n",
590 set, periodic_position, animation, scale, rotation, translation);
591 return E_NOTIMPL;
594 static HRESULT WINAPI d3dx9_keyframed_animation_GetCallback(ID3DXKeyframedAnimationSet *iface, double position,
595 DWORD flags, double *callback_position, void **callback_data)
597 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
599 FIXME("set %p, position %.16e, flags %#x, callback_position %p, callback_data %p stub.\n",
600 set, position, flags, callback_position, callback_data);
601 return E_NOTIMPL;
604 static D3DXPLAYBACK_TYPE WINAPI d3dx9_keyframed_animation_GetPlaybackType(ID3DXKeyframedAnimationSet *iface)
606 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
608 TRACE("set %p.\n", set);
609 return set->playback_type;
612 static double WINAPI d3dx9_keyframed_animation_GetSourceTicksPerSecond(ID3DXKeyframedAnimationSet *iface)
614 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
616 TRACE("set %p.\n", set);
617 return set->ticks_per_second;
620 static UINT WINAPI d3dx9_keyframed_animation_GetNumScaleKeys(ID3DXKeyframedAnimationSet *iface, UINT keys)
622 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
624 FIXME("set %p, keys %u stub.\n", set, keys);
625 return 0;
628 static HRESULT WINAPI d3dx9_keyframed_animation_GetScaleKeys(ID3DXKeyframedAnimationSet *iface, UINT animation,
629 D3DXKEY_VECTOR3 *scale_keys)
631 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
633 FIXME("set %p, animation %u, scale_keys %p stub.\n", set, animation, scale_keys);
634 return E_NOTIMPL;
637 static HRESULT WINAPI d3dx9_keyframed_animation_GetScaleKey(ID3DXKeyframedAnimationSet *iface, UINT animation,
638 UINT key, D3DXKEY_VECTOR3 *scale_key)
640 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
642 FIXME("set %p, animation %u, key %u, scale_key %p stub.\n", set, animation, key, scale_key);
643 return E_NOTIMPL;
646 static HRESULT WINAPI d3dx9_keyframed_animation_SetScaleKey(ID3DXKeyframedAnimationSet *iface, UINT animation,
647 UINT key, D3DXKEY_VECTOR3 *scale_key)
649 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
651 FIXME("set %p, animation %u, key %u, scale_key %p stub.\n", set, animation, key, scale_key);
652 return E_NOTIMPL;
655 static UINT WINAPI d3dx9_keyframed_animation_GetNumRotationKeys(ID3DXKeyframedAnimationSet *iface, UINT animation)
657 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
659 FIXME("set %p, animation %u stub.\n", set, animation);
660 return E_NOTIMPL;
663 static HRESULT WINAPI d3dx9_keyframed_animation_GetRotationKeys(ID3DXKeyframedAnimationSet *iface,
664 UINT animation, D3DXKEY_QUATERNION *rotation_keys)
666 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
668 FIXME("set %p, animation %u, rotation_keys %p stub.\n", set, animation, rotation_keys);
669 return E_NOTIMPL;
672 static HRESULT WINAPI d3dx9_keyframed_animation_GetRotationKey(ID3DXKeyframedAnimationSet *iface,
673 UINT animation, UINT key, D3DXKEY_QUATERNION *rotation_key)
675 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
677 FIXME("set %p, animation %u, key %u, rotation_key %p stub.\n", set, animation, key, rotation_key);
678 return E_NOTIMPL;
681 static HRESULT WINAPI d3dx9_keyframed_animation_SetRotationKey(ID3DXKeyframedAnimationSet *iface,
682 UINT animation, UINT key, D3DXKEY_QUATERNION *rotation_key)
684 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
686 FIXME("set %p, animation %u, key %u, rotation_key %p stub.\n", set, animation, key, rotation_key);
687 return E_NOTIMPL;
690 static UINT WINAPI d3dx9_keyframed_animation_GetNumTranslationKeys(ID3DXKeyframedAnimationSet *iface, UINT animation)
692 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
694 FIXME("set %p, animation %u stub.\n", set, animation);
695 return E_NOTIMPL;
698 static HRESULT WINAPI d3dx9_keyframed_animation_GetTranslationKeys(ID3DXKeyframedAnimationSet *iface,
699 UINT animation, D3DXKEY_VECTOR3 *translation_keys)
701 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
703 FIXME("set %p, animation %u, translation_keys %p stub.\n", set, animation, translation_keys);
704 return E_NOTIMPL;
707 static HRESULT WINAPI d3dx9_keyframed_animation_GetTranslationKey(ID3DXKeyframedAnimationSet *iface,
708 UINT animation, UINT key, D3DXKEY_VECTOR3 *translation_key)
710 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
712 FIXME("set %p, animation %u, key %u, translation_key %p stub.\n", set, animation, key, translation_key);
713 return E_NOTIMPL;
716 static HRESULT WINAPI d3dx9_keyframed_animation_SetTranslationKey(ID3DXKeyframedAnimationSet *iface,
717 UINT animation, UINT key, D3DXKEY_VECTOR3 *translation_key)
719 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
721 FIXME("set %p, animation %u, key %u, translation_key %p stub.\n", set, animation, key, translation_key);
722 return E_NOTIMPL;
725 static UINT WINAPI d3dx9_keyframed_animation_GetNumCallbackKeys(ID3DXKeyframedAnimationSet *iface)
727 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
729 FIXME("set %p stub.\n", set);
730 return E_NOTIMPL;
733 static HRESULT WINAPI d3dx9_keyframed_animation_GetCallbackKeys(ID3DXKeyframedAnimationSet *iface,
734 D3DXKEY_CALLBACK *callback_keys)
736 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
738 FIXME("set %p, callback_keys %p stub.\n", set, callback_keys);
739 return E_NOTIMPL;
742 static HRESULT WINAPI d3dx9_keyframed_animation_GetCallbackKey(ID3DXKeyframedAnimationSet *iface,
743 UINT key, D3DXKEY_CALLBACK *callback_key)
745 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
747 FIXME("set %p, key %u, callback_key %p stub.\n", set, key, callback_key);
748 return E_NOTIMPL;
751 static HRESULT WINAPI d3dx9_keyframed_animation_SetCallbackKey(ID3DXKeyframedAnimationSet *iface,
752 UINT key, D3DXKEY_CALLBACK *callback_key)
754 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
756 FIXME("set %p, key %u, callback_key %p stub.\n", set, key, callback_key);
757 return E_NOTIMPL;
760 static HRESULT WINAPI d3dx9_keyframed_animation_UnregisterScaleKey(ID3DXKeyframedAnimationSet *iface,
761 UINT animation, UINT key)
763 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
765 FIXME("set %p, animation %u, key %u stub.\n", set, animation, key);
766 return E_NOTIMPL;
769 static HRESULT WINAPI d3dx9_keyframed_animation_UnregisterRotationKey(ID3DXKeyframedAnimationSet *iface,
770 UINT animation, UINT key)
772 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
774 FIXME("set %p, animation %u, key %u stub.\n", set, animation, key);
775 return E_NOTIMPL;
778 static HRESULT WINAPI d3dx9_keyframed_animation_UnregisterTranslationKey(ID3DXKeyframedAnimationSet *iface,
779 UINT animation, UINT key)
781 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
783 FIXME("set %p, animation %u, key %u stub.\n", set, animation, key);
784 return E_NOTIMPL;
787 static HRESULT WINAPI d3dx9_keyframed_animation_RegisterAnimationSRTKeys(ID3DXKeyframedAnimationSet *iface,
788 const char *name, UINT scale_keys_count, UINT rotation_keys_count, UINT translation_keys_count,
789 const D3DXKEY_VECTOR3 *scale_keys, const D3DXKEY_QUATERNION *rotation_keys,
790 const D3DXKEY_VECTOR3 *translation_keys, DWORD *animation_index)
792 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
794 FIXME("set %p, name %s, scale_keys_count %u, rotation_keys_count %u, translation_keys_count %u, "
795 "scale_keys %p, rotation_keys %p, translation_keys %p, animation_index %p stub.\n",
796 set, debugstr_a(name), scale_keys_count, rotation_keys_count, translation_keys_count,
797 scale_keys, rotation_keys, translation_keys, animation_index);
798 return E_NOTIMPL;
801 static HRESULT WINAPI d3dx9_keyframed_animation_Compress(ID3DXKeyframedAnimationSet *iface,
802 DWORD flags, float lossiness, D3DXFRAME *hierarchy, ID3DXBuffer **compressed_data)
804 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
806 FIXME("set %p, flags %#x, lossiness %.8e, hierarchy %p, compressed_data %p stub.\n",
807 set, flags, lossiness, hierarchy, compressed_data);
808 return E_NOTIMPL;
811 static HRESULT WINAPI d3dx9_keyframed_animation_UnregisterAnimation(ID3DXKeyframedAnimationSet *iface, UINT index)
813 struct d3dx9_keyframed_animation_set *set = impl_from_ID3DXKeyframedAnimationSet(iface);
815 FIXME("set %p, index %u stub.\n", set, index);
816 return E_NOTIMPL;
819 static const struct ID3DXKeyframedAnimationSetVtbl d3dx9_keyframed_animation_vtbl =
821 d3dx9_keyframed_animation_QueryInterface,
822 d3dx9_keyframed_animation_AddRef,
823 d3dx9_keyframed_animation_Release,
824 d3dx9_keyframed_animation_GetName,
825 d3dx9_keyframed_animation_GetPeriod,
826 d3dx9_keyframed_animation_GetPeriodicPosition,
827 d3dx9_keyframed_animation_GetNumAnimations,
828 d3dx9_keyframed_animation_GetAnimationNameByIndex,
829 d3dx9_keyframed_animation_GetAnimationIndexByName,
830 d3dx9_keyframed_animation_GetSRT,
831 d3dx9_keyframed_animation_GetCallback,
832 d3dx9_keyframed_animation_GetPlaybackType,
833 d3dx9_keyframed_animation_GetSourceTicksPerSecond,
834 d3dx9_keyframed_animation_GetNumScaleKeys,
835 d3dx9_keyframed_animation_GetScaleKeys,
836 d3dx9_keyframed_animation_GetScaleKey,
837 d3dx9_keyframed_animation_SetScaleKey,
838 d3dx9_keyframed_animation_GetNumRotationKeys,
839 d3dx9_keyframed_animation_GetRotationKeys,
840 d3dx9_keyframed_animation_GetRotationKey,
841 d3dx9_keyframed_animation_SetRotationKey,
842 d3dx9_keyframed_animation_GetNumTranslationKeys,
843 d3dx9_keyframed_animation_GetTranslationKeys,
844 d3dx9_keyframed_animation_GetTranslationKey,
845 d3dx9_keyframed_animation_SetTranslationKey,
846 d3dx9_keyframed_animation_GetNumCallbackKeys,
847 d3dx9_keyframed_animation_GetCallbackKeys,
848 d3dx9_keyframed_animation_GetCallbackKey,
849 d3dx9_keyframed_animation_SetCallbackKey,
850 d3dx9_keyframed_animation_UnregisterScaleKey,
851 d3dx9_keyframed_animation_UnregisterRotationKey,
852 d3dx9_keyframed_animation_UnregisterTranslationKey,
853 d3dx9_keyframed_animation_RegisterAnimationSRTKeys,
854 d3dx9_keyframed_animation_Compress,
855 d3dx9_keyframed_animation_UnregisterAnimation
858 HRESULT WINAPI D3DXCreateKeyframedAnimationSet(const char *name, double ticks_per_second,
859 D3DXPLAYBACK_TYPE playback_type, UINT animation_count, UINT callback_key_count,
860 const D3DXKEY_CALLBACK *callback_keys, ID3DXKeyframedAnimationSet **animation_set)
862 struct d3dx9_keyframed_animation_set *object;
863 char *string;
865 TRACE("name %s, ticks_per_second %.16e, playback_type %u, animation_count %u, "
866 "callback_key_count %u, callback_keys %p, animation_set %p.\n",
867 debugstr_a(name), ticks_per_second, playback_type, animation_count,
868 callback_key_count, callback_keys, animation_set);
870 if (!animation_count)
871 return D3DERR_INVALIDCALL;
873 if (!(object = heap_alloc(sizeof(*object))))
874 return E_OUTOFMEMORY;
876 object->ID3DXKeyframedAnimationSet_iface.lpVtbl = &d3dx9_keyframed_animation_vtbl;
877 object->ref = 1;
878 if (!(string = heap_alloc(strlen(name) + 1)))
880 heap_free(object);
881 return E_OUTOFMEMORY;
883 strcpy(string, name);
884 object->name = string;
885 object->ticks_per_second = ticks_per_second;
886 object->playback_type = playback_type;
887 object->animation_count = animation_count;
888 object->callback_key_count = callback_key_count;
889 object->callback_keys = callback_keys;
891 *animation_set = &object->ID3DXKeyframedAnimationSet_iface;
893 return D3D_OK;