LeftArmSkeleton.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. namespace EMotionFX
  9. {
  10. class Skeleton;
  11. class Node;
  12. class PrefabLeftArmSkeleton
  13. {
  14. public:
  15. enum JointIndexes
  16. {
  17. leftShoulderIndex = 0,
  18. leftElbowIndex = 1,
  19. leftWristIndex = 2,
  20. leftHandIndex = 3,
  21. leftThumb1Index = 4,
  22. leftThumb2Index = 5,
  23. leftThumb3Index = 6,
  24. leftIndex1Index = 7,
  25. leftIndex2Index = 8,
  26. leftIndex3Index = 9,
  27. leftPinky1Index = 10,
  28. leftPinky2Index = 11,
  29. leftPinky3Index = 12,
  30. numJoints = 13,
  31. INVALID = InvalidIndex
  32. };
  33. PrefabLeftArmSkeleton()
  34. {
  35. using testing::Return;
  36. AddJoint(&m_leftShoulder, leftShoulderIndex, nullptr, INVALID, "leftShoulder", leftElbowIndex);
  37. AddJoint(&m_leftElbow, leftElbowIndex, &m_leftShoulder, leftShoulderIndex, "leftElbow", leftWristIndex);
  38. AddJoint(&m_leftWrist, leftWristIndex, &m_leftElbow, leftElbowIndex, "leftWrist", leftHandIndex);
  39. AddJoint(&m_leftHand, leftHandIndex, &m_leftWrist, leftWristIndex, "leftHand", leftThumb1Index, leftIndex1Index, leftPinky1Index);
  40. AddJoint(&m_leftThumb1, leftThumb1Index, &m_leftHand, leftHandIndex, "leftThumb1", leftThumb2Index);
  41. AddJoint(&m_leftThumb2, leftThumb2Index, &m_leftThumb1, leftThumb1Index, "leftThumb2", leftThumb3Index);
  42. AddJoint(&m_leftThumb3, leftThumb3Index, &m_leftThumb2, leftThumb2Index, "leftThumb3");
  43. AddJoint(&m_leftIndex1, leftIndex1Index, &m_leftHand, leftHandIndex, "leftIndex1", leftIndex2Index);
  44. AddJoint(&m_leftIndex2, leftIndex2Index, &m_leftIndex1, leftIndex1Index, "leftIndex2", leftIndex3Index);
  45. AddJoint(&m_leftIndex3, leftIndex3Index, &m_leftIndex2, leftIndex2Index, "leftIndex3");
  46. AddJoint(&m_leftPinky1, leftPinky1Index, &m_leftHand, leftHandIndex, "leftPinky1", leftPinky2Index);
  47. AddJoint(&m_leftPinky2, leftPinky2Index, &m_leftPinky1, leftPinky1Index, "leftPinky2", leftPinky3Index);
  48. AddJoint(&m_leftPinky3, leftPinky3Index, &m_leftPinky2, leftPinky2Index, "leftPinky3");
  49. EXPECT_CALL(m_skeleton, GetNumNodes())
  50. .WillRepeatedly(Return(numJoints));
  51. }
  52. template<class... T>
  53. void AddJoint(Node* node, const JointIndexes index, Node* parentNode, const JointIndexes parentIndex, const char* nodeName, T... children)
  54. {
  55. using testing::Return;
  56. EXPECT_CALL(m_skeleton, GetNode(index))
  57. .WillRepeatedly(Return(node));
  58. EXPECT_CALL(*node, GetNumChildNodes())
  59. .WillRepeatedly(Return(static_cast<AZ::u32>(sizeof...(T))));
  60. EXPECT_CALL(*node, GetNodeIndex())
  61. .WillRepeatedly(Return(index));
  62. EXPECT_CALL(*node, GetParentIndex())
  63. .WillRepeatedly(Return(parentIndex));
  64. EXPECT_CALL(*node, GetParentNode())
  65. .WillRepeatedly(Return(parentNode));
  66. EXPECT_CALL(*node, GetName())
  67. .WillRepeatedly(Return(nodeName));
  68. [[maybe_unused]] AZ::u32 i = 0;
  69. [[maybe_unused]] std::initializer_list<int> dummy = {(([&]() {
  70. EXPECT_CALL(*node, GetChildIndex(i))
  71. .WillRepeatedly(Return(children));
  72. ++i;
  73. })(), 0)...};
  74. }
  75. Node m_leftShoulder;
  76. Node m_leftElbow;
  77. Node m_leftWrist;
  78. Node m_leftHand;
  79. Node m_leftThumb1;
  80. Node m_leftThumb2;
  81. Node m_leftThumb3;
  82. Node m_leftIndex1;
  83. Node m_leftIndex2;
  84. Node m_leftIndex3;
  85. Node m_leftPinky1;
  86. Node m_leftPinky2;
  87. Node m_leftPinky3;
  88. Skeleton m_skeleton;
  89. };
  90. };