2
0

Joint.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef JOINT_H_
  2. #define JOINT_H_
  3. #include "Node.h"
  4. namespace gameplay
  5. {
  6. class MeshSkin;
  7. class Bundle;
  8. /**
  9. * Defines a basic hierachial structure of transformation spaces.
  10. */
  11. class Joint : public Node
  12. {
  13. friend class Node;
  14. friend class MeshSkin;
  15. friend class Bundle;
  16. public:
  17. /**
  18. * @see Node::getType()
  19. */
  20. Node::Type getType() const;
  21. /**
  22. * Returns the inverse bind pose matrix for this joint.
  23. *
  24. * @return Inverse bind pose matrix.
  25. */
  26. const Matrix& getInverseBindPose() const;
  27. protected:
  28. /**
  29. * Constructor.
  30. */
  31. Joint(const char* id);
  32. /**
  33. * Destructor.
  34. */
  35. virtual ~Joint();
  36. /**
  37. * Creates a new joint with the given id.
  38. *
  39. * @param id ID string.
  40. *
  41. * @return Newly created joint.
  42. */
  43. static Joint* create(const char* id);
  44. /**
  45. * Clones a single node and its data but not its children.
  46. * This method returns a node pointer but actually creates a Joint.
  47. *
  48. * @param context The clone context.
  49. *
  50. * @return Pointer to the newly created joint.
  51. */
  52. virtual Node* cloneSingleNode(NodeCloneContext &context) const;
  53. /**
  54. * Sets the inverse bind pose matrix.
  55. *
  56. * @param m Matrix representing the inverse bind pose for this Joint.
  57. */
  58. void setInverseBindPose(const Matrix& m);
  59. /**
  60. * Updates the joint matrix.
  61. *
  62. * @param bindShape The bind shape matrix.
  63. * @param matrixPalette The matrix palette to update.
  64. */
  65. void updateJointMatrix(const Matrix& bindShape, Vector4* matrixPalette);
  66. /**
  67. * Called when this Joint's transform changes.
  68. */
  69. void transformChanged();
  70. private:
  71. /**
  72. * Constructor.
  73. */
  74. Joint(const Joint& copy);
  75. /**
  76. * Copy assignment operator.
  77. */
  78. Joint& operator=(const Joint&);
  79. protected:
  80. /**
  81. * The Matrix representation of the Joint's bind pose.
  82. */
  83. Matrix _bindPose;
  84. /**
  85. * Flag used to mark if the Joint's matrix is dirty.
  86. */
  87. bool _jointMatrixDirty;
  88. /**
  89. * The number of MeshSkin's influencing the Joint.
  90. */
  91. unsigned int _skinCount;
  92. };
  93. }
  94. #endif