DAEUtil.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef DAEUTIL_H_
  2. #define DAEUTIL_H_
  3. namespace gameplay
  4. {
  5. /**
  6. * Gets all of the animation channels that target the given node and appends them to the list.
  7. *
  8. * @param node The node that the animation channels target.
  9. * @param channels The list of channels to append to.
  10. */
  11. void getAnimationChannels(const domNodeRef& node, std::list<domChannelRef>& channels);
  12. /**
  13. * Gets the joint names for the given source and appends them to the given list.
  14. *
  15. * @param source The source element to search in.
  16. * @param list The list to append the joint names to.
  17. */
  18. void getJointNames(const domSourceRef source, std::vector<std::string>& list);
  19. /**
  20. * Gets the joint names for the given skin and appends them to the given list.
  21. *
  22. * @param skin The skin element to search in.
  23. * @param list The list to append the joint names to.
  24. */
  25. void getJointNames(const domSkin* skin, std::vector<std::string>& list);
  26. /**
  27. * Gets the input source from the given channel.
  28. *
  29. * @param channel The channel to search in.
  30. *
  31. * @return The source element or NULL if not found.
  32. */
  33. domSource* getInputSource(const domChannelRef& channel);
  34. /**
  35. * Returns the sampler from the given channel.
  36. *
  37. * @param channel The channel dom element.
  38. *
  39. * @return The sampler or NULL if not found.
  40. */
  41. const domSamplerRef getSampler(const domChannelRef& channel);
  42. /**
  43. * Returns the source from the given sampler input.
  44. * Searchs within the given animation.
  45. *
  46. * @param inputLocal The input element within a sampler.
  47. * @param animation The animation to search within.
  48. *
  49. * @return The source or NULL if not found.
  50. */
  51. const domSourceRef getSource(const domInputLocalRef& inputLocal, const domAnimationRef& animation);
  52. /**
  53. * Returns the name array from the given source.
  54. *
  55. * @param source The source element.
  56. *
  57. * @return The name array or NULL if not found.
  58. */
  59. const domName_arrayRef getSourceNameArray(const domSourceRef& source);
  60. /**
  61. * Returns one skeleton from the given instance controller.
  62. * The COLLADA spec says that instance_controller can have multiple skeletons but we only need one.
  63. * Maya sometimes exports multiple skeleton nodes so this function will try to find the correct one.
  64. *
  65. * @param instanceController The instance_controller element.
  66. *
  67. * @return The skeleton or NULL if not found.
  68. */
  69. const domInstance_controller::domSkeletonRef getSkeleton(const domInstance_controllerRef& instanceController);
  70. /**
  71. * Returns the root joint node of the given skin.
  72. *
  73. * @param skin The COLLADA skin to get the root joint for.
  74. *
  75. * @return The COLLADA node or NULL if not found.
  76. */
  77. domNode* getRootJointNode(const domSkin* skin);
  78. /**
  79. * Returns true if the two given animation channels have equal key time input source.
  80. *
  81. * @param c1 Channel one to compare.
  82. * @param c2 Channel two to compare.
  83. *
  84. * @return True if the channels have the same key times, false otherwise.
  85. */
  86. bool equalKeyTimes(const domChannelRef& c1, const domChannelRef& c2);
  87. /**
  88. * Returns true if the two sources have the same key times.
  89. *
  90. * @param s1 Source one.
  91. * @param s2 Source two.
  92. *
  93. * @return True true if the key times are equal, false otherwise.
  94. */
  95. bool equalKeyTimes(const domSource* s1, const domSource* s2);
  96. /**
  97. * Moves a channel and the sources it uses to the destination animation.
  98. *
  99. * @param channel The channel to move.
  100. * @param animation The destination animation to copy to.
  101. */
  102. void moveChannelAndSouresToAnimation(domChannelRef& channel, domAnimationRef& animation);
  103. /**
  104. * Returns true if the given animation is empty and contains no children.
  105. *
  106. * @param animation The animation element to check.
  107. *
  108. * @return True if the animation has no children, false otherwise.
  109. */
  110. bool isEmptyAnimation(domAnimationRef& animation);
  111. /**
  112. * Gets the visual scene from the given COLLADA dom scene.
  113. *
  114. * @param COLLADA dom scene.
  115. *
  116. * @return The visual scene or NULL if not found.
  117. */
  118. domVisual_scene* getVisualScene(const domCOLLADA::domSceneRef& domScene);
  119. }
  120. #endif