#include "DisplayClass.h" DisplayClass::Renderer DisplayClass::render; DisplayClass::DisplayClass(int x, int y, int z) : angle(0) { /*cubehole0 = Cubehole(3.0, 6.0, 3.0, 0.0, 0.0, 0.0, 2.5, 2.5, vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5)); cubehole1 = Cubehole(2.5, 6.0, 2.5, 0.0, 0.0, 0.0, 2.0, 2.0, vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5)); cubehole2 = Cubehole(2.0, 6.0, 2.0, 0.0, 0.0, 0.0, 1.5, 1.5, vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5)); cubehole3 = Cubehole(1.5, 6.0, 1.5, 0.0, 0.0, 0.0, 1.0, 1.0, vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5), vmml::vec4f(1.0, 0.85, 0.06, 0.5)); cubehole4 = Cubehole(1.0, 6.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5), vmml::vec4f(0.0, 0.85, 0.06, 0.5)); cubehole5 = Cubehole(0.5, 6.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5), vmml::vec4f(1.0, 0.0, 0.06, 0.5)); std::list triangles = cubehole0.getTriangles(); std::list t1 = cubehole1.getTriangles(); triangles.splice(triangles.end(), t1); std::list t2 = cubehole2.getTriangles(); triangles.splice(triangles.end(), t2); std::list t3 = cubehole3.getTriangles(); triangles.splice(triangles.end(), t3); std::list t4 = cubehole4.getTriangles(); triangles.splice(triangles.end(), t4); std::list t5 = cubehole5.getTriangles(); triangles.splice(triangles.end(), t5);*/ // Temparray temp(20, x, y, z); // triangles=temp.getTriangles(); this->x=x; this->y=y; this->z=z; //tree = new BSPTree(triangles); } DisplayClass::~DisplayClass() { //delete tree; } void DisplayClass::renderScene(unsigned long delta) { angle += delta*0.055; if(angle >= 360) angle -= 360; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // Clean up matrix glTranslatef(0.0, -2.0, -10.0); // Then set up transformation glRotatef(15, 1.0, 0.0, 0.0); glRotatef(angle, 0.0, 1.0, 0.0); // glRotatef(angle*2, 1.0, 0.0, 0.0); // glRotatef(angle*3, 0.0, 0.0, 1.0); // glRotatef(-angle*5, 1.0, 1.0, 1.0); // static Temparray temp(20, x, y, z); static House house(20, x, y, z, 60, 300, 53.55, 0.82, 2.82, 0.0047, 40, 45, 1900, 3, 11500); triangles=house.getTriangles(); house.controller(); //// temp.calcTemp(); //vmml::mat4f transform, inverseTransform; //glGetFloatv(GL_MODELVIEW_MATRIX, transform.array); //transform.inverse(inverseTransform); //vmml::vec3f viewPoint = inverseTransform*vmml::vec3f::ZERO; glBegin(GL_TRIANGLES); //tree->visit(render, viewPoint); for(std::list::iterator t = triangles.begin(); t != triangles.end(); ++t) { render(*t); } glEnd(); glFlush(); }