2
0

Mesh.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 <vector>
  10. #include <string>
  11. class Mesh
  12. {
  13. public:
  14. Mesh();
  15. ~Mesh();
  16. // Load/unload mesh
  17. bool Load(const std::string& fileName, class Renderer* renderer);
  18. void Unload();
  19. // Get the vertex array associated with this mesh
  20. class VertexArray* GetVertexArray() { return mVertexArray; }
  21. // Get a texture from specified index
  22. class Texture* GetTexture(size_t index);
  23. // Get name of shader
  24. const std::string& GetShaderName() const { return mShaderName; }
  25. // Get object space bounding sphere radius
  26. float GetRadius() const { return mRadius; }
  27. // Get specular power of mesh
  28. float GetSpecPower() const { return mSpecPower; }
  29. private:
  30. // Textures associated with this mesh
  31. std::vector<class Texture*> mTextures;
  32. // Vertex array associated with this mesh
  33. class VertexArray* mVertexArray;
  34. // Name of shader specified by mesh
  35. std::string mShaderName;
  36. // Stores object space bounding sphere radius
  37. float mRadius;
  38. // Specular power of surface
  39. float mSpecPower;
  40. };