volmetrics

changeset 20:21bc62bb3e14

added spinner
author Eleni Maria Stea <elene.mst@gmail.com>
date Tue, 25 Mar 2014 00:07:12 +0200
parents 09896653017e
children c22866ecb7ae
files src/main.cc
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/src/main.cc	Mon Mar 24 23:57:14 2014 +0200
     1.2 +++ b/src/main.cc	Tue Mar 25 00:07:12 2014 +0200
     1.3 @@ -38,6 +38,7 @@
     1.4  static Volume *vol;
     1.5  static Mesh *mesh;
     1.6  static float cur_z, thres = 0.5, thres2 = 1.0;
     1.7 +static float zeta;
     1.8  
     1.9  static int use_orig_vol_res = 1;
    1.10  static int vol_res[3]; // volume sampling resolution x/y/z
    1.11 @@ -168,13 +169,17 @@
    1.12  		res_spin[i]->disable();
    1.13  	}
    1.14  
    1.15 +	GLUI_Panel *preview_panel = ui->add_panel("volume preview");
    1.16 +
    1.17 +	GLUI_Spinner *preview_spin = ui->add_spinner_to_panel(preview_panel, "slice z", GLUI_SPINNER_FLOAT, &zeta, 0);
    1.18 +	preview_spin->set_float_limits(0, 1);
    1.19 +
    1.20  	return ui;
    1.21  }
    1.22  
    1.23  static void volume_preview ()
    1.24  {
    1.25  	float aspect = win_xsz / win_ysz;
    1.26 -	float z = 0.0;
    1.27  
    1.28  	glDisable(GL_LIGHTING);
    1.29  
    1.30 @@ -191,10 +196,10 @@
    1.31  	glEnable(GL_TEXTURE_3D);
    1.32  	glBegin(GL_QUADS);
    1.33  	glColor3f(1.0, 0.0, 0.0);
    1.34 -	glTexCoord3f(0, 0, z); glVertex3f(-1.0, 1.0, 0.0);
    1.35 -	glTexCoord3f(0, 1, z); glVertex3f(-1.0, 0.5, 0.0);
    1.36 -	glTexCoord3f(1, 1, z); glVertex3f(-0.5, 0.5, 0.0);
    1.37 -	glTexCoord3f(1, 0, z); glVertex3f(-0.5, 1.0, 0.0);
    1.38 +	glTexCoord3f(0, 0, zeta); glVertex3f(-1.0, 1.0, 0.0);
    1.39 +	glTexCoord3f(0, 1, zeta); glVertex3f(-1.0, 0.5, 0.0);
    1.40 +	glTexCoord3f(1, 1, zeta); glVertex3f(-0.5, 0.5, 0.0);
    1.41 +	glTexCoord3f(1, 0, zeta); glVertex3f(-0.5, 1.0, 0.0);
    1.42  	glEnd();
    1.43  	glDisable(GL_TEXTURE_3D);
    1.44