glviewvol

diff sdr/fast.p.glsl @ 8:fb6d93471352

main thing done
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 30 Dec 2014 20:03:32 +0200
parents 04330eb80b36
children 931a6b35f1cd
line diff
     1.1 --- a/sdr/fast.p.glsl	Tue Dec 30 17:28:38 2014 +0200
     1.2 +++ b/sdr/fast.p.glsl	Tue Dec 30 20:03:32 2014 +0200
     1.3 @@ -3,9 +3,17 @@
     1.4  
     1.5  void main()
     1.6  {
     1.7 +	vec3 tc = gl_TexCoord[0].xyz;
     1.8 +	float max_manh_dist = max(tc.x, max(tc.y, tc.z));
     1.9 +	float min_manh_dist = min(tc.x, min(tc.y, tc.z));
    1.10 +	float border = step(0.0, min_manh_dist) * (1.0 - step(1.0, max_manh_dist));
    1.11 +
    1.12  	vec4 voxel = texture3D(vol_tex, gl_TexCoord[0].xyz);
    1.13  	vec4 color = texture1D(xfer_tex, voxel.a);
    1.14  
    1.15 -	gl_FragColor.rgb = color.rgb;
    1.16 -	gl_FragColor.a = 1.0;
    1.17 +	float alpha = color.a * border;
    1.18 +	if(alpha < 0.001) discard;
    1.19 +
    1.20 +	gl_FragColor.rgb = voxel.rgb;
    1.21 +	gl_FragColor.a = alpha;
    1.22  }