-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaterial.cpp
50 lines (41 loc) · 1014 Bytes
/
material.cpp
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
#include "material.h"
Material::Material( QVector3D surf_col, qreal diff_amount, QVector3D spec, qreal shininess, qreal spec_amount, QVector3D ambient, qreal am_amount, qreal reflection , qreal refraction, qreal refr_angle ):
surf_col_(surf_col),
diff_amount_ (diff_amount),
ambient_col_(ambient),
ambient_amount_(am_amount),
specular_col_(spec),
shininess_(shininess),
spec_amount_(spec_amount),
reflection_(reflection),
refraction_(refraction),
refr_angle_(refr_angle)
{
//sanitycheck
if((reflection_+refraction_)>1)
{
refraction_ = 1-reflection;
}
}
void Material::setReflectionAmount(qreal ref)
{
if((ref+refraction_)>1)
{
reflection_= 1-refraction_;
}
else
{
reflection_=ref;
}
}
void Material::setRefractionAmount(qreal ref)
{
if((ref+reflection_)>1)
{
refraction_ = 1-reflection_;
}
else
{
refraction_ = ref;
}
}