Symphony Of Empires
material.hpp
Go to the documentation of this file.
1 // Eng3D - General purpouse game engine
2 // Copyright (C) 2021, Eng3D contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // material.hpp
20 //
21 // Abstract:
22 // Does some important stuff.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <string>
28 #include <map>
29 #include <vector>
30 #include <memory>
31 
32 #include <glm/vec3.hpp>
33 #include <glm/vec4.hpp>
34 
35 namespace Eng3D {
36  class State;
37  class Texture;
38 
40  struct Material {
41  Material() = default;
42  ~Material() = default;
43  Material(const Material&) = default;
44  Material(Material&&) noexcept = default;
45  Material& operator=(const Material&) = default;
46 
47  glm::vec3 color;
48  float specular_exp;
50  glm::vec4 diffuse_color = glm::vec4(1.f);
51  std::shared_ptr<Eng3D::Texture> diffuse_map;
52  glm::vec4 ambient_color = glm::vec4(1.f);
53  std::shared_ptr<Eng3D::Texture> ambient_map;
54  glm::vec4 specular_color = glm::vec4(1.f);
55  std::shared_ptr<Eng3D::Texture> specular_map;
58  std::shared_ptr<Eng3D::Texture> luminance_map;
59  std::shared_ptr<Eng3D::Texture> height_map;
60  std::shared_ptr<Eng3D::Texture> normal_map;
61  std::shared_ptr<Eng3D::Texture> roughness_map;
62  };
63 
65  std::map<std::string, std::shared_ptr<Eng3D::Material>> materials;
66  Eng3D::State& s;
67  public:
68  MaterialManager() = delete;
70  : s{ _s }
71  {
72 
73  }
74  ~MaterialManager() = default;
75  const std::shared_ptr<Eng3D::Material> load(const std::string& name);
76  };
77 }
MaterialManager(Eng3D::State &_s)
Definition: material.hpp:69
void load(GameState &gs, const std::string &savefile_path)
Definition: utils.hpp:35
A definition for a surface/color/texture to be applied to a model.
Definition: material.hpp:40
std::shared_ptr< Eng3D::Texture > luminance_map
Definition: material.hpp:58
std::shared_ptr< Eng3D::Texture > height_map
Definition: material.hpp:59
std::shared_ptr< Eng3D::Texture > specular_map
Definition: material.hpp:55
~Material()=default
float optical_density
Definition: material.hpp:49
std::shared_ptr< Eng3D::Texture > displacement_map
Definition: material.hpp:56
std::shared_ptr< Eng3D::Texture > roughness_map
Definition: material.hpp:61
Material()=default
glm::vec4 diffuse_color
Definition: material.hpp:50
std::shared_ptr< Eng3D::Texture > normal_map
Definition: material.hpp:60
std::shared_ptr< Eng3D::Texture > ambient_map
Definition: material.hpp:53
Material(const Material &)=default
glm::vec4 specular_color
Definition: material.hpp:54
std::shared_ptr< Eng3D::Texture > occlussion_map
Definition: material.hpp:57
glm::vec3 color
Definition: material.hpp:47
float specular_exp
Definition: material.hpp:48
glm::vec4 ambient_color
Definition: material.hpp:52
Material(Material &&) noexcept=default
std::shared_ptr< Eng3D::Texture > diffuse_map
Definition: material.hpp:51