glviewvol

diff src/renderer.cc @ 5:5417c25cb238

moving to a simpler transfer function
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Dec 2014 15:59:55 +0200
parents 04330eb80b36
children f22be47a3572
line diff
     1.1 --- a/src/renderer.cc	Mon Dec 29 05:41:36 2014 +0200
     1.2 +++ b/src/renderer.cc	Mon Dec 29 15:59:55 2014 +0200
     1.3 @@ -12,6 +12,9 @@
     1.4  		xfer[i].set_point(1, 1);
     1.5  	}
     1.6  
     1.7 +	xfer_low = 0.0;
     1.8 +	xfer_high = 1.0;
     1.9 +
    1.10  	for(int i=0; i<MAX_CLIP_PLANES; i++) {
    1.11  		disable_clipping_plane(i);
    1.12  	}
    1.13 @@ -51,6 +54,18 @@
    1.14  	return xfer[color];
    1.15  }
    1.16  
    1.17 +void Renderer::set_simple_transfer(float low, float high)
    1.18 +{
    1.19 +	xfer_low = std::min(low, high);
    1.20 +	xfer_high = std::max(low, high);
    1.21 +}
    1.22 +
    1.23 +void Renderer::get_simple_transfer(float *low, float *high) const
    1.24 +{
    1.25 +	*low = xfer_low;
    1.26 +	*high = xfer_high;
    1.27 +}
    1.28 +
    1.29  void Renderer::set_clipping_plane(int idx, float nx, float ny, float nz, float dist)
    1.30  {
    1.31  	float len = sqrt(nx * nx + ny * ny + nz * nz);