summaryrefslogtreecommitdiffstats
path: root/Cubehole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Cubehole.cpp')
-rw-r--r--Cubehole.cpp230
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;
}