-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathicc_gl.h
282 lines (255 loc) · 9.4 KB
/
icc_gl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/*
* ICC Examin ist eine ICC Profil Betrachter
*
* Copyright (C) 2004-2013 Kai-Uwe Behrmann
*
* Autor: Kai-Uwe Behrmann <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* -----------------------------------------------------------------------------
*
* the 3D viewer.
*
*/
// Date: 12. 09. 2004
#ifndef ICC_GL_H
#define ICC_GL_H
#include "icc_utils.h"
//#include "agviewer.h"
#include "icc_fenster.h"
#include "icc_vrml_parser.h"
#include "icc_oyranos.h"
#include "icc_thread_daten.h"
#if defined(__APPLE__)
# include <OpenGL/glu.h>
#else
# include <GL/glu.h> // added for FLTK
#endif
#include "icc_model_observer.h"
#include "bsp/bsp.h"
//#include "Fl_Slot.H"
#include <FL/Fl_Gl_Window.H>
#include <FL/Fl_Group.H>
class Fl_Menu_Button;
class Agviewer;
/*template <typename T>
class ICCnetzList: public ICClist,
public icc_examin_ns::ThreadDaten {
};*/
class GL_View : public Fl_Gl_Window,
public icc_examin_ns::ThreadDaten,
public icc_examin_ns::Observer,
public icc_examin_ns::Model {
// internal data
//! position: colour1, colour2, colour3, colour channel No., value
ICClist<ICClist<ICClist<ICClist<double> > > > table_;
ICClist<std::string>to_channel_names_;
ICClist<std::string>from_channel_names_;
ICClist<int> channels_;
oyStructList_s * colours_;
oyNamedColor_s * epoint_; //!< emphasize point
oyProfile_s * edit_; //!< editing colour space
oyRectangle_s * window_geometry;
public:
oyNamedColor_s * mouse_3D_hit; //!< a point recently hit by the mouse
private:
void windowShape();
// adapt inner struktures at data change
void renewMenue_();
int createGLLists_();
void adornText_();
void adorn_();
int refresh_(); //!< refresh without init()
// menues
Fl_Menu_Button *menue_;
Fl_Menu_Button *menue_button_;
Fl_Menu_Button *menue_cut_;
Fl_Menu_Button *menue_shape_;
Fl_Menu_Button *menue_background_;
static void c_(Fl_Widget* w, void* data);
// IDs
Agviewer *agv_;
static int ref_;
int id_;
int type_;
void GLinit_();
void menueInit_();
typedef enum {NOTALLOWED, AXES, RASTER, POINTS , SPEKTRUM, HELPER, CONTOURS, DL_MAX } DisplayLists;
int gl_listen_[DL_MAX];
public:
typedef enum {
MENU_AXES,
MENU_QUIT,
MENU_SPHERE, //!< form of 3DLut-representation
MENU_CUBE,
MENU_STAR,
MENU_GRAY, //!< the colour displaying of the 3DLut
MENU_COLOUR,
MENU_HIGHCONTRAST,
MENU_ONIONSKIN, //!< space of the 3DLut / plug-in candidate
MENU_dE1SPHERE, //!< meashurement-/profile differences with colour location
MENU_dE2SPHERE,
MENU_dE4SPHERE,
MENU_dE1STAR,
MENU_DIFFERENCE_LINE, //!< meashurement-/profile differences with put lines
MENU_SPECTRAL_LINE, //!< spectral colours as lines
MENU_HELPER, //!< show texts and arrows
MENU_WHITE, //!< background colour
MENU_LIGHT_GRAY,
MENU_GRAY_GRAY,
MENU_DARK_GRAY,
MENU_BLACK,
MENU_MAX
} MenuChoices;
private:
int backgroundColourToMenuEntry( float farbe );
int DrawAxes;
public:
GL_View(int X,int Y,int W,int H);
GL_View(int X,int Y,int W,int H, const char *l);
~GL_View();
GL_View (const GL_View & gl)
: Fl_Gl_Window(0,0,gl.w(),gl.h()), ThreadDaten() { id_ = ref_; ++ref_; copy(gl); }
GL_View& copy(const GL_View& gl);
GL_View& operator = (const GL_View& gl) { return copy(gl); }
private:
void init_();
void zero_();
bool initialised_;
public:
void init(int window);
void savePreferences();
// which window is managed?
int id() {return id_; } //!< equal to agviewer::RedisplayWindow
void id(int i) { id_ = i; }
int type() {return type_; } //!< window ID / display mode
void type(int t_) { type_ = t_; }
static Agviewer* getAgv(GL_View *me, GL_View *referenz);
void resetContexts ();
// fltk virtual
void redraw();
private:
void draw();
int handle(int event);
int waiting_; //!< dont generate and display new movement
ICCnetz net; //!< internal net representation, thread entry
icc_examin_ns::BSPNODE *bsp; //**< BSP tree root
void loadNets_ (const icc_examin_ns::ICCThreadList<ICCnetz> & triangle_nets);
void setBspProperties_( icc_examin_ns::BSPNODE * bsp );
void setBspFaceProperties_( icc_examin_ns::FACE * faceList );
void updateNet_ ();
public:
void show();
void hide();
// redraw request from agv_
void message( icc_examin_ns::Model* model, int info );
// import data
//TODO: use oyNamedColor_s
void namedColours (oyStructList_s * colours);
oyStructList_s * namedColours ();
void namedColoursRelease ();
void emphasizePoint (oyNamedColor_s * colour); //!< a named colour
void clearNet ();
icc_examin_ns::ICCThreadList<ICCnetz> triangle_nets;
void achsNamen (ICClist<std::string> achs_namen);
void loadTable(ICClist<ICClist<ICClist<ICClist<double> > > >vect,
ICClist<std::string> fromColours,
ICClist<std::string> toColours,
ICClist<int> channels );
ICClist<int> channels() { return channels_; }
void channels( ICClist<int>channels ) { channels_ = channels; }
// transparent displaying
int channel; //!< selected channel
// displaying of grid points of the transformation table
int point_form; //!< MENU_SPHERE MENU_CUBE MENU_STAR
int point_colour; //!< MENU_GRAY MENU_COLOUR MENU_HIGHCONTRAST
int point_size; //!< size in pixel
double pointRadius(); //*< estimated size of a point
float background_colour; //!< background colour / colour sheme
float text_colour[3];
float arrow_colour[3];
float shadow;
float line_mult; //!< multiplicator
char line_1, line_2, line_3;
int onion_skin; //!< MENU_ONIONSKIN
// drawing functions
void setPerspective(); //!< actualise perspektive
void refreshTable();//!< glCompile for table
void refreshPoints(); //!< glCompile for points
void refreshNets(); //!< sort and drawing
double window_proportion; //!< proportion of window
static const double std_front_cut;
double front_cut; //!< front cut plane
double cut_distance; //!< thickness of the GL slice
double level; //*< level for table slicing 0...1
double level_step; //*< modification of level variable
double cie_a_display_stretch; //!< direction CIE*a for stretching
double cie_b_display_stretch; //!< ~ CIE*b ; where CIE*L max is 1.0
bool show_points_as_pairs;
bool show_points_as_measurements;
int spectral_line; //!< show spectral saturated colour line
int show_helpers; //!< show arrows and text
char text[128]; //!< Status line text
void iccPoint3d ( oyPROFILE_e projection,
double * vertex,
double radius );
private:
void showSprectralLine_();
void showContours_();
// Debug
void drawCoordinates_();
public:
// display functions
void drawGL(); //!< gl drawing
int keyEvents(int e);
void menuEvents(int value);
// Bewegungsfunktionen
void move(bool setze);
bool canMove();
void canMove(int d);
void invalidate(void) { Fl_Gl_Window::invalidate(); valid_ = 0; line_mult = SCALE(1.0); }
private:
static void moveStatic_(void* GL_View);
private:
double time_diff_; //!< seconds per frame
double time_;
int valid_; //!< remembers valid() from within draw()
int update_geometries_; //!< remembers creating GL lists from within draw()
char t[128]; //!< text for searching errors
int mouse_x_;
int mouse_y_;
int mouse_x_old, mouse_y_old;
bool mouse_stays;
void mousePoint_( GLdouble & oX, GLdouble & oY, GLdouble & oZ,
GLdouble & X, GLdouble & Y, GLdouble & Z, int from_mouse );
public:
// speed
int smooth; //!< smooth drawing
int blend; //!< -"-
// data informations
const char* channelName() const {
if (to_channel_names_.size() &&
(int)to_channel_names_.size() > channel) {
return to_channel_names_[channel].c_str();
} else {
return "";} }
const char* channelName(unsigned int i) const {
if (to_channel_names_.size()>i)
return (const char*)to_channel_names_[i].c_str();
else return _("not available"); }
unsigned int channel_count() {return (unsigned int)to_channel_names_.size(); }
};
#endif //ICC_GL_H