File: myglwidget.h

package info (click to toggle)
meshlab 1.3.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,900 kB
  • ctags: 33,325
  • sloc: cpp: 224,813; ansic: 8,170; xml: 119; makefile: 78
file content (151 lines) | stat: -rw-r--r-- 2,863 bytes parent folder | download | duplicates (5)
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
#include <GL/glew.h>
#include <qgl.h>
#include <wrap/gl/glwraptetra.h>
#include <wrap/gl/pick.h>
#include <wrap/gui/trackball.h>
#include "myclasses.h"
#include "tetrastats.h"



class MyGLWidget: public QGLWidget{

Q_OBJECT

private :
	int _H;
	int _W;
	vcg::Trackball Track;
	vcg::GLWrapTetra<MyTetraMesh::TetraContainer > *WT;

	GLdouble projection[16];
	GLdouble modelMatrix[16];
	GLint viewport[4];

	
	int modality;//rendering modality
	enum mousemod {MMTrackball, MMSection,MMNavigateSection};//modality of using mouse
	mousemod mouse_modality;
	

	vcg::Trackball TrackClip;
	
/// This are the flags pf info of the mesh that we want to show
	int  _ShowBar;

  enum {
	SIMPLEX        = 0x00000001,	 // show vertex number and tetrahedrons number
	PHYSICS		   = 0x00000002,	 // show also physical information about the mesh
	QUALITY        = 0x00000004,	 // show informations about aspect ratio
	};

	
public:
	
	MyGLWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 );

	virtual void glDraw();
    void resizeGL( int w, int h );
    virtual void mousePressEvent ( QMouseEvent * e );
	virtual void mouseReleaseEvent(QMouseEvent * e );
	virtual void mouseMoveEvent ( QMouseEvent * e );
	virtual void wheelEvent ( QWheelEvent * e );
	virtual void keyPressEvent(QKeyEvent *k);
	virtual void initializeGL();
	virtual void SaveMatrix();
	void DrawTetraMesh();
	void DrawBox();
	bool ShowTextSimplex();
	bool ShowTextPhysics();
	bool ShowTextQuality();
	void DrawTextInfo();
	void LoadMatrix();

public slots:

	///bounding box visualization modality
	void setBox(){
		modality=0;
		repaint();
	};

	///wireframe modality
	void setWire(){
		modality=1;
		repaint();
	};

	///hiddenlines modality
	void setHidden(){
		modality=2;
		repaint();
	};

	///alternate wire visualization
	void setFlat(){
		modality=3;
		repaint();
	};

	///alternate wire visualization
	void setFlatWire(){
		modality=4;
		repaint();
	};

	///alternate wire visualization
	void setSmooth(){
		modality=5;
		repaint();
	};

	///alternate wire visualization
	void setSmallTetra()
	{
		modality=6;
		repaint();
	};

	//set trackball modality
	void TrackMouseModality()
	{
		mouse_modality=MMTrackball;
	};

	//set trackball modality
	void SectionMouseModality()
	{
		mouse_modality=MMSection;
	};

	///switching to modality of viewing txt info on simplex
	void SwitchTextSimplex()
	{
		if (ShowTextSimplex())
			_ShowBar&=~SIMPLEX;
		else
			_ShowBar|=SIMPLEX;
		repaint();
	};

	///switching to modality of viewing txt info on physics
	void SwitchTextPhysics()
	{
		if (ShowTextPhysics())
			_ShowBar&=~PHYSICS;
		else
		_ShowBar|=PHYSICS;
		repaint();
	};

	///switching to modality of viewing txt info on quality
	void SwitchTextQuality()
	{
		if (ShowTextQuality())
			_ShowBar&=~QUALITY;
		else
		_ShowBar|=QUALITY;
		repaint();
	};

};