diff options
-rw-r--r-- | DisplayClass.cpp | 2 | ||||
-rw-r--r-- | DisplayClass.h | 2 | ||||
-rw-r--r-- | Temparray.cpp | 19 |
3 files changed, 13 insertions, 10 deletions
diff --git a/DisplayClass.cpp b/DisplayClass.cpp index 0a833c9..647cbf6 100644 --- a/DisplayClass.cpp +++ b/DisplayClass.cpp @@ -48,7 +48,7 @@ DisplayClass::DisplayClass() : angle(0) { std::list<Triangle> t5 = cubehole5.getTriangles(); triangles.splice(triangles.end(), t5);*/ - Temparray temp(20, 5, 5, 5); + Temparray temp(20, 2, 2, 2); std::list<Triangle> triangles=temp.getTriangles(); tree = new BSPTree(triangles); diff --git a/DisplayClass.h b/DisplayClass.h index 1efd945..688e2f6 100644 --- a/DisplayClass.h +++ b/DisplayClass.h @@ -1,7 +1,7 @@ #ifndef _DISPLAYCLASS_H_ #define _DISPLAYCLASS_H_ -#include "Cubehole.h" +//#include "Cubehole.h" #include "Temparray.h" #include "BSPTree.h" diff --git a/Temparray.cpp b/Temparray.cpp index ebedb07..bb3596a 100644 --- a/Temparray.cpp +++ b/Temparray.cpp @@ -1,22 +1,25 @@ #include "Temparray.h" Temparray::Temparray(float initialtemp, int x0, int y0, int z0){ - float *temperature = new float[x0*y0*z0*6*4]; - Cubehole *cubearray = new Cubehole[x0*y0*z0*6]; + float *temperature = new float[x0*y0*z0*6*4 + y0*z0*6*4 + z0*6*4 + 6*4 + 4]; + Cubehole *cubearray = new Cubehole[x0*y0*z0*6 + y0*z0*64 + z0*6 + 6]; tempInit(initialtemp, x0, y0, z0); size[0] = x0; size[1] = y0; size[2] = z0; - static const float pos[5] = {-2.0, -1.0, 0.0, 1.0, 2.0}; +// static const float pos[5] = {-2.0, -1.0, 0.0, 1.0, 2.0}; + float x1, y1, z1; for(int i = 0; i < x0; ++i) { for(int j = 0; j < y0; ++j) { for(int k = 0; k < z0; ++k) { for(int l = 0; l < 6; ++l) { cubearray[i*y0*z0*6 + j*z0*6 + k*6 + l].setSize((6-l)/6, (6-l)/6, (6-l)/6, (5-l)/6, (5-l)/6); - cubearray[i*y0*z0*6 + j*z0*6 + k*6 + l].setPos(pos[k], pos[j], pos[i]); - cubearray[i*y0*z0*6 + j*z0*6 + k*6 + l].setColor(vmml::vec4f(1.0, 1.0, 1.0, 1.0), - vmml::vec4f(1.0, 1.0, 1.0, 1.0), - vmml::vec4f(1.0, 1.0, 1.0, 1.0), - vmml::vec4f(1.0, 1.0, 1.0, 1.0)); + if(x0 % 2 == 0) x1 = -(x0/2)+i+0.5; + else if(x0 % 2 == 1) x1 = -(x0-1)/2+i; + if(y0 % 2 == 0) y1 = -(y0/2)+i+0.5; + else if(y0 % 2 == 1) y1 = -(y0-1)/2+i; + if(z0 % 2 == 0) z1 = -(z0/2)+i+0.5; + else if(z0 % 2 == 1) z1 = -(z0-1)/2+i; + cubearray[i*y0*z0*6 + j*z0*6 + k*6 + l].setPos(x1, y1, z1); } } } |