| 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"
6 #include "ShaderPrograms/ShaderProgram.h"
7
8 namespace Fling
9 {
13 struct PBRTextures
14 {
15 Texture* m_AlbedoTexture = nullptr;
16 Texture* m_NormalTexture = nullptr;
17 Texture* m_RoughnessTexture = nullptr;
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
JsonFile.h
Fling::Material::GetPBRTextures
const PBRTextures & GetPBRTextures() const
Definition: Material.h:43
Fling::PBRTextures
the properties of a PBR
Definition: Material.h:13
Texture.h
Fling::Texture
An image represents a 2D file that has data about each pixel in the image.
Definition: Texture.h:11
Shader.h
Fling::PBRTextures::m_NormalTexture
Texture * m_NormalTexture
Definition: Material.h:16
Fling::PBRTextures::m_MetalTexture
Texture * m_MetalTexture
Definition: Material.h:18
Fling::PBRTextures::m_AlbedoTexture
Texture * m_AlbedoTexture
Definition: Material.h:15
Fling::PBRTextures::m_RoughnessTexture
Texture * m_RoughnessTexture
Definition: Material.h:17
Fling::Guid
entt::hashed_string Guid
Definition: FlingTypes.h:26
Fling::Material::Type
Type
Definition: Material.h:29
Fling::JsonFile
A JsonFile provides an interface for easily using JSON files.
Definition: JsonFile.h:16
UINT8
uint8_t UINT8
Definition: FlingTypes.h:11
Fling::Material
A material represents what properties should be given to a set of shaders.
Definition: Material.h:25
Fling::ShaderProgramType::Reflection
ShaderProgram.h
Fling::Material::GetType
Material::Type GetType() const
Definition: Material.h:45
Fling
Definition: Engine.h:29
Fling::Cubemap
Definition: Cubemap.h:20
Fling::Material::TypeMap
static std::unordered_map< std::string, Material::Type > TypeMap
Definition: Material.h:63