-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.h
177 lines (123 loc) · 4.61 KB
/
application.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
/**
* Header file for application.cc
*
* Application interface independent layer
*
* Author: Ricardo Marroquim
*
* Data created: 20-12-07
*
**/
#ifndef __APPLICATION__
#define __APPLICATION__
//OpenGL and GLUT includes
// Standard headers
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <stack>
#include <cassert>
using namespace std;
//IO includes
#include <sstream>
#include <iomanip>
#include <cmath>
#include <list>
#include <vector>
#include "pyramid_point_renderer_base.h"
#include "pyramid_point_renderer.h"
#include "pyramid_point_renderer_color.h"
//#include "pyramid_point_renderer_elipse.h"
//#include "pyramid_point_renderer_er.h"
#include <vcg/simplex/vertex/base.h>
#include <vcg/simplex/vertex/component.h>
#include <vcg/simplex/face/base.h>
#include <vcg/simplex/face/component.h>
#include <vcg/complex/trimesh/base.h>
#include <vcg/complex/trimesh/update/normal.h>
#include <vcg/complex/trimesh/update/bounding.h>
#include <vcg/complex/trimesh/update/flag.h>
// input output
#include <wrap/io_trimesh/import.h>
#include <wrap/gui/trackball.h>
#include <vcg/math/matrix44.h>
#include "IOSurfels.hpp"
using namespace vcg;
class CVertex;
class CFace;
class MyUsedTypes: public vcg::UsedTypes< vcg::Use<CVertex>::AsVertexType, vcg::Use<CFace>::AsFaceType> {};
class CVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vertex::Color4b, vertex::Radiusf> {};
class CFace : public vcg::Face<MyUsedTypes, vcg::face::VertexRef> {};
class CMesh : public vcg::tri::TriMesh< std::vector<CVertex>, std::vector<CFace> > {};
//class CVertex : public VertexSimp2< CVertex, CEdge, CFace, vertex::Coord3f, vertex::Normal3f, vertex::Color4b, vertex::Radiusf, vertex::Qualityf > {};
/* class CFace : public FaceSimp2< CVertex, CEdge, CFace, face::VertexRef > {}; */
/* class CMesh : public vcg::tri::TriMesh< vector<CVertex>, vector<CFace> > {}; */
class Application
{
private :
void createPointRenderer( void );
void drawPoints ( void );
public :
Application( GLint default_mode = PYRAMID_POINTS, int w = 512, int h = 512);
~Application();
void readFile ( const char * filename, bool eliptical = 0 );
int appendFile ( const char * filename );
int startFileReading ( void );
int finishFileReading ( void );
void draw ( void );
void reshape ( int w, int h );
void setView( void );
void changeRendererType ( int type );
void changeMaterial( int mat );
int getNumberPoints ( void );
void setGpuMask ( int m );
void setPerVertexColor ( bool b );
void setAutoRotate ( bool r );
void setBackFaceCulling ( bool c );
void setEllipticalWeight ( bool b );
void setReconstructionFilter ( double s );
void setMinimumRadius ( double r );
void setPrefilter ( double s );
void setDepthTest ( bool d );
void mouseLeftButton( int x, int y, bool shift, bool ctrl, bool alt );
void mouseMiddleButton(int x, int y, bool shift, bool ctrl, bool alt );
void mouseRightButton(int x, int y, bool shift, bool ctrl, bool alt );
void mouseLeftMotion( int x, int y, bool shift, bool ctrl, bool alt );
void mouseMiddleMotion( int x, int y, bool shift, bool ctrl, bool alt );
void mouseRightMotion( int x, int y, bool shift, bool ctrl, bool alt );
void mouseReleaseLeftButton( int x, int y, bool shift, bool ctrl, bool alt );
void mouseReleaseMiddleButton( int x, int y, bool shift, bool ctrl, bool alt );
void mouseReleaseRightButton( int x, int y, bool shift, bool ctrl, bool alt );
void mouseWheel( int step, bool shift, bool ctrl, bool alt );
void increaseSelected ( void );
void decreaseSelected ( void );
private :
int readSurfelFile ( const char * filename, vector<Surfeld>& surfels, bool eliptical = 0 );
Trackball trackball;
Trackball trackball_light;
Box3f FullBBox;
// Generic class, is instanced as one of the inherited classes (rendering algorithms)
PointBasedRenderer *point_based_render;
int canvas_width, canvas_height;
int windows_width, windows_height;
float clipRatioNear, clipRatioFar;
float fov;
float scale_factor;
// Lists of objects (usually one ply file is associated to one object in list)
vector<Object> objects;
// Determines which rendering class to use (Pyramid points, with color per vertex, templates version ...)
// see objects.h for the complete list (point_render_type_enum).
GLint render_mode;
// Flags on/off
bool show_points;
bool rotating;
int selected;
/***** Frames per second and Surfels per second vars ******/
double sps, fps;
int fps_loop;
double start_time, end_time;
int timing_profile;
/*************************************/
};
#endif