-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cxx
92 lines (73 loc) · 2.2 KB
/
main.cxx
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
// $Id: main.cxx,v 1.3 2008/02/11 07:23:36 canacar Exp $
/*
* Copyright (C) 2014 Can Erkin Acar
* Copyright (C) 2014 Zeynep Akalin Acar
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include <stdio.h>
#include <FL/Fl.H>
#include "showmeshui.h"
int winW = 640;
int winH = 480;
const char *appName = "ShowMesh - OpenGL";
ShowMeshUI *ui;
extern "C" {
size_t strlcpy(char *dst, const char *src, size_t len);
}
int
main(int argc, char *argv[])
{
static char fn[FILENAME_MAX+1];
char *cmdfn = NULL;
ui = new ShowMeshUI();
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
printf("ShowMesh by Can Erkin Acar, Zeynep Akalin Acar, 2011\n");
printf("Smoothing and correction based on algorithms by Taubin et. al.\n\n");
// ShowMeshWindow *sm = new ShowMeshWindow(0, 0, winW, winH, appName);
// sm->end();
ShowMeshWindow *sm = ui->showmesh_window;
Fl::gl_visual(FL_DOUBLE|FL_RGB);
if (argc < 2) {
printf("Enter filename:\n");
fgets(fn, FILENAME_MAX, stdin);
char *z = strchr(fn,'\n');
if (z)
*z = 0;
ui->add_mesh(fn);
}
if (argc >= 3 && strcmp(argv[1], "-c") == 0) {
cmdfn = strdup(argv[2]);
argv += 2;
argc -= 2;
}
for (int n = 1; n < argc; n++) {
strlcpy(fn, argv[n], FILENAME_MAX);
ui->add_mesh(fn);
}
if (sm->numMeshes() < 1 && cmdfn == NULL)
printf ("Warning: Failed to load any mesh!\n");
if (cmdfn != NULL) {
printf("Running commands from %s\n", cmdfn);
command_file(cmdfn);
}
if (ui->m_quit)
return 0;
ui->main_window->show();
sm->show();
return Fl::run();
}