-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaterial.cpp
More file actions
50 lines (41 loc) · 1.19 KB
/
Material.cpp
File metadata and controls
50 lines (41 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#define STB_IMAGE_IMPLEMENTATION
#include "Material.h"
namespace violet {
Material::Material(
MATL_BLEND_MODEL bm,
MATL_SHADING_MODEL sm,
MATL_DIFFUSE_MODEL dm,
MATL_SPECULAR_MODEL spm,
bool cullface,
bool depthtest,
DEPTH_FUNCTION depthfunc,
const string&gpu_program
) :_blend{ bm }, _shading{ sm }, _diffuse{ dm }, _specular{ spm },
_cullface{ cullface }, _depthTest{ depthtest }, _depthFunc{ depthfunc } {};
bool Material::operator <= (const Material&m)const {
if (_blend <= m._blend)
if (_shading <= m._shading)
if (_diffuse <= m._diffuse)
if (_specular <= m._specular)
return true;
return false;
}
void Material::insertParam1f(const string&name, float param) {
_param1f[name] = param;
}
void Material::insertParam2f(const string&name, const glm::vec2& param) {
_param2f[name] = param;
}
void Material::insertParam3f(const string&name, const glm::vec3& param) {
_param3f[name] = param;
}
float Material::getParam1f(const string&name)const {
return _param1f.at(name);
}
glm::vec2 Material::getParam2f(const string&name)const {
return _param2f.at(name);
}
glm::vec3 Material::getParam3f(const string&name)const {
return _param3f.at(name);
}
}