MeshComponent.h 1010 B

123456789101112131415161718192021222324252627282930313233
  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 "Component.h"
  10. #include <cstddef>
  11. class MeshComponent : public Component
  12. {
  13. public:
  14. MeshComponent(class Actor* owner, bool isSkeletal = false);
  15. ~MeshComponent();
  16. // Draw this mesh component
  17. virtual void Draw(class Shader* shader);
  18. // Set the mesh/texture index used by mesh component
  19. virtual void SetMesh(class Mesh* mesh) { mMesh = mesh; }
  20. void SetTextureIndex(size_t index) { mTextureIndex = index; }
  21. void SetVisible(bool visible) { mVisible = visible; }
  22. bool GetVisible() const { return mVisible; }
  23. bool GetIsSkeletal() const { return mIsSkeletal; }
  24. protected:
  25. class Mesh* mMesh;
  26. size_t mTextureIndex;
  27. bool mVisible;
  28. bool mIsSkeletal;
  29. };