Subversion Repositories gelsvn

Rev

Rev 386 | Rev 388 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 386 Rev 387
1
/*
1
/*
2
 *  MeshEdit is a small application which allows you to load and edit a mesh.
2
 *  MeshEdit is a small application which allows you to load and edit a mesh.
3
 *  The mesh will be stored in GEL's half edge based Manifold data structure.
3
 *  The mesh will be stored in GEL's half edge based Manifold data structure.
4
 *  A number of editing operations are supported. Most of these are accessible from the 
4
 *  A number of editing operations are supported. Most of these are accessible from the 
5
 *  console that pops up when you hit 'esc'.
5
 *  console that pops up when you hit 'esc'.
6
 *
6
 *
7
 *  Created by J. Andreas Bærentzen on 15/08/08.
7
 *  Created by J. Andreas Bærentzen on 15/08/08.
8
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
8
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
9
 *
9
 *
10
 */
10
 */
11
#include <iostream>
11
#include <iostream>
12
#include <CGLA/eigensolution.h>
12
#include <CGLA/eigensolution.h>
13
#include <CGLA/Vec2d.h>
13
#include <CGLA/Vec2d.h>
14
#include <CGLA/Vec3d.h>
14
#include <CGLA/Vec3d.h>
15
#include <CGLA/Mat3x3d.h>
15
#include <CGLA/Mat3x3d.h>
16
#include <CGLA/Mat2x2d.h>
16
#include <CGLA/Mat2x2d.h>
17
#include <CGLA/Mat2x3d.h>
17
#include <CGLA/Mat2x3d.h>
18
 
18
 
19
#include <LinAlg/Matrix.h>
19
#include <LinAlg/Matrix.h>
20
#include <LinAlg/Vector.h>
20
#include <LinAlg/Vector.h>
21
#include <LinAlg/LapackFunc.h>
21
#include <LinAlg/LapackFunc.h>
22
 
22
 
23
#include <Util/Timer.h>
23
#include <Util/Timer.h>
24
#include <Util/ArgExtracter.h>
24
#include <Util/ArgExtracter.h>
25
 
25
 
26
#include <GL/glew.h>
26
#include <GL/glew.h>
27
#include <GLGraphics/gel_glut.h>
27
#include <GLGraphics/gel_glut.h>
28
#include <GLGraphics/draw.h>
28
#include <GLGraphics/draw.h>
29
#include <GLGraphics/glsl_shader.h>
29
#include <GLGraphics/glsl_shader.h>
30
#include <GLGraphics/GLViewController.h>
30
#include <GLGraphics/GLViewController.h>
31
 
31
 
32
#include <HMesh/Manifold.h>
32
#include <HMesh/Manifold.h>
33
#include <HMesh/VertexCirculator.h>
33
#include <HMesh/VertexCirculator.h>
34
#include <HMesh/FaceCirculator.h>
34
#include <HMesh/FaceCirculator.h>
35
#include <HMesh/build_manifold.h>
35
#include <HMesh/build_manifold.h>
36
#include <HMesh/mesh_optimization.h>
36
#include <HMesh/mesh_optimization.h>
37
#include <HMesh/triangulate.h>
37
#include <HMesh/triangulate.h>
38
#include <HMesh/load.h>
38
#include <HMesh/load.h>
-
 
39
#include <HMesh/quadric_simplify.h>
-
 
40
#include <HMesh/smooth.h>
39
#include <HMesh/x3d_save.h>
41
#include <HMesh/x3d_save.h>
-
 
42
#include <HMesh/mesh_optimization.h>
40
 
43
 
41
#include <GLConsole/GLConsole.h>
44
#include <GLConsole/GLConsole.h>
42
 
45
 
43
#include "harmonics.h"
46
#include "harmonics.h"
44
#include "wireframe.h"
47
#include "wireframe.h"
45
 
48
 
46
 
49
 
47
// Single global instance so glut can get access
50
// Single global instance so glut can get access
48
GLConsole theConsole;
51
GLConsole theConsole;
49
 
52
 
50
////////////////////////////////////////////////////////////////////////////////
53
////////////////////////////////////////////////////////////////////////////////
51
char* ConsoleHelp(std::vector<std::string> &args)
54
char* ConsoleHelp(std::vector<std::string> &args)
52
{
55
{
53
    theConsole.Printf("");
56
    theConsole.Printf("");
54
    theConsole.Printf("----------------- HELP -----------------");
57
    theConsole.Printf("----------------- HELP -----------------");
55
    theConsole.Printf("Press ~ key to open and close console");
58
    theConsole.Printf("Press ~ key to open and close console");
56
    theConsole.Printf("Press TAB to see the available commands and functions");
59
    theConsole.Printf("Press TAB to see the available commands and functions");
57
    theConsole.Printf("Functions are shown in green and variables in yellow");
60
    theConsole.Printf("Functions are shown in green and variables in yellow");
58
    theConsole.Printf("Setting a value: [command] = value");
61
    theConsole.Printf("Setting a value: [command] = value");
59
    theConsole.Printf("Getting a value: [command]");
62
    theConsole.Printf("Getting a value: [command]");
60
    theConsole.Printf("Functions: [function] [arg1] [arg2] ...");
63
    theConsole.Printf("Functions: [function] [arg1] [arg2] ...");
61
    theConsole.Printf("Entering just the function name will give a description.");
64
    theConsole.Printf("Entering just the function name will give a description.");
62
    theConsole.Printf("History: Up and Down arrow keys move through history.");
65
    theConsole.Printf("History: Up and Down arrow keys move through history.");
63
    theConsole.Printf("Tab Completion: TAB does tab completion and makes suggestions.");
66
    theConsole.Printf("Tab Completion: TAB does tab completion and makes suggestions.");
64
    theConsole.Printf("----------------- HELP -----------------");
67
    theConsole.Printf("----------------- HELP -----------------");
65
    theConsole.Printf("");
68
    theConsole.Printf("");
66
    return "";
69
    return "";
67
}
70
}
68
 
71
 
69
using namespace std;
72
using namespace std;
70
using namespace HMesh;
73
using namespace HMesh;
71
using namespace Geometry;
74
using namespace Geometry;
72
using namespace GLGraphics;
75
using namespace GLGraphics;
73
using namespace CGLA;
76
using namespace CGLA;
74
using namespace Util;
77
using namespace Util;
75
using namespace LinAlg;
78
using namespace LinAlg;
76
 
79
 
77
 
80
 
78
 
81
 
79
namespace 
82
namespace 
80
{
83
{
81
	GLViewController* view_ctrl;
84
	GLViewController* view_ctrl;
82
	int WINX=800, WINY=800;
85
	int WINX=800, WINY=800;
83
	
86
	
84
	Manifold mani;	
87
	Manifold mani;	
85
	bool create_display_list = true;
88
	bool create_display_list = true;
86
}
89
}
87
 
90
 
88
 
91
 
-
 
92
char* console_minimize_curvature(std::vector<std::string> &args)
-
 
93
{
-
 
94
	bool anneal=false;
-
 
95
	if(args.size()>0)
-
 
96
	{
-
 
97
		istringstream a0(args[0]);
-
 
98
		a0 >> anneal;
-
 
99
	}
-
 
100
 
-
 
101
	minimize_curvature(mani, anneal);
-
 
102
	return "";
-
 
103
}
-
 
104
 
-
 
105
char* console_minimize_dihedral(std::vector<std::string> &args)
-
 
106
{
-
 
107
	int iter = 1000;
-
 
108
	if(args.size()>0)
-
 
109
	{
-
 
110
		istringstream a0(args[0]);
-
 
111
		a0 >> iter;
-
 
112
	}
-
 
113
 
-
 
114
	bool anneal = false;
-
 
115
	if(args.size()>1)
-
 
116
	{
-
 
117
		istringstream a0(args[0]);
-
 
118
		a0 >> anneal;
-
 
119
	}
-
 
120
 
-
 
121
	bool use_alpha = true;
-
 
122
	if(args.size()>22)
-
 
123
	{
-
 
124
		istringstream a0(args[0]);
-
 
125
		a0 >> use_alpha;
-
 
126
	}
-
 
127
 
-
 
128
	float gamma = 4.0;
-
 
129
	if(args.size()>3)
-
 
130
	{
-
 
131
		istringstream a0(args[0]);
-
 
132
		a0 >> gamma;
-
 
133
	}
-
 
134
	
-
 
135
	
-
 
136
	minimize_dihedral_angle(mani, iter, anneal, use_alpha, gamma);
-
 
137
	return "";
-
 
138
}
-
 
139
 
-
 
140
char* console_optimize_valency(std::vector<std::string> &args)
-
 
141
{
-
 
142
	bool anneal=false;
-
 
143
	if(args.size()>0)
-
 
144
	{
-
 
145
		istringstream a0(args[0]);
-
 
146
		a0 >> anneal;
-
 
147
	}
-
 
148
	optimize_valency(mani, anneal);
-
 
149
	return "";
-
 
150
}
89
 
151
 
90
char* console_partial_reconstruct(std::vector<std::string> &args)
152
char* console_partial_reconstruct(std::vector<std::string> &args)
91
{
153
{
92
	int E0,E1;
154
	int E0,E1;
93
	float scale;
155
	float scale;
94
	istringstream a0(args[0]);
156
	istringstream a0(args[0]);
95
	a0 >> E0;
157
	a0 >> E0;
96
	istringstream a1(args[1]);
158
	istringstream a1(args[1]);
97
	a1 >> E1;
159
	a1 >> E1;
98
	istringstream a2(args[2]);
160
	istringstream a2(args[2]);
99
	a2 >> scale;
161
	a2 >> scale;
100
	partial_reconstruct(mani, E0,E1,scale);
162
	partial_reconstruct(mani, E0,E1,scale);
101
	return "";
163
	return "";
102
}
164
}
103
 
165
 
104
char* console_reset_shape(std::vector<std::string> &args)
166
char* console_reset_shape(std::vector<std::string> &args)
105
{
167
{
106
	reset_shape(mani);
168
	reset_shape(mani);
107
	return "";
169
	return "";
108
}
170
}
109
 
171
 
110
void reshape(int W, int H)
172
void reshape(int W, int H)
111
{
173
{
112
	view_ctrl->reshape(W,H);
174
	view_ctrl->reshape(W,H);
113
}
175
}
114
 
176
 
115
 
177
 
-
 
178
char* console_simplify(std::vector<std::string> &args)
-
 
179
{
-
 
180
	float keep_fraction;
-
 
181
	if(args.size()==0) return "you must specify fraction of vertices to keep";
-
 
182
	istringstream a0(args[0]);
-
 
183
	a0 >> keep_fraction;
-
 
184
 
-
 
185
	Vec3f p0, p7;
-
 
186
	mani.get_bbox(p0, p7);
-
 
187
	Vec3f d = p7-p0;
-
 
188
	float s = 1.0/d.max_coord();
-
 
189
	Vec3f pcentre = (p7+p0)/2.0;
-
 
190
	for(VertexIter vi = mani.vertices_begin(); vi != mani.vertices_end(); ++vi)
-
 
191
		vi->pos = (vi->pos - pcentre) * s;
-
 
192
	quadric_simplify(mani,keep_fraction,0.0001f,true);
-
 
193
	for(VertexIter vi = mani.vertices_begin(); vi != mani.vertices_end(); ++vi)
-
 
194
		vi->pos = vi->pos*d.max_coord() + pcentre;
-
 
195
	return "";
-
 
196
}
-
 
197
 
-
 
198
char* console_laplacian_smooth(std::vector<std::string> &args)
-
 
199
{
-
 
200
	float t=1.0;
-
 
201
	if(args.size()>0)
-
 
202
	{
-
 
203
		istringstream a0(args[0]);
-
 
204
		a0 >> t;
-
 
205
	}
-
 
206
	/// Simple laplacian smoothing with an optional weight.
-
 
207
	laplacian_smooth(mani, t);
-
 
208
	return "";
-
 
209
}
-
 
210
 
-
 
211
char* console_taubin_smooth(std::vector<std::string> &args)
-
 
212
{
-
 
213
	int iter=1;
-
 
214
	if(args.size()>0)
-
 
215
	{
-
 
216
		istringstream a0(args[0]);
-
 
217
		a0 >> iter;
-
 
218
	}
-
 
219
	
-
 
220
	/// Taubin smoothing is similar to laplacian smoothing but reduces shrinkage
-
 
221
	taubin_smooth(mani,  iter);
-
 
222
	return "";
-
 
223
}
-
 
224
 
-
 
225
char* console_fvm_smooth(std::vector<std::string> &args)
-
 
226
{	
-
 
227
	int iter=1;
-
 
228
	if(args.size()>0)
-
 
229
	{
-
 
230
		istringstream a0(args[0]);
-
 
231
		a0 >> iter;
-
 
232
	}
-
 
233
	/** Fuzzy vector median smoothing is effective when it comes to
-
 
234
	 preserving sharp edges. */
-
 
235
	fvm_smooth(mani,  iter);
-
 
236
	return "";
-
 
237
 
-
 
238
}
116
 
239
 
117
void display() 
240
void display() 
118
{
241
{
119
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
242
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
120
	
243
	
121
	static CVar<int> do_wireframe("display.wireframe",0);
244
	static CVar<int> do_wireframe("display.wireframe",0);
122
	
245
	
123
	glPushMatrix();
246
	glPushMatrix();
124
	
247
	
125
	view_ctrl->set_gl_modelview();
248
	view_ctrl->set_gl_modelview();
126
	
249
	
127
	if(create_display_list)
250
	if(create_display_list)
128
	{
251
	{
129
		create_display_list = false;
252
		create_display_list = false;
130
		
253
		
131
		glNewList(1,GL_COMPILE);
254
		glNewList(1,GL_COMPILE);
132
		if(do_wireframe)
255
		if(do_wireframe)
133
			{
256
			{
134
				enable_wireframe();
257
				enable_wireframe();
135
				draw(mani);
258
				draw(mani);
136
			}
259
			}
137
		else
260
		else
138
			draw_eigenvalues(mani);
261
			draw_eigenvalues(mani);
139
		glEndList();
262
		glEndList();
140
	}
263
	}
141
	glCallList(1);
264
	glCallList(1);
142
	
265
	
143
	glPopMatrix();
266
	glPopMatrix();
144
	
267
	
145
	glUseProgram(0);
268
	glUseProgram(0);
146
	theConsole.RenderConsole();
269
	theConsole.RenderConsole();
147
	
270
	
148
	glutSwapBuffers();
271
	glutSwapBuffers();
149
}
272
}
150
 
273
 
151
void animate() 
274
void animate() 
152
{	
275
{	
153
	usleep( (int)1e4 );
276
	usleep( (int)1e4 );
154
	view_ctrl->try_spin();
277
	view_ctrl->try_spin();
155
	glutPostRedisplay();
278
	glutPostRedisplay();
156
}
279
}
157
 
280
 
158
 
281
 
159
void mouse(int button, int state, int x, int y) 
282
void mouse(int button, int state, int x, int y) 
160
{
283
{
161
	Vec2i pos(x,y);
284
	Vec2i pos(x,y);
162
	if (state==GLUT_DOWN) 
285
	if (state==GLUT_DOWN) 
163
	{
286
	{
164
		if (button==GLUT_LEFT_BUTTON) 
287
		if (button==GLUT_LEFT_BUTTON) 
165
			view_ctrl->grab_ball(ROTATE_ACTION,pos);
288
			view_ctrl->grab_ball(ROTATE_ACTION,pos);
166
		else if (button==GLUT_MIDDLE_BUTTON) 
289
		else if (button==GLUT_MIDDLE_BUTTON) 
167
			view_ctrl->grab_ball(ZOOM_ACTION,pos);
290
			view_ctrl->grab_ball(ZOOM_ACTION,pos);
168
		else if (button==GLUT_RIGHT_BUTTON) 
291
		else if (button==GLUT_RIGHT_BUTTON) 
169
			view_ctrl->grab_ball(PAN_ACTION,pos);
292
			view_ctrl->grab_ball(PAN_ACTION,pos);
170
	}
293
	}
171
	else if (state==GLUT_UP)
294
	else if (state==GLUT_UP)
172
		view_ctrl->release_ball();
295
		view_ctrl->release_ball();
173
}
296
}
174
 
297
 
175
void motion(int x, int y) {
298
void motion(int x, int y) {
176
	Vec2i pos(x,y);
299
	Vec2i pos(x,y);
177
	view_ctrl->roll_ball(Vec2i(x,y));
300
	view_ctrl->roll_ball(Vec2i(x,y));
178
}
301
}
179
 
302
 
180
void keyboard_spec(int key, int x, int y)
303
void keyboard_spec(int key, int x, int y)
181
{
304
{
182
   int mod = glutGetModifiers();
305
   int mod = glutGetModifiers();
183
 
306
 
184
    if( theConsole.isOpen() ) {
307
    if( theConsole.isOpen() ) {
185
        // If shift held, scroll the console
308
        // If shift held, scroll the console
186
        if( mod == GLUT_ACTIVE_SHIFT ) {
309
        if( mod == GLUT_ACTIVE_SHIFT ) {
187
            switch (key){
310
            switch (key){
188
                case GLUT_KEY_UP:
311
                case GLUT_KEY_UP:
189
                    theConsole.ScrollDownLine();
312
                    theConsole.ScrollDownLine();
190
                    break;
313
                    break;
191
                case GLUT_KEY_DOWN: 
314
                case GLUT_KEY_DOWN: 
192
                    theConsole.ScrollUpLine();
315
                    theConsole.ScrollUpLine();
193
                    break;
316
                    break;
194
            }
317
            }
195
        } else {
318
        } else {
196
            theConsole.StandardKeyBindings( key );
319
            theConsole.StandardKeyBindings( key );
197
        }
320
        }
198
    }
321
    }
199
}
322
}
200
 
323
 
201
template<typename T>
324
template<typename T>
202
T& get_CVar_ref(const std::string& s)
325
T& get_CVar_ref(const std::string& s)
203
{
326
{
204
	return *reinterpret_cast<T*> (GetCVarData(s));
327
	return *reinterpret_cast<T*> (GetCVarData(s));
205
}
328
}
206
 
329
 
207
void keyboard(unsigned char key, int x, int y) 
330
void keyboard(unsigned char key, int x, int y) 
208
{	
331
{	
209
	if(theConsole.isOpen())
332
	if(theConsole.isOpen())
210
		switch(key) {
333
		switch(key) {
211
			case '\033': 
334
			case '\033': 
212
				theConsole.ToggleConsole();
335
				theConsole.ToggleConsole();
213
			default:      
336
			default:      
214
				//send keystroke to console
337
				//send keystroke to console
215
				if( theConsole.isOpen() ){
338
				if( theConsole.isOpen() ){
216
					theConsole.EnterCommandCharacter(key);
339
					theConsole.EnterCommandCharacter(key);
217
				}
340
				}
218
				break;
341
				break;
219
		}	
342
		}	
220
	else {
343
	else {
221
		int& display_eigenvalue = get_CVar_ref<int>("display.eigenvalue");
344
		int& display_eigenvalue = get_CVar_ref<int>("display.eigenvalue");
222
		int& display_wireframe = get_CVar_ref<int>("display.wireframe");
345
		int& display_wireframe = get_CVar_ref<int>("display.wireframe");
223
		int& display_diffuse = get_CVar_ref<int>("display.diffuse");
346
		int& display_diffuse = get_CVar_ref<int>("display.diffuse");
224
		int& display_highlight = get_CVar_ref<int>("display.highlight");
347
		int& display_highlight = get_CVar_ref<int>("display.highlight");
225
		
348
		
226
		switch(key) {
349
		switch(key) {
227
			case 'q': exit(0);
350
			case 'q': exit(0);
228
			case '\033':
351
			case '\033':
229
				theConsole.ToggleConsole();
352
				theConsole.ToggleConsole();
230
				break;
353
				break;
231
			case '+': 
354
			case '+': 
232
				display_eigenvalue = min(display_eigenvalue+1, MAX_E); 
355
				display_eigenvalue = min(display_eigenvalue+1, MAX_E); 
233
				break;
356
				break;
234
			case '-': 
357
			case '-': 
235
				display_eigenvalue = max(display_eigenvalue-1, 0); 
358
				display_eigenvalue = max(display_eigenvalue-1, 0); 
236
				break;
359
				break;
237
			case '1': E = 1; reconstruct(mani,E); 
360
			case '1': E = 1; reconstruct(mani,E); 
238
				break;
361
				break;
239
			case '>': if(E < MAX_E) partial_reconstruct(mani,E,++E); 
362
			case '>': if(E < MAX_E) partial_reconstruct(mani,E,++E); 
240
				break;
363
				break;
241
			case '<': E = max(E-1, 0); reconstruct(mani,E); 
364
			case '<': E = max(E-1, 0); reconstruct(mani,E); 
242
				break;
365
				break;
243
			case 'd':	
366
			case 'd':	
244
				display_diffuse = !display_diffuse; 
367
				display_diffuse = !display_diffuse; 
245
				break;
368
				break;
246
			case 'h':
369
			case 'h':
247
				display_highlight = !display_highlight;
370
				display_highlight = !display_highlight;
248
				break;			
371
				break;			
249
			case 'w':
372
			case 'w':
250
				display_wireframe = !display_wireframe;
373
				display_wireframe = !display_wireframe;
251
				break;
374
				break;
252
		}
375
		}
253
	}
376
	}
254
	create_display_list = true;
377
	create_display_list = true;
255
}
378
}
256
 
379
 
257
void init_glut(int argc, char** argv)
380
void init_glut(int argc, char** argv)
258
{
381
{
259
	glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
382
	glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH);
260
	glutInitWindowSize(WINX, WINY);
383
	glutInitWindowSize(WINX, WINY);
261
	glutInit(&argc, argv);
384
	glutInit(&argc, argv);
262
	glutCreateWindow("Shape Harmonics");
385
	glutCreateWindow("Shape Harmonics");
263
	glutDisplayFunc(display);
386
	glutDisplayFunc(display);
264
	glutKeyboardFunc(keyboard);
387
	glutKeyboardFunc(keyboard);
265
	glutSpecialFunc(keyboard_spec);
388
	glutSpecialFunc(keyboard_spec);
266
	glutReshapeFunc(reshape);
389
	glutReshapeFunc(reshape);
267
	glutMouseFunc(mouse);
390
	glutMouseFunc(mouse);
268
	glutMotionFunc(motion);
391
	glutMotionFunc(motion);
269
	glutIdleFunc(animate);
392
	glutIdleFunc(animate);
270
}
393
}
271
 
394
 
272
void init_gl()
395
void init_gl()
273
{
396
{
274
	glewInit();
397
	glewInit();
275
	glEnable(GL_LIGHTING);
398
	glEnable(GL_LIGHTING);
276
	glEnable(GL_LIGHT0);
399
	glEnable(GL_LIGHT0);
277
	Vec3f c(0,0,0);
400
	Vec3f c(0,0,0);
278
	float r = 5;
401
	float r = 5;
279
	mani.get_bsphere(c,r);
402
	mani.get_bsphere(c,r);
280
	view_ctrl = new GLViewController(WINX,WINY, c,r*2);
403
	view_ctrl = new GLViewController(WINX,WINY, c,r*2);
281
	
404
	
282
	initialize_wireframe_shaders();
405
	initialize_wireframe_shaders();
283
	
406
	
284
	
407
	
285
	// Set the value of a uniform
408
	// Set the value of a uniform
286
	//glUniform2f(glGetUniformLocation(prog_P0,"WIN_SCALE"), win_size_x/2.0, win_size_y/2.0);
409
	//glUniform2f(glGetUniformLocation(prog_P0,"WIN_SCALE"), win_size_x/2.0, win_size_y/2.0);
287
	
410
	
288
	glMatrixMode(GL_MODELVIEW);
411
	glMatrixMode(GL_MODELVIEW);
289
	glLoadIdentity();
412
	glLoadIdentity();
290
	glClearColor(0.50f, 0.50f, 0.50f, 0.f);
413
	glClearColor(0.50f, 0.50f, 0.50f, 0.f);
291
	glColor4f(1.0f, 1.0f, 1.0f, 0.f);
414
	glColor4f(1.0f, 1.0f, 1.0f, 0.f);
292
	glEnable(GL_DEPTH_TEST);
415
	glEnable(GL_DEPTH_TEST);
293
	
416
	
294
	static CVar<ConsoleFunc> help( "help", ConsoleHelp );
417
	static CVar<ConsoleFunc> help( "help", ConsoleHelp );
295
	static CVar<ConsoleFunc> rs("reset_shape", console_reset_shape);
418
	static CVar<ConsoleFunc> rs("reset_shape", console_reset_shape);
296
	static CVar<ConsoleFunc> pr("partial_reconstruct", console_partial_reconstruct);
419
	static CVar<ConsoleFunc> pr("partial_reconstruct", console_partial_reconstruct);
-
 
420
	static CVar<ConsoleFunc> simpl("simplify", console_simplify);
-
 
421
	static CVar<ConsoleFunc> lsmooth("laplacian_smooth", console_laplacian_smooth);
-
 
422
	static CVar<ConsoleFunc> tsmooth("taubin_smooth", console_taubin_smooth);
-
 
423
	static CVar<ConsoleFunc> fsmooth("fvm_smooth", console_fvm_smooth);
297
 
424
 
-
 
425
	static CVar<ConsoleFunc> opt_val("optimize_valency", console_optimize_valency);
-
 
426
	static CVar<ConsoleFunc> min_dih("minimize_dihedral", console_minimize_dihedral);
-
 
427
	static CVar<ConsoleFunc> min_curv("minimize_curvature", console_minimize_curvature);
-
 
428
	
-
 
429
	
298
}
430
}
299
 
431
 
300
 
-
 
301
int main(int argc, char** argv)
432
int main(int argc, char** argv)
302
{
433
{
303
	ArgExtracter ae(argc, argv);
434
	ArgExtracter ae(argc, argv);
304
	ae.extract("-E", E);
435
	ae.extract("-E", E);
305
    if(argc>1)
436
    if(argc>1)
306
	{		
437
	{		
307
		string file = ae.get_last_arg();
438
		string file = ae.get_last_arg();
308
		load(file, mani);
439
		load(file, mani);
309
	}
440
	}
310
 
441
 
311
	
442
	
312
	init_glut(argc,argv);
443
	init_glut(argc,argv);
313
	init_gl();
444
	init_gl();
314
	init_harmonics(mani);
445
	init_harmonics(mani);
315
 
446
 
316
	glutMainLoop();
447
	glutMainLoop();
317
}
448
}
318
 
449
 
319
 
450
 
320
 
451