qvolray
diff src/volray.cc @ 23:53aca4775514
clip checkbox
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 13 Apr 2012 15:43:45 +0300 |
parents | 2d0dfb5751dc |
children | aeef3c2ae472 |
line diff
1.1 --- a/src/volray.cc Wed Apr 11 18:35:12 2012 +0300 1.2 +++ b/src/volray.cc Fri Apr 13 15:43:45 2012 +0300 1.3 @@ -48,6 +48,7 @@ 1.4 static bool xfertex_needs_recalc = true; 1.5 1.6 static float cur_z = 0.5; 1.7 +static bool clip_z; 1.8 static float ray_step = 0.01; 1.9 1.10 static Volume *volume; 1.11 @@ -64,7 +65,7 @@ 1.12 set_uniform_int(vol_sdr, "ray_tex", 1); 1.13 set_uniform_int(vol_sdr, "xfer_tex", 2); 1.14 set_uniform_float(vol_sdr, "ray_step", ray_step); 1.15 - set_uniform_float(vol_sdr, "zclip", cur_z); 1.16 + set_uniform_float(vol_sdr, "zclip", 0.0); 1.17 1.18 if(!(slice_sdr = create_program_load(0, "sdr/slice.p.glsl"))) { 1.19 return false; 1.20 @@ -92,11 +93,17 @@ 1.21 switch(which) { 1.22 case VOLRAY_ZCURSOR: 1.23 cur_z = val; 1.24 - set_uniform_float(vol_sdr, "zclip", cur_z); 1.25 + if(clip_z) { 1.26 + set_uniform_float(vol_sdr, "zclip", cur_z); 1.27 + } 1.28 post_redisplay(); 1.29 break; 1.30 1.31 case VOLRAY_ZCLIP: 1.32 + clip_z = val > 0.5; 1.33 + set_uniform_float(vol_sdr, "zclip", clip_z ? cur_z : 0.0); 1.34 + post_redisplay(); 1.35 + break; 1.36 1.37 default: 1.38 break; 1.39 @@ -109,6 +116,10 @@ 1.40 case VOLRAY_ZCURSOR: 1.41 return cur_z; 1.42 1.43 + case VOLRAY_ZCLIP: 1.44 + return clip_z > 0.5 ? 1.0 : 0.0; 1.45 + break; 1.46 + 1.47 default: 1.48 break; 1.49 }