From 59b00645ccfbade509b1d1694c9fcfc68e013a10 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 10 Dec 2009 00:32:11 +0100 Subject: Zu vmmlib migriert --- Trapezocube.cpp | 89 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 45 deletions(-) (limited to 'Trapezocube.cpp') 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 Trapezocube::getTriangles(/*const Matrix &modelview*/) { std::list 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::iterator t = triangles.begin(); t != triangles.end(); ++t) { t->transform(rotation); -- cgit v1.2.3