-
Notifications
You must be signed in to change notification settings - Fork 0
/
Material.cpp
109 lines (90 loc) · 3.57 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "Material.h"
#include <windows.h>
#include "GLee.h"
#include <GL/glut.h>
//testovaci a pouzitelne materialy
//modry material
void Material::getBlueGlass(){
GLfloat materialAmbient[4];
GLfloat materialDiffuse[4];
GLfloat materialSpecular[4];
GLfloat materialShininess[1];
// ambientni slozka barvy materialu
materialAmbient[0]=0.05375;
materialAmbient[1]=0.05;
materialAmbient[2]=0.06625;
materialAmbient[3]=1.0;
// difuzni slozka barvy materialu
materialDiffuse[0]=0.18275;
materialDiffuse[1]=0.17;
materialDiffuse[2]=0.22525;
materialDiffuse[3]=1.0;
// barva odlesku
materialSpecular[0]=0.332741;
materialSpecular[1]=0.328634;
materialSpecular[2]=0.346435;
materialSpecular[3]=1.0;
// faktor odlesku
materialShininess[0]=0.3;
glMaterialfv(GL_FRONT, GL_AMBIENT, materialAmbient);// nastaveni ambientni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialDiffuse);// nastaveni difuzni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);// nastaveni barvy odlesku materialu
glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess);
}
//bronz
void Material::getBronze(){
GLfloat materialAmbient[4];
GLfloat materialDiffuse[4];
GLfloat materialSpecular[4];
GLfloat materialShininess[1];
// ambientni slozka barvy materialu
materialAmbient[0]=0.25;
materialAmbient[1]=0.148;
materialAmbient[2]=0.06475;
materialAmbient[3]=1.0;
// difuzni slozka barvy materialu
materialDiffuse[0]=0.4;
materialDiffuse[1]=0.2368;
materialDiffuse[2]=0.1036;
materialDiffuse[3]=1.0;
// barva odlesku
materialSpecular[0]=0.774597;
materialSpecular[1]=0.458561;
materialSpecular[2]=0.200621;
materialSpecular[3]=1.0;
// faktor odlesku
materialShininess[0]=0,4;
glMaterialfv(GL_FRONT, GL_AMBIENT, materialAmbient);// nastaveni ambientni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_DIFFUSE, materialDiffuse);// nastaveni difuzni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);// nastaveni barvy odlesku materialu
glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess);
}
//zlato
void Material::getGold()
{
GLfloat materialAmbient[4];
GLfloat materialDiffuse[4];
GLfloat materialSpecular[4];
GLfloat materialShininess[1];
// ambientni slozka barvy materialu
materialAmbient[0]=0.24725;
materialAmbient[1]=0.1995;
materialAmbient[2]=0.0745;
materialAmbient[3]=1.0;
// difuzni slozka barvy materialu
materialDiffuse[0]=0.75164;
materialDiffuse[1]=0.60648;
materialDiffuse[2]=0.22648;
materialDiffuse[3]=1.0;
// barva odlesku
materialSpecular[0]=0.628281;
materialSpecular[1]=0.366065;
materialSpecular[2]=0.366065;
materialSpecular[3]=1.0;
// faktor odlesku
materialShininess[0]=.8;
glMaterialfv(GL_FRONT, GL_AMBIENT, materialAmbient);// nastaveni ambientni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_DIFFUSE, materialDiffuse);// nastaveni difuzni slozky barvy materialu
glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);// nastaveni barvy odlesku materialu
glMaterialfv(GL_FRONT, GL_SHININESS, materialShininess);
}