Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
Material.hpp
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5 */
6
7#ifndef ENGINE_MATERIAL
8#define ENGINE_MATERIAL
9
10#include "Shader.hpp"
11#include "../Utils.hpp"
12#include <map>
13
14namespace Engine::Graphics {
15
16 enum MaterialParameterType {
17 FLOAT,
18 INT,
19 VEC2,
20 VEC3,
21 VEC4
22 };
23
43 class Material {
44 private:
45 Shader* m_referenceShader;
46
47 std::map<const char*, MaterialParameterType> m_parameters;
48 std::map<const char*, void*> m_parameterValues;
49
50 public:
51
57 Material(Shader* referenceShader);
58
69 void CreateParameter(const char* name, MaterialParameterType type);
70
92 void* SetParameter(const char* name, void* value);
93
104
110 Shader* GetShader();
111 };
112}
113
114#endif
Success
A generic success type.
Definition Utils.hpp:29
an semi-abstract class that represents a material to a shader
Definition Material.hpp:43
void * SetParameter(const char *name, void *value)
Sets the value of a parameter.
Definition Material.cpp:19
Engine::Success ApplyMaterialParams()
Applies both the material values to the shader.
Definition Material.cpp:28
Shader * GetShader()
Gets the shader used by the material.
Definition Material.cpp:60
void CreateParameter(const char *name, MaterialParameterType type)
Creates a parameter for the material.
Definition Material.cpp:15
A class used to load and use shaders.
Definition Shader.hpp:37