diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-12-10 00:32:11 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-12-10 00:32:11 +0100 |
commit | 59b00645ccfbade509b1d1694c9fcfc68e013a10 (patch) | |
tree | 5df4d3b47810d2d95589f9e7c58653349578f195 /Cubehole.cpp | |
parent | 4731d3f4cf576d791db21ac1932fd91f9b43ff3a (diff) | |
download | c3d-59b00645ccfbade509b1d1694c9fcfc68e013a10.tar c3d-59b00645ccfbade509b1d1694c9fcfc68e013a10.zip |
Zu vmmlib migriert
Diffstat (limited to 'Cubehole.cpp')
-rw-r--r-- | Cubehole.cpp | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/Cubehole.cpp b/Cubehole.cpp index e755e45..428cc7a 100644 --- a/Cubehole.cpp +++ b/Cubehole.cpp @@ -1,162 +1,162 @@ #include "Cubehole.h" #include "gl.h" -std::list<Triangle> Cubehole::getTriangles(const Matrix &modelview) +std::list<Triangle> Cubehole::getTriangles(/*const Matrix &modelview*/) { std::list<Triangle> triangles; // width, height, depth // 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-width/2, y+height/2, z+depth/2), - Vertex(x+width/2, y+height/2, z+depth/2), - Vertex(x-width/2, y-height/2, z+depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y+height/2, z+depth/2), + vmml::vec3f(x+width/2, y+height/2, z+depth/2), + vmml::vec3f(x-width/2, y-height/2, z+depth/2), c)); - triangles.push_back(Triangle(Vertex(x-width/2, y-height/2, z+depth/2), - Vertex(x+width/2, y+height/2, z+depth/2), - Vertex(x+width/2, y-height/2, z+depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y-height/2, z+depth/2), + vmml::vec3f(x+width/2, y+height/2, z+depth/2), + vmml::vec3f(x+width/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-width/2, y+height/2, z-depth/2), - Vertex(x-width/2, y-height/2, z-depth/2), - Vertex(x+width/2, y+height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y+height/2, z-depth/2), + vmml::vec3f(x-width/2, y-height/2, z-depth/2), + vmml::vec3f(x+width/2, y+height/2, z-depth/2), c)); - triangles.push_back(Triangle(Vertex(x-width/2, y-height/2, z-depth/2), - Vertex(x+width/2, y+height/2, z-depth/2), - Vertex(x+width/2, y-height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y-height/2, z-depth/2), + vmml::vec3f(x+width/2, y+height/2, z-depth/2), + vmml::vec3f(x+width/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-width/2, y+height/2, z+depth/2), - Vertex(x-width/2, y-height/2, z+depth/2), - Vertex(x-width/2, y+height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y+height/2, z+depth/2), + vmml::vec3f(x-width/2, y-height/2, z+depth/2), + vmml::vec3f(x-width/2, y+height/2, z-depth/2), c)); - triangles.push_back(Triangle(Vertex(x-width/2, y-height/2, z-depth/2), - Vertex(x-width/2, y+height/2, z-depth/2), - Vertex(x-width/2, y-height/2, z+depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y-height/2, z-depth/2), + vmml::vec3f(x-width/2, y+height/2, z-depth/2), + vmml::vec3f(x-width/2, y-height/2, z+depth/2), c)); // Right face - triangles.push_back(Triangle(Vertex(x+width/2, y+height/2, z+depth/2), - Vertex(x+width/2, y-height/2, z+depth/2), - Vertex(x+width/2, y+height/2, z-depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y+height/2, z+depth/2), + vmml::vec3f(x+width/2, y-height/2, z+depth/2), + vmml::vec3f(x+width/2, y+height/2, z-depth/2), c)); - triangles.push_back(Triangle(Vertex(x+width/2, y-height/2, z-depth/2), - Vertex(x+width/2, y+height/2, z-depth/2), - Vertex(x+width/2, y-height/2, z+depth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y-height/2, z-depth/2), + vmml::vec3f(x+width/2, y+height/2, z-depth/2), + vmml::vec3f(x+width/2, y-height/2, z+depth/2), c)); // Top face - c = Color(1.0, 0.0, 0.0, 0.5); - - triangles.push_back(Triangle(Vertex(x-width/2, y+height/2, z+depth/2), - Vertex(x+width/2, y+height/2, z+depth/2), - Vertex(x-width/2, y+height/2, z+innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x+width/2, y+height/2, z+depth/2), - Vertex(x+width/2, y+height/2, z+innerdepth/2), - Vertex(x-width/2, y+height/2, z+innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x-width/2, y+height/2, z-depth/2), - Vertex(x+width/2, y+height/2, z-depth/2), - Vertex(x-width/2, y+height/2, z-innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x+width/2, y+height/2, z-depth/2), - Vertex(x+width/2, y+height/2, z-innerdepth/2), - Vertex(x-width/2, y+height/2, z-innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x- width/2, y+height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y+height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x- width/2, y+height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x- width/2, y+height/2, z-innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x+ width/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x+ width/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x+ width/2, y+height/2, z-innerdepth/2), c)); + c = vmml::vec4f(1.0, 0.0, 0.0, 0.5); + + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y+height/2, z+depth/2), + vmml::vec3f(x+width/2, y+height/2, z+depth/2), + vmml::vec3f(x-width/2, y+height/2, z+innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y+height/2, z+depth/2), + vmml::vec3f(x+width/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-width/2, y+height/2, z+innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y+height/2, z-depth/2), + vmml::vec3f(x+width/2, y+height/2, z-depth/2), + vmml::vec3f(x-width/2, y+height/2, z-innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y+height/2, z-depth/2), + vmml::vec3f(x+width/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x-width/2, y+height/2, z-innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x- width/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y+height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x- width/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x- width/2, y+height/2, z-innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x+ width/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+ width/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x+ width/2, y+height/2, z-innerdepth/2), c)); // Bottom face - triangles.push_back(Triangle(Vertex(x-width/2, y-height/2, z+depth/2), - Vertex(x+width/2, y-height/2, z+depth/2), - Vertex(x-width/2, y-height/2, z+innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x+width/2, y-height/2, z+depth/2), - Vertex(x+width/2, y-height/2, z+innerdepth/2), - Vertex(x-width/2, y-height/2, z+innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x-width/2, y-height/2, z-depth/2), - Vertex(x+width/2, y-height/2, z-depth/2), - Vertex(x-width/2, y-height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x+width/2, y-height/2, z-depth/2), - Vertex(x+width/2, y-height/2, z-innerdepth/2), - Vertex(x-width/2, y-height/2, z-innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x- width/2, y-height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x- width/2, y-height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x- width/2, y-height/2, z-innerdepth/2), c)); - - triangles.push_back(Triangle(Vertex(x+ width/2, y-height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x+ width/2, y-height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x+ width/2, y-height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y-height/2, z+depth/2), + vmml::vec3f(x+width/2, y-height/2, z+depth/2), + vmml::vec3f(x-width/2, y-height/2, z+innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y-height/2, z+depth/2), + vmml::vec3f(x+width/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x-width/2, y-height/2, z+innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x-width/2, y-height/2, z-depth/2), + vmml::vec3f(x+width/2, y-height/2, z-depth/2), + vmml::vec3f(x-width/2, y-height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+width/2, y-height/2, z-depth/2), + vmml::vec3f(x+width/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x-width/2, y-height/2, z-innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x- width/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x- width/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x- width/2, y-height/2, z-innerdepth/2), c)); + + triangles.push_back(Triangle(vmml::vec3f(x+ width/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+ width/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x+ width/2, y-height/2, z-innerdepth/2), c)); // FrontInner face - c = Color(1.0, 1.0, 1.0, 0.5); + c = vmml::vec4f(1.0, 1.0, 1.0, 0.5); - triangles.push_back(Triangle(Vertex(x-innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z+innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z+innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x-innerwidth/2, y-height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z+innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z+innerdepth/2), c)); // BackInner face - c = Color(1.0, 0.5, 0.0, 0.5); + c = vmml::vec4f(1.0, 0.5, 0.0, 0.5); - triangles.push_back(Triangle(Vertex(x-innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x-innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z-innerdepth/2), c)); // LeftInner 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-innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z+innerdepth/2), - Vertex(x-innerwidth/2, y+height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x-innerwidth/2, y+height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x-innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x-innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x-innerwidth/2, y-height/2, z+innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x-innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x-innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x-innerwidth/2, y-height/2, z+innerdepth/2), c)); // RightInner face - triangles.push_back(Triangle(Vertex(x+innerwidth/2, y+height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z+innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+innerwidth/2, y+height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z+innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), c)); - triangles.push_back(Triangle(Vertex(x+innerwidth/2, y-height/2, z-innerdepth/2), - Vertex(x+innerwidth/2, y+height/2, z-innerdepth/2), - Vertex(x+innerwidth/2, y-height/2, z+innerdepth/2), c)); + triangles.push_back(Triangle(vmml::vec3f(x+innerwidth/2, y-height/2, z-innerdepth/2), + vmml::vec3f(x+innerwidth/2, y+height/2, z-innerdepth/2), + vmml::vec3f(x+innerwidth/2, y-height/2, z+innerdepth/2), c)); - for(std::list<Triangle>::iterator t = triangles.begin(); t != triangles.end(); ++t) { + /*for(std::list<Triangle>::iterator t = triangles.begin(); t != triangles.end(); ++t) { t->transform(modelview); - } + }*/ return triangles; } |