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
21 #include "d3dx9_36_private.h"
23 struct d3dx9_animation_controller
25 ID3DXAnimationController ID3DXAnimationController_iface
;
34 static inline struct d3dx9_animation_controller
*impl_from_ID3DXAnimationController(ID3DXAnimationController
*iface
)
36 return CONTAINING_RECORD(iface
, struct d3dx9_animation_controller
, ID3DXAnimationController_iface
);
39 static HRESULT WINAPI
d3dx9_animation_controller_QueryInterface(ID3DXAnimationController
*iface
, REFIID riid
, void **out
)
41 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
43 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
44 IsEqualGUID(riid
, &IID_ID3DXAnimationController
))
46 iface
->lpVtbl
->AddRef(iface
);
51 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
56 static ULONG WINAPI
d3dx9_animation_controller_AddRef(ID3DXAnimationController
*iface
)
58 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
59 ULONG refcount
= InterlockedIncrement(&animation
->ref
);
61 TRACE("%p increasing refcount to %u.\n", animation
, refcount
);
66 static ULONG WINAPI
d3dx9_animation_controller_Release(ID3DXAnimationController
*iface
)
68 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
69 ULONG refcount
= InterlockedDecrement(&animation
->ref
);
71 TRACE("%p decreasing refcount to %u.\n", animation
, refcount
);
75 HeapFree(GetProcessHeap(), 0, animation
);
81 static UINT WINAPI
d3dx9_animation_controller_GetMaxNumAnimationOutputs(ID3DXAnimationController
*iface
)
83 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
85 TRACE("iface %p.\n", iface
);
87 return animation
->max_outputs
;
90 static UINT WINAPI
d3dx9_animation_controller_GetMaxNumAnimationSets(ID3DXAnimationController
*iface
)
92 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
94 TRACE("iface %p.\n", iface
);
96 return animation
->max_sets
;
99 static UINT WINAPI
d3dx9_animation_controller_GetMaxNumTracks(ID3DXAnimationController
*iface
)
101 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
103 TRACE("iface %p.\n", iface
);
105 return animation
->max_tracks
;
108 static UINT WINAPI
d3dx9_animation_controller_GetMaxNumEvents(ID3DXAnimationController
*iface
)
110 struct d3dx9_animation_controller
*animation
= impl_from_ID3DXAnimationController(iface
);
112 TRACE("iface %p.\n", iface
);
114 return animation
->max_events
;
117 static HRESULT WINAPI
d3dx9_animation_controller_RegisterAnimationOutput(ID3DXAnimationController
*iface
,
118 const char *name
, D3DXMATRIX
*matrix
, D3DXVECTOR3
*scale
, D3DXQUATERNION
*rotation
, D3DXVECTOR3
*translation
)
120 FIXME("iface %p, name %s, matrix %p, scale %p, rotation %p, translation %p stub.\n", iface
, debugstr_a(name
),
121 matrix
, scale
, rotation
, translation
);
126 static HRESULT WINAPI
d3dx9_animation_controller_RegisterAnimationSet(ID3DXAnimationController
*iface
,
127 ID3DXAnimationSet
*anim_set
)
129 FIXME("iface %p, anim_set %p stub.\n", iface
, anim_set
);
134 static HRESULT WINAPI
d3dx9_animation_controller_UnregisterAnimationSet(ID3DXAnimationController
*iface
,
135 ID3DXAnimationSet
*anim_set
)
137 FIXME("iface %p, anim_set %p stub.\n", iface
, anim_set
);
142 static UINT WINAPI
d3dx9_animation_controller_GetNumAnimationSets(ID3DXAnimationController
*iface
)
144 FIXME("iface %p stub.\n", iface
);
149 static HRESULT WINAPI
d3dx9_animation_controller_GetAnimationSet(ID3DXAnimationController
*iface
,
150 UINT index
, ID3DXAnimationSet
**anim_set
)
152 FIXME("iface %p, index %u, anim_set %p stub.\n", iface
, index
, anim_set
);
157 static HRESULT WINAPI
d3dx9_animation_controller_GetAnimationSetByName(ID3DXAnimationController
*iface
,
158 const char *name
, ID3DXAnimationSet
**anim_set
)
160 FIXME("iface %p, name %s, anim_set %p stub.\n", iface
, debugstr_a(name
), anim_set
);
165 static HRESULT WINAPI
d3dx9_animation_controller_AdvanceTime(ID3DXAnimationController
*iface
, double time_delta
,
166 ID3DXAnimationCallbackHandler
*callback_handler
)
168 FIXME("iface %p, time_delta %.16e, callback_handler %p stub.\n", iface
, time_delta
, callback_handler
);
173 static HRESULT WINAPI
d3dx9_animation_controller_Reset(ID3DXAnimationController
*iface
)
175 FIXME("iface %p stub.\n", iface
);
180 static double WINAPI
d3dx9_animation_controller_GetTime(ID3DXAnimationController
*iface
)
182 FIXME("iface %p stub.\n", iface
);
187 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackAnimationSet(ID3DXAnimationController
*iface
,
188 UINT track
, ID3DXAnimationSet
*anim_set
)
190 FIXME("iface %p, track %u, anim_set %p stub.\n", iface
, track
, anim_set
);
195 static HRESULT WINAPI
d3dx9_animation_controller_GetTrackAnimationSet(ID3DXAnimationController
*iface
,
196 UINT track
, ID3DXAnimationSet
**anim_set
)
198 FIXME("iface %p, track %u, anim_set %p stub.\n", iface
, track
, anim_set
);
203 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackPriority(ID3DXAnimationController
*iface
,
204 UINT track
, D3DXPRIORITY_TYPE priority
)
206 FIXME("iface %p, track %u, priority %u stub.\n", iface
, track
, priority
);
211 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackSpeed(ID3DXAnimationController
*iface
,
212 UINT track
, float speed
)
214 FIXME("iface %p, track %u, speed %.8e stub.\n", iface
, track
, speed
);
219 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackWeight(ID3DXAnimationController
*iface
,
220 UINT track
, float weight
)
222 FIXME("iface %p, track %u, weight %.8e stub.\n", iface
, track
, weight
);
227 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackPosition(ID3DXAnimationController
*iface
,
228 UINT track
, double position
)
230 FIXME("iface %p, track %u, position %.16e stub.\n", iface
, track
, position
);
235 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackEnable(ID3DXAnimationController
*iface
,
236 UINT track
, BOOL enable
)
238 FIXME("iface %p, track %u, enable %#x stub.\n", iface
, track
, enable
);
243 static HRESULT WINAPI
d3dx9_animation_controller_SetTrackDesc(ID3DXAnimationController
*iface
,
244 UINT track
, D3DXTRACK_DESC
*desc
)
246 FIXME("iface %p, track %u, desc %p stub.\n", iface
, track
, desc
);
251 static HRESULT WINAPI
d3dx9_animation_controller_GetTrackDesc(ID3DXAnimationController
*iface
,
252 UINT track
, D3DXTRACK_DESC
*desc
)
254 FIXME("iface %p, track %u, desc %p stub.\n", iface
, track
, desc
);
259 static HRESULT WINAPI
d3dx9_animation_controller_SetPriorityBlend(ID3DXAnimationController
*iface
,
262 FIXME("iface %p, blend_weight %.8e stub.\n", iface
, blend_weight
);
267 static float WINAPI
d3dx9_animation_controller_GetPriorityBlend(ID3DXAnimationController
*iface
)
269 FIXME("iface %p stub.\n", iface
);
274 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_KeyTrackSpeed(ID3DXAnimationController
*iface
,
275 UINT track
, float new_speed
, double start_time
, double duration
, D3DXTRANSITION_TYPE transition
)
277 FIXME("iface %p, track %u, new_speed %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface
,
278 track
, new_speed
, start_time
, duration
, transition
);
283 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_KeyTrackWeight(ID3DXAnimationController
*iface
,
284 UINT track
, float new_weight
, double start_time
, double duration
, D3DXTRANSITION_TYPE transition
)
286 FIXME("iface %p, track %u, new_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface
,
287 track
, new_weight
, start_time
, duration
, transition
);
292 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_KeyTrackPosition(ID3DXAnimationController
*iface
,
293 UINT track
, double new_position
, double start_time
)
295 FIXME("iface %p, track %u, new_position %.16e, start_time %.16e stub.\n", iface
,
296 track
, new_position
, start_time
);
301 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_KeyTrackEnable(ID3DXAnimationController
*iface
,
302 UINT track
, BOOL new_enable
, double start_time
)
304 FIXME("iface %p, track %u, new_enable %#x, start_time %.16e stub.\n", iface
,
305 track
, new_enable
, start_time
);
310 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_KeyTrackBlend(ID3DXAnimationController
*iface
,
311 float new_blend_weight
, double start_time
, double duration
, D3DXTRANSITION_TYPE transition
)
313 FIXME("iface %p, new_blend_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface
,
314 new_blend_weight
, start_time
, duration
, transition
);
319 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyEvent(ID3DXAnimationController
*iface
, D3DXEVENTHANDLE event
)
321 FIXME("iface %p, event %u stub.\n", iface
, event
);
326 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyAllTrackEvents(ID3DXAnimationController
*iface
, UINT track
)
328 FIXME("iface %p, track %u stub.\n", iface
, track
);
333 static HRESULT WINAPI
d3dx9_animation_controller_UnkeyAllPriorityBlends(ID3DXAnimationController
*iface
)
335 FIXME("iface %p stub.\n", iface
);
340 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetCurrentTrackEvent(ID3DXAnimationController
*iface
,
341 UINT track
, D3DXEVENT_TYPE event_type
)
343 FIXME("iface %p, track %u, event_type %u stub.\n", iface
, track
, event_type
);
348 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetCurrentPriorityBlend(ID3DXAnimationController
*iface
)
350 FIXME("iface %p stub.\n", iface
);
355 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetUpcomingTrackEvent(ID3DXAnimationController
*iface
,
356 UINT track
, D3DXEVENTHANDLE event
)
358 FIXME("iface %p, track %u, event %u stub.\n", iface
, track
, event
);
363 static D3DXEVENTHANDLE WINAPI
d3dx9_animation_controller_GetUpcomingPriorityBlend(ID3DXAnimationController
*iface
,
364 D3DXEVENTHANDLE event
)
366 FIXME("iface %p, event %u stub.\n", iface
, event
);
371 static HRESULT WINAPI
d3dx9_animation_controller_ValidateEvent(ID3DXAnimationController
*iface
, D3DXEVENTHANDLE event
)
373 FIXME("iface %p, event %u stub.\n", iface
, event
);
378 static HRESULT WINAPI
d3dx9_animation_controller_GetEventDesc(ID3DXAnimationController
*iface
,
379 D3DXEVENTHANDLE event
, D3DXEVENT_DESC
*desc
)
381 FIXME("iface %p, event %u, desc %p stub.\n", iface
, event
, desc
);
386 static HRESULT WINAPI
d3dx9_animation_controller_CloneAnimationController(ID3DXAnimationController
*iface
, UINT max_outputs
,
387 UINT max_sets
, UINT max_tracks
, UINT max_events
, ID3DXAnimationController
**anim_controller
)
389 FIXME("iface %p, max_outputs %u, max_sets %u, max_tracks %u, max_events %u, anim_controller %p stub.\n",
390 iface
, max_outputs
, max_sets
, max_tracks
, max_events
, anim_controller
);
395 static /* const */ struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl
=
397 d3dx9_animation_controller_QueryInterface
,
398 d3dx9_animation_controller_AddRef
,
399 d3dx9_animation_controller_Release
,
400 d3dx9_animation_controller_GetMaxNumAnimationOutputs
,
401 d3dx9_animation_controller_GetMaxNumAnimationSets
,
402 d3dx9_animation_controller_GetMaxNumTracks
,
403 d3dx9_animation_controller_GetMaxNumEvents
,
404 d3dx9_animation_controller_RegisterAnimationOutput
,
405 d3dx9_animation_controller_RegisterAnimationSet
,
406 d3dx9_animation_controller_UnregisterAnimationSet
,
407 d3dx9_animation_controller_GetNumAnimationSets
,
408 d3dx9_animation_controller_GetAnimationSet
,
409 d3dx9_animation_controller_GetAnimationSetByName
,
410 d3dx9_animation_controller_AdvanceTime
,
411 d3dx9_animation_controller_Reset
,
412 d3dx9_animation_controller_GetTime
,
413 d3dx9_animation_controller_SetTrackAnimationSet
,
414 d3dx9_animation_controller_GetTrackAnimationSet
,
415 d3dx9_animation_controller_SetTrackPriority
,
416 d3dx9_animation_controller_SetTrackSpeed
,
417 d3dx9_animation_controller_SetTrackWeight
,
418 d3dx9_animation_controller_SetTrackPosition
,
419 d3dx9_animation_controller_SetTrackEnable
,
420 d3dx9_animation_controller_SetTrackDesc
,
421 d3dx9_animation_controller_GetTrackDesc
,
422 d3dx9_animation_controller_SetPriorityBlend
,
423 d3dx9_animation_controller_GetPriorityBlend
,
424 d3dx9_animation_controller_KeyTrackSpeed
,
425 d3dx9_animation_controller_KeyTrackWeight
,
426 d3dx9_animation_controller_KeyTrackPosition
,
427 d3dx9_animation_controller_KeyTrackEnable
,
428 d3dx9_animation_controller_KeyTrackBlend
,
429 d3dx9_animation_controller_UnkeyEvent
,
430 d3dx9_animation_controller_UnkeyAllTrackEvents
,
431 d3dx9_animation_controller_UnkeyAllPriorityBlends
,
432 d3dx9_animation_controller_GetCurrentTrackEvent
,
433 d3dx9_animation_controller_GetCurrentPriorityBlend
,
434 d3dx9_animation_controller_GetUpcomingTrackEvent
,
435 d3dx9_animation_controller_GetUpcomingPriorityBlend
,
436 d3dx9_animation_controller_ValidateEvent
,
437 d3dx9_animation_controller_GetEventDesc
,
438 d3dx9_animation_controller_CloneAnimationController
441 HRESULT WINAPI
D3DXCreateAnimationController(UINT max_outputs
, UINT max_sets
,
442 UINT max_tracks
, UINT max_events
, ID3DXAnimationController
**controller
)
444 struct d3dx9_animation_controller
*object
;
446 TRACE("max_outputs %u, max_sets %u, max_tracks %u, max_events %u, controller %p.\n",
447 max_outputs
, max_sets
, max_tracks
, max_events
, controller
);
449 if (!max_outputs
|| !max_sets
|| !max_tracks
|| !max_events
|| !controller
)
452 object
= HeapAlloc(GetProcessHeap(), 0, sizeof(*object
));
454 return E_OUTOFMEMORY
;
456 object
->ID3DXAnimationController_iface
.lpVtbl
= &d3dx9_animation_controller_vtbl
;
458 object
->max_outputs
= max_outputs
;
459 object
->max_sets
= max_sets
;
460 object
->max_tracks
= max_tracks
;
461 object
->max_events
= max_events
;
463 *controller
= &object
->ID3DXAnimationController_iface
;