-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaterial.cpp
More file actions
43 lines (35 loc) · 1.32 KB
/
Material.cpp
File metadata and controls
43 lines (35 loc) · 1.32 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
/******************************************************************************
* @file Material.cpp
* @author Andrés Gavín Murillo, 716358
* @author Abel Naya Forcano, 544125
* @date Enero 2020
* @coms Informática Gráfica - Trabajo 4: Path tracer
******************************************************************************/
#include "Material.hpp"
Material Emitter(const Texture &texture) {
return Material {
.type = EMITTER,
.property = {.texture = texture}
};
}
Material Reflector(const Texture &kd, const Texture &ks, const float s, const Texture &kdPhong, const Texture &ksPhong) {
return Material {
.type = REFLECTOR,
.property = {.reflectance = {.kd = kd, .ks = ks, .kdPhong = kdPhong, .ksPhong = ksPhong, .s = s}}
};
}
Material Phong(const Texture &kdPhong, const Texture &ksPhong, const float s) {
return Reflector(colored(C_BLACK), colored(C_BLACK), s, kdPhong, ksPhong);
}
Material Diffuse(const Texture &k) {
return Phong(k, colored(C_BLACK), 1);
}
Material Delta(const Texture &kd, const Texture &ks) {
return Reflector(kd, ks, 1, colored(C_BLACK), colored(C_BLACK));
}
Material Refractor(const Texture &kd) {
return Delta(kd, colored(C_BLACK));
}
Material Specular(const Texture &ks) {
return Delta(colored(C_BLACK), ks);
}