diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-12-10 00:32:11 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-12-10 00:32:11 +0100 |
commit | 59b00645ccfbade509b1d1694c9fcfc68e013a10 (patch) | |
tree | 5df4d3b47810d2d95589f9e7c58653349578f195 /Trapezocube.cpp | |
parent | 4731d3f4cf576d791db21ac1932fd91f9b43ff3a (diff) | |
download | c3d-59b00645ccfbade509b1d1694c9fcfc68e013a10.tar c3d-59b00645ccfbade509b1d1694c9fcfc68e013a10.zip |
Zu vmmlib migriert
Diffstat (limited to 'Trapezocube.cpp')
-rw-r--r-- | Trapezocube.cpp | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/Trapezocube.cpp b/Trapezocube.cpp index 24bcfc3..271db7d 100644 --- a/Trapezocube.cpp +++ b/Trapezocube.cpp @@ -1,78 +1,77 @@ #include "Trapezocube.h" + 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(); + vmml::mat4f rotation(vmml::mat4f::IDENTITY); + rotation.rotate_y(rotate); + // Front face - Color c(0.0, 0.0, 1.0, 0.5); + vmml::vec4f 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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(x-widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(x+widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(x+widthfront/2, y+height/2, z+depth/2), c)); // Back face - c = Color(1.0, 1.0, 0.0, 0.5); + c = vmml::vec4f(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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthback/2, y+height/2, z-depth/2), + vmml::vec3f(x+widthback/2, y+height/2, z-depth/2), + vmml::vec3f(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), - Vertex(x+widthback/2, y-height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-widthback/2, y-height/2, z-depth/2), + vmml::vec3f(x+widthback/2, y+height/2, z-depth/2), + vmml::vec3f(x+widthback/2, y-height/2, z-depth/2), c)); // Left face - c = Color(0.0, 1.0, 0.0, 0.5); + c = vmml::vec4f(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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(x-widthback /2, y+height/2, z-depth/2), + vmml::vec3f(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-widthfront/2, y-height/2, z+depth/2), - Vertex(x-widthback /2, y+height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-widthback /2, y-height/2, z-depth/2), + vmml::vec3f(x-widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(x-widthback /2, y+height/2, z-depth/2), c)); // 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)); + triangles.push_back(Triangle(vmml::vec3f(x+widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(x+widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(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), - Vertex(x+widthfront/2, y-height/2, z+depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+widthback /2, y-height/2, z-depth/2), + vmml::vec3f(x+widthback /2, y+height/2, z-depth/2), + vmml::vec3f(x+widthfront/2, y-height/2, z+depth/2), c)); // Top face - c = Color(1.0, 0.0, 0.0, 0.5); + c = vmml::vec4f(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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(x+widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(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-widthback /2, y+height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+widthfront/2, y+height/2, z+depth/2), + vmml::vec3f(x+widthback /2, y+height/2, z-depth/2), + vmml::vec3f(x-widthback /2, y+height/2, z-depth/2), c)); // 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)); + triangles.push_back(Triangle(vmml::vec3f(x-widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(x-widthback /2, y-height/2, z-depth/2), + vmml::vec3f(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)); + triangles.push_back(Triangle(vmml::vec3f(x+widthfront/2, y-height/2, z+depth/2), + vmml::vec3f(x-widthback /2, y-height/2, z-depth/2), + vmml::vec3f(x+widthback /2, y-height/2, z-depth/2), c)); for(std::list<Triangle>::iterator t = triangles.begin(); t != triangles.end(); ++t) { t->transform(rotation); |