summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-05 14:53:43 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-05 14:53:43 +0100
commitb71c8bfd17097c3e0c7711a41893b631cc104203 (patch)
tree1966f5d48a05eca4c61d786a0712ba28925384dc
parentf53795458ddf252d08979820a98697cca9327834 (diff)
downloadc3d-b71c8bfd17097c3e0c7711a41893b631cc104203.tar
c3d-b71c8bfd17097c3e0c7711a41893b631cc104203.zip
blabla
-rw-r--r--House.cpp2
-rw-r--r--Temparray.cpp16
-rw-r--r--Temparray.h18
3 files changed, 29 insertions, 7 deletions
diff --git a/House.cpp b/House.cpp
index c5dc37b..fb0f848 100644
--- a/House.cpp
+++ b/House.cpp
@@ -480,7 +480,7 @@ void House::controller(){
++time;
if(time > 23){
- std::cerr << day << std::endl;
+ //std::cerr << day << std::endl;
time = 0;
++day;
}
diff --git a/Temparray.cpp b/Temparray.cpp
index f2c8fb8..dfc001e 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -438,7 +438,7 @@ void Temparray::calcTemp(){
mergetemperature();
coloring();
// std::cerr << temperaturenew(2, 2, 2, 1, 2) << std::endl;
- std::cerr << temperaturenew(2, 2, 2, 2, 2) << std::endl;
+// std::cerr << temperaturenew(2, 2, 2, 2, 2) << std::endl;
// std::cerr << temperaturenew(2, 2, 2, 3, 2) << "\n" << std::endl;
// std::cerr << " " << temperatureold(2, 2, 2, 1, 2) << std::endl;
// std::cerr << temperatureold(2, 2, 2, 2, 1) << " " << temperatureold(2, 2, 2, 2, 2) << " " << temperatureold(2, 2, 2, 2, 3) << std::endl;
@@ -462,17 +462,21 @@ std::list<Triangle> Temparray::getTriangles(){
}
void Temparray::coloring() {
+ calcAverage();
float r[4], g[4], b[4];
for(int i=0; i<sx; ++i){
for(int j=0; j<sy; ++j){
for(int k=0; k<sz; ++k){
for(int l=0; l<6; ++l){
for(int m=0; m<4; ++m){
- if(temperatureold(i, j, k, l, m) >= 50 ) b[m]=0;
- else b[m]=1/(50-temperatureold(i, j, k, l, m));
- g[m]=fabs(1/(50-temperatureold(i, j, k, l, m)));
- if(temperatureold(i, j, k, l, m) <= 25 ) r[m]=0;
- else r[m]=1/(100-temperatureold(i, j, k, l, m));
+ if(temperaturenew(i, j, k, l, m) <= averagetemp/2) b[m] = 1;
+ else if(temperaturenew(i, j, k, l, m) < averagetemp)
+ b[m] = 1/(averagetemp/2+temperaturenew(i, j, k, l, m));
+
+ g[m]=0;
+
+ if(temperaturenew(i, j, k, l, m) >= 100-averagetemp/2) r[m] = 1;
+// r[m]=0;
}
cubehole(i, j, k, l).setColor(vmml::vec4f(r[0], g[0], b[0], 1.0),
vmml::vec4f(r[1], g[1], b[1], 1.0),
diff --git a/Temparray.h b/Temparray.h
index ac96c04..0886c9d 100644
--- a/Temparray.h
+++ b/Temparray.h
@@ -57,6 +57,24 @@ class Temparray
}
earthtemp=8;
}
+ void calcAverage(){
+ float tempcache = 0;
+ int times = 0;
+ for(int i=0; i<sx; i++){
+ for(int j=0; j<sy; j++){
+ for(int k=0; k<sz; k++){
+ for(int l=0; l<6; l++){
+ for(int m=0; m<4; m++){
+ tempcache += temperaturenew(i, j, k, l, m);
+ ++times;
+ }
+ }
+ }
+ }
+ }
+ averagetemp = tempcache/times;
+ std::cerr << averagetemp << std::endl;
+ }
};
#endif /* _TEMPARRAY_H_ */