volmetrics
diff src/volume.cc @ 35:df4a277adb82
port to macosx
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 06 Feb 2015 21:15:23 +0200 |
parents | eb87d4a12bd3 |
children |
line diff
1.1 --- a/src/volume.cc Mon Aug 18 10:44:11 2014 +0300 1.2 +++ b/src/volume.cc Fri Feb 06 21:15:23 2015 +0200 1.3 @@ -1,4 +1,4 @@ 1.4 -#include <GL/glew.h> 1.5 +#include "opengl.h" 1.6 1.7 #include <assert.h> 1.8 1.9 @@ -11,8 +11,6 @@ 1.10 #include <string> 1.11 #include <vector> 1.12 1.13 -#include <metasurf.h> 1.14 - 1.15 #include "mesh.h" 1.16 #include "volume.h" 1.17 1.18 @@ -228,31 +226,6 @@ 1.19 (1 - smoothstep(x, high_thres - dt, high_thres + dt)); 1.20 } 1.21 1.22 -static float cb_eval(float x, float y, float z) 1.23 -{ 1.24 - const Image *img = cur_vol->get_slice_by_z((z + 1) / 2.0); 1.25 - const float *pixels = img->get_pixels(); 1.26 - 1.27 - int px = (x + 1) / 2.0 * img->get_width(); 1.28 - int py = (y + 1) / 2.0 * img->get_height(); 1.29 - 1.30 - float val = pixels[px + img->get_width() * py]; 1.31 - return transfer_function(val, low_thres, high_thres); 1.32 -} 1.33 - 1.34 -static void cb_vertex(float x, float y, float z) 1.35 -{ 1.36 - float dx = 1.0 / cur_vol->get_slice(0)->get_width(); 1.37 - float dy = 1.0 / cur_vol->get_slice(0)->get_height(); 1.38 - float dz = 1.0 / cur_vol->get_slice_count(); 1.39 - float dfdx = cb_eval(x - dx, y, z) - cb_eval(x + dx, y, z); 1.40 - float dfdy = cb_eval(x, y - dy, z) - cb_eval(x, y + dy, z); 1.41 - float dfdz = cb_eval(x, y, z - dz) - cb_eval(x, y, z + dz); 1.42 - 1.43 - cur_mesh->add_normal(Vector3(dfdx, dfdy, dfdz)); 1.44 - cur_mesh->add_vertex(Vector3(x, y, z)); 1.45 -} 1.46 - 1.47 void Volume::create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres) 1.48 { 1.49 if (tmin > tmax) { 1.50 @@ -271,14 +244,6 @@ 1.51 1.52 cur_mesh = mesh; 1.53 cur_vol = this; 1.54 - 1.55 - metasurface *ms = msurf_create(); 1.56 - msurf_threshold(ms, 0.5); 1.57 - msurf_resolution(ms, xres, yres, zres); 1.58 - msurf_vertex_func(ms, cb_vertex); 1.59 - msurf_eval_func(ms, cb_eval); 1.60 - msurf_polygonize(ms); 1.61 - msurf_free(ms); 1.62 } 1.63 1.64 void Volume::draw() const