MeshSkin.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef MESHSKIN_H_
  2. #define MESHSKIN_H_
  3. #include "Base.h"
  4. #include "Object.h"
  5. #include "Matrix.h"
  6. #include "Animation.h"
  7. #include "BoundingVolume.h"
  8. namespace gameplay
  9. {
  10. class Node;
  11. class Mesh;
  12. class MeshSkin : public Object
  13. {
  14. friend class Model;
  15. public:
  16. /**
  17. * Constructor.
  18. */
  19. MeshSkin(void);
  20. /**
  21. * Destructor.
  22. */
  23. virtual ~MeshSkin(void);
  24. virtual unsigned int getTypeId(void) const;
  25. virtual const char* getElementName(void) const;
  26. virtual void writeBinary(FILE* file);
  27. virtual void writeText(FILE* file);
  28. unsigned int getJointCount() const;
  29. void setBindShape(const float data[]);
  30. void setVertexInfluenceCount(unsigned int count);
  31. const std::vector<std::string>& getJointNames();
  32. void setJointNames(const std::vector<std::string>& list);
  33. const std::vector<Node*>& getJoints() const;
  34. void setJoints(const std::vector<Node*>& list);
  35. void setBindPoses(std::vector<Matrix>& list);
  36. /**
  37. * Returns true if the MeshSkin contains a joint with the given ID.
  38. *
  39. * @param id The ID of the joint to search for.
  40. *
  41. * @return True if the joint belongs to this skin, false otherwise.
  42. */
  43. bool hasJoint(const char* id);
  44. void computeBounds();
  45. private:
  46. Mesh* _mesh;
  47. float _bindShape[16];
  48. std::vector<Node*> _joints;
  49. std::vector<Matrix> _bindPoses;
  50. std::vector<std::string> _jointNames;
  51. unsigned int _vertexInfluenceCount;
  52. std::vector<BoundingVolume> _jointBounds;
  53. };
  54. }
  55. #endif