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
;
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
);
54 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
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
);
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
);
78 HeapFree(GetProcessHeap(), 0, animation
);
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
);
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
);
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
);
145 static UINT WINAPI
d3dx9_animation_controller_GetNumAnimationSets(ID3DXAnimationController
*iface
)
147 FIXME("iface %p stub.\n", iface
);
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
);
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
);
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
);
176 static HRESULT WINAPI
d3dx9_animation_controller_Reset(ID3DXAnimationController
*iface
)
178 FIXME("iface %p stub.\n", iface
);
183 static double WINAPI
d3dx9_animation_controller_GetTime(ID3DXAnimationController
*iface
)
185 FIXME("iface %p stub.\n", iface
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
262 static HRESULT WINAPI
d3dx9_animation_controller_SetPriorityBlend(ID3DXAnimationController
*iface
,
265 FIXME("iface %p, blend_weight %.8e stub.\n", iface
, blend_weight
);
270 static float WINAPI
d3dx9_animation_controller_GetPriorityBlend(ID3DXAnimationController
*iface
)
272 FIXME("iface %p stub.\n", iface
);
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
);
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
);
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
);
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
);
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
);
322 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyEvent(ID3DXAnimationController
*iface
, D3DXEVENTHANDLE event
)
324 FIXME("iface %p, event %u stub.\n", iface
, event
);
329 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyAllTrackEvents(ID3DXAnimationController
*iface
, UINT track
)
331 FIXME("iface %p, track %u stub.\n", iface
, track
);
336 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyAllPriorityBlends(ID3DXAnimationController
*iface
)
338 FIXME("iface %p stub.\n", iface
);
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
);
351 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetCurrentPriorityBlend(ID3DXAnimationController
*iface
)
353 FIXME("iface %p stub.\n", iface
);
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
);
366 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetUpcomingPriorityBlend(ID3DXAnimationController
*iface
,
367 D3DXEVENTHANDLE event
)
369 FIXME("iface %p, event %u stub.\n", iface
, event
);
374 static HRESULT WINAPI
d3dx9_animation_controller_ValidateEvent(ID3DXAnimationController
*iface
, D3DXEVENTHANDLE event
)
376 FIXME("iface %p, event %u stub.\n", iface
, event
);
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
);
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
);
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
)
455 object
= HeapAlloc(GetProcessHeap(), 0, sizeof(*object
));
457 return E_OUTOFMEMORY
;
459 object
->ID3DXAnimationController_iface
.lpVtbl
= &d3dx9_animation_controller_vtbl
;
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
;
471 HRESULT WINAPI
D3DXCreateKeyframedAnimationSet(const char *name
, double ticks_per_second
,
472 D3DXPLAYBACK_TYPE playback_type
, UINT animation_count
, UINT callback_key_count
,
473 const D3DXKEY_CALLBACK
*callback_keys
, ID3DXKeyframedAnimationSet
**animation_set
)
475 FIXME("name %s, ticks_per_second %.16e, playback_type %u, animation_count %u, "
476 "callback_key_count %u, callback_keys %p, animation_set %p stub.\n",
477 debugstr_a(name
), ticks_per_second
, playback_type
, animation_count
,
478 callback_key_count
, callback_keys
, animation_set
);