glviewvol

view src/xfermap.h @ 15:2a67ea257ac0

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