Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Material.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Shader.h"
4 #include "Texture.h"
5 #include "JsonFile.h"
7 
8 namespace Fling
9 {
13  struct PBRTextures
14  {
18  Texture* m_MetalTexture = nullptr;
19  };
20 
25  class Material : public JsonFile
26  {
27  friend class Renderer;
28  public:
29  enum class Type : UINT8
30  {
31  Default,
32  Cubemap,
33  Reflection,
34  Debug
35  };
36 
37  static std::shared_ptr<Fling::Material> Create(Guid t_ID);
38 
39  static std::shared_ptr<Fling::Material> GetDefaultMat();
40 
41  explicit Material(Guid t_ID);
42 
43  const PBRTextures& GetPBRTextures() const { return m_Textures; }
44 
45  Material::Type GetType() const { return m_Type; }
46 
47  static Material::Type GetTypeFromStr(const std::string& t_Str);
48 
49  static const std::string& GetStringFromType(const Material::Type);
50 
51  private:
52 
53  void LoadMaterial();
54 
55  // Textures that this material uses
56  PBRTextures m_Textures = {};
57 
58  Material::Type m_Type = Type::Default;
59 
60  float m_Shininiess = 0.5f;
61 
62  // A map of types to their parsed names
63  static std::unordered_map<std::string, Material::Type> TypeMap;
64  };
65 } // namespace Fling
const PBRTextures & GetPBRTextures() const
Definition: Material.h:43
the properties of a PBR
Definition: Material.h:13
An image represents a 2D file that has data about each pixel in the image.
Definition: Texture.h:11
Texture * m_NormalTexture
Definition: Material.h:16
Texture * m_MetalTexture
Definition: Material.h:18
Texture * m_AlbedoTexture
Definition: Material.h:15
Texture * m_RoughnessTexture
Definition: Material.h:17
entt::hashed_string Guid
Definition: FlingTypes.h:26
Type
Definition: Material.h:29
A JsonFile provides an interface for easily using JSON files.
Definition: JsonFile.h:16
uint8_t UINT8
Definition: FlingTypes.h:11
A material represents what properties should be given to a set of shaders.
Definition: Material.h:25
Material::Type GetType() const
Definition: Material.h:45
Definition: Engine.h:29
Definition: Cubemap.h:20
static std::unordered_map< std::string, Material::Type > TypeMap
Definition: Material.h:63