-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcubo.cpp
More file actions
43 lines (36 loc) · 884 Bytes
/
cubo.cpp
File metadata and controls
43 lines (36 loc) · 884 Bytes
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
#include "cubo.h"
#include "glwidget.h"
Cubo::Cubo()
{
}
void Cubo::quad(int a, int b, int c, int d)
{
glBegin(GL_QUADS);
glColor3fv(cor);
glVertex3fv(vertices[a]);
glVertex3fv(vertices[b]);
glVertex3fv(vertices[c]);
glVertex3fv(vertices[d]);
glEnd();
}
void Cubo::transladar(float x, float y, float z){
int i,j;
for(i=0;i < 8;i++){
vertices[i][0] = vertices[i][0] + x;
vertices[i][1] = vertices[i][1] + y;
vertices[i][2] = vertices[i][2] + z;
}
}
void Cubo::escalonar(float x, float y, float z){
int i,j;
for(i=0;i < 8;i++){
vertices[i][0] = vertices[i][0] * x;
vertices[i][1] = vertices[i][1] * y;
vertices[i][2] = vertices[i][2] * z;
}
}
void Cubo::mudarCor(float red, float green, float blue){
cor[0] = red;
cor[1] = green;
cor[2] = blue;
}