summaryrefslogtreecommitdiffstats
path: root/Trapezocube.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-12-09 16:28:58 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-12-09 16:28:58 +0100
commit8705ce3d468c3cd22159bc0fedf727e8250861ca (patch)
treef94debc4b7f52badac6052f016e9ab2f9232b095 /Trapezocube.cpp
parent3035d4c9e76d6f28579d0b5a024e1c1b2a538919 (diff)
parent3b534c013dd072d0296ebaac434e8c943ab88c14 (diff)
downloadc3d-8705ce3d468c3cd22159bc0fedf727e8250861ca.tar
c3d-8705ce3d468c3cd22159bc0fedf727e8250861ca.zip
Merge branch 'master' of git://git.gamezock.de/c3d
Conflicts: DisplayClass.cpp
Diffstat (limited to 'Trapezocube.cpp')
-rw-r--r--Trapezocube.cpp42
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;