-
Notifications
You must be signed in to change notification settings - Fork 0
/
Material.h
68 lines (53 loc) · 1.52 KB
/
Material.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "Vector.h"
#include "Line.h"
#include "Color.h"
#include "Intersection.h"
#ifndef RT_MATERIAL_INCLUDED
#define RT_MATERIAL_INCLUDED
namespace rt {
class Material {
private:
Color _ambient;
Color _diffuse;
Color _specular;
int _shininess;
public:
Material() {
_shininess = 0;
}
Material(const Color& ambient, const Color& diffuse, const Color& specular, int shininess) {
_ambient = Color(ambient);
_diffuse = Color(diffuse);
_specular = Color(specular);
_shininess = shininess;
}
Material(float ar, float ag, float ab,
float dr, float dg, float db,
float sr, float sg, float sb,
int shininess) {
_ambient = Color(ar, ag, ab);
_diffuse = Color(dr, dg, db);
_specular = Color(sr, sg, sb);
_shininess = shininess;
}
Material(const Material& mat) {
_ambient = Color(mat.ambient());
_diffuse = Color(mat.diffuse());
_specular = Color(mat.specular());
_shininess = mat.shininess();
}
inline const Color& ambient() const {
return _ambient;
}
inline const Color& diffuse() const {
return _diffuse;
}
inline const Color& specular() const {
return _specular;
}
inline int shininess() const {
return _shininess;
}
};
}
#endif