Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Material.h
Go to the documentation of this file.
1#pragma once
2#include <memory>
3#include <unordered_map>
4#include <string>
5
6#include <glm/vec3.hpp>
7
8namespace eng
9{
10 class ShaderProgram;
11 class Texture;
12
14 {
15 public:
16 void SetShaderProgram(const std::shared_ptr<ShaderProgram>& shaderProgram);
18 void SetParam(const std::string& name, float value);
19 void SetParam(const std::string& name, float v0, float v1);
20 void SetParam(const std::string& name, const glm::vec3& value);
21 void SetParam(const std::string& name, const std::shared_ptr<Texture>& texture);
22 void Bind();
23
24 static std::shared_ptr<Material> Load(const std::string& path);
25
26 private:
27 std::shared_ptr<ShaderProgram> m_shaderProgram;
28 std::unordered_map<std::string, float> m_floatParams;
29 std::unordered_map<std::string, std::pair<float, float>> m_float2Params;
30 std::unordered_map<std::string, glm::vec3> m_float3Params;
31 std::unordered_map<std::string, std::shared_ptr<Texture>> m_textures;
32 };
33}
static std::shared_ptr< Material > Load(const std::string &path)
Definition Material.cpp:70
void SetParam(const std::string &name, float value)
Definition Material.cpp:20
void SetShaderProgram(const std::shared_ptr< ShaderProgram > &shaderProgram)
Definition Material.cpp:10
ShaderProgram * GetShaderProgram()
Definition Material.cpp:15