From fbed33283cdd85589e4ea577ba11e635f55723f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Ri=C3=9F?= Date: Thu, 10 Dec 2009 22:00:10 +0100 Subject: =?UTF-8?q?Kleine=20=C3=A4nderungen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cubehole.h | 17 ++++++++--------- DisplayClass.cpp | 8 ++++---- Trapezocube.cpp | 40 ++++++++++++++-------------------------- Trapezocube.h | 3 ++- main.cpp | 2 +- 5 files changed, 29 insertions(+), 41 deletions(-) diff --git a/Cubehole.h b/Cubehole.h index a31fae9..3398ef4 100644 --- a/Cubehole.h +++ b/Cubehole.h @@ -10,7 +10,6 @@ class Cubehole { public: Cubehole(): width(0), height(0), depth(0), x(0), y(0), z(0), innerwidth(0), innerdepth(0) {} - Cubehole(float width0, float height0, float depth0, float x0, float y0, float z0, float innerwidth0, float innerdepth0, const vmml::vec4f &colorfront0, const vmml::vec4f &colorright0, @@ -20,8 +19,8 @@ class Cubehole setColor(colorfront0, colorright0, colorback0, colorleft0); front.setRotate(0); right.setRotate(90); - back.setRotate(180); - left.setRotate(270); + back.setRotate(180); + left.setRotate(270); } float getHeight() {return height;} @@ -49,16 +48,16 @@ class Cubehole x = x0; y = y0; z = z0; - front.setPos(x, y, depth-(depth-innerdepth)/2); - right.setPos(x, y, width-(width-innerwidth)/2); - back.setPos(x, y, depth-(depth-innerdepth)/2); - left.setPos(x, y, width-(width-innerwidth)/2); + front.setPos(x, y, z/*(depth-(depth-innerdepth)/2*/); + right.setPos(x-(width-innerwidth)/2, y, z/*width-(width-innerwidth)/2*/); + back.setPos(x, y, z/*depth-(depth-innerdepth)/2*/); + left.setPos(x-(width-innerwidth)/2, y, z/*width-(width-innerwidth)/2*/); } void setColor(const vmml::vec4f &cf, const vmml::vec4f &cr, const vmml::vec4f &cb, const vmml::vec4f &cl) { front.setColor(cf); right.setColor(cr); - back.setColor(cb); - left.setColor(cl); + back.setColor(cb); + left.setColor(cl); } std::list getTriangles(); diff --git a/DisplayClass.cpp b/DisplayClass.cpp index 6d9fdee..c621965 100644 --- a/DisplayClass.cpp +++ b/DisplayClass.cpp @@ -7,10 +7,10 @@ DisplayClass::Renderer DisplayClass::renderer; DisplayClass::DisplayClass() { cubehole = Cubehole(3.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.5, - vmml::vec4f(1.0, 0.0, 0.0), - vmml::vec4f(0.0, 1.0, 0.0), - vmml::vec4f(0.0, 0.0, 1.0), - vmml::vec4f(1.0, 0.85, 0.06)); + vmml::vec4f(1.0, 0.0, 0.0, 0.5), + vmml::vec4f(0.0, 1.0, 0.0, 0.5), + vmml::vec4f(0.0, 0.0, 1.0, 0.5), + vmml::vec4f(1.0, 0.85, 0.06, 0.5)); } void DisplayClass::renderScene(unsigned long delta) diff --git a/Trapezocube.cpp b/Trapezocube.cpp index 8205ee6..85570c3 100644 --- a/Trapezocube.cpp +++ b/Trapezocube.cpp @@ -1,6 +1,5 @@ #include "Trapezocube.h" - std::list Trapezocube::getTriangles() { std::list triangles; @@ -10,68 +9,58 @@ std::list Trapezocube::getTriangles() rotation.rotate_y(M_PI*rotate/180.0f); // 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)); + 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), c)); - + vmml::vec3f(x+widthfront/2, y+height/2, z+depth/2), color)); // 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), + (trianglultisample) { + glClearColor(0.0, );//glClearColor(1.0, 0.85, 0.es.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)); + 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), c)); + vmml::vec3f(x+widthback/2, y-height/2, z-depth/2), color)); // 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)); + 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), c)); + 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), c)); + 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), c)); + vmml::vec3f(x+widthfront/2, y-height/2, z+depth/2), color)); // 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)); + 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), c)); + 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), c)); + 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), c)); + 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); @@ -79,4 +68,3 @@ std::list Trapezocube::getTriangles() return triangles; } - diff --git a/Trapezocube.h b/Trapezocube.h index c291e21..3c2aa71 100644 --- a/Trapezocube.h +++ b/Trapezocube.h @@ -10,7 +10,8 @@ class Trapezocube public: Trapezocube(): widthfront(0), widthback(0), height(0), depth(0), x(0), y(0), z(0), rotate(0) {} - Trapezocube(float widthfront, float widthback, float height, float depth, float x, float y, float z, float rotate, const vmml::vec4f &col) { + Trapezocube(float widthfront, float widthback, float height, float depth, float x, float y, float z, + float rotate, const vmml::vec4f &col) { setSize(widthfront, widthback, height, depth); setPos(x, y, z); setRotate(rotate); diff --git a/main.cpp b/main.cpp index fd20eb9..632c3b9 100644 --- a/main.cpp +++ b/main.cpp @@ -18,7 +18,7 @@ void initGL(bool multisample); void resize(int width, int height); void initGL(bool multisample) { - glClearColor(1.0, 0.85, 0.06, 1.0); + glClearColor(0.0, 0.0, 0.0, 1.0);//glClearColor(1.0, 0.85, 0.06, 1.0); glClearDepth(1.0); //glEnable(GL_DEPTH_TEST); //glDepthFunc(GL_LEQUAL); -- cgit v1.2.3