clray
diff src/scene.cc @ 34:a218551293ad
blah blah blah
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 24 Aug 2010 18:35:03 +0100 |
parents | 4cf4919c3812 |
children | 4dec8853bf75 |
line diff
1.1 --- a/src/scene.cc Tue Aug 24 05:47:04 2010 +0100 1.2 +++ b/src/scene.cc Tue Aug 24 18:35:03 2010 +0100 1.3 @@ -253,6 +253,48 @@ 1.4 glVertex3fv(node->aabb.max); 1.5 glVertex3f(node->aabb.min[0], node->aabb.max[1], node->aabb.min[2]); 1.6 glVertex3f(node->aabb.min[0], node->aabb.max[1], node->aabb.max[2]); 1.7 + /*if(!node->left) return; 1.8 + 1.9 + AABBox *bleft = &node->left->aabb; 1.10 + 1.11 + int axis = level % 3; 1.12 + switch(axis) { 1.13 + case 0: 1.14 + glVertex3f(bleft->max[0], bleft->min[1], bleft->min[2]); 1.15 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 1.16 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 1.17 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.18 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.19 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 1.20 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 1.21 + glVertex3f(bleft->max[0], bleft->min[1], bleft->min[2]); 1.22 + break; 1.23 + 1.24 + case 1: 1.25 + glVertex3f(bleft->min[0], bleft->min[1], bleft->max[2]); 1.26 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 1.27 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 1.28 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.29 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.30 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 1.31 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 1.32 + glVertex3f(bleft->min[0], bleft->min[1], bleft->max[2]); 1.33 + break; 1.34 + 1.35 + case 2: 1.36 + glVertex3f(bleft->min[0], bleft->max[1], bleft->min[2]); 1.37 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 1.38 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 1.39 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.40 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 1.41 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 1.42 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 1.43 + glVertex3f(bleft->min[0], bleft->max[1], bleft->min[2]); 1.44 + break; 1.45 + 1.46 + default: 1.47 + break; 1.48 + }*/ 1.49 } 1.50 1.51 bool Scene::build_kdtree() 1.52 @@ -370,6 +412,7 @@ 1.53 kdleft->cost = best_cost[0]; 1.54 kdright->cost = best_cost[1]; 1.55 1.56 + // TODO would it be much better if we actually split faces that straddle the splitting plane? 1.57 for(size_t i=0; i<kd->face_idx.size(); i++) { 1.58 int fidx = kd->face_idx[i]; 1.59 const Face *face = faces + fidx; 1.60 @@ -411,7 +454,7 @@ 1.61 } 1.62 1.63 float sarea = aabb.calc_surface_area(); 1.64 - if(sarea < 1e-8) { 1.65 + if(sarea < 1e-6) { 1.66 return FLT_MAX; // heavily penalize 0-area voxels 1.67 } 1.68