qvolray
diff src/volray.c @ 7:f40e4edfee7e
shading
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 05 Apr 2012 00:52:11 +0300 |
parents | 0c3874aa717a |
children | a6765984e057 |
line diff
1.1 --- a/src/volray.c Wed Apr 04 01:37:58 2012 +0300 1.2 +++ b/src/volray.c Thu Apr 05 00:52:11 2012 +0300 1.3 @@ -54,11 +54,12 @@ 1.4 int raytex_needs_recalc = 1; 1.5 1.6 unsigned int xfer_tex; 1.7 -float xfer_mean = 0.5, xfer_sdev = 1.0; 1.8 +float xfer_mean = 0.7, xfer_sdev = 0.1; 1.9 int xfertex_needs_recalc = 1; 1.10 1.11 static int uimode; 1.12 -static float cur_z = 0.5; 1.13 +static float cur_z = 0.0; 1.14 +static float ray_step = 0.01; 1.15 1.16 int main(int argc, char **argv) 1.17 { 1.18 @@ -99,6 +100,8 @@ 1.19 set_uniform_int(vol_sdr, "volume", 0); 1.20 set_uniform_int(vol_sdr, "ray_tex", 1); 1.21 set_uniform_int(vol_sdr, "xfer_tex", 2); 1.22 + set_uniform_float(vol_sdr, "ray_step", ray_step); 1.23 + set_uniform_float(vol_sdr, "zclip", cur_z); 1.24 1.25 if(!(slice_sdr = create_program_load(0, "slice.p.glsl"))) { 1.26 return -1; 1.27 @@ -127,7 +130,7 @@ 1.28 1.29 if(i == 0) { 1.30 /* allocate storage for the texture */ 1.31 - glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, xsz, ysz, nslices, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.32 + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32F, xsz, ysz, nslices, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.33 1.34 vol_xsz = xsz; 1.35 vol_ysz = ysz; 1.36 @@ -388,6 +391,8 @@ 1.37 cur_z = 0.0; 1.38 if(cur_z > 1.0) 1.39 cur_z = 1.0; 1.40 + 1.41 + set_uniform_float(vol_sdr, "zclip", cur_z); 1.42 glutPostRedisplay(); 1.43 break; 1.44