volmetrics

annotate src/volume.h @ 26:5ee081af59b8

volume rendering
author Eleni Maria Stea <elene.mst@gmail.com>
date Sun, 27 Apr 2014 18:25:40 +0300
parents 1272e3335608
children e548d95e0667
rev   line source
eleni@0 1 #ifndef VOLUME_H_
eleni@0 2 #define VOLUME_H_
eleni@0 3
elene@3 4 #include <vector>
elene@3 5 #include "image.h"
elene@3 6
elene@9 7 class Mesh;
elene@9 8
eleni@1 9 class Volume {
eleni@1 10 private:
elene@3 11 std::vector<Image> slices;
elene@6 12
elene@4 13 int width;
elene@4 14 int height;
elene@5 15 float zaspect;
eleni@1 16
elene@6 17 unsigned int vol_tex;
elene@6 18 mutable bool vol_tex_valid;
elene@6 19
elene@6 20 void create_vol_tex() const;
elene@6 21
elene@3 22 public:
elene@3 23 Volume();
elene@6 24 ~Volume();
elene@3 25
elene@6 26 bool load(const char *fname);
elene@6 27
elene@4 28 bool push_slice(Image &&slice);
elene@6 29 const Image *get_slice(int num_slice) const;
elene@9 30
elene@9 31 // z must be in [0, 1]
elene@6 32 const Image *get_slice_by_z(float z) const;
elene@9 33
elene@6 34 int get_slice_count() const;
elene@6 35
elene@9 36 // z must be in [0, 1]
elene@6 37 int get_slice_idx_by_z(float z) const;
elene@6 38
elene@6 39 unsigned int get_texture() const;
elene@3 40
elene@12 41 void create_mesh(Mesh *mesh, float tmin, float tmax, int xres, int yres, int zres);
elene@9 42
elene@8 43 void draw() const;
eleni@1 44 };
eleni@1 45
elene@16 46 float transfer_function(float x, float low_thres, float high_thres);
elene@16 47
eleni@0 48 #endif // VOLUME_H_