volmetrics
diff src/volume.cc @ 30:e548d95e0667
fixed lighting, added parameter for volume rotation
author | Eleni Maria Stea <elene.mst@gmail.com> |
---|---|
date | Thu, 01 May 2014 15:28:51 +0300 |
parents | 4e120dcd55ec |
children | eb87d4a12bd3 |
line diff
1.1 --- a/src/volume.cc Sun Apr 27 21:07:10 2014 +0300 1.2 +++ b/src/volume.cc Thu May 01 15:28:51 2014 +0300 1.3 @@ -21,6 +21,7 @@ 1.4 { 1.5 width = height = 0; 1.6 zaspect = 1; 1.7 + x_rot = 0; 1.8 vol_tex_valid = false; 1.9 1.10 glGenTextures(1, &vol_tex); 1.11 @@ -56,6 +57,8 @@ 1.12 1.13 bool Volume::load(const char *fname) 1.14 { 1.15 + char up = 'y'; 1.16 + 1.17 FILE *fp = fopen(fname, "r"); 1.18 if(!fp) { 1.19 fprintf(stderr, "Failed to open file: %s: %s\n", fname, strerror(errno)); 1.20 @@ -85,6 +88,7 @@ 1.21 reading_slices = true; 1.22 1.23 sscanf(line, "zaspect = %f", &zaspect); 1.24 + sscanf(line, "up = %c", &up); 1.25 } 1.26 else { 1.27 img_fnames.push_back(line); 1.28 @@ -103,6 +107,9 @@ 1.29 } 1.30 } 1.31 1.32 + if (up == 'z') 1.33 + x_rot = 90; 1.34 + 1.35 return true; 1.36 } 1.37 1.38 @@ -166,6 +173,11 @@ 1.39 return vol_tex; 1.40 } 1.41 1.42 +float Volume::get_volume_rotation() const 1.43 +{ 1.44 + return x_rot; 1.45 +} 1.46 + 1.47 static Mesh *cur_mesh; 1.48 static Volume *cur_vol; 1.49 static float low_thres, high_thres; 1.50 @@ -241,7 +253,6 @@ 1.51 1.52 void Volume::draw() const 1.53 { 1.54 - 1.55 } 1.56 1.57 static char *strip_whitespaces(char *buf)