clray
changeset 34:a218551293ad
blah blah blah
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 24 Aug 2010 18:35:03 +0100 |
parents | 931d13b72f83 |
children | 4dec8853bf75 |
files | src/clray.cc src/scene.cc |
diffstat | 2 files changed, 45 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- a/src/clray.cc Tue Aug 24 05:47:04 2010 +0100 1.2 +++ b/src/clray.cc Tue Aug 24 18:35:03 2010 +0100 1.3 @@ -120,7 +120,7 @@ 1.4 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 1.5 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1.6 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 1.7 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, test_pattern); 1.8 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F_ARB, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, test_pattern); 1.9 delete [] test_pattern; 1.10 1.11 glutMainLoop();
2.1 --- a/src/scene.cc Tue Aug 24 05:47:04 2010 +0100 2.2 +++ b/src/scene.cc Tue Aug 24 18:35:03 2010 +0100 2.3 @@ -253,6 +253,48 @@ 2.4 glVertex3fv(node->aabb.max); 2.5 glVertex3f(node->aabb.min[0], node->aabb.max[1], node->aabb.min[2]); 2.6 glVertex3f(node->aabb.min[0], node->aabb.max[1], node->aabb.max[2]); 2.7 + /*if(!node->left) return; 2.8 + 2.9 + AABBox *bleft = &node->left->aabb; 2.10 + 2.11 + int axis = level % 3; 2.12 + switch(axis) { 2.13 + case 0: 2.14 + glVertex3f(bleft->max[0], bleft->min[1], bleft->min[2]); 2.15 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 2.16 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 2.17 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.18 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.19 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 2.20 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 2.21 + glVertex3f(bleft->max[0], bleft->min[1], bleft->min[2]); 2.22 + break; 2.23 + 2.24 + case 1: 2.25 + glVertex3f(bleft->min[0], bleft->min[1], bleft->max[2]); 2.26 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 2.27 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 2.28 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.29 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.30 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 2.31 + glVertex3f(bleft->max[0], bleft->min[1], bleft->max[2]); 2.32 + glVertex3f(bleft->min[0], bleft->min[1], bleft->max[2]); 2.33 + break; 2.34 + 2.35 + case 2: 2.36 + glVertex3f(bleft->min[0], bleft->max[1], bleft->min[2]); 2.37 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 2.38 + glVertex3f(bleft->max[0], bleft->max[1], bleft->min[2]); 2.39 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.40 + glVertex3f(bleft->max[0], bleft->max[1], bleft->max[2]); 2.41 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 2.42 + glVertex3f(bleft->min[0], bleft->max[1], bleft->max[2]); 2.43 + glVertex3f(bleft->min[0], bleft->max[1], bleft->min[2]); 2.44 + break; 2.45 + 2.46 + default: 2.47 + break; 2.48 + }*/ 2.49 } 2.50 2.51 bool Scene::build_kdtree() 2.52 @@ -370,6 +412,7 @@ 2.53 kdleft->cost = best_cost[0]; 2.54 kdright->cost = best_cost[1]; 2.55 2.56 + // TODO would it be much better if we actually split faces that straddle the splitting plane? 2.57 for(size_t i=0; i<kd->face_idx.size(); i++) { 2.58 int fidx = kd->face_idx[i]; 2.59 const Face *face = faces + fidx; 2.60 @@ -411,7 +454,7 @@ 2.61 } 2.62 2.63 float sarea = aabb.calc_surface_area(); 2.64 - if(sarea < 1e-8) { 2.65 + if(sarea < 1e-6) { 2.66 return FLT_MAX; // heavily penalize 0-area voxels 2.67 } 2.68