From 3b534c013dd072d0296ebaac434e8c943ab88c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Ri=C3=9F?= Date: Wed, 9 Dec 2009 15:59:14 +0100 Subject: =?UTF-8?q?Beleuchtung=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Trapezocube.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'Trapezocube.cpp') diff --git a/Trapezocube.cpp b/Trapezocube.cpp index e9877de..24bcfc3 100644 --- a/Trapezocube.cpp +++ b/Trapezocube.cpp @@ -1,27 +1,32 @@ #include "Trapezocube.h" -std::list Trapezocube::getTriangles(const Matrix &modelview) +std::list Trapezocube::getTriangles(/*const Matrix &modelview*/) { std::list triangles; // width, height, depth - //glRotatef(rotate, 0.0, 1.0, 0.0); + + 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), - 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), + Vertex(x+widthfront/2, y+height/2, z+depth/2), c)); 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), + Vertex(x+widthfront/2, y+height/2, z+depth/2), c)); // 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), + Vertex(x-widthback/2, y-height/2, z-depth/2), c)); triangles.push_back(Triangle(Vertex(x-widthback/2, y-height/2, z-depth/2), Vertex(x+widthback/2, y+height/2, z-depth/2), @@ -30,13 +35,13 @@ std::list Trapezocube::getTriangles(const Matrix &modelview) // 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-widthfront /2, y-height/2, z+depth/2), - Vertex(x-widthback /2, y+height/2, z-depth/2), c)); + 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)); 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), + Vertex(x-widthback /2, y+height/2, z-depth/2), c)); // Right face @@ -62,15 +67,16 @@ std::list Trapezocube::getTriangles(const Matrix &modelview) // Bottom 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), + Vertex(x+widthfront/2, y-height/2, z+depth/2), c)); 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), + Vertex(x+widthback /2, y-height/2, z-depth/2), c)); for(std::list::iterator t = triangles.begin(); t != triangles.end(); ++t) { - t->transform(modelview); + t->transform(rotation); + //t->transform(modelview); } return triangles; -- cgit v1.2.3