MeshSkin.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. void setBindShape(const float data[]);
  29. void setVertexInfluenceCount(unsigned int count);
  30. void setJointNames(const std::vector<std::string>& list);
  31. const std::vector<std::string>& getJointNames();
  32. void setJoints(const std::vector<Node*>& list);
  33. void setBindPoses(std::vector<Matrix>& list);
  34. /**
  35. * Returns true if the MeshSkin contains a joint with the given ID.
  36. *
  37. * @param id The ID of the joint to search for.
  38. *
  39. * @return True if the joint belongs to this skin, false otherwise.
  40. */
  41. bool hasJoint(const char* id);
  42. void computeBounds();
  43. private:
  44. Mesh* _mesh;
  45. float _bindShape[16];
  46. std::vector<Node*> _joints;
  47. std::vector<Matrix> _bindPoses;
  48. std::vector<std::string> _jointNames;
  49. unsigned int _vertexInfluenceCount;
  50. std::vector<BoundingVolume> _jointBounds;
  51. };
  52. }
  53. #endif