-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMamaQuad.cpp
More file actions
185 lines (142 loc) · 4.16 KB
/
MamaQuad.cpp
File metadata and controls
185 lines (142 loc) · 4.16 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include "Settings.h"
#include "MamaQuad.h"
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
#include <glm/gtc/type_ptr.hpp>
#include "raygl/raygl.h"
#include "raygl/raygldefs.h"
MamaQuad::MamaQuad() {
animate = true;
rotPropeller=0;
quad = gluNewQuadric();
gluQuadricDrawStyle(quad,GLU_FILL);
gluQuadricNormals(quad,GLU_SMOOTH);
timeline = new Timeline("MAM");
}
string MamaQuad::getName()
{
return "MAM";
}
MamaQuad::~MamaQuad() {
gluDeleteQuadric(quad);
}
/****************************************************/
// written by Steve Buettner
void MamaQuad::propeller() {
glPushMatrix();
glColor3f(1.0f,0.0f,0.0f);
glRotatef(90.0f,0.0f,1.0f,0.0f);
glRotatef(rotPropeller,1.0,0.0,0.0);
gluCylinder(quad,0.1f , 0.1f ,6.0f,5.0f,5.0f);
glTranslatef(0.0f,0.0f,-6.5f);
gluCylinder(quad,0.1f , 0.1f ,6.0f,5.0f,5.0f);
glPopMatrix();
}
//written by Steve Buettner
void MamaQuad::motor() {
//motor
gluCylinder(quad,1.0f , 1.0f ,3.0f,5.0f,5.0f);
//draw sphere for propeller blades
gluSphere(quad,1.0,5,5);
}
//written by Steve Buettner
void MamaQuad::newBody() {
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glScalef(0.5f,0.5f,0.5f);
//body
gluSphere(quad,5.0f,25,25);
//head
glTranslatef(-6.9,0.0f,0.0f);
GLUquadricObj *sphere = gluNewQuadric();
gluQuadricDrawStyle(sphere, GLU_FILL);
gluQuadricTexture(sphere, GL_TRUE);
gluQuadricNormals(sphere,GL_SMOOTH);
gluSphere(sphere,2.0f,25,25);
gluDeleteQuadric(sphere);
}
//written by Steve Buettner
void MamaQuad::arm() {
glScalef(0.5f,0.5f,0.5f);
//drawing arm
gluCylinder(quad,0.5f , 0.5f ,10.0f,5.0f,5.0f);
}
//written by Steve Buettner
void MamaQuad::drawQuad(void){
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMultMatrixf(glm::value_ptr(Model)); //load Model glLoadMatrixd
glScalef(4.0f,4.0f,4.0f);
// glPushMatrix();
glRotated(180,0,1,0);
glRotated(90,1,0,0);
glPushMatrix();
glTranslatef(0.0f,0.0f,-2.0f);
// mySmoke();
glPopMatrix();
glPushMatrix();
glColor3f(0.5f,0.5f,0.0f);
newBody();
glPopMatrix();
glPushMatrix();
//lower right arm
glColor3f(0.0f,1.0f,0.0f);
glTranslatef(0.25f,-0.25f,-0.01f);
glRotatef(90.0f,1.0f,1.0f,0.0f);
arm();
glTranslatef(0.75f,-0.75f,9.5f);
glRotatef(-90.0f,1.0f,1.0f,0.0f);
motor();
propeller();
glPopMatrix();
glPushMatrix();
//lower left arm
glColor3f(0.0f,1.0f,0.0f);
glTranslatef(-0.25f,-0.25f,-0.01f);
glRotatef(90.0f,1.0f,-1.0f,0.0f);
arm();
//set up motor for lower left arm
glTranslatef(-1.25f,-1.25f,9.5f);
glRotatef(-90.0f,1.0f,-1.0f,0.0f);
motor();
propeller();
glPopMatrix();
glPushMatrix();
//upper left arm
glColor3f(0.0f,1.0f,0.0f);
glTranslatef(-0.25f,0.25f,-0.01f);
glRotatef(90.0f,-1.0f,-1.0f,0.0f);
arm();
//upper left motor
glTranslatef(-0.75f,0.75f,9.5f);
glRotatef(90.0f,1.0f,1.0f,0.0f);
motor();
propeller();
glPopMatrix();
glPushMatrix();
//upper right arm
glColor3f(0.0f,1.0f,0.0f);
glTranslatef(0.25f,0.25f,-0.01f);
glRotatef(90.0f,-1.0f,1.0f,0.0f);
arm();
//set up upper right arm motor
glTranslatef(0.75f,0.75f,9.5f);
glRotatef(90.0f,1.0f,-1.0f,0.0f);
motor();
propeller();
glPopMatrix();
if(animate)
rotPropeller+=15.0;
// glPopMatrix();
}
void MamaQuad::collided()
{
}
glm::vec3 MamaQuad::getBarrelPosition()
{
}
void MamaQuad::customCommandParser(string commandString)
{
if(!strcmp(command,"DIE"))
animate = false;
}