rev |
line source |
nuclear@12
|
1 /*
|
nuclear@12
|
2 glviewvol is an OpenGL 3D volume data viewer
|
nuclear@12
|
3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org>
|
nuclear@12
|
4
|
nuclear@12
|
5 This program is free software: you can redistribute it and/or modify
|
nuclear@12
|
6 it under the terms of the GNU General Public License as published by
|
nuclear@12
|
7 the Free Software Foundation, either version 3 of the License, or
|
nuclear@12
|
8 (at your option) any later version.
|
nuclear@12
|
9
|
nuclear@12
|
10 This program is distributed in the hope that it will be useful,
|
nuclear@12
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nuclear@12
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nuclear@12
|
13 GNU General Public License for more details.
|
nuclear@12
|
14
|
nuclear@12
|
15 You should have received a copy of the GNU General Public License
|
nuclear@12
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
nuclear@12
|
17 */
|
nuclear@6
|
18 #ifndef XFERMAP_H_
|
nuclear@6
|
19 #define XFERMAP_H_
|
nuclear@6
|
20
|
nuclear@6
|
21 class TransferFunc {
|
nuclear@6
|
22 public:
|
nuclear@6
|
23 virtual ~TransferFunc();
|
nuclear@6
|
24
|
nuclear@6
|
25 virtual float map(float x) const = 0;
|
nuclear@6
|
26 virtual void map(float x, float *rgba_value) const = 0;
|
nuclear@6
|
27 };
|
nuclear@6
|
28
|
nuclear@6
|
29 class TransferWindow : public TransferFunc {
|
nuclear@6
|
30 private:
|
nuclear@6
|
31 float soft_rad;
|
nuclear@7
|
32 float low[3], high[3]; // rgb
|
nuclear@6
|
33
|
nuclear@6
|
34 public:
|
nuclear@7
|
35 enum { HANDLE_LOW = 0, HANDLE_HIGH = 1};
|
nuclear@7
|
36
|
nuclear@6
|
37 TransferWindow();
|
nuclear@6
|
38
|
nuclear@7
|
39 // handle: 0 or HANDLE_LOW is low, 1 or HANDLE_HIGH is high
|
nuclear@7
|
40 // if channel == -1, change all channels simultaneously
|
nuclear@7
|
41 void set_handle(int channel, int handle, float val);
|
nuclear@7
|
42 float get_handle(int channel, int handle) const;
|
nuclear@7
|
43
|
nuclear@7
|
44 int nearest_handle(int channel, float pos) const;
|
nuclear@7
|
45
|
nuclear@6
|
46 void set_interval(float a, float b);
|
nuclear@6
|
47 void set_interval(float *rgba_low, float *rgba_high);
|
nuclear@6
|
48 void set_interval_rgba(int channel, float a, float b);
|
nuclear@6
|
49
|
nuclear@6
|
50 void get_interval(float *aptr, float *bptr) const;
|
nuclear@6
|
51 void get_interval_rgba(float *rgba_low, float *rgba_high) const;
|
nuclear@6
|
52 void get_interval_rgba(int channel, float *aptr, float *bptr) const;
|
nuclear@6
|
53
|
nuclear@6
|
54 void set_soft_radius(float s);
|
nuclear@6
|
55 float get_soft_radius() const;
|
nuclear@6
|
56
|
nuclear@6
|
57 float map(float x) const;
|
nuclear@6
|
58 void map(float x, float *rgba_value) const;
|
nuclear@6
|
59 };
|
nuclear@6
|
60
|
nuclear@6
|
61 #endif // XFERMAP_H_
|