From d439daec66c28f85debc2479e95eadb5fc3c00a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Ri=C3=9F?= Date: Thu, 10 Dec 2009 20:48:49 +0100 Subject: =?UTF-8?q?Cubehole=20angefangen=20zu=20=C3=A4ndern.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trapezocube.cpp | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'Trapezocube.cpp') diff --git a/Trapezocube.cpp b/Trapezocube.cpp index 24bcfc3..20aa1c4 100644 --- a/Trapezocube.cpp +++ b/Trapezocube.cpp @@ -3,76 +3,67 @@ std::list Trapezocube::getTriangles(/*const Matrix &modelview*/) { std::list 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::iterator t = triangles.begin(); t != triangles.end(); ++t) { t->transform(rotation); -- cgit v1.2.3