💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.8 KiB

  1. /*
  2. * Copyright (C) 2021 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code 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
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_ANIMATION_POSE_HPP
  20. #define ANTKEEPER_ANIMATION_POSE_HPP
  21. #include "animation/bone.hpp"
  22. #include "math/transform-type.hpp"
  23. #include "utility/fundamental-types.hpp"
  24. #include <map>
  25. /**
  26. * Skeletal animation pose.
  27. */
  28. typedef std::map<bone, math::transform<float>, bone_index_compare> pose;
  29. /**
  30. * Transforms a pose from bone-space into skeleton-space.
  31. *
  32. * @param[in] bone_space Bone-space pose.
  33. * @param[out] skeleton_space Skeleton-space pose.
  34. *
  35. * @warning If the index of any child bone is greater than its parent index, the concatenated pose may be incorrect.
  36. */
  37. void concatenate(const pose& bone_space, pose& skeleton_space);
  38. /**
  39. * Inverses each transform in a pose.
  40. *
  41. * @param[in] x Input pose.
  42. * @param[out] y Output pose.
  43. */
  44. void inverse(const pose& x, pose& y);
  45. /**
  46. * Generates a skinning matrix palette from a pose.
  47. *
  48. * @param inverse_bind_pose Inverse of the skeleton-space bind pose.
  49. * @param pose Bone-space Skeleton-space pose.
  50. */
  51. void matrix_palette(const pose& inverse_bind_pose, const pose& pose, float4x4* palette);
  52. #endif // ANTKEEPER_ANIMATION_POSE_HPP