summaryrefslogtreecommitdiffstats
path: root/Trapezocube.cpp
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2009-12-10 20:48:49 +0100
committerConstantin Riß <constantin.riss@dre.de>2009-12-10 20:48:49 +0100
commitd439daec66c28f85debc2479e95eadb5fc3c00a2 (patch)
treeef096f881be26737b4092151302033c4b1c5bb29 /Trapezocube.cpp
parent8705ce3d468c3cd22159bc0fedf727e8250861ca (diff)
downloadc3d-d439daec66c28f85debc2479e95eadb5fc3c00a2.tar
c3d-d439daec66c28f85debc2479e95eadb5fc3c00a2.zip
Cubehole angefangen zu ändern.
Diffstat (limited to 'Trapezocube.cpp')
-rw-r--r--Trapezocube.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/Trapezocube.cpp b/Trapezocube.cpp
index 24bcfc3..20aa1c4 100644
--- a/Trapezocube.cpp
+++ b/Trapezocube.cpp
@@ -3,76 +3,67 @@
std::list<Triangle> Trapezocube::getTriangles(/*const Matrix &modelview*/)
{
std::list<Triangle> triangles;
- // width, height, depth
glPushMatrix();
glLoadIdentity();
glRotatef(rotate, 0.0, 1.0, 0.0);
Matrix rotation;
glPopMatrix();
- // Front face
- Color c(0.0, 0.0, 1.0, 0.5);
- triangles.push_back(Triangle(Vertex(x-widthfront/2, y+height/2, z+depth/2),
+ // Front face
+ triangles.push_back(Triangle(Vertex(x-widthfront/2, y+height/2, z+depth/2),
Vertex(x-widthfront/2, y-height/2, z+depth/2),
- Vertex(x+widthfront/2, y+height/2, z+depth/2), c));
+ Vertex(x+widthfront/2, y+height/2, z+depth/2), color));
triangles.push_back(Triangle(Vertex(x-widthfront/2, y-height/2, z+depth/2),
Vertex(x+widthfront/2, y-height/2, z+depth/2),
- Vertex(x+widthfront/2, y+height/2, z+depth/2), c));
+ Vertex(x+widthfront/2, y+height/2, z+depth/2), color));
// Back face
- c = Color(1.0, 1.0, 0.0, 0.5);
-
triangles.push_back(Triangle(Vertex(x-widthback/2, y+height/2, z-depth/2),
Vertex(x+widthback/2, y+height/2, z-depth/2),
- Vertex(x-widthback/2, y-height/2, z-depth/2), c));
+ Vertex(x-widthback/2, y-height/2, z-depth/2), color));
triangles.push_back(Triangle(Vertex(x-widthback/2, y-height/2, z-depth/2),
Vertex(x+widthback/2, y+height/2, z-depth/2),
- Vertex(x+widthback/2, y-height/2, z-depth/2), c));
+ Vertex(x+widthback/2, y-height/2, z-depth/2), color));
// Left face
- c = Color(0.0, 1.0, 0.0, 0.5);
-
triangles.push_back(Triangle(Vertex(x-widthfront/2, y+height/2, z+depth/2),
- Vertex(x-widthback /2, y+height/2, z-depth/2),
- Vertex(x-widthfront/2, y-height/2, z+depth/2), c));
+ Vertex(x-widthback /2, // width, height, depth
+ y+height/2, z-depth/2),
+ Vertex(x-widthfront/2, y-height/2, z+depth/2), color));
triangles.push_back(Triangle(Vertex(x-widthback /2, y-height/2, z-depth/2),
Vertex(x-widthfront/2, y-height/2, z+depth/2),
- Vertex(x-widthback /2, y+height/2, z-depth/2), c));
+ Vertex(x-widthback /2, y+height/2, z-depth/2), color));
// Right face
-
triangles.push_back(Triangle(Vertex(x+widthfront/2, y+height/2, z+depth/2),
Vertex(x+widthfront/2, y-height/2, z+depth/2),
- Vertex(x+widthback /2, y+height/2, z-depth/2), c));
+ Vertex(x+widthback /2, y+height/2, z-depth/2), color));
triangles.push_back(Triangle(Vertex(x+widthback /2, y-height/2, z-depth/2),
Vertex(x+widthback /2, y+height/2, z-depth/2),
- Vertex(x+widthfront/2, y-height/2, z+depth/2), c));
+ Vertex(x+widthfront/2, y-height/2, z+depth/2), color));
// Top face
- c = Color(1.0, 0.0, 0.0, 0.5);
-
triangles.push_back(Triangle(Vertex(x-widthfront/2, y+height/2, z+depth/2),
Vertex(x+widthfront/2, y+height/2, z+depth/2),
- Vertex(x-widthback /2, y+height/2, z-depth/2), c));
+ Vertex(x-widthback /2, y+height/2, z-depth/2), color));
triangles.push_back(Triangle(Vertex(x+widthfront/2, y+height/2, z+depth/2),
Vertex(x+widthback /2, y+height/2, z-depth/2),
- Vertex(x-widthback /2, y+height/2, z-depth/2), c));
+ Vertex(x-widthback /2, y+height/2, z-depth/2), color));
// Bottom face
-
triangles.push_back(Triangle(Vertex(x-widthfront/2, y-height/2, z+depth/2),
Vertex(x-widthback /2, y-height/2, z-depth/2),
- Vertex(x+widthfront/2, y-height/2, z+depth/2), c));
+ Vertex(x+widthfront/2, y-height/2, z+depth/2), color));
triangles.push_back(Triangle(Vertex(x+widthfront/2, y-height/2, z+depth/2),
Vertex(x-widthback /2, y-height/2, z-depth/2),
- Vertex(x+widthback /2, y-height/2, z-depth/2), c));
+ Vertex(x+widthback /2, y-height/2, z-depth/2), color));
for(std::list<Triangle>::iterator t = triangles.begin(); t != triangles.end(); ++t) {
t->transform(rotation);