volmetrics

view src/volume.h @ 22:4e120dcd55ec

added shaders that just draw
author Eleni Maria Stea <elene.mst@gmail.com>
date Thu, 24 Apr 2014 20:47:48 +0300
parents 1272e3335608
children e548d95e0667
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;
17 unsigned int vol_tex;
18 mutable bool vol_tex_valid;
20 void create_vol_tex() const;
22 public:
23 Volume();
24 ~Volume();
26 bool load(const char *fname);
28 bool push_slice(Image &&slice);
29 const Image *get_slice(int num_slice) const;
31 // z must be in [0, 1]
32 const Image *get_slice_by_z(float z) const;
34 int get_slice_count() const;
36 // z must be in [0, 1]
37 int get_slice_idx_by_z(float z) const;
39 unsigned int get_texture() const;
41 void create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres);
43 void draw() const;
44 };
46 float transfer_function(float x, float low_thres, float high_thres);
48 #endif // VOLUME_H_