DrawSkeleton.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <Ogre.h>
  17. /**
  18. * A skeleton bone.
  19. */
  20. struct Bone{
  21. /**
  22. * Initializer
  23. */
  24. Bone(): length(0), parent_id(-1){}
  25. /**
  26. * Bone length.
  27. */
  28. float length;
  29. /**
  30. * Parent bone ID.
  31. */
  32. int parent_id;
  33. };
  34. typedef std::vector<Bone> Skeleton;
  35. /**
  36. * Draws a skeleton.
  37. *
  38. * @param[in] skeleton The skeleton to draw.
  39. * @param[in] mesh Parent mesh for the skeleton.
  40. */
  41. void DrawSkeleton(const Skeleton& skeleton, const Ogre::MeshPtr& mesh);
  42. /**
  43. * Draws a bone.
  44. *
  45. * @param[in] skeleton Skeleton the bone belongs to.
  46. * @param[in] parent_index The parent bone ID.
  47. * @param[in] colours Colour for the bone.
  48. */
  49. void DrawBone(const Skeleton& skeleton, int parent_index, Ogre::RGBA* colours);