diff options
author | Constantin Riß <constantin.riss@dre.de> | 2009-12-09 15:59:14 +0100 |
---|---|---|
committer | Constantin Riß <constantin.riss@dre.de> | 2009-12-09 15:59:14 +0100 |
commit | 3b534c013dd072d0296ebaac434e8c943ab88c14 (patch) | |
tree | 13e3d7315ccc816a2b9d07a58e98655618177b03 /Trapezocube.cpp | |
parent | 482852aceacb54879c08e6fffc909a2cc160d483 (diff) | |
download | c3d-3b534c013dd072d0296ebaac434e8c943ab88c14.tar c3d-3b534c013dd072d0296ebaac434e8c943ab88c14.zip |
Beleuchtung hinzugefügt
Diffstat (limited to 'Trapezocube.cpp')
-rw-r--r-- | Trapezocube.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
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<Triangle> Trapezocube::getTriangles(const Matrix &modelview) +std::list<Triangle> Trapezocube::getTriangles(/*const Matrix &modelview*/) { std::list<Triangle> 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<Triangle> 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<Triangle> 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<Triangle>::iterator t = triangles.begin(); t != triangles.end(); ++t) { - t->transform(modelview); + t->transform(rotation); + //t->transform(modelview); } return triangles; |