#include "Trapezocube.h" std::list Trapezocube::getTriangles() { std::list triangles; // width, height, depth vmml::mat4f rotation(vmml::mat4f::IDENTITY); rotation.rotate_y(M_PI*rotate/180.0f); // Front 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+widthfront/2, y+height/2, z+depth/2), color)); 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), color)); // Back face 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), color)); 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), color)); // Left 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), color)); 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), color)); // 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), color)); 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), color)); // Top 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), color)); 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), color)); // 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), color)); 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), color)); for(std::list::iterator t = triangles.begin(); t != triangles.end(); ++t) { t->transform(rotation); } return triangles; }