#include "Trapezocube.h" std::list Trapezocube::getTriangles(/*const Matrix &modelview*/) { std::list triangles; // width, height, depth vmml::mat4f rotation(vmml::mat4f::IDENTITY); rotation.rotate_y(rotate); // Front face vmml::vec4f c(0.0, 0.0, 1.0, 0.5); 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(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 = vmml::vec4f(1.0, 1.0, 0.0, 0.5); 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(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 = vmml::vec4f(0.0, 1.0, 0.0, 0.5); 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(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(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(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 = vmml::vec4f(1.0, 0.0, 0.0, 0.5); 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(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(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(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); //t->transform(modelview); } return triangles; }