volmetrics

view src/volume.h @ 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 add30e2d5253
children eb87d4a12bd3
line source
1 #ifndef VOLUME_H_
2 #define VOLUME_H_
4 #include <vector>
5 #include "image.h"
7 class Mesh;
9 class Volume {
10 private:
11 std::vector<Image> slices;
13 int width;
14 int height;
15 float zaspect;
16 float x_rot;
18 unsigned int vol_tex;
19 mutable bool vol_tex_valid;
21 void create_vol_tex() const;
23 public:
24 Volume();
25 ~Volume();
27 bool load(const char *fname);
29 bool push_slice(Image &&slice);
30 const Image *get_slice(int num_slice) const;
32 // z must be in [0, 1]
33 const Image *get_slice_by_z(float z) const;
35 int get_slice_count() const;
37 // z must be in [0, 1]
38 int get_slice_idx_by_z(float z) const;
40 unsigned int get_texture() const;
42 float get_volume_rotation() const;
44 void create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres);
46 void draw() const;
47 };
49 float transfer_function(float x, float low_thres, float high_thres);
51 #endif // VOLUME_H_