From 1bcde14162e469919c16042f50b5d48f5fd9896e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20Ri=C3=9F?= Date: Thu, 7 Jan 2010 19:59:31 +0100 Subject: =?UTF-8?q?Anzeige=20des=20Temparray=20erweitert,=20aber=20das=20p?= =?UTF-8?q?rogramm=20st=C3=BCrzt=20ab.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Temparray.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Temparray.cpp') 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); } } } -- cgit v1.2.3