AnimationNativeAccess.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. #ifndef _AnimationGraphNativeAccessor_h_
  2. #define _AnimationGraphNativeAccessor_h_
  3. //------------------------------------------------------------------------------------
  4. // * На время работы все передоваемые указатели должны быть валидны
  5. // * С возвращаемыми указателями можно пользоваться пока что загружена анимация
  6. //
  7. // Аксесоры:
  8. //
  9. // AGNA_GlobalInfo Получить общую информацию по графу
  10. // AGNA_NodeInfo Получить информацию о ноде
  11. // AGNA_LinkInfo Получить информацию о линке нода
  12. // AGNA_ClipInfo Получить информацию об клипе
  13. // AGNA_EventInfo Получить информацию об эвенте клипа
  14. //
  15. //------------------------------------------------------------------------------------
  16. #include "Animation.h"
  17. #include "templates\string.h"
  18. enum AGNA_Types
  19. {
  20. agna_unknown = 0,
  21. agna_global,
  22. agna_node_by_name,
  23. agna_node_by_index,
  24. agna_link,
  25. agna_clip,
  26. agna_event,
  27. agna_global_event,
  28. agna_get_frame,
  29. agna_set_frame,
  30. agna_get_number_of_frames,
  31. agna_is_bone_use_global_pos,
  32. agna_set_fps,
  33. agna_goto_nodeclip,
  34. agna_pause,
  35. agna_block_control,
  36. };
  37. //Получить общую информацию по графу
  38. struct AGNA_GlobalInfo : public IAnimation::GraphNativeAccessor
  39. {
  40. AGNA_GlobalInfo()
  41. {
  42. accessorType = agna_global;
  43. numNodes = 0;
  44. numLinks = 0;
  45. numConstatns = 0;
  46. numEvents = 0;
  47. numClips = 0;
  48. };
  49. dword numNodes; //Количество нодов в графе
  50. dword numLinks; //Общее количество линков в графе
  51. dword numConstatns; //Общее количество констант в графе
  52. dword numEvents; //Общее количество евентов в графе
  53. dword numClips; //Общее количество клипов в графе
  54. };
  55. //Получить информацию о ноде
  56. struct AGNA_NodeInfo : public IAnimation::GraphNativeAccessor
  57. {
  58. AGNA_NodeInfo(const char * nodeName)
  59. {
  60. accessorType = agna_node_by_name;
  61. Reset();
  62. name = nodeName;
  63. };
  64. AGNA_NodeInfo(dword nodeIndex)
  65. {
  66. accessorType = agna_node_by_index;
  67. Reset();
  68. index = nodeIndex;
  69. };
  70. void Reset()
  71. {
  72. name = "";
  73. index = -1;
  74. numClips = 0;
  75. numConsts = 0;
  76. numLinks = 0;
  77. defLink = 0;
  78. isLoop = false;
  79. isChange = false;
  80. }
  81. const char * name; //Имя нода
  82. dword index; //Индекс нода
  83. dword numClips; //Количество клипов в ноде
  84. dword numConsts; //Количество констант
  85. dword numLinks; //Количество линков
  86. long defLink; //Линк по которому переходить в случае отсутствия активных ликтов
  87. bool isLoop; //Зацикленно проигрывать действия
  88. bool isChange; //Менять ли клип на следующем цикле
  89. };
  90. //Получить информацию о линке нода
  91. struct AGNA_LinkInfo : public IAnimation::GraphNativeAccessor
  92. {
  93. AGNA_LinkInfo(dword _nodeIndex, dword _linkIndex)
  94. {
  95. accessorType = agna_link;
  96. nodeIndex = _nodeIndex;
  97. linkIndex = _linkIndex;
  98. command = "";
  99. to = _nodeIndex;
  100. arange[0] = -1;
  101. arange[1] = -1;
  102. mrange[0] = -1;
  103. mrange[1] = -1;
  104. kBlendTime = 1.0f;
  105. syncPos = -1.0f;
  106. };
  107. dword nodeIndex; //Индекс нода в графе
  108. dword linkIndex; //Индекс линка в ноде
  109. const char * command; //Команда линка (имя)
  110. dword to; //На какой нод переходить (индекс нода)
  111. dword arange[2]; //диапазон активации
  112. dword mrange[2]; //диапазона перехода
  113. float kBlendTime; //Коэфициент время блендинга между нодами 1/t
  114. float syncPos; //Относительная синхронизация нодов, -1 нету её
  115. };
  116. //Получить информацию об клипе
  117. struct AGNA_ClipInfo : public IAnimation::GraphNativeAccessor
  118. {
  119. AGNA_ClipInfo(dword _nodeIndex, dword _clipIndex)
  120. {
  121. accessorType = agna_clip;
  122. nodeIndex = _nodeIndex;
  123. clipIndex = _clipIndex;
  124. numEvents = 0;
  125. frames = 0;
  126. fps = 0.0f;
  127. probability = 0.0f;
  128. };
  129. dword nodeIndex; //Индекс нода в графе
  130. dword clipIndex; //Индекс клипа в ноде
  131. dword numEvents; //Количество событий
  132. dword frames; //Размер клипа в кадрах
  133. float fps; //Скорость проигрывания анимации
  134. float probability; //Нормализованная вероятность выбора клипа в ноде
  135. };
  136. //Получить информацию об эвенте клипа
  137. struct AGNA_EventInfo : public IAnimation::GraphNativeAccessor
  138. {
  139. AGNA_EventInfo(dword _nodeIndex, dword _clipIndex, dword _eventIndex)
  140. {
  141. accessorType = agna_event;
  142. nodeIndex = _nodeIndex;
  143. clipIndex = _clipIndex;
  144. eventIndex = _eventIndex;
  145. name = "";
  146. frame = 0;
  147. params = null;
  148. numParams = 0;
  149. };
  150. dword nodeIndex; //Индекс нода в графе
  151. dword clipIndex; //Индекс клипа в ноде
  152. dword eventIndex; //Индекс эвента в клипе
  153. const char * name; //Имя события
  154. dword frame; //Кадр срабатывания события
  155. const char ** params; //Параметры события
  156. dword numParams; //Количество параметров
  157. };
  158. //Получить информацию об эвенте клипа
  159. struct AGNA_GlobalEventInfo : public IAnimation::GraphNativeAccessor
  160. {
  161. AGNA_GlobalEventInfo(dword _globalIndex)
  162. {
  163. accessorType = agna_global_event;
  164. eventIndex = _globalIndex;
  165. name = "";
  166. frame = 0;
  167. params = null;
  168. numParams = 0;
  169. };
  170. dword eventIndex; //Индекс эвента в графе
  171. const char * name; //Имя события
  172. dword frame; //Кадр срабатывания события
  173. const char ** params; //Параметры события
  174. dword numParams; //Количество параметров
  175. };
  176. //Получить текущий проигрываемый кадр
  177. struct AGNA_GetCurrentFrame : public IAnimation::GraphNativeAccessor
  178. {
  179. AGNA_GetCurrentFrame()
  180. {
  181. accessorType = agna_get_frame;
  182. currentFrame = -1.0f;
  183. }
  184. float currentFrame;
  185. };
  186. //Установить текущий проигрываемый кадр
  187. struct AGNA_SetCurrentFrame : public IAnimation::GraphNativeAccessor
  188. {
  189. AGNA_SetCurrentFrame(float frame)
  190. {
  191. accessorType = agna_set_frame;
  192. currentFrame = frame;
  193. }
  194. float currentFrame;
  195. };
  196. //Получить текущий проигрываемый кадр
  197. struct AGNA_GetNumberOfFrames : public IAnimation::GraphNativeAccessor
  198. {
  199. AGNA_GetNumberOfFrames()
  200. {
  201. accessorType = agna_get_number_of_frames;
  202. frames = 0;
  203. }
  204. dword frames;
  205. };
  206. //Использует ли кость основного проигрывателя глобальные позиции в данный момент
  207. struct AGNA_IsBoneUseGlobalPos : public IAnimation::GraphNativeAccessor
  208. {
  209. AGNA_IsBoneUseGlobalPos(long boneIndex)
  210. {
  211. accessorType = agna_is_bone_use_global_pos;
  212. index = boneIndex;
  213. }
  214. long index;
  215. };
  216. struct AGNA_SetFPS : public IAnimation::GraphNativeAccessor
  217. {
  218. AGNA_SetFPS(float newFPS)
  219. {
  220. accessorType = agna_set_fps;
  221. fps = newFPS;
  222. }
  223. float fps;
  224. };
  225. //Выполнить переход на нод с возможностью выбора клипа
  226. struct AGNA_GotoNodeClip : public IAnimation::GraphNativeAccessor
  227. {
  228. AGNA_GotoNodeClip(const char * _node, long _clipIndex, float _blendTime)
  229. {
  230. accessorType = agna_goto_nodeclip;
  231. node = _node;
  232. clipIndex = _clipIndex;
  233. blendTime = _blendTime;
  234. }
  235. const char * node;
  236. long clipIndex;
  237. float blendTime;
  238. };
  239. //Выполнить переход на нод с возможностью выбора клипа
  240. struct AGNA_AnimationPause : public IAnimation::GraphNativeAccessor
  241. {
  242. AGNA_AnimationPause(bool isPause)
  243. {
  244. accessorType = agna_pause;
  245. isAnimationPause = isPause;
  246. }
  247. bool isAnimationPause;
  248. };
  249. //Заблокировать стандартное управление анимацией и оставить долтуп только через аксессоры
  250. struct AGNA_BlockControl : public IAnimation::GraphNativeAccessor
  251. {
  252. AGNA_BlockControl(bool isBlock)
  253. {
  254. accessorType = agna_block_control;
  255. isBlockControl = isBlock;
  256. }
  257. bool isBlockControl;
  258. };
  259. #endif