SkeletalMeshComponent.h 1010 B

1234567891011121314151617181920212223242526272829303132333435
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. #include "MeshComponent.h"
  10. #include "MatrixPalette.h"
  11. class SkeletalMeshComponent : public MeshComponent
  12. {
  13. public:
  14. SkeletalMeshComponent(class Actor* owner);
  15. // Draw this mesh component
  16. void Draw(class Shader* shader) override;
  17. void Update(float deltaTime) override;
  18. // Setters
  19. void SetSkeleton(const class Skeleton* sk) { mSkeleton = sk; }
  20. // Play an animation. Returns the length of the animation
  21. float PlayAnimation(const class Animation* anim, float playRate = 1.0f);
  22. protected:
  23. void ComputeMatrixPalette();
  24. MatrixPalette mPalette;
  25. const class Skeleton* mSkeleton;
  26. const class Animation* mAnimation;
  27. float mAnimPlayRate;
  28. float mAnimTime;
  29. };