-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolidSphere.cpp
103 lines (77 loc) · 1.84 KB
/
SolidSphere.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
#include "SolidSphere.h"
SolidSphere::SolidSphere(float r, int sl, int st) : SolidShape3D() {
radius = r;
segmentation[0] = sl;
segmentation[1] = st;
}
SolidSphere::SolidSphere(const SolidSphere& sph) : SolidShape3D(sph) {
radius = sph.radius;
segmentation[0] = sph.segmentation[0];
segmentation[1] = sph.segmentation[1];
floor = sph.floor;
ballColor = sph.ballColor;
remove = sph.remove;
removevisited = sph.removevisited;
xy = sph.xy;
drop = sph.drop;
dropvisited = sph.dropvisited;
notShooted = sph.notShooted;
}
float SolidSphere::getRadius() const {
return radius;
}
void SolidSphere::draw() const {
glPushMatrix();
glShadeModel(GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_EMISSION, mtl.getEmission());
glMaterialfv(GL_FRONT, GL_AMBIENT, mtl.getAmbient());
glMaterialfv(GL_FRONT, GL_DIFFUSE, mtl.getDiffuse());
glMaterialfv(GL_FRONT, GL_SPECULAR, mtl.getSpecular());
glMaterialfv(GL_FRONT, GL_SHININESS, mtl.getShininess());
glTranslatef(center[0], center[1], center[2]);
glutSolidSphere(radius, segmentation[0], segmentation[1]);
glPopMatrix();
}
void SolidSphere::setFloor(const int f) {
floor = f;
}
int SolidSphere::getFloor() {
return floor;
}
void SolidSphere::setBallColor(int c) {
ballColor = c;
}
int SolidSphere::getBallColor() {
return ballColor;
}
void SolidSphere::setXY(int x, int y) {
xy[0] = x;
xy[1] = y;
}
VectorN<int, 2> SolidSphere::getXY() {
return xy;
}
void SolidSphere::setRemove(bool r) {
remove = r;
}
bool SolidSphere::getRemove() {
return remove;
}
void SolidSphere::setremovevisited(bool v) {
removevisited = v;
}
bool SolidSphere::getremovevisited() {
return removevisited;
}
void SolidSphere::setdrop(bool d) {
drop = d;
}
bool SolidSphere::getdrop() {
return drop;
}
void SolidSphere::setdropvisited(bool d) {
dropvisited = d;
}
bool SolidSphere::getdropvisited() {
return dropvisited;
}