1 | // generated by Fast Light User Interface Designer (fluid) version 2.0100
|
---|
2 |
|
---|
3 | #include "GeoMeshViewUI.h"
|
---|
4 | #include "resource.h"
|
---|
5 |
|
---|
6 | using namespace Geometry;
|
---|
7 | using namespace std;
|
---|
8 |
|
---|
9 | //---------------------------------------------------------------------------
|
---|
10 | // Menu File Open Callback
|
---|
11 | //---------------------------------------------------------------------------
|
---|
12 | inline void GeoMeshViewUI::cb_menuFileOpen_i(fltk::Item*, void*)
|
---|
13 | {
|
---|
14 | // Sets menus application state to NONE.
|
---|
15 | mApplicationState = NONE;
|
---|
16 |
|
---|
17 | // Loads a mesh file.
|
---|
18 | openMeshFile();
|
---|
19 |
|
---|
20 | // Debug.
|
---|
21 | cout << "Vertex Count SubMesh 0: "
|
---|
22 | << mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount
|
---|
23 | << endl;
|
---|
24 | //----------------------------------------------------------
|
---|
25 |
|
---|
26 | // Deactive Lod strip visualization.
|
---|
27 | geoMeshView->deactiveLodStrip();
|
---|
28 |
|
---|
29 | // Repaint the window.
|
---|
30 | mMainWindow->redraw();
|
---|
31 | }
|
---|
32 |
|
---|
33 | //---------------------------------------------------------------------------
|
---|
34 | // Repaint the FPS label.
|
---|
35 | //---------------------------------------------------------------------------
|
---|
36 | void GeoMeshViewUI::refreshFPS(int fps)
|
---|
37 | {
|
---|
38 | static char char_value[10];
|
---|
39 |
|
---|
40 | // Translate the FPS count to a char value.
|
---|
41 | sprintf(char_value,"FPS %d",fps);
|
---|
42 |
|
---|
43 | mFPS->label(char_value);
|
---|
44 |
|
---|
45 | // Repaint the window.
|
---|
46 | mMainWindow->redraw();
|
---|
47 | }
|
---|
48 |
|
---|
49 | void GeoMeshViewUI::cb_menuFileOpen(fltk::Item* o, void* v)
|
---|
50 | {
|
---|
51 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
52 | ->
|
---|
53 | cb_menuFileOpen_i(o,v);
|
---|
54 | }
|
---|
55 |
|
---|
56 | //---------------------------------------------------------------------------
|
---|
57 | // Save callback
|
---|
58 | //---------------------------------------------------------------------------
|
---|
59 | inline void GeoMeshViewUI::cb_menuFileSave_i(fltk::Item*, void*)
|
---|
60 | {
|
---|
61 | GeoMeshSaver *mesh_saver;
|
---|
62 |
|
---|
63 | // If there is a mesh object created.
|
---|
64 | if (mGeoMesh != NULL)
|
---|
65 | {
|
---|
66 | // Create a mesh saver with mesh bounds.
|
---|
67 | mesh_saver = new GeoMeshSaver(mMeshBounds);
|
---|
68 |
|
---|
69 | // Save the file mesh.
|
---|
70 | mesh_saver->save( mGeoMesh,
|
---|
71 | mFileName);
|
---|
72 |
|
---|
73 | // Free memory.
|
---|
74 | delete mesh_saver;
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | void GeoMeshViewUI::cb_menuFileSave(fltk::Item* o, void* v)
|
---|
79 | {
|
---|
80 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
81 | ->
|
---|
82 | cb_menuFileSave_i(o,v);
|
---|
83 | }
|
---|
84 |
|
---|
85 | //---------------------------------------------------------------------------
|
---|
86 | // Save As Callback
|
---|
87 | //---------------------------------------------------------------------------
|
---|
88 | inline void GeoMeshViewUI::cb_menuOpenSaveAs_i(fltk::Item*, void*)
|
---|
89 | {
|
---|
90 | fltk::FileChooser *fcho;
|
---|
91 | GeoMeshSaver *mesh_saver;
|
---|
92 |
|
---|
93 | if (mGeoMesh != NULL)
|
---|
94 | {
|
---|
95 | fcho = new fltk::FileChooser("",
|
---|
96 | "*.mesh",
|
---|
97 | fltk::FileChooser::CREATE,
|
---|
98 | "Save Mesh as");
|
---|
99 |
|
---|
100 | fcho->exec();
|
---|
101 |
|
---|
102 | if (fcho->value())
|
---|
103 | {
|
---|
104 | mesh_saver = new GeoMeshSaver(mMeshBounds);
|
---|
105 |
|
---|
106 | mesh_saver->save( mGeoMesh,
|
---|
107 | filename_name(fcho->value()));
|
---|
108 |
|
---|
109 | delete mesh_saver;
|
---|
110 | }
|
---|
111 |
|
---|
112 | // Repaint the window.
|
---|
113 | mMainWindow->redraw();
|
---|
114 |
|
---|
115 | delete fcho;
|
---|
116 | }
|
---|
117 | }
|
---|
118 |
|
---|
119 | void GeoMeshViewUI::cb_menuOpenSaveAs(fltk::Item* o, void* v)
|
---|
120 | {
|
---|
121 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
122 | ->
|
---|
123 | cb_menuOpenSaveAs_i(o,v);
|
---|
124 | }
|
---|
125 |
|
---|
126 | //---------------------------------------------------------------------------
|
---|
127 | // Mesh info callback
|
---|
128 | //---------------------------------------------------------------------------
|
---|
129 | inline void GeoMeshViewUI::cb_menuMeshInfo_i(fltk::Item*, void*)
|
---|
130 | {
|
---|
131 | // Show title.
|
---|
132 | mProcessTitle->label("Mesh Info");
|
---|
133 |
|
---|
134 | showMeshInfo();
|
---|
135 | mMainWindow->redraw();
|
---|
136 | }
|
---|
137 |
|
---|
138 | void GeoMeshViewUI::cb_menuMeshInfo(fltk::Item* o, void* v)
|
---|
139 | {
|
---|
140 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
141 | ->
|
---|
142 | cb_menuMeshInfo_i(o,v);
|
---|
143 | }
|
---|
144 |
|
---|
145 | //---------------------------------------------------------------------------
|
---|
146 | // Mesh Export to OBJ callback
|
---|
147 | //---------------------------------------------------------------------------
|
---|
148 | inline void GeoMeshViewUI::cb_menuMeshExportOBJ_i(fltk::Item*, void*)
|
---|
149 | {
|
---|
150 | char *p;
|
---|
151 |
|
---|
152 | // Sets menus application state to NONE.
|
---|
153 | mApplicationState = NONE;
|
---|
154 |
|
---|
155 | // Open file chooser dialog.
|
---|
156 | p = fltk::file_chooser( "Export to OBJ",
|
---|
157 | "*.obj",
|
---|
158 | "");
|
---|
159 | if (p && mGeoMesh)
|
---|
160 | {
|
---|
161 | mGeoMesh->exportToOBJ(p);
|
---|
162 | }
|
---|
163 | }
|
---|
164 |
|
---|
165 | void GeoMeshViewUI::cb_menuMeshExportOBJ(fltk::Item* o, void* v)
|
---|
166 | {
|
---|
167 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
168 | ->
|
---|
169 | cb_menuMeshExportOBJ_i(o,v);
|
---|
170 | }
|
---|
171 |
|
---|
172 | //---------------------------------------------------------------------------
|
---|
173 | // Transform to Shared Vertex callback
|
---|
174 | //---------------------------------------------------------------------------
|
---|
175 | inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item*, void*)
|
---|
176 | {
|
---|
177 | Mesh *mesh_aux;
|
---|
178 |
|
---|
179 | // if the undo mesh is not initialized.
|
---|
180 | if (mGeoMesh != NULL)
|
---|
181 | {
|
---|
182 | // Deletes the actual mesh.
|
---|
183 | delete mUndoMesh;
|
---|
184 |
|
---|
185 | mUndoMesh = new Mesh();
|
---|
186 |
|
---|
187 | // Restore the previous mesh.
|
---|
188 | *mUndoMesh = *mGeoMesh;
|
---|
189 |
|
---|
190 | // Transform NoSV Mesh to a SV Mesh.
|
---|
191 | mesh_aux = mGeoMesh->toSharedVertex();
|
---|
192 |
|
---|
193 | // Deletes the mesh No Shared Vertex.
|
---|
194 | delete mGeoMesh;
|
---|
195 |
|
---|
196 | // Gets the mesh Shared Vertex.
|
---|
197 | mGeoMesh = mesh_aux;
|
---|
198 |
|
---|
199 | // Visualize the mesh stripified.
|
---|
200 | geoMeshView->setMesh(mGeoMesh);
|
---|
201 |
|
---|
202 | // Refresh mesh information.
|
---|
203 | showMeshInfo();
|
---|
204 |
|
---|
205 | // Repaint the window.
|
---|
206 | mMainWindow->redraw();
|
---|
207 | }
|
---|
208 | }
|
---|
209 |
|
---|
210 | void GeoMeshViewUI::cb_menuFileTransformSharedVertex(fltk::Item* o, void* v)
|
---|
211 | {
|
---|
212 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
213 | ->
|
---|
214 | cb_menuTransformSharedVertex_i(o,v);
|
---|
215 | }
|
---|
216 |
|
---|
217 | //---------------------------------------------------------------------------
|
---|
218 | // Quit Callback
|
---|
219 | //---------------------------------------------------------------------------
|
---|
220 | inline void GeoMeshViewUI::cb_menuOpenQuit_i(fltk::Item*, void*)
|
---|
221 | {
|
---|
222 | delete this;
|
---|
223 | }
|
---|
224 |
|
---|
225 | void GeoMeshViewUI::cb_menuOpenQuit(fltk::Item* o, void* v)
|
---|
226 | {
|
---|
227 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
228 | ->
|
---|
229 | cb_menuOpenQuit_i(o,v);
|
---|
230 | }
|
---|
231 |
|
---|
232 | //---------------------------------------------------------------------------
|
---|
233 | // Undo Callback
|
---|
234 | //---------------------------------------------------------------------------
|
---|
235 | inline void GeoMeshViewUI::cb_menuEditUndo_i(fltk::Item*, void*)
|
---|
236 | {
|
---|
237 | // Undo the mesh changes.
|
---|
238 | undo();
|
---|
239 | }
|
---|
240 |
|
---|
241 | void GeoMeshViewUI::cb_menuEditUndo(fltk::Item* o, void* v)
|
---|
242 | {
|
---|
243 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
244 | ->
|
---|
245 | cb_menuEditUndo_i(o,v);
|
---|
246 | }
|
---|
247 |
|
---|
248 | //---------------------------------------------------------------------------
|
---|
249 | // Fit Callback
|
---|
250 | //---------------------------------------------------------------------------
|
---|
251 | inline void GeoMeshViewUI::cb_menuEditFit_i(fltk::Item*, void*)
|
---|
252 | {
|
---|
253 | geoMeshView->fit();
|
---|
254 | mMainWindow->redraw();
|
---|
255 | }
|
---|
256 |
|
---|
257 | void GeoMeshViewUI::cb_menuEditFit(fltk::Item* o, void* v)
|
---|
258 | {
|
---|
259 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
260 | ->
|
---|
261 | cb_menuEditFit_i(o,v);
|
---|
262 | }
|
---|
263 |
|
---|
264 | //---------------------------------------------------------------------------
|
---|
265 | // Rotate Callback
|
---|
266 | //---------------------------------------------------------------------------
|
---|
267 | inline void GeoMeshViewUI::cb_menuEditRotate_i(fltk::Item *item, void*)
|
---|
268 | {
|
---|
269 | // If the item is activated.
|
---|
270 | if (item->value())
|
---|
271 | {
|
---|
272 | menuEditPan->clear_value();
|
---|
273 | geoMeshView->deactivePan();
|
---|
274 |
|
---|
275 | geoMeshView->activeRotate();
|
---|
276 | }
|
---|
277 | else
|
---|
278 | {
|
---|
279 | menuEditPan->set_value();
|
---|
280 | geoMeshView->activePan();
|
---|
281 |
|
---|
282 | geoMeshView->deactiveRotate();
|
---|
283 | }
|
---|
284 |
|
---|
285 | // Repaint the main window.
|
---|
286 | mMainWindow->redraw();
|
---|
287 | }
|
---|
288 |
|
---|
289 | void GeoMeshViewUI::cb_menuEditRotate(fltk::Item* o, void* v)
|
---|
290 | {
|
---|
291 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
292 | ->
|
---|
293 | cb_menuEditRotate_i(o,v);
|
---|
294 | }
|
---|
295 |
|
---|
296 | //---------------------------------------------------------------------------
|
---|
297 | // Pan Callback
|
---|
298 | //---------------------------------------------------------------------------
|
---|
299 | inline void GeoMeshViewUI::cb_menuEditPan_i(fltk::Item *item, void*)
|
---|
300 | {
|
---|
301 | // If the item is activated.
|
---|
302 | if (item->value())
|
---|
303 | {
|
---|
304 | geoMeshView->activePan();
|
---|
305 |
|
---|
306 | menuEditRotate->clear_value();
|
---|
307 | geoMeshView->deactiveRotate();
|
---|
308 | }
|
---|
309 | else
|
---|
310 | {
|
---|
311 | geoMeshView->deactivePan();
|
---|
312 |
|
---|
313 | menuEditRotate->set_value();
|
---|
314 | geoMeshView->activeRotate();
|
---|
315 | }
|
---|
316 |
|
---|
317 | // Repaint the main window.
|
---|
318 | mMainWindow->redraw();
|
---|
319 | }
|
---|
320 |
|
---|
321 | void GeoMeshViewUI::cb_menuEditPan(fltk::Item* o, void* v)
|
---|
322 | {
|
---|
323 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
324 | ->
|
---|
325 | cb_menuEditPan_i(o,v);
|
---|
326 | }
|
---|
327 |
|
---|
328 | //---------------------------------------------------------------------------
|
---|
329 | // Zoom Callback
|
---|
330 | //---------------------------------------------------------------------------
|
---|
331 | inline void GeoMeshViewUI::cb_menuEditZoom_i(fltk::Item*, void*)
|
---|
332 | {
|
---|
333 | }
|
---|
334 |
|
---|
335 | void GeoMeshViewUI::cb_menuEditZoom(fltk::Item* o, void* v)
|
---|
336 | {
|
---|
337 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
338 | ->
|
---|
339 | cb_menuEditZoom_i(o,v);
|
---|
340 | }
|
---|
341 |
|
---|
342 | //---------------------------------------------------------------------------
|
---|
343 | // Wire Callback
|
---|
344 | //---------------------------------------------------------------------------
|
---|
345 | inline void GeoMeshViewUI::cb_menuRenderWire_i(fltk::Item *item, void*)
|
---|
346 | {
|
---|
347 | if (item->value())
|
---|
348 | {
|
---|
349 | geoMeshView->activeWire();
|
---|
350 | }
|
---|
351 | else
|
---|
352 | {
|
---|
353 | geoMeshView->deactiveWire();
|
---|
354 | }
|
---|
355 |
|
---|
356 | // Repaint the canvas.
|
---|
357 | //geoMeshView->redraw();
|
---|
358 |
|
---|
359 | // Repaint the main window.
|
---|
360 | mMainWindow->redraw();
|
---|
361 | }
|
---|
362 |
|
---|
363 | void GeoMeshViewUI::cb_menuRenderWire(fltk::Item* o, void* v)
|
---|
364 | {
|
---|
365 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
366 | ->
|
---|
367 | cb_menuRenderWire_i(o,v);
|
---|
368 | }
|
---|
369 |
|
---|
370 | //---------------------------------------------------------------------------
|
---|
371 | // Solid Callback
|
---|
372 | //---------------------------------------------------------------------------
|
---|
373 | inline void GeoMeshViewUI::cb_menuRenderSolid_i(fltk::Item *item, void*)
|
---|
374 | {
|
---|
375 | if (item->value())
|
---|
376 | {
|
---|
377 | geoMeshView->activeSolid();
|
---|
378 | }
|
---|
379 | else
|
---|
380 | {
|
---|
381 | geoMeshView->deactiveSolid();
|
---|
382 | }
|
---|
383 |
|
---|
384 | // Repaint the canvas.
|
---|
385 | //geoMeshView->redraw();
|
---|
386 |
|
---|
387 | // Repaint the main window.
|
---|
388 | mMainWindow->redraw();
|
---|
389 | }
|
---|
390 |
|
---|
391 | void GeoMeshViewUI::cb_menuRenderSolid(fltk::Item* o, void* v)
|
---|
392 | {
|
---|
393 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
394 | ->
|
---|
395 | cb_menuRenderSolid_i(o,v);
|
---|
396 | }
|
---|
397 |
|
---|
398 | //---------------------------------------------------------------------------
|
---|
399 | // CW callback
|
---|
400 | //---------------------------------------------------------------------------
|
---|
401 | inline void GeoMeshViewUI::cb_menuRenderCW_i(fltk::Item *item, void*)
|
---|
402 | {
|
---|
403 | // Clear the CCW state.
|
---|
404 | menuRenderCCW->clear_value();
|
---|
405 | geoMeshView->deactiveCCW();
|
---|
406 |
|
---|
407 | // If the item is activated.
|
---|
408 | if (item->value())
|
---|
409 | {
|
---|
410 | geoMeshView->activeCW();
|
---|
411 | }
|
---|
412 | else
|
---|
413 | {
|
---|
414 | geoMeshView->deactiveCW();
|
---|
415 | }
|
---|
416 |
|
---|
417 | // Repaint the main window.
|
---|
418 | mMainWindow->redraw();
|
---|
419 | }
|
---|
420 |
|
---|
421 | void GeoMeshViewUI::cb_menuRenderCW(fltk::Item* o, void* v)
|
---|
422 | {
|
---|
423 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
424 | ->
|
---|
425 | cb_menuRenderCW_i(o,v);
|
---|
426 | }
|
---|
427 |
|
---|
428 | //---------------------------------------------------------------------------
|
---|
429 | // CCW callback
|
---|
430 | //---------------------------------------------------------------------------
|
---|
431 | inline void GeoMeshViewUI::cb_menuRenderCCW_i(fltk::Item *item, void*)
|
---|
432 | {
|
---|
433 | // Clear the CW state.
|
---|
434 | menuRenderCW->clear_value();
|
---|
435 | geoMeshView->deactiveCW();
|
---|
436 |
|
---|
437 | // If the item is activated.
|
---|
438 | if (item->value())
|
---|
439 | {
|
---|
440 | geoMeshView->activeCCW();
|
---|
441 | }
|
---|
442 | else
|
---|
443 | {
|
---|
444 | geoMeshView->deactiveCCW();
|
---|
445 | }
|
---|
446 |
|
---|
447 | // Repaint the main window.
|
---|
448 | mMainWindow->redraw();
|
---|
449 | }
|
---|
450 |
|
---|
451 | void GeoMeshViewUI::cb_menuRenderCCW(fltk::Item* o, void* v)
|
---|
452 | {
|
---|
453 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
454 | ->
|
---|
455 | cb_menuRenderCCW_i(o,v);
|
---|
456 | }
|
---|
457 |
|
---|
458 | //---------------------------------------------------------------------------
|
---|
459 | // Flat callback
|
---|
460 | //---------------------------------------------------------------------------
|
---|
461 | inline void GeoMeshViewUI::cb_menuRenderFlat_i(fltk::Item*, void*)
|
---|
462 | {
|
---|
463 | // Deactive smooth flag.
|
---|
464 | menuRenderSmooth->clear_value();
|
---|
465 |
|
---|
466 | // Sets flat lighting.
|
---|
467 | geoMeshView->flat();
|
---|
468 |
|
---|
469 | // Repaint the main window.
|
---|
470 | mMainWindow->redraw();
|
---|
471 | }
|
---|
472 |
|
---|
473 | void GeoMeshViewUI::cb_menuRenderFlat(fltk::Item* o, void* v)
|
---|
474 | {
|
---|
475 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
476 | ->
|
---|
477 | cb_menuRenderFlat_i(o,v);
|
---|
478 | }
|
---|
479 |
|
---|
480 | //---------------------------------------------------------------------------
|
---|
481 | // Smooth Callback
|
---|
482 | //---------------------------------------------------------------------------
|
---|
483 | inline void GeoMeshViewUI::cb_menuRenderSmooth_i(fltk::Item*, void*)
|
---|
484 | {
|
---|
485 | // Deactive flat flag.
|
---|
486 | menuRenderFlat->clear_value();
|
---|
487 |
|
---|
488 | // Sets smooth lighting.
|
---|
489 | geoMeshView->smooth();
|
---|
490 |
|
---|
491 | // Repaint the main window.
|
---|
492 | mMainWindow->redraw();
|
---|
493 | }
|
---|
494 |
|
---|
495 | void GeoMeshViewUI::cb_menuRenderSmooth(fltk::Item* o, void* v)
|
---|
496 | {
|
---|
497 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
498 | ->
|
---|
499 | cb_menuRenderSmooth_i(o,v);
|
---|
500 | }
|
---|
501 |
|
---|
502 | //---------------------------------------------------------------------------
|
---|
503 | // Textures callback
|
---|
504 | //---------------------------------------------------------------------------
|
---|
505 | inline void GeoMeshViewUI::cb_menuRenderTextures_i(fltk::Item*, void*)
|
---|
506 | {
|
---|
507 | // Repaint the main window.
|
---|
508 | mMainWindow->redraw();
|
---|
509 | }
|
---|
510 |
|
---|
511 | void GeoMeshViewUI::cb_menuRenderTextures(fltk::Item* o, void* v)
|
---|
512 | {
|
---|
513 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
514 | ->
|
---|
515 | cb_menuRenderTextures_i(o,v);
|
---|
516 | }
|
---|
517 |
|
---|
518 | //---------------------------------------------------------------------------
|
---|
519 | // Stripify Callback
|
---|
520 | //---------------------------------------------------------------------------
|
---|
521 | inline void GeoMeshViewUI::cb_menuStripify_i(fltk::Item*, void*)
|
---|
522 | {
|
---|
523 | // Show title.
|
---|
524 | mProcessTitle->label("Stripify");
|
---|
525 | mProcessBar->position(0);
|
---|
526 |
|
---|
527 | // Hide the right panel.
|
---|
528 | hideRightPanel();
|
---|
529 |
|
---|
530 | // Show the stripify panel.
|
---|
531 | showStripify();
|
---|
532 |
|
---|
533 | // Sets menus application state to STRIPIFY.
|
---|
534 | mApplicationState = STRIPIFY;
|
---|
535 |
|
---|
536 | // Repaint the window.
|
---|
537 | mMainWindow->redraw();
|
---|
538 | }
|
---|
539 |
|
---|
540 | void GeoMeshViewUI::cb_menuStripify(fltk::Item* o, void* v)
|
---|
541 | {
|
---|
542 | ((GeoMeshViewUI*) (o->parent()->parent()->user_data()))
|
---|
543 | ->
|
---|
544 | cb_menuStripify_i(o,v);
|
---|
545 | }
|
---|
546 |
|
---|
547 | //---------------------------------------------------------------------------
|
---|
548 | // Simplify Callback
|
---|
549 | //---------------------------------------------------------------------------
|
---|
550 | inline void GeoMeshViewUI::cb_menuSimplify_i(fltk::ItemGroup*, void*)
|
---|
551 | {
|
---|
552 | }
|
---|
553 |
|
---|
554 | void GeoMeshViewUI::cb_menuSimplify(fltk::ItemGroup* o, void* v)
|
---|
555 | {
|
---|
556 | ((GeoMeshViewUI*) (o->parent()->parent()->user_data()))
|
---|
557 | ->
|
---|
558 | cb_menuSimplify_i(o,v);
|
---|
559 | }
|
---|
560 |
|
---|
561 | //---------------------------------------------------------------------------
|
---|
562 | // Edge collapse Callback
|
---|
563 | //---------------------------------------------------------------------------
|
---|
564 | inline void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse_i(fltk::Item*, void*)
|
---|
565 | {
|
---|
566 | // Show title.
|
---|
567 | mProcessTitle->label("Mesh Simplification");
|
---|
568 | mProcessBar->position(0);
|
---|
569 |
|
---|
570 | // Hide the right panel.
|
---|
571 | hideRightPanel();
|
---|
572 |
|
---|
573 | // Show the edge collapse panel.
|
---|
574 | showEdgeCollapse();
|
---|
575 |
|
---|
576 | // Sets menus application state to EDGE_COLLAPSE.
|
---|
577 | mApplicationState = EDGE_COLLAPSE;
|
---|
578 |
|
---|
579 | // Repaint the window.
|
---|
580 | mMainWindow->redraw();
|
---|
581 |
|
---|
582 | }
|
---|
583 |
|
---|
584 | void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse(fltk::Item* o, void* v)
|
---|
585 | {
|
---|
586 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
587 | ->
|
---|
588 | cb_menuSimplifyEdgeCollapse_i(o,v);
|
---|
589 | }
|
---|
590 |
|
---|
591 | //---------------------------------------------------------------------------
|
---|
592 | // Leaves collapse Callback
|
---|
593 | //---------------------------------------------------------------------------
|
---|
594 | inline void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse_i(fltk::Item*, void*)
|
---|
595 | {
|
---|
596 | // Show title.
|
---|
597 | mProcessTitle->label("Leaves Simplification");
|
---|
598 | mProcessBar->position(0);
|
---|
599 |
|
---|
600 | // Hide the right panel.
|
---|
601 | hideRightPanel();
|
---|
602 |
|
---|
603 | // Show the leaves collapse panel.
|
---|
604 | showLeavesCollapse();
|
---|
605 |
|
---|
606 | // Sets menus application state to LEAVES_COLLAPSE.
|
---|
607 | mApplicationState = LEAVES_COLLAPSE;
|
---|
608 |
|
---|
609 | // Repaint the window.
|
---|
610 | mMainWindow->redraw();
|
---|
611 | }
|
---|
612 |
|
---|
613 | void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse(fltk::Item* o, void* v)
|
---|
614 | {
|
---|
615 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
616 | ->
|
---|
617 | cb_menuSimplifyLeavesCollapse_i(o,v);
|
---|
618 | }
|
---|
619 |
|
---|
620 | //---------------------------------------------------------------------------
|
---|
621 | // Tree select leaves simplification Callback
|
---|
622 | //---------------------------------------------------------------------------
|
---|
623 | inline void GeoMeshViewUI::cb_menuSelectLeaves_i(fltk::Item*, void*)
|
---|
624 | {
|
---|
625 | // Show title.
|
---|
626 | mProcessTitle->label("Select Leaves");
|
---|
627 |
|
---|
628 | showMeshInfo();
|
---|
629 | mButtonProcess->show();
|
---|
630 | mButtonProcess->activate();
|
---|
631 | mApplicationState = SELECT_LEAVES;
|
---|
632 | }
|
---|
633 |
|
---|
634 | void GeoMeshViewUI::cb_menuSelectLeaves(fltk::Item* o, void* v)
|
---|
635 | {
|
---|
636 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
637 | ->
|
---|
638 | cb_menuSelectLeaves_i(o,v);
|
---|
639 | }
|
---|
640 |
|
---|
641 | //---------------------------------------------------------------------------
|
---|
642 | // Auto Generate LodStrips Callback
|
---|
643 | //---------------------------------------------------------------------------
|
---|
644 | inline void GeoMeshViewUI::cb_menuLodStripsGenerate_i(fltk::Item*, void*)
|
---|
645 | {
|
---|
646 | // Show title.
|
---|
647 | mProcessTitle->label("Generate LodStrips");
|
---|
648 | mProcessBar->position(0);
|
---|
649 | mBuildBar->position(0);
|
---|
650 |
|
---|
651 | // Hide the right panel.
|
---|
652 | hideRightPanel();
|
---|
653 |
|
---|
654 | // Show the LodStrips panel.
|
---|
655 | showAutoGenerateLodStrips();
|
---|
656 |
|
---|
657 | // Sets menus application state to LODSTRIPS_AUTO.
|
---|
658 | mApplicationState = LODSTRIPS_AUTO;
|
---|
659 |
|
---|
660 | // Repaint the window.
|
---|
661 | mMainWindow->redraw();
|
---|
662 | }
|
---|
663 |
|
---|
664 | void GeoMeshViewUI::cb_menuLodStripsGenerate(fltk::Item* o, void* v)
|
---|
665 | {
|
---|
666 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
667 | ->
|
---|
668 | cb_menuLodStripsGenerate_i(o,v);
|
---|
669 | }
|
---|
670 |
|
---|
671 | //---------------------------------------------------------------------------
|
---|
672 | // Visualize LodStrips Callback
|
---|
673 | //---------------------------------------------------------------------------
|
---|
674 | inline void GeoMeshViewUI::cb_menuLodStripsVisualize_i(fltk::Item*, void*)
|
---|
675 | {
|
---|
676 | fltk::FileChooser *fcho;
|
---|
677 | const char *lod_file;
|
---|
678 |
|
---|
679 | // Sets menus application state to NONE.
|
---|
680 | mApplicationState = NONE;
|
---|
681 |
|
---|
682 | // Deactive Lod strip visualization.
|
---|
683 | geoMeshView->deactiveLodStrip();
|
---|
684 |
|
---|
685 | // Loads a mesh file.
|
---|
686 | openMeshFile();
|
---|
687 |
|
---|
688 | // Show title.
|
---|
689 | mProcessTitle->label("Visualize LodStrips");
|
---|
690 |
|
---|
691 | // If an object is loaded.
|
---|
692 | if (mGeoMesh != NULL)
|
---|
693 | {
|
---|
694 | fcho = new fltk::FileChooser("",
|
---|
695 | "*.lod",
|
---|
696 | fltk::FileChooser::CREATE,
|
---|
697 | "Open Lod file");
|
---|
698 |
|
---|
699 | fcho->exec();
|
---|
700 |
|
---|
701 | // If a file was selected.
|
---|
702 | if (fcho->value())
|
---|
703 | {
|
---|
704 | // Build lod strips library.
|
---|
705 | setLodStripsLibrary(string(fcho->value()), mGeoMesh);
|
---|
706 |
|
---|
707 | // Sets the aplication mode.
|
---|
708 | mApplicationState = VISUALIZE_LODSTRIPS;
|
---|
709 | }
|
---|
710 |
|
---|
711 | // Free memory.
|
---|
712 | delete fcho;
|
---|
713 | }
|
---|
714 |
|
---|
715 | // Hide the right panel.
|
---|
716 | hideRightPanel();
|
---|
717 |
|
---|
718 | // Show the Visulize LodStrips panel.
|
---|
719 | showVisualizeLodStrips();
|
---|
720 |
|
---|
721 | // Repaint the window.
|
---|
722 | mMainWindow->redraw();
|
---|
723 | }
|
---|
724 |
|
---|
725 | void GeoMeshViewUI::cb_menuLodStripsVisualize(fltk::Item* o, void* v)
|
---|
726 | {
|
---|
727 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
728 | ->
|
---|
729 | cb_menuLodStripsVisualize_i(o,v);
|
---|
730 | }
|
---|
731 |
|
---|
732 | //---------------------------------------------------------------------------
|
---|
733 | // Open LodStrip trunk Callback
|
---|
734 | //---------------------------------------------------------------------------
|
---|
735 | inline void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*)
|
---|
736 | {
|
---|
737 | }
|
---|
738 |
|
---|
739 | void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk(fltk::Item* o, void* v)
|
---|
740 | {
|
---|
741 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
742 | ->
|
---|
743 | cb_menuLodTreesOpenLodStripTrunk_i(o,v);
|
---|
744 | }
|
---|
745 |
|
---|
746 | //---------------------------------------------------------------------------
|
---|
747 | // Open leaves simplification Callback
|
---|
748 | //---------------------------------------------------------------------------
|
---|
749 | inline void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*)
|
---|
750 | {
|
---|
751 | // Hide the right panel.
|
---|
752 | hideRightPanel();
|
---|
753 |
|
---|
754 | // Show the LodTrees panel.
|
---|
755 | showOpenLeavesSimplification();
|
---|
756 |
|
---|
757 | // Sets menus application state to LODTREES.
|
---|
758 | mApplicationState = LODTREES;
|
---|
759 |
|
---|
760 | // Repaint the window.
|
---|
761 | mMainWindow->redraw();
|
---|
762 | }
|
---|
763 |
|
---|
764 | void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification(fltk::Item* o, void* v)
|
---|
765 | {
|
---|
766 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
767 | ->
|
---|
768 | cb_menuLodTreesOpenLeavesSimplification_i(o,v);
|
---|
769 | }
|
---|
770 |
|
---|
771 | //---------------------------------------------------------------------------
|
---|
772 | // About Callback
|
---|
773 | //---------------------------------------------------------------------------
|
---|
774 | inline void GeoMeshViewUI::cb_menuHelpAbout_i(fltk::Item*, void*)
|
---|
775 | {
|
---|
776 | new GTAboutDialog();
|
---|
777 | }
|
---|
778 |
|
---|
779 | void GeoMeshViewUI::cb_menuHelpAbout(fltk::Item* o, void* v)
|
---|
780 | {
|
---|
781 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
782 | ->
|
---|
783 | cb_menuHelpAbout_i(o,v);
|
---|
784 | }
|
---|
785 |
|
---|
786 | //---------------------------------------------------------------------------
|
---|
787 | // Button Process Callback
|
---|
788 | //---------------------------------------------------------------------------
|
---|
789 | inline void GeoMeshViewUI::cb_mButtonProcess_i(fltk::Button*, void*)
|
---|
790 | {
|
---|
791 | Mesh *mesh_aux;
|
---|
792 |
|
---|
793 | // Sets the progress bar to process bar.
|
---|
794 | progressBarType = PROCESS;
|
---|
795 | mProcessBar->position(0);
|
---|
796 |
|
---|
797 | // If there is a mesh object.
|
---|
798 | if (mGeoMesh != NULL)
|
---|
799 | {
|
---|
800 | // Choose between aplication state.
|
---|
801 | switch(mApplicationState)
|
---|
802 | {
|
---|
803 | // Stripify state.
|
---|
804 | case STRIPIFY:
|
---|
805 |
|
---|
806 | // Stripify the mesh object.
|
---|
807 | stripify();
|
---|
808 |
|
---|
809 | break;
|
---|
810 |
|
---|
811 | // Simplify edge collapse state.
|
---|
812 | case EDGE_COLLAPSE:
|
---|
813 |
|
---|
814 | // if the mesh is stripified.
|
---|
815 | if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
816 | {
|
---|
817 | fltk::alert("Can't simplify a mesh in triagle strips.");
|
---|
818 | }
|
---|
819 | else
|
---|
820 | {
|
---|
821 |
|
---|
822 | // Simplify the mesh object.
|
---|
823 | simplifyEdgeCollapse();
|
---|
824 | }
|
---|
825 | break;
|
---|
826 |
|
---|
827 | // Simplify leaves
|
---|
828 | case LEAVES_COLLAPSE:
|
---|
829 |
|
---|
830 | // Simplify the mesh object.
|
---|
831 | simplifyLeavesCollapse();
|
---|
832 |
|
---|
833 | break;
|
---|
834 |
|
---|
835 | // Simplify and generate simplification sequence.
|
---|
836 | case LODSTRIPS_AUTO:
|
---|
837 |
|
---|
838 | // if the mesh is stripified.
|
---|
839 | if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
840 | {
|
---|
841 | fltk::alert("Can't simplify a mesh in triagle strips.");
|
---|
842 | }
|
---|
843 | else
|
---|
844 | {
|
---|
845 |
|
---|
846 | // Transform NoSV Mesh to a SV Mesh.
|
---|
847 | mesh_aux = mGeoMesh->toSharedVertex();
|
---|
848 |
|
---|
849 | // Deletes the mesh No Shared Vertex.
|
---|
850 | delete mGeoMesh;
|
---|
851 |
|
---|
852 | // Gets the mesh Shared Vertex.
|
---|
853 | mGeoMesh = mesh_aux;
|
---|
854 |
|
---|
855 | // Simplify the mesh object.
|
---|
856 | simplifyEdgeCollapse();
|
---|
857 |
|
---|
858 | // Create the qslim simplification sequence.
|
---|
859 | createQslimSequence();
|
---|
860 | }
|
---|
861 |
|
---|
862 | break;
|
---|
863 |
|
---|
864 | // Añadido 23-12-2005
|
---|
865 | case SELECT_LEAVES:
|
---|
866 |
|
---|
867 | idMeshLeaves = paintMesh();
|
---|
868 |
|
---|
869 | // Set the leaves submesh.
|
---|
870 | geoMeshView->setLeavesSubmesh(idMeshLeaves);
|
---|
871 |
|
---|
872 | // Refresh mesh info.
|
---|
873 | showMeshInfo();
|
---|
874 |
|
---|
875 | break;
|
---|
876 | }
|
---|
877 |
|
---|
878 | // Refresh geometry attributes.
|
---|
879 | refreshApplicationBar();
|
---|
880 | }
|
---|
881 |
|
---|
882 | // Repaint the GL Window.
|
---|
883 | mMainWindow->redraw();
|
---|
884 | }
|
---|
885 |
|
---|
886 | void GeoMeshViewUI::cb_mButtonProcess(fltk::Button* o, void* v)
|
---|
887 | {
|
---|
888 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
889 | ->
|
---|
890 | cb_mButtonProcess_i(o,v);
|
---|
891 | }
|
---|
892 |
|
---|
893 | //---------------------------------------------------------------------------
|
---|
894 | // Button Sort Callback
|
---|
895 | //---------------------------------------------------------------------------
|
---|
896 | inline void GeoMeshViewUI::cb_mButtonSort_i(fltk::Button*, void*)
|
---|
897 | {
|
---|
898 | }
|
---|
899 |
|
---|
900 | void GeoMeshViewUI::cb_mButtonSort(fltk::Button* o, void* v)
|
---|
901 | {
|
---|
902 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
903 | ->
|
---|
904 | cb_mButtonSort_i(o,v);
|
---|
905 | }
|
---|
906 |
|
---|
907 | //---------------------------------------------------------------------------
|
---|
908 | // Button Build Callback
|
---|
909 | //---------------------------------------------------------------------------
|
---|
910 | inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*)
|
---|
911 | {
|
---|
912 | char *file_name;
|
---|
913 | GeoMeshSaver *mesh_saver;
|
---|
914 | Serializer *oSerializer;
|
---|
915 |
|
---|
916 | // Sets the progress bar to process bar.
|
---|
917 | progressBarType = BUILD;
|
---|
918 |
|
---|
919 | // Reset the build bar.
|
---|
920 | mBuildBar->position(0);
|
---|
921 |
|
---|
922 | // If there is a mesh object.
|
---|
923 | if (mGeoMesh != NULL)
|
---|
924 | {
|
---|
925 | // Choose between aplication state.
|
---|
926 | switch(mApplicationState)
|
---|
927 | {
|
---|
928 | // Build the LOD file.
|
---|
929 | case LODSTRIPS_AUTO:
|
---|
930 |
|
---|
931 | // Builder
|
---|
932 |
|
---|
933 | // Open file chooser dialog.
|
---|
934 | file_name = fltk::file_chooser( "Build LOD",
|
---|
935 | "*",
|
---|
936 | "");
|
---|
937 |
|
---|
938 | // If a file was selected.
|
---|
939 | if (file_name)
|
---|
940 | {
|
---|
941 | // Undo the simplification changes.
|
---|
942 | undo();
|
---|
943 |
|
---|
944 | // Stripify the mesh object.
|
---|
945 | stripify();
|
---|
946 |
|
---|
947 | // Reset the build bar.
|
---|
948 | mBuildBar->position(0);
|
---|
949 |
|
---|
950 | // Simplification sequence.
|
---|
951 | oMeshSimpSequence = new MeshSimplificationSequence();
|
---|
952 |
|
---|
953 | // Loads a simplification sequence file.
|
---|
954 | oMeshSimpSequence->Load(Serializer( "mqslimSequence.txt",
|
---|
955 | Serializer::READ));
|
---|
956 |
|
---|
957 | // If the simplification sequence and the mesh exist.
|
---|
958 | if (oMeshSimpSequence && mGeoMesh)
|
---|
959 | {
|
---|
960 | oLodStrip = new LodStripsConstructor( mGeoMesh,
|
---|
961 | oMeshSimpSequence,
|
---|
962 | progress_function);
|
---|
963 |
|
---|
964 | oSerializer = new Serializer( strcat(file_name,".lod"),
|
---|
965 | Serializer::Mode::WRITE);
|
---|
966 |
|
---|
967 | oLodStrip->LodStripsConstructor::Save(*oSerializer);
|
---|
968 |
|
---|
969 | // Close file.
|
---|
970 | delete oSerializer;
|
---|
971 |
|
---|
972 | // Deletes the previous mesh.
|
---|
973 | delete mUndoMesh;
|
---|
974 |
|
---|
975 | mUndoMesh = new Mesh();
|
---|
976 |
|
---|
977 | // Sets the undo mesh.
|
---|
978 | *mUndoMesh = *mGeoMesh;
|
---|
979 |
|
---|
980 | delete mGeoMesh;
|
---|
981 |
|
---|
982 | mGeoMesh = oLodStrip->GetMesh();
|
---|
983 |
|
---|
984 | geoMeshView->setMesh(mGeoMesh);
|
---|
985 |
|
---|
986 | mesh_saver = new GeoMeshSaver(mMeshBounds);
|
---|
987 | file_name[strlen(file_name) - 4] = '\0';
|
---|
988 | mesh_saver->save( mGeoMesh,
|
---|
989 | strcat(file_name,".mesh"));
|
---|
990 | delete mesh_saver;
|
---|
991 |
|
---|
992 | }
|
---|
993 | else
|
---|
994 | {
|
---|
995 | // Error message.
|
---|
996 | fltk::alert("There is no simplification sequence.");
|
---|
997 | }
|
---|
998 |
|
---|
999 | // Deletes the siplification sequence object.
|
---|
1000 | delete oMeshSimpSequence;
|
---|
1001 | }
|
---|
1002 | break;
|
---|
1003 | }
|
---|
1004 | // Refresh data aplication.
|
---|
1005 | refreshApplicationBar();
|
---|
1006 | }
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | void GeoMeshViewUI::cb_mButtonBuild(fltk::Button *o, void *v)
|
---|
1010 | {
|
---|
1011 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
1012 | ->
|
---|
1013 | cb_mButtonBuild_i(o,v);
|
---|
1014 | }
|
---|
1015 |
|
---|
1016 | //---------------------------------------------------------------------------
|
---|
1017 | // Lod Slider Callback
|
---|
1018 | //---------------------------------------------------------------------------
|
---|
1019 | inline void GeoMeshViewUI::cb_mLodSlider_i(fltk::Slider *o, void *)
|
---|
1020 | {
|
---|
1021 | // Change the lod.
|
---|
1022 | geoMeshView->GoToLod((unsigned int)o->value());
|
---|
1023 |
|
---|
1024 | // Refresh data aplication.
|
---|
1025 | refreshApplicationBar();
|
---|
1026 |
|
---|
1027 | mMainWindow->flush();
|
---|
1028 | }
|
---|
1029 |
|
---|
1030 | void GeoMeshViewUI::cb_mLodSlider(fltk::Slider *o, void *v)
|
---|
1031 | {
|
---|
1032 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
1033 | ->
|
---|
1034 | cb_mLodSlider_i(o,v);
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | //---------------------------------------------------------------------------
|
---|
1038 | // Mesh Info Callback
|
---|
1039 | //---------------------------------------------------------------------------
|
---|
1040 | inline void GeoMeshViewUI::cb_mMeshInfo_i(fltk::Browser *, void *)
|
---|
1041 | {
|
---|
1042 | paintMesh();
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | void GeoMeshViewUI::cb_mMeshInfo(fltk::Browser* o, void* v)
|
---|
1046 | {
|
---|
1047 | ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data()))
|
---|
1048 | ->
|
---|
1049 | cb_mMeshInfo_i(o,v);
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | //---------------------------------------------------------------------------
|
---|
1053 | // Logo Callback
|
---|
1054 | //---------------------------------------------------------------------------
|
---|
1055 | inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*)
|
---|
1056 | {
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | void GeoMeshViewUI::cb_mLogo(fltk::InvisibleBox* o, void* v)
|
---|
1060 | {
|
---|
1061 | ((GeoMeshViewUI*) (o->parent()->parent()->user_data()))
|
---|
1062 | ->
|
---|
1063 | cb_mLogo_i(o,v);
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | //---------------------------------------------------------------------------
|
---|
1067 | // Show the stripify panel
|
---|
1068 | //---------------------------------------------------------------------------
|
---|
1069 | void GeoMeshViewUI::showStripify()
|
---|
1070 | {
|
---|
1071 | /*
|
---|
1072 | mTypeLabel->set_visible();
|
---|
1073 | mTypeLabel->activate();
|
---|
1074 |
|
---|
1075 | mOneCacheStrip->set_visible();
|
---|
1076 | mOneCacheStrip->activate();
|
---|
1077 |
|
---|
1078 | mQualityStrips->set_visible();
|
---|
1079 | mQualityStrips->activate();
|
---|
1080 | */
|
---|
1081 |
|
---|
1082 | mButtonProcess->set_visible();
|
---|
1083 | mButtonProcess->activate();
|
---|
1084 |
|
---|
1085 | mProcessBar->set_visible();
|
---|
1086 | mProcessBar->activate();
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | //---------------------------------------------------------------------------
|
---|
1090 | // Hide the stripify panel
|
---|
1091 | //---------------------------------------------------------------------------
|
---|
1092 | void GeoMeshViewUI::hideStripify()
|
---|
1093 | {
|
---|
1094 | /*
|
---|
1095 | mTypeLabel->hide();
|
---|
1096 | mTypeLabel->deactivate();
|
---|
1097 | */
|
---|
1098 |
|
---|
1099 | mOneCacheStrip->hide();
|
---|
1100 | mOneCacheStrip->deactivate();
|
---|
1101 |
|
---|
1102 | mQualityStrips->hide();
|
---|
1103 | mQualityStrips->deactivate();
|
---|
1104 |
|
---|
1105 | mButtonProcess->hide();
|
---|
1106 | mButtonProcess->deactivate();
|
---|
1107 |
|
---|
1108 | mProcessBar->hide();
|
---|
1109 | mProcessBar->deactivate();
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | //---------------------------------------------------------------------------
|
---|
1113 | // Show the Simplify Edge Collapse panel
|
---|
1114 | //---------------------------------------------------------------------------
|
---|
1115 | void GeoMeshViewUI::showEdgeCollapse()
|
---|
1116 | {
|
---|
1117 | mMetricLabel->set_visible();
|
---|
1118 | mMetricLabel->activate();
|
---|
1119 |
|
---|
1120 | mGeometryBased->set_visible();
|
---|
1121 | mGeometryBased->activate();
|
---|
1122 | mGeometryBased->set();
|
---|
1123 |
|
---|
1124 | mImageBased->set_visible();
|
---|
1125 | mImageBased->activate();
|
---|
1126 |
|
---|
1127 | /*
|
---|
1128 | mTypeLabel->set_visible();
|
---|
1129 | mTypeLabel->activate();
|
---|
1130 |
|
---|
1131 | mChangeVertices->set_visible();
|
---|
1132 | mChangeVertices->activate();
|
---|
1133 | */
|
---|
1134 |
|
---|
1135 | mMeshReductionLabel->set_visible();
|
---|
1136 | mMeshReductionLabel->activate();
|
---|
1137 |
|
---|
1138 | mPercent->set_visible();
|
---|
1139 | mPercent->activate();
|
---|
1140 | mPercent->set();
|
---|
1141 |
|
---|
1142 | mVerticesNumber->set_visible();
|
---|
1143 | mVerticesNumber->activate();
|
---|
1144 |
|
---|
1145 | mMeshReduction->set_visible();
|
---|
1146 |
|
---|
1147 | // JGA
|
---|
1148 | // Allows floating point.
|
---|
1149 | mMeshReduction->type(fltk::FloatInput::FLOAT);
|
---|
1150 |
|
---|
1151 | mMeshReduction->activate();
|
---|
1152 |
|
---|
1153 | mButtonProcess->set_visible();
|
---|
1154 | mButtonProcess->activate();
|
---|
1155 |
|
---|
1156 | mProcessBar->set_visible();
|
---|
1157 | mProcessBar->activate();
|
---|
1158 | }
|
---|
1159 |
|
---|
1160 | //---------------------------------------------------------------------------
|
---|
1161 | // Hide the Simplify Edge Collapse
|
---|
1162 | //---------------------------------------------------------------------------
|
---|
1163 | void GeoMeshViewUI::hideEdgeCollapse()
|
---|
1164 | {
|
---|
1165 | mMetricLabel->hide();
|
---|
1166 | mMetricLabel->deactivate();
|
---|
1167 |
|
---|
1168 | mGeometryBased->hide();
|
---|
1169 | mGeometryBased->deactivate();
|
---|
1170 |
|
---|
1171 | mImageBased->hide();
|
---|
1172 | mImageBased->deactivate();
|
---|
1173 |
|
---|
1174 | /*
|
---|
1175 | mTypeLabel->hide();
|
---|
1176 | mTypeLabel->deactivate();
|
---|
1177 |
|
---|
1178 | mChangeVertices->hide();
|
---|
1179 | mChangeVertices->deactivate();
|
---|
1180 | */
|
---|
1181 |
|
---|
1182 | mMeshReductionLabel->hide();
|
---|
1183 | mMeshReductionLabel->deactivate();
|
---|
1184 |
|
---|
1185 | mPercent->hide();
|
---|
1186 | mPercent->deactivate();
|
---|
1187 |
|
---|
1188 | mVerticesNumber->hide();
|
---|
1189 | mVerticesNumber->deactivate();
|
---|
1190 |
|
---|
1191 | mMeshReduction->hide();
|
---|
1192 | mMeshReduction->deactivate();
|
---|
1193 |
|
---|
1194 | mButtonProcess->hide();
|
---|
1195 | mButtonProcess->deactivate();
|
---|
1196 |
|
---|
1197 | mProcessBar->hide();
|
---|
1198 | mProcessBar->deactivate();
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 | //---------------------------------------------------------------------------
|
---|
1202 | // Show the Simlify Leaves Collapse
|
---|
1203 | //---------------------------------------------------------------------------
|
---|
1204 | void GeoMeshViewUI::showLeavesCollapse()
|
---|
1205 | {
|
---|
1206 | mMetricLabel->set_visible();
|
---|
1207 | mMetricLabel->activate();
|
---|
1208 |
|
---|
1209 | mGeometryBased->set_visible();
|
---|
1210 | mGeometryBased->activate();
|
---|
1211 | mGeometryBased->set();
|
---|
1212 |
|
---|
1213 | mImageBased->set_visible();
|
---|
1214 | mImageBased->activate();
|
---|
1215 |
|
---|
1216 | /*
|
---|
1217 | mTypeLabel->set_visible();
|
---|
1218 | mTypeLabel->activate();
|
---|
1219 |
|
---|
1220 | mChangeTexture->set_visible();
|
---|
1221 | mChangeTexture->activate();
|
---|
1222 | */
|
---|
1223 |
|
---|
1224 | mMeshReductionLabel->set_visible();
|
---|
1225 | mMeshReductionLabel->activate();
|
---|
1226 |
|
---|
1227 | mPercent->set_visible();
|
---|
1228 | mPercent->activate();
|
---|
1229 | mPercent->set();
|
---|
1230 |
|
---|
1231 | mVerticesNumber->set_visible();
|
---|
1232 | mVerticesNumber->activate();
|
---|
1233 |
|
---|
1234 | mMeshReduction->set_visible();
|
---|
1235 | mMeshReduction->type(fltk::FloatInput::FLOAT);
|
---|
1236 | mMeshReduction->activate();
|
---|
1237 |
|
---|
1238 | mButtonProcess->set_visible();
|
---|
1239 | mButtonProcess->activate();
|
---|
1240 |
|
---|
1241 | mProcessBar->set_visible();
|
---|
1242 | mProcessBar->activate();
|
---|
1243 | }
|
---|
1244 |
|
---|
1245 | //---------------------------------------------------------------------------
|
---|
1246 | // Hide the Simplify Leaves Collapse
|
---|
1247 | //---------------------------------------------------------------------------
|
---|
1248 | void GeoMeshViewUI::hideLeavesCollapse()
|
---|
1249 | {
|
---|
1250 | mMetricLabel->hide();
|
---|
1251 | mMetricLabel->deactivate();
|
---|
1252 |
|
---|
1253 | mGeometryBased->hide();
|
---|
1254 | mGeometryBased->deactivate();
|
---|
1255 |
|
---|
1256 | mImageBased->hide();
|
---|
1257 | mImageBased->deactivate();
|
---|
1258 |
|
---|
1259 | /*
|
---|
1260 | mTypeLabel->hide();
|
---|
1261 | mTypeLabel->deactivate();
|
---|
1262 |
|
---|
1263 | mChangeTexture->hide();
|
---|
1264 | mChangeTexture->deactivate();
|
---|
1265 | */
|
---|
1266 |
|
---|
1267 | mMeshReductionLabel->hide();
|
---|
1268 | mMeshReductionLabel->deactivate();
|
---|
1269 |
|
---|
1270 | mPercent->hide();
|
---|
1271 | mPercent->deactivate();
|
---|
1272 |
|
---|
1273 | mVerticesNumber->hide();
|
---|
1274 | mVerticesNumber->deactivate();
|
---|
1275 |
|
---|
1276 | mMeshReduction->hide();
|
---|
1277 | mMeshReduction->deactivate();
|
---|
1278 |
|
---|
1279 | mButtonProcess->hide();
|
---|
1280 | mButtonProcess->deactivate();
|
---|
1281 |
|
---|
1282 | mProcessBar->hide();
|
---|
1283 | mProcessBar->deactivate();
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | //---------------------------------------------------------------------------
|
---|
1287 | // Show the LodStrips Panel
|
---|
1288 | //---------------------------------------------------------------------------
|
---|
1289 | void GeoMeshViewUI::showOpenMeshSimplification()
|
---|
1290 | {
|
---|
1291 | mButtonProcess->set_visible();
|
---|
1292 | mButtonProcess->activate();
|
---|
1293 |
|
---|
1294 | mProcessBar->set_visible();
|
---|
1295 | mProcessBar->activate();
|
---|
1296 |
|
---|
1297 | mButtonBuild->set_visible();
|
---|
1298 | mButtonBuild->activate();
|
---|
1299 |
|
---|
1300 | mBuildBar->set_visible();
|
---|
1301 | mBuildBar->activate();
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | //---------------------------------------------------------------------------
|
---|
1305 | // Hide the LodStrips Panel
|
---|
1306 | //---------------------------------------------------------------------------
|
---|
1307 | void GeoMeshViewUI::hideOpenMeshSimplification()
|
---|
1308 | {
|
---|
1309 | mButtonProcess->hide();
|
---|
1310 | mButtonProcess->deactivate();
|
---|
1311 |
|
---|
1312 | mProcessBar->hide();
|
---|
1313 | mProcessBar->deactivate();
|
---|
1314 |
|
---|
1315 | mButtonBuild->hide();
|
---|
1316 | mButtonBuild->deactivate();
|
---|
1317 |
|
---|
1318 | mBuildBar->hide();
|
---|
1319 | mBuildBar->deactivate();
|
---|
1320 | }
|
---|
1321 |
|
---|
1322 | //---------------------------------------------------------------------------
|
---|
1323 | // Shows the auto generate LodStrips panel
|
---|
1324 | //---------------------------------------------------------------------------
|
---|
1325 | void GeoMeshViewUI::showAutoGenerateLodStrips()
|
---|
1326 | {
|
---|
1327 | // Shows the simplify panel.
|
---|
1328 | showEdgeCollapse();
|
---|
1329 |
|
---|
1330 | mButtonBuild->set_visible();
|
---|
1331 | mButtonBuild->activate();
|
---|
1332 |
|
---|
1333 | mBuildBar->set_visible();
|
---|
1334 | mBuildBar->activate();
|
---|
1335 | }
|
---|
1336 |
|
---|
1337 | //---------------------------------------------------------------------------
|
---|
1338 | // Show the LodStrips visulization panel
|
---|
1339 | //---------------------------------------------------------------------------
|
---|
1340 | void GeoMeshViewUI::showVisualizeLodStrips()
|
---|
1341 | {
|
---|
1342 | mLodSlider->set_visible();
|
---|
1343 | mLodSlider->activate();
|
---|
1344 | }
|
---|
1345 |
|
---|
1346 | //---------------------------------------------------------------------------
|
---|
1347 | // Hide the LodStrips visualization panel
|
---|
1348 | //---------------------------------------------------------------------------
|
---|
1349 | void GeoMeshViewUI::hideVisualizeLodStrips()
|
---|
1350 | {
|
---|
1351 | mLodSlider->hide();
|
---|
1352 | mLodSlider->deactivate();
|
---|
1353 | }
|
---|
1354 |
|
---|
1355 | //---------------------------------------------------------------------------
|
---|
1356 | // Show the LodTrees Panel
|
---|
1357 | //---------------------------------------------------------------------------
|
---|
1358 | void GeoMeshViewUI::showOpenLeavesSimplification()
|
---|
1359 | {
|
---|
1360 | mButtonBuild->set_visible();
|
---|
1361 | mButtonBuild->activate();
|
---|
1362 |
|
---|
1363 | mBuildBar->set_visible();
|
---|
1364 | mBuildBar->activate();
|
---|
1365 | }
|
---|
1366 |
|
---|
1367 | //---------------------------------------------------------------------------
|
---|
1368 | // Hide the LodTrees Panel
|
---|
1369 | //---------------------------------------------------------------------------
|
---|
1370 | void GeoMeshViewUI::hideOpenLeavesSimplification()
|
---|
1371 | {
|
---|
1372 | mButtonBuild->hide();
|
---|
1373 | mButtonBuild->deactivate();
|
---|
1374 |
|
---|
1375 | mBuildBar->hide();
|
---|
1376 | mBuildBar->deactivate();
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | //---------------------------------------------------------------------------
|
---|
1380 | // Show the mesh info browser
|
---|
1381 | //---------------------------------------------------------------------------
|
---|
1382 | void GeoMeshViewUI::showMeshInfo()
|
---|
1383 | {
|
---|
1384 | char type[10];
|
---|
1385 |
|
---|
1386 | if (mGeoMesh)
|
---|
1387 | {
|
---|
1388 | // Remove previous mesh information
|
---|
1389 | this->mMeshInfo->remove_all();
|
---|
1390 | ogeometry = new fltk::ItemGroup("Geometry");
|
---|
1391 | ogeometry->begin();
|
---|
1392 |
|
---|
1393 | fltk::ItemGroup **oprueba;
|
---|
1394 | oprueba=new fltk::ItemGroup*[mGeoMesh->mSubMeshCount];
|
---|
1395 | for(int i=0; i<mGeoMesh->mSubMeshCount;i++)
|
---|
1396 | {
|
---|
1397 | char *cadena=new char[12];
|
---|
1398 |
|
---|
1399 | if (geoMeshView->getLeavesSubmesh() >= 0)
|
---|
1400 | {
|
---|
1401 | if (geoMeshView->getLeavesSubmesh() == i)
|
---|
1402 | {
|
---|
1403 | strcpy(type,"(Leaves)");
|
---|
1404 | }
|
---|
1405 | else
|
---|
1406 | {
|
---|
1407 | strcpy(type,"(Trunc)");
|
---|
1408 | }
|
---|
1409 | }
|
---|
1410 | else
|
---|
1411 | {
|
---|
1412 | strcpy(type,"");
|
---|
1413 | }
|
---|
1414 |
|
---|
1415 | // Submesh identifier.
|
---|
1416 | sprintf(cadena,"SubMesh %d %s",i,type);
|
---|
1417 |
|
---|
1418 | oprueba[i] = new fltk::ItemGroup(cadena);
|
---|
1419 | oprueba[i]->begin();
|
---|
1420 | fltk::Item *sharedGeometry;
|
---|
1421 | if (mGeoMesh->mSubMesh[i].mSharedVertexBuffer)
|
---|
1422 | {
|
---|
1423 | sharedGeometry = new fltk::Item("Shared Geometry: Yes");
|
---|
1424 | }
|
---|
1425 | else
|
---|
1426 | {
|
---|
1427 | sharedGeometry = new fltk::Item("Shared Geometry: No");
|
---|
1428 | }
|
---|
1429 |
|
---|
1430 | char *cadena2=new char[30];
|
---|
1431 | sprintf(cadena2, "Number of indexes: %d",mGeoMesh->mSubMesh[i].mIndexCount);
|
---|
1432 | fltk::Item *numberIndex = new fltk::Item(cadena2);
|
---|
1433 | if (mGeoMesh->mType==Geometry::GEO_TRIANGLE_LIST)
|
---|
1434 | {
|
---|
1435 | fltk::Item *type = new fltk::Item("Triangle list");
|
---|
1436 | }
|
---|
1437 | else
|
---|
1438 | {
|
---|
1439 | fltk::Item *type = new fltk::Item("Triangle strips");
|
---|
1440 | }
|
---|
1441 |
|
---|
1442 | char *cadenavertex=new char[30];
|
---|
1443 | sprintf(cadenavertex, "Number of vertices: %d",mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount);
|
---|
1444 | fltk::Item *numberVertex = new fltk::Item(cadenavertex);
|
---|
1445 |
|
---|
1446 | if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)
|
---|
1447 | {
|
---|
1448 | fltk::Item *normals = new fltk::Item("Normals: Yes");
|
---|
1449 | }
|
---|
1450 | else
|
---|
1451 | {
|
---|
1452 | fltk::Item *normals = new fltk::Item("Normals: No");
|
---|
1453 | }
|
---|
1454 |
|
---|
1455 | if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS)
|
---|
1456 | {
|
---|
1457 | fltk::Item *textures = new fltk::Item("Textures: Yes");
|
---|
1458 | }
|
---|
1459 | else
|
---|
1460 | {
|
---|
1461 | fltk::Item *textures = new fltk::Item("Textures: No");
|
---|
1462 | }
|
---|
1463 |
|
---|
1464 |
|
---|
1465 | oprueba[i]->end();
|
---|
1466 | }
|
---|
1467 | ogeometry->end();
|
---|
1468 | this->mMeshInfo->add(ogeometry);
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | // Hide the right panel.
|
---|
1472 | hideRightPanel();
|
---|
1473 |
|
---|
1474 | mMeshInfo->set_visible();
|
---|
1475 | mMeshInfo->activate();
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 | //---------------------------------------------------------------------------
|
---|
1479 | // Hide the mesh info browser
|
---|
1480 | //---------------------------------------------------------------------------
|
---|
1481 | void GeoMeshViewUI::hideMeshInfo()
|
---|
1482 | {
|
---|
1483 | mMeshInfo->hide();
|
---|
1484 | mMeshInfo->deactivate();
|
---|
1485 | }
|
---|
1486 |
|
---|
1487 | //---------------------------------------------------------------------------
|
---|
1488 | // Hide the right panel
|
---|
1489 | //---------------------------------------------------------------------------
|
---|
1490 | void GeoMeshViewUI::hideRightPanel()
|
---|
1491 | {
|
---|
1492 | hideStripify();
|
---|
1493 | hideEdgeCollapse();
|
---|
1494 | hideLeavesCollapse();
|
---|
1495 | hideOpenMeshSimplification();
|
---|
1496 | hideOpenLeavesSimplification();
|
---|
1497 | hideVisualizeLodStrips();
|
---|
1498 | hideMeshInfo();
|
---|
1499 | }
|
---|
1500 |
|
---|
1501 | //---------------------------------------------------------------------------
|
---|
1502 | // Get the number of vertices
|
---|
1503 | //---------------------------------------------------------------------------
|
---|
1504 | size_t GeoMeshViewUI::getVertexCount(Mesh *geoMesh)
|
---|
1505 | {
|
---|
1506 | size_t vertex_count;
|
---|
1507 | SubMesh *geoSubMesh;
|
---|
1508 |
|
---|
1509 | vertex_count = geoMesh->mVertexBuffer->mVertexCount;
|
---|
1510 |
|
---|
1511 | // For each submesh.
|
---|
1512 | for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
|
---|
1513 | {
|
---|
1514 | // Gets the actual submesh.
|
---|
1515 | geoSubMesh = &geoMesh->mSubMesh[submesh];
|
---|
1516 |
|
---|
1517 | // If the mesh does not have shared vertex.
|
---|
1518 | if (!geoSubMesh->mSharedVertexBuffer)
|
---|
1519 | {
|
---|
1520 | // Adds the vertex of the submesh to the total count.
|
---|
1521 | vertex_count += geoSubMesh->mVertexBuffer->mVertexCount;
|
---|
1522 | }
|
---|
1523 | }
|
---|
1524 |
|
---|
1525 | return vertex_count;
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | //---------------------------------------------------------------------------
|
---|
1529 | // Get the number of triangles
|
---|
1530 | //---------------------------------------------------------------------------
|
---|
1531 | size_t GeoMeshViewUI::getTriangleCount(Geometry::Mesh *geoMesh)
|
---|
1532 | {
|
---|
1533 | size_t triangle_count;
|
---|
1534 | SubMesh *geoSubMesh;
|
---|
1535 |
|
---|
1536 | // Initialize the triangle count.
|
---|
1537 | triangle_count = 0;
|
---|
1538 |
|
---|
1539 | // If the application is in visualize lodstrips mode.
|
---|
1540 | if (mApplicationState == VISUALIZE_LODSTRIPS)
|
---|
1541 | {
|
---|
1542 | triangle_count = geoMeshView->getLodStripsTriangleCount();
|
---|
1543 | }
|
---|
1544 | else
|
---|
1545 | {
|
---|
1546 | // For each submesh.
|
---|
1547 | for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
|
---|
1548 | {
|
---|
1549 | // Gets the actual submesh.
|
---|
1550 | geoSubMesh = &geoMesh->mSubMesh[submesh];
|
---|
1551 |
|
---|
1552 | switch (geoMesh->mType)
|
---|
1553 | {
|
---|
1554 | case GEO_TRIANGLE_LIST:
|
---|
1555 | triangle_count += geoSubMesh->mIndexCount / 3;
|
---|
1556 | break;
|
---|
1557 | case GEO_TRIANGLE_STRIPS:
|
---|
1558 | triangle_count += geoSubMesh->mIndexCount - 2;
|
---|
1559 | break;
|
---|
1560 | }
|
---|
1561 | }
|
---|
1562 | }
|
---|
1563 |
|
---|
1564 | return triangle_count;
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | //---------------------------------------------------------------------------
|
---|
1568 | // Get the number of strips
|
---|
1569 | //---------------------------------------------------------------------------
|
---|
1570 | size_t GeoMeshViewUI::getStripCount(Geometry::Mesh *geoMesh)
|
---|
1571 | {
|
---|
1572 | size_t strip_count;
|
---|
1573 | SubMesh *geoSubMesh;
|
---|
1574 |
|
---|
1575 | // Initialize the triangle count.
|
---|
1576 | strip_count = 0;
|
---|
1577 |
|
---|
1578 | if (geoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
1579 | {
|
---|
1580 | // For each submesh.
|
---|
1581 | for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
|
---|
1582 | {
|
---|
1583 | // Gets the actual submesh.
|
---|
1584 | geoSubMesh = &geoMesh->mSubMesh[submesh];
|
---|
1585 |
|
---|
1586 | strip_count += geoSubMesh->mStripCount;
|
---|
1587 | }
|
---|
1588 | }
|
---|
1589 | return strip_count;
|
---|
1590 | }
|
---|
1591 |
|
---|
1592 | //---------------------------------------------------------------------------
|
---|
1593 | // It paints the submesh selected by the mMeshInfo tree
|
---|
1594 | // Trate the mMeshInfo event
|
---|
1595 | //---------------------------------------------------------------------------
|
---|
1596 | int GeoMeshViewUI::paintMesh(void)
|
---|
1597 | {
|
---|
1598 | char selectedTag[100];
|
---|
1599 | char *pch;
|
---|
1600 | char *p;
|
---|
1601 | int meshNumber;
|
---|
1602 |
|
---|
1603 | // Initializa mesh to not selected.
|
---|
1604 | meshNumber = -1;
|
---|
1605 |
|
---|
1606 | // Shows the selected object label
|
---|
1607 | strcpy(selectedTag,mMeshInfo->goto_focus()->label());
|
---|
1608 |
|
---|
1609 | p=strstr(selectedTag,"SubMesh ");
|
---|
1610 |
|
---|
1611 | // If the item begins with string "SubMesh"
|
---|
1612 | if (p!=NULL)
|
---|
1613 | {
|
---|
1614 | pch = strtok (selectedTag," ");
|
---|
1615 | pch = strtok (NULL, " ");
|
---|
1616 | sscanf(pch,"%d",&meshNumber);
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | geoMeshView->setColorSubmeshi(meshNumber);
|
---|
1620 | geoMeshView->redraw();
|
---|
1621 |
|
---|
1622 | return meshNumber;
|
---|
1623 | }
|
---|
1624 |
|
---|
1625 | //---------------------------------------------------------------------------
|
---|
1626 | // Simplify the mesh object.
|
---|
1627 | //---------------------------------------------------------------------------
|
---|
1628 | void GeoMeshViewUI::simplifyEdgeCollapse()
|
---|
1629 | {
|
---|
1630 | Real percent;
|
---|
1631 |
|
---|
1632 | simplificacionState = QSLIM;
|
---|
1633 |
|
---|
1634 | ms = new ImageBasedSimplifier(mGeoMesh, progress_function);
|
---|
1635 |
|
---|
1636 | ms->setMeshLeaves(idMeshLeaves);
|
---|
1637 |
|
---|
1638 | if (mPercent->value() == true)
|
---|
1639 | {
|
---|
1640 | // Simplificación por porcentaje
|
---|
1641 | if (mMeshReduction->fvalue() <= 100.0 && mMeshReduction->fvalue()>0.0)
|
---|
1642 | {
|
---|
1643 | percent = mMeshReduction->fvalue();
|
---|
1644 | percent = percent / 100.0;
|
---|
1645 |
|
---|
1646 | // Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
|
---|
1647 | ms->Simplify(percent);
|
---|
1648 |
|
---|
1649 | // Deletes the previous mesh.
|
---|
1650 | delete mUndoMesh;
|
---|
1651 |
|
---|
1652 | mUndoMesh = new Mesh();
|
---|
1653 |
|
---|
1654 | // Sets the undo mesh.
|
---|
1655 | *mUndoMesh = *mGeoMesh;
|
---|
1656 |
|
---|
1657 | delete mGeoMesh;
|
---|
1658 |
|
---|
1659 | mGeoMesh = ms->GetMesh();
|
---|
1660 |
|
---|
1661 | // Visualize mesh.
|
---|
1662 | geoMeshView->setMesh(mGeoMesh);
|
---|
1663 | }
|
---|
1664 | else
|
---|
1665 | {
|
---|
1666 | fltk::alert("Wrong value for simplification.\n"
|
---|
1667 | "Valid values [0..100]");
|
---|
1668 | }
|
---|
1669 | }
|
---|
1670 | else
|
---|
1671 | {
|
---|
1672 | // Simplificar hasta un número de vértices.
|
---|
1673 | uint32 v = (uint32)mMeshReduction->fvalue();
|
---|
1674 |
|
---|
1675 | // Simplifica el geomesh -> Parámetro es un factor LOD [0,1].
|
---|
1676 | ms->Simplify(v);
|
---|
1677 |
|
---|
1678 | // Deletes the previous mesh.
|
---|
1679 | delete mUndoMesh;
|
---|
1680 |
|
---|
1681 | mUndoMesh = new Mesh();
|
---|
1682 |
|
---|
1683 | // Sets the undo mesh.
|
---|
1684 | *mUndoMesh = *mGeoMesh;
|
---|
1685 |
|
---|
1686 | delete mGeoMesh;
|
---|
1687 |
|
---|
1688 | mGeoMesh = ms->GetMesh();
|
---|
1689 |
|
---|
1690 | // Visualize the mesh.
|
---|
1691 | geoMeshView->setMesh(mGeoMesh);
|
---|
1692 | }
|
---|
1693 | }
|
---|
1694 |
|
---|
1695 | //---------------------------------------------------------------------------
|
---|
1696 | // Simplify the mesh object.
|
---|
1697 | //---------------------------------------------------------------------------
|
---|
1698 | void GeoMeshViewUI::simplifyLeavesCollapse()
|
---|
1699 | {
|
---|
1700 | uint32 vi;
|
---|
1701 |
|
---|
1702 | // if the mesh is stripified.
|
---|
1703 | if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
1704 | {
|
---|
1705 | fltk::alert("Can't simplify a tree in triagle strips.");
|
---|
1706 | }
|
---|
1707 | // if the mesh is in triangle list.
|
---|
1708 | else
|
---|
1709 | {
|
---|
1710 | simplificacionState = HOJAS;
|
---|
1711 |
|
---|
1712 | mts = new TreeSimplifier(mGeoMesh, progress_function);
|
---|
1713 | vi = (uint32)mMeshReduction->fvalue();
|
---|
1714 |
|
---|
1715 | // Simplify
|
---|
1716 | if(idMeshLeaves != (unsigned short)-1)
|
---|
1717 | {
|
---|
1718 | // Simplify
|
---|
1719 | mts->Simplify(vi, idMeshLeaves);
|
---|
1720 |
|
---|
1721 | // Deletes the previous mesh.
|
---|
1722 | delete mUndoMesh;
|
---|
1723 |
|
---|
1724 | mUndoMesh = new Mesh();
|
---|
1725 |
|
---|
1726 | // Sets the undo mesh.
|
---|
1727 | *mUndoMesh = *mGeoMesh;
|
---|
1728 |
|
---|
1729 | delete mGeoMesh;
|
---|
1730 |
|
---|
1731 | mGeoMesh = mts->GetMesh();
|
---|
1732 |
|
---|
1733 | geoMeshView->setMesh(mGeoMesh);
|
---|
1734 | }
|
---|
1735 | else
|
---|
1736 | {
|
---|
1737 | fltk::alert("You must select the mesh that contains the leaves.");
|
---|
1738 | }
|
---|
1739 | }
|
---|
1740 | }
|
---|
1741 |
|
---|
1742 | //---------------------------------------------------------------------------
|
---|
1743 | // Create a simplification sequence of the QSLIM method.
|
---|
1744 | //---------------------------------------------------------------------------
|
---|
1745 | void GeoMeshViewUI::createQslimSequence()
|
---|
1746 | {
|
---|
1747 | MeshSimplificationSequence *secsimpl;
|
---|
1748 |
|
---|
1749 | secsimpl = ms->GetSimplificationSequence();
|
---|
1750 |
|
---|
1751 | secsimpl->putMeshName(nombremesh); // Nombre del mesh para guardar la secuencia de simplificación
|
---|
1752 | secsimpl->Save(Geometry::Serializer("mqslimSequence.txt",Serializer::WRITE));
|
---|
1753 |
|
---|
1754 | delete secsimpl;
|
---|
1755 | }
|
---|
1756 |
|
---|
1757 | //---------------------------------------------------------------------------
|
---|
1758 | // Stripify the mesh object.
|
---|
1759 | //---------------------------------------------------------------------------
|
---|
1760 | void GeoMeshViewUI::stripify()
|
---|
1761 | {
|
---|
1762 | char char_value[10];
|
---|
1763 | CustomStripifier *geoStripifier;
|
---|
1764 |
|
---|
1765 | // if the mesh is stripified.
|
---|
1766 | if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
1767 | {
|
---|
1768 | fltk::alert("The mesh is already in strips.");
|
---|
1769 | }
|
---|
1770 | // if the mesh is in triangle list.
|
---|
1771 | else
|
---|
1772 | {
|
---|
1773 | //Stripify.
|
---|
1774 | geoStripifier = new CustomStripifier(mGeoMesh);
|
---|
1775 |
|
---|
1776 | // Set the progress bar function.
|
---|
1777 | geoStripifier->SetProgressFunc(progress_function);
|
---|
1778 |
|
---|
1779 | if (geoStripifier->Stripify())
|
---|
1780 | {
|
---|
1781 | // Deletes the mesh object.
|
---|
1782 | delete mUndoMesh;
|
---|
1783 |
|
---|
1784 | mUndoMesh = new Mesh();
|
---|
1785 |
|
---|
1786 | *mUndoMesh = *mGeoMesh;
|
---|
1787 |
|
---|
1788 | delete mGeoMesh;
|
---|
1789 |
|
---|
1790 | // Gets the mesh stripified.
|
---|
1791 | mGeoMesh = geoStripifier->GetMesh();
|
---|
1792 |
|
---|
1793 | // Visualize the mesh stripified.
|
---|
1794 | geoMeshView->setMesh(mGeoMesh);
|
---|
1795 |
|
---|
1796 | // Store the color of the strips.
|
---|
1797 | geoMeshView->setStripColors();
|
---|
1798 | }
|
---|
1799 | else
|
---|
1800 | {
|
---|
1801 | // Error message.
|
---|
1802 | fltk::alert("Impossible to stripify. The mesh is not manifold");
|
---|
1803 | }
|
---|
1804 |
|
---|
1805 | // Deletes the stripifier object.
|
---|
1806 | delete geoStripifier;
|
---|
1807 | }
|
---|
1808 | }
|
---|
1809 |
|
---|
1810 | //---------------------------------------------------------------------------
|
---|
1811 | // Method that undo then mesh changes.
|
---|
1812 | //---------------------------------------------------------------------------
|
---|
1813 | void GeoMeshViewUI::undo()
|
---|
1814 | {
|
---|
1815 | // if the undo mesh is not initialized.
|
---|
1816 | if (mUndoMesh != NULL)
|
---|
1817 | {
|
---|
1818 | // Deletes the actual mesh.
|
---|
1819 | delete mGeoMesh;
|
---|
1820 |
|
---|
1821 | mGeoMesh = new Mesh();
|
---|
1822 |
|
---|
1823 | // Restore the previous mesh.
|
---|
1824 | *mGeoMesh = *mUndoMesh;
|
---|
1825 |
|
---|
1826 | // Visualize the mesh.
|
---|
1827 | geoMeshView->setMesh(mGeoMesh);
|
---|
1828 |
|
---|
1829 | // Refresh geometry attributes.
|
---|
1830 | refreshApplicationBar();
|
---|
1831 |
|
---|
1832 | // Repaint the window.
|
---|
1833 | mMainWindow->redraw();
|
---|
1834 | }
|
---|
1835 | }
|
---|
1836 |
|
---|
1837 | //---------------------------------------------------------------------------
|
---|
1838 | // Refresh number of vertices, triangles, strips, ...
|
---|
1839 | //---------------------------------------------------------------------------
|
---|
1840 | void GeoMeshViewUI::refreshApplicationBar()
|
---|
1841 | {
|
---|
1842 | static char vertices_value[50];
|
---|
1843 | static char triangles_value[50];
|
---|
1844 | static char strips_value[50];
|
---|
1845 |
|
---|
1846 | // Translate the vertex count to a char value.
|
---|
1847 | sprintf(vertices_value,"Vertices %d",getVertexCount(mGeoMesh));
|
---|
1848 |
|
---|
1849 | mVertices->label(vertices_value);
|
---|
1850 |
|
---|
1851 | // Translate the triangle count to a char value.
|
---|
1852 | sprintf(triangles_value,"Triangles %d",getTriangleCount(mGeoMesh));
|
---|
1853 |
|
---|
1854 | mTriangles->label(triangles_value);
|
---|
1855 |
|
---|
1856 | // Translate the triangle count to a char value.
|
---|
1857 | sprintf(strips_value,"Strips %d",getStripCount(mGeoMesh));
|
---|
1858 |
|
---|
1859 | mStrips->label(strips_value);
|
---|
1860 | }
|
---|
1861 |
|
---|
1862 | // Method that updates the porgress bar.
|
---|
1863 | float GeoMeshViewUI::updateProgressBar(float v)
|
---|
1864 | {
|
---|
1865 | fltk::ProgressBar *progressBar;
|
---|
1866 |
|
---|
1867 | // Choose progress bar to update.
|
---|
1868 | switch(progressBarType)
|
---|
1869 | {
|
---|
1870 | case PROCESS:
|
---|
1871 | progressBar = mProcessBar;
|
---|
1872 | break;
|
---|
1873 | case BUILD:
|
---|
1874 | progressBar = mBuildBar;
|
---|
1875 | break;
|
---|
1876 | }
|
---|
1877 |
|
---|
1878 | // Update progress bar.
|
---|
1879 | progressBar->step(v);
|
---|
1880 | progressBar->step();
|
---|
1881 | mMainWindow->flush();
|
---|
1882 | //mMainWindow->redraw();
|
---|
1883 |
|
---|
1884 | return 0;
|
---|
1885 | }
|
---|
1886 |
|
---|
1887 | //---------------------------------------------------------------------------
|
---|
1888 | // Initialize the lodstripslibrary for visualization.
|
---|
1889 | //---------------------------------------------------------------------------
|
---|
1890 | void GeoMeshViewUI::setLodStripsLibrary(std::string lodfile, Mesh *geomesh)
|
---|
1891 | {
|
---|
1892 | // If there is no lod strips object.
|
---|
1893 | if (lodStripsLib)
|
---|
1894 | {
|
---|
1895 | delete lodStripsLib;
|
---|
1896 | }
|
---|
1897 |
|
---|
1898 | // New lod strips object.
|
---|
1899 | lodStripsLib = new LodStripsLibrary(lodfile, geomesh);
|
---|
1900 |
|
---|
1901 | // Sets the slider range.
|
---|
1902 | mLodSlider->range(lodStripsLib->MaxLod(),
|
---|
1903 | lodStripsLib->MinLod());
|
---|
1904 |
|
---|
1905 | // Pass to geomeshview the lod strips object.
|
---|
1906 | geoMeshView->setLodStripsLibrary(lodStripsLib);
|
---|
1907 |
|
---|
1908 | // Puts the slider in the max position.
|
---|
1909 | mLodSlider->value(lodStripsLib->MinLod());
|
---|
1910 | }
|
---|
1911 |
|
---|
1912 | //---------------------------------------------------------------------------
|
---|
1913 | // Open a mesh file.
|
---|
1914 | //---------------------------------------------------------------------------
|
---|
1915 | void GeoMeshViewUI::openMeshFile()
|
---|
1916 | {
|
---|
1917 | fltk::FileChooser *fcho;
|
---|
1918 | static char char_value[10];
|
---|
1919 | static char title[256];
|
---|
1920 |
|
---|
1921 | fcho = new fltk::FileChooser("",
|
---|
1922 | "*.mesh",
|
---|
1923 | fltk::FileChooser::CREATE,
|
---|
1924 | "Open mesh file");
|
---|
1925 |
|
---|
1926 | fcho->exec();
|
---|
1927 |
|
---|
1928 | // File name.
|
---|
1929 | mFileName = (char *)fcho->value();
|
---|
1930 |
|
---|
1931 | if (mFileName)
|
---|
1932 | {
|
---|
1933 | // Set Window Title.
|
---|
1934 | strcpy(title,mFileName);
|
---|
1935 | mMainWindow->label(strcat(title," - GeoTool"));
|
---|
1936 |
|
---|
1937 | // Identify the mesh that stores the leaves
|
---|
1938 | idMeshLeaves = -1;
|
---|
1939 |
|
---|
1940 | // Stores the name of the mesh.
|
---|
1941 | nombremesh = new char[255];
|
---|
1942 | strcpy(nombremesh,mFileName);
|
---|
1943 |
|
---|
1944 | // Delete the current mesh.
|
---|
1945 | delete mGeoMesh;
|
---|
1946 | delete mUndoMesh;
|
---|
1947 |
|
---|
1948 | // Loads a new mesh.
|
---|
1949 | mGeoMesh = geoMeshLoader->load(mFileName);
|
---|
1950 |
|
---|
1951 | // Reset the undo mesh.
|
---|
1952 | mUndoMesh = new Mesh();
|
---|
1953 | *mUndoMesh = *mGeoMesh;
|
---|
1954 |
|
---|
1955 | // Translate the MB count to a char value.
|
---|
1956 | sprintf(char_value,
|
---|
1957 | "MB %.3f",
|
---|
1958 | (float)geoMeshLoader->getFileSize()/1024/1024);
|
---|
1959 |
|
---|
1960 | mMB->label(char_value);
|
---|
1961 |
|
---|
1962 | // Visualize mesh.
|
---|
1963 | geoMeshView->setMesh(mGeoMesh);
|
---|
1964 |
|
---|
1965 | // Get the mesh bounds.
|
---|
1966 | mMeshBounds = geoMeshView->getBoundingBox();
|
---|
1967 |
|
---|
1968 | // Hide right panel.
|
---|
1969 | hideRightPanel();
|
---|
1970 |
|
---|
1971 | // Quit culling.
|
---|
1972 | menuRenderCW->clear_value();
|
---|
1973 | menuRenderCCW->clear_value();
|
---|
1974 | geoMeshView->deactiveCW();
|
---|
1975 | geoMeshView->deactiveCCW();
|
---|
1976 |
|
---|
1977 | // Deactive solid mode and wire.
|
---|
1978 | menuRenderSolid->clear_value();
|
---|
1979 | menuRenderWire->clear_value();
|
---|
1980 | geoMeshView->deactiveSolid();
|
---|
1981 | geoMeshView->deactiveWire();
|
---|
1982 |
|
---|
1983 | // Fit model in midle.
|
---|
1984 | geoMeshView->fit();
|
---|
1985 |
|
---|
1986 | // Lighting smooth.
|
---|
1987 | menuRenderFlat->clear_value();
|
---|
1988 | menuRenderSmooth->set_value();
|
---|
1989 | geoMeshView->smooth();
|
---|
1990 |
|
---|
1991 | // Show title.
|
---|
1992 | mProcessTitle->label("Mesh Info");
|
---|
1993 |
|
---|
1994 | // Shows the mesh info.
|
---|
1995 | showMeshInfo();
|
---|
1996 |
|
---|
1997 | // if the mesh is stripified.
|
---|
1998 | if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS)
|
---|
1999 | {
|
---|
2000 | geoMeshView->setStripColors();
|
---|
2001 | }
|
---|
2002 |
|
---|
2003 | // Refresh geometry attributes.
|
---|
2004 | refreshApplicationBar();
|
---|
2005 | }
|
---|
2006 |
|
---|
2007 | // Free memory.
|
---|
2008 | delete fcho;
|
---|
2009 | }
|
---|
2010 |
|
---|
2011 | /******************/
|
---|
2012 | /* Constructor */
|
---|
2013 | /******************/
|
---|
2014 | GeoMeshViewUI::GeoMeshViewUI(TIPOFUNC fun)
|
---|
2015 | {
|
---|
2016 | progress_function = fun;
|
---|
2017 | fltk::gifImage *logo;
|
---|
2018 |
|
---|
2019 | // Initialize the file name.
|
---|
2020 | mFileName = NULL;
|
---|
2021 |
|
---|
2022 | // Initialize the 3D object.
|
---|
2023 | mGeoMesh = NULL;
|
---|
2024 | mUndoMesh = NULL;
|
---|
2025 |
|
---|
2026 | // Initialize the lod strip object.
|
---|
2027 | lodStripsLib = NULL;
|
---|
2028 |
|
---|
2029 | // Identify the mesh that stores the leaves
|
---|
2030 | idMeshLeaves = -1;
|
---|
2031 |
|
---|
2032 | // Initialize the loader of meshes.
|
---|
2033 | geoMeshLoader = new GeoMeshLoader();
|
---|
2034 |
|
---|
2035 | // Initialize the menus application state.
|
---|
2036 | mApplicationState = NONE;
|
---|
2037 |
|
---|
2038 | {
|
---|
2039 | fltk::Window* o = new fltk::Window(800, 600,"GeoTool");
|
---|
2040 |
|
---|
2041 | mMainWindow = o;
|
---|
2042 |
|
---|
2043 | // Program Icon for Win32.
|
---|
2044 | mMainWindow->icon((char *)LoadIcon( GetModuleHandle(0),
|
---|
2045 | MAKEINTRESOURCE(GEOICON)));
|
---|
2046 |
|
---|
2047 | // Double buffer.
|
---|
2048 | mMainWindow->set_double_buffer();
|
---|
2049 |
|
---|
2050 | o->user_data((void*)(this));
|
---|
2051 | o->begin();
|
---|
2052 |
|
---|
2053 | {
|
---|
2054 | fltk::Group* o = new fltk::Group(0, 27, 806, 559);
|
---|
2055 | o->begin();
|
---|
2056 |
|
---|
2057 | {
|
---|
2058 | fltk::Group* o;
|
---|
2059 | o = MainView = new fltk::Group(0, 0, 600, 500);
|
---|
2060 | o->begin();
|
---|
2061 |
|
---|
2062 | {
|
---|
2063 | fltk::InvisibleBox* o;
|
---|
2064 | o = cframe = new fltk::InvisibleBox(0, 0, 600, 500);
|
---|
2065 | o->box(fltk::FLAT_BOX);
|
---|
2066 | o->color((fltk::Color)0xffffff00);
|
---|
2067 | //fltk::Group::current()->resizable(o);
|
---|
2068 | }
|
---|
2069 |
|
---|
2070 | {
|
---|
2071 | GeoMeshView* o;
|
---|
2072 | o = geoMeshView = new GeoMeshView( 0,0,600,500,0,this);
|
---|
2073 | }
|
---|
2074 |
|
---|
2075 | o->end();
|
---|
2076 |
|
---|
2077 | fltk::Group::current()->resizable(o);
|
---|
2078 |
|
---|
2079 | }
|
---|
2080 |
|
---|
2081 | {
|
---|
2082 | fltk::Group* o;
|
---|
2083 | o = MainView = new fltk::Group(600, 0, 200, 500);
|
---|
2084 | o->begin();
|
---|
2085 |
|
---|
2086 | {
|
---|
2087 | fltk::Button* o;
|
---|
2088 | //o = mButtonProcess = new fltk::Button(665, 410, 73, 25, "Process");
|
---|
2089 | o = mButtonProcess = new fltk::Button(65, 410, 73, 25, "Process");
|
---|
2090 | o->callback((fltk::Callback*)cb_mButtonProcess);
|
---|
2091 | o->hide();
|
---|
2092 | o->deactivate();
|
---|
2093 | }
|
---|
2094 |
|
---|
2095 | {
|
---|
2096 | fltk::ProgressBar* o;
|
---|
2097 | //o = mProcessBar = new fltk::ProgressBar(616, 435, 175, 18);
|
---|
2098 | o = mProcessBar = new fltk::ProgressBar(16, 435, 175, 18);
|
---|
2099 | o->hide();
|
---|
2100 | o->deactivate();
|
---|
2101 | }
|
---|
2102 |
|
---|
2103 | {
|
---|
2104 | fltk::Button* o;
|
---|
2105 | o = mButtonSort = new fltk::Button(65, 375, 73, 25, "Sort");
|
---|
2106 | o->callback((fltk::Callback*)cb_mButtonSort);
|
---|
2107 | o->hide();
|
---|
2108 | o->deactivate();
|
---|
2109 | }
|
---|
2110 |
|
---|
2111 | {
|
---|
2112 | fltk::ProgressBar* o;
|
---|
2113 | o = mSortBar = new fltk::ProgressBar(16, 390, 175, 18);
|
---|
2114 | o->hide();
|
---|
2115 | o->deactivate();
|
---|
2116 | }
|
---|
2117 |
|
---|
2118 | {
|
---|
2119 | fltk::Button* o;
|
---|
2120 | o = mButtonBuild = new fltk::Button(65, 455, 73, 25, "Build");
|
---|
2121 | o->callback((fltk::Callback*)cb_mButtonBuild);
|
---|
2122 | o->hide();
|
---|
2123 | o->deactivate();
|
---|
2124 | }
|
---|
2125 |
|
---|
2126 | {
|
---|
2127 | fltk::ProgressBar* o;
|
---|
2128 | o = mBuildBar = new fltk::ProgressBar(16, 480, 175, 18);
|
---|
2129 | o->hide();
|
---|
2130 | o->deactivate();
|
---|
2131 | }
|
---|
2132 |
|
---|
2133 | {
|
---|
2134 | fltk::Slider* o;
|
---|
2135 | o = mLodSlider = new fltk::Slider(16, 50, 30, 450);
|
---|
2136 | o->type(fltk::Slider::TICK_BELOW);
|
---|
2137 | o->set_vertical();
|
---|
2138 | o->callback((fltk::Callback*)cb_mLodSlider);
|
---|
2139 | o->hide();
|
---|
2140 | o->deactivate();
|
---|
2141 | }
|
---|
2142 |
|
---|
2143 | {
|
---|
2144 | mMetricLabel = new fltk::Output(26, 28, 5, 25, "Metric");
|
---|
2145 | fltk::Output* o = mMetricLabel;
|
---|
2146 | o->set_vertical();
|
---|
2147 | o->box(fltk::NO_BOX);
|
---|
2148 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2149 | o->color((fltk::Color)0xe0dfe300);
|
---|
2150 | o->align(fltk::ALIGN_RIGHT);
|
---|
2151 | }
|
---|
2152 |
|
---|
2153 | {
|
---|
2154 | fltk::Group* o;
|
---|
2155 | o = MainView = new fltk::Group(30, 40, 30, 60);
|
---|
2156 | o->begin();
|
---|
2157 | {
|
---|
2158 | mGeometryBased = new fltk::RadioButton(0, 8, 25, 25, "Geometry based");
|
---|
2159 | mImageBased = new fltk::RadioButton(0, 23, 25, 25, "Image based");
|
---|
2160 | }
|
---|
2161 | o->end();
|
---|
2162 | }
|
---|
2163 |
|
---|
2164 | //mChangeVertices = new fltk::CheckButton(30, 104, 25, 25, "Change vertices");
|
---|
2165 |
|
---|
2166 | {
|
---|
2167 | mProcessTitle = new fltk::Widget(0, 0, 200, 25, "");
|
---|
2168 | fltk::Widget* o = mProcessTitle;
|
---|
2169 | o->set_vertical();
|
---|
2170 | o->box(fltk::NO_BOX);
|
---|
2171 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2172 | o->labelsize(15.0);
|
---|
2173 | o->color((fltk::Color)0xe0dfe300);
|
---|
2174 | o->align(fltk::ALIGN_CENTER);
|
---|
2175 | }
|
---|
2176 |
|
---|
2177 | /*
|
---|
2178 | {
|
---|
2179 | mTypeLabel = new fltk::Output(26, 82, 5, 25, "Type");
|
---|
2180 | fltk::Output* o = mTypeLabel;
|
---|
2181 | o->set_vertical();
|
---|
2182 | o->box(fltk::NO_BOX);
|
---|
2183 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2184 | o->color((fltk::Color)0xe0dfe300);
|
---|
2185 | o->align(fltk::ALIGN_RIGHT);
|
---|
2186 | }
|
---|
2187 | */
|
---|
2188 |
|
---|
2189 | {
|
---|
2190 | mMeshReductionLabel = new fltk::Output(26, 124, 5, 25, "Mesh Reduction");
|
---|
2191 | fltk::Output* o = mMeshReductionLabel;
|
---|
2192 | o->set_vertical();
|
---|
2193 | o->box(fltk::NO_BOX);
|
---|
2194 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2195 | o->color((fltk::Color)0xe0dfe300);
|
---|
2196 | o->align(fltk::ALIGN_RIGHT);
|
---|
2197 | }
|
---|
2198 |
|
---|
2199 | //mChangeTexture = new fltk::CheckButton(30, 104, 25, 25, "Change texture");
|
---|
2200 |
|
---|
2201 | {
|
---|
2202 | fltk::Group* o;
|
---|
2203 | o = MainView = new fltk::Group(30, 140, 30, 60);
|
---|
2204 | o->begin();
|
---|
2205 |
|
---|
2206 | {
|
---|
2207 | mPercent = new fltk::RadioButton(0, 5, 25, 25, "%");
|
---|
2208 | mVerticesNumber = new fltk::RadioButton(0, 20, 25, 25, "Vertices number");
|
---|
2209 | }
|
---|
2210 | o->end();
|
---|
2211 | }
|
---|
2212 |
|
---|
2213 | {
|
---|
2214 | mMeshReduction = new fltk::FloatInput(75, 181, 75, 21, "Value:");
|
---|
2215 | fltk::FloatInput* o = mMeshReduction;
|
---|
2216 | o->type(1);
|
---|
2217 | }
|
---|
2218 |
|
---|
2219 | {
|
---|
2220 | fltk::Group* o;
|
---|
2221 | o = MainView = new fltk::Group(30, 100, 30, 60);
|
---|
2222 | o->begin();
|
---|
2223 |
|
---|
2224 | {
|
---|
2225 | mOneCacheStrip = new fltk::RadioButton(0, 4, 25, 25, "One cache strip");
|
---|
2226 | mQualityStrips = new fltk::RadioButton(0, 23, 25, 25, "Quality strips");
|
---|
2227 | }
|
---|
2228 | o->end();
|
---|
2229 | }
|
---|
2230 |
|
---|
2231 | {
|
---|
2232 | fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 200, 380);
|
---|
2233 | o->set_vertical();
|
---|
2234 | o->callback((fltk::Callback*)cb_mMeshInfo);
|
---|
2235 | }
|
---|
2236 | o->end();
|
---|
2237 | }
|
---|
2238 |
|
---|
2239 | o->end();
|
---|
2240 |
|
---|
2241 | fltk::Group::current()->resizable(o);
|
---|
2242 | }
|
---|
2243 |
|
---|
2244 | {
|
---|
2245 | fltk::MenuBar* o = menuBar = new fltk::MenuBar(1, 2, 801, 21);
|
---|
2246 | o->begin();
|
---|
2247 |
|
---|
2248 | // Menu File.
|
---|
2249 | {
|
---|
2250 | fltk::ItemGroup* o = menuFile = new fltk::ItemGroup("File");
|
---|
2251 | o->begin();
|
---|
2252 |
|
---|
2253 | {
|
---|
2254 | fltk::Item* o = menuFileOpen = new fltk::Item("Open");
|
---|
2255 | o->callback((fltk::Callback*)cb_menuFileOpen);
|
---|
2256 | }
|
---|
2257 |
|
---|
2258 | {
|
---|
2259 | fltk::Item* o = menuFileSave = new fltk::Item("Save");
|
---|
2260 | o->callback((fltk::Callback*)cb_menuFileSave);
|
---|
2261 | }
|
---|
2262 |
|
---|
2263 | {
|
---|
2264 | fltk::Item* o = menuOpenSaveAs = new fltk::Item("Save As");
|
---|
2265 | o->callback((fltk::Callback*)cb_menuOpenSaveAs);
|
---|
2266 | }
|
---|
2267 |
|
---|
2268 | //{
|
---|
2269 | // fltk::Item* o = menuMeshExportOBJ = new fltk::Item("Export to OBJ");
|
---|
2270 | // o->callback((fltk::Callback*)cb_menuMeshExportOBJ);
|
---|
2271 | //}
|
---|
2272 |
|
---|
2273 | //{
|
---|
2274 | // fltk::Item* o = menuFileTransformSharedVertex = new fltk::Item("Transform to Shared Vertex");
|
---|
2275 | // o->callback((fltk::Callback*)cb_menuFileTransformSharedVertex);
|
---|
2276 | //}
|
---|
2277 |
|
---|
2278 | {
|
---|
2279 | fltk::Item* o = menuOpenQuit = new fltk::Item("Quit");
|
---|
2280 | o->callback((fltk::Callback*)cb_menuOpenQuit);
|
---|
2281 | }
|
---|
2282 |
|
---|
2283 | o->end();
|
---|
2284 | }
|
---|
2285 |
|
---|
2286 | // Menu Edit.
|
---|
2287 | {
|
---|
2288 | fltk::ItemGroup* o = menuEdit = new fltk::ItemGroup("Edit");
|
---|
2289 | o->begin();
|
---|
2290 |
|
---|
2291 | {
|
---|
2292 | fltk::Item* o = menuEditUndo = new fltk::Item("Undo");
|
---|
2293 | o->callback((fltk::Callback*)cb_menuEditUndo);
|
---|
2294 | }
|
---|
2295 |
|
---|
2296 | {
|
---|
2297 | fltk::Item* o = menuEditFit = new fltk::Item("Fit");
|
---|
2298 | o->callback((fltk::Callback*)cb_menuEditFit);
|
---|
2299 |
|
---|
2300 | }
|
---|
2301 |
|
---|
2302 | {
|
---|
2303 | fltk::Item* o = menuEditRotate = new fltk::Item("Rotate");
|
---|
2304 | o->type(fltk::Item::RADIO);
|
---|
2305 | o->set_value();
|
---|
2306 | o->callback((fltk::Callback*)cb_menuEditRotate);
|
---|
2307 | }
|
---|
2308 |
|
---|
2309 | {
|
---|
2310 | fltk::Item* o = menuEditPan = new fltk::Item("Pan");
|
---|
2311 | o->type(fltk::Item::RADIO);
|
---|
2312 | o->callback((fltk::Callback*)cb_menuEditPan);
|
---|
2313 | }
|
---|
2314 |
|
---|
2315 | //{
|
---|
2316 | // fltk::Item* o = menuEditZoom = new fltk::Item("Zoom");
|
---|
2317 | // o->callback((fltk::Callback*)cb_menuEditZoom);
|
---|
2318 | //}
|
---|
2319 |
|
---|
2320 | new fltk::Divider();
|
---|
2321 |
|
---|
2322 | {
|
---|
2323 | fltk::Item* o = menuMeshInfo = new fltk::Item("Mesh info");
|
---|
2324 | o->callback((fltk::Callback*)cb_menuMeshInfo);
|
---|
2325 | }
|
---|
2326 |
|
---|
2327 | //{
|
---|
2328 | // fltk::Item* o;
|
---|
2329 | // o = menuSelectLeaves = new fltk::Item("Select leaves");
|
---|
2330 | // o->callback((fltk::Callback*)cb_menuSelectLeaves);
|
---|
2331 | //}
|
---|
2332 |
|
---|
2333 | o->end();
|
---|
2334 | }
|
---|
2335 |
|
---|
2336 | // Menu Render.
|
---|
2337 | {
|
---|
2338 | fltk::ItemGroup* o = menuRender = new fltk::ItemGroup("Render");
|
---|
2339 | o->begin();
|
---|
2340 |
|
---|
2341 | {
|
---|
2342 | fltk::Item* o = menuRenderWire = new fltk::Item("Wire");
|
---|
2343 | o->type(fltk::Item::RADIO);
|
---|
2344 | o->callback((fltk::Callback*)cb_menuRenderWire);
|
---|
2345 | }
|
---|
2346 |
|
---|
2347 | {
|
---|
2348 | fltk::Item* o = menuRenderSolid = new fltk::Item("Solid");
|
---|
2349 | o->type(fltk::Item::RADIO);
|
---|
2350 | o->callback((fltk::Callback*)cb_menuRenderSolid);
|
---|
2351 | }
|
---|
2352 |
|
---|
2353 | //new fltk::Divider();
|
---|
2354 |
|
---|
2355 | {
|
---|
2356 | fltk::Item* o = menuRenderCW = new fltk::Item("CW");
|
---|
2357 | o->type(fltk::Item::RADIO);
|
---|
2358 | o->callback((fltk::Callback*)cb_menuRenderCW);
|
---|
2359 |
|
---|
2360 | o->hide();
|
---|
2361 | }
|
---|
2362 |
|
---|
2363 | {
|
---|
2364 | fltk::Item* o = menuRenderCCW = new fltk::Item("CCW");
|
---|
2365 | o->type(fltk::Item::RADIO);
|
---|
2366 | o->set_value();
|
---|
2367 | o->callback((fltk::Callback*)cb_menuRenderCCW);
|
---|
2368 |
|
---|
2369 | o->hide();
|
---|
2370 | }
|
---|
2371 |
|
---|
2372 | new fltk::Divider();
|
---|
2373 |
|
---|
2374 | {
|
---|
2375 | fltk::Item* o = menuRenderFlat = new fltk::Item("Flat");
|
---|
2376 | o->type(fltk::Item::RADIO);
|
---|
2377 | o->clear_value();
|
---|
2378 | o->callback((fltk::Callback*)cb_menuRenderFlat);
|
---|
2379 | }
|
---|
2380 |
|
---|
2381 | {
|
---|
2382 | fltk::Item* o = menuRenderSmooth = new fltk::Item("Smooth");
|
---|
2383 | o->type(fltk::Item::RADIO);
|
---|
2384 | o->set_value();
|
---|
2385 | o->callback((fltk::Callback*)cb_menuRenderSmooth);
|
---|
2386 | }
|
---|
2387 |
|
---|
2388 | //new fltk::Divider();
|
---|
2389 |
|
---|
2390 | //{
|
---|
2391 | // fltk::Item* o = menuRenderTextures = new fltk::Item("Textures");
|
---|
2392 | // o->callback((fltk::Callback*)cb_menuRenderTextures);
|
---|
2393 | //}
|
---|
2394 |
|
---|
2395 | o->end();
|
---|
2396 | }
|
---|
2397 |
|
---|
2398 | // Menu Stripify.
|
---|
2399 | {
|
---|
2400 | fltk::Item* o = menuStripify = new fltk::Item("Stripify");
|
---|
2401 | o->callback((fltk::Callback*)cb_menuStripify);
|
---|
2402 | }
|
---|
2403 |
|
---|
2404 | // Menu Simplify.
|
---|
2405 | {
|
---|
2406 | fltk::ItemGroup* o = menuSimplify = new fltk::ItemGroup("Simplify");
|
---|
2407 | o->callback((fltk::Callback*)cb_menuSimplify);
|
---|
2408 | o->begin();
|
---|
2409 |
|
---|
2410 | {
|
---|
2411 | fltk::Item* o;
|
---|
2412 | o = menuSimplifyEdgeCollapse = new fltk::Item("Mesh Simplification");
|
---|
2413 | o->callback((fltk::Callback*)cb_menuSimplifyEdgeCollapse);
|
---|
2414 | }
|
---|
2415 |
|
---|
2416 | //{
|
---|
2417 | // fltk::Item* o;
|
---|
2418 | // o = menuSimplifyLeavesCollapse = new fltk::Item("Leaves Simplification");
|
---|
2419 | // o->callback((fltk::Callback*)cb_menuSimplifyLeavesCollapse);
|
---|
2420 | //}
|
---|
2421 |
|
---|
2422 | o->end();
|
---|
2423 | }
|
---|
2424 |
|
---|
2425 | // Menu LodStrips.
|
---|
2426 | {
|
---|
2427 | fltk::ItemGroup* o;
|
---|
2428 | o = menuLodStrips = new fltk::ItemGroup("LodStrips");
|
---|
2429 | o->begin();
|
---|
2430 |
|
---|
2431 | {
|
---|
2432 | fltk::Item* o;
|
---|
2433 | o = menuLodStripsGenerate = new fltk::Item("Generate");
|
---|
2434 | o->callback((fltk::Callback*)cb_menuLodStripsGenerate);
|
---|
2435 | }
|
---|
2436 |
|
---|
2437 | {
|
---|
2438 | fltk::Item* o;
|
---|
2439 | o = menuLodStripsVisualize = new fltk::Item("Visualize");
|
---|
2440 | o->callback((fltk::Callback*)cb_menuLodStripsVisualize);
|
---|
2441 | }
|
---|
2442 |
|
---|
2443 | o->end();
|
---|
2444 | }
|
---|
2445 |
|
---|
2446 | // Menu LodTrees.
|
---|
2447 | /*
|
---|
2448 | {
|
---|
2449 | fltk::ItemGroup* o;
|
---|
2450 | o = menuLodTrees = new fltk::ItemGroup("LodTrees");
|
---|
2451 | o->begin();
|
---|
2452 |
|
---|
2453 | {
|
---|
2454 | fltk::Item* o;
|
---|
2455 | o = menuLodTreesOpenLodStripTrunk = new fltk::Item("Open LodStrip trunk");
|
---|
2456 | o->callback((fltk::Callback*)cb_menuLodTreesOpenLodStripTrunk);
|
---|
2457 | }
|
---|
2458 |
|
---|
2459 | {
|
---|
2460 | fltk::Item* o;
|
---|
2461 | o = menuLodTreesOpenLeavesSimplification = new fltk::Item("Open leaves simplification");
|
---|
2462 | o->callback((fltk::Callback*)cb_menuLodTreesOpenLeavesSimplification);
|
---|
2463 | }
|
---|
2464 | o->end();
|
---|
2465 | }
|
---|
2466 | */
|
---|
2467 |
|
---|
2468 | {
|
---|
2469 | fltk::ItemGroup* o = new fltk::ItemGroup("?");
|
---|
2470 | o->begin();
|
---|
2471 |
|
---|
2472 | {
|
---|
2473 | fltk::Item* o = menuHelpAbout = new fltk::Item("About");
|
---|
2474 | o->callback((fltk::Callback*)cb_menuHelpAbout);
|
---|
2475 | }
|
---|
2476 |
|
---|
2477 | o->end();
|
---|
2478 | }
|
---|
2479 |
|
---|
2480 | /* {
|
---|
2481 | fltk::SharedImage *gifLogo = logo->get("media\\logos\\logo.gif");
|
---|
2482 |
|
---|
2483 | //o->callback((fltk::Callback*)cb_mLogo);
|
---|
2484 |
|
---|
2485 | mLogo = new fltk::InvisibleBox(406, 1, 43, 13);
|
---|
2486 | mLogo->image(gifLogo);
|
---|
2487 | }*/
|
---|
2488 |
|
---|
2489 | o->end();
|
---|
2490 | }
|
---|
2491 |
|
---|
2492 | {
|
---|
2493 | fltk::Group* o;
|
---|
2494 | o = ApplicationBar = new fltk::Group(0, 570, 807, 28);
|
---|
2495 | o->box(fltk::BORDER_BOX);
|
---|
2496 | o->begin();
|
---|
2497 |
|
---|
2498 | {
|
---|
2499 | fltk::Widget* o;
|
---|
2500 | o = mFPS = new fltk::Widget(10, 4, 30, 15, "FPS ");
|
---|
2501 | o->box(fltk::NO_BOX);
|
---|
2502 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2503 | o->color((fltk::Color)0xe0dfe300);
|
---|
2504 | }
|
---|
2505 |
|
---|
2506 | {
|
---|
2507 | fltk::Widget* o;
|
---|
2508 | o = mVertices = new fltk::Widget(154, 4, 40, 15, "Vertices");
|
---|
2509 | o->box(fltk::NO_BOX);
|
---|
2510 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2511 | o->color((fltk::Color)0xe0dfe300);
|
---|
2512 | }
|
---|
2513 |
|
---|
2514 | {
|
---|
2515 | fltk::Widget* o;
|
---|
2516 | o = mTriangles = new fltk::Widget(254, 3, 40, 15, "Triangles");
|
---|
2517 | o->box(fltk::NO_BOX);
|
---|
2518 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2519 | o->color((fltk::Color)0xe0dfe300);
|
---|
2520 |
|
---|
2521 | // Hide triangle count.
|
---|
2522 | o->hide();
|
---|
2523 | }
|
---|
2524 |
|
---|
2525 | {
|
---|
2526 | fltk::Widget* o;
|
---|
2527 | o = mStrips = new fltk::Widget(354, 3, 30, 15, "Strips");
|
---|
2528 | o->box(fltk::NO_BOX);
|
---|
2529 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2530 | o->color((fltk::Color)0xe0dfe300);
|
---|
2531 | }
|
---|
2532 |
|
---|
2533 | //{
|
---|
2534 | // fltk::Widget* o;
|
---|
2535 | // o = mQuads = new fltk::Widget(454, 4, 40, 15, "Quads");
|
---|
2536 | // o->box(fltk::NO_BOX);
|
---|
2537 | // o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2538 | // o->color((fltk::Color)0xe0dfe300);
|
---|
2539 | //}
|
---|
2540 |
|
---|
2541 | {
|
---|
2542 | fltk::Widget* o;
|
---|
2543 | o = mMB = new fltk::Widget(740, 3, 30, 15, "MB");
|
---|
2544 | o->box(fltk::NO_BOX);
|
---|
2545 | o->labelfont(fltk::HELVETICA_BOLD);
|
---|
2546 | o->color((fltk::Color)0xe0dfe300);
|
---|
2547 | }
|
---|
2548 | o->end();
|
---|
2549 | }
|
---|
2550 |
|
---|
2551 |
|
---|
2552 | o->end();
|
---|
2553 | }
|
---|
2554 |
|
---|
2555 | fltk::focus(geoMeshView);
|
---|
2556 |
|
---|
2557 |
|
---|
2558 | /*Hide Right Panel*/
|
---|
2559 | hideRightPanel();
|
---|
2560 |
|
---|
2561 | mMainWindow->show();
|
---|
2562 | }
|
---|
2563 |
|
---|
2564 | /****************/
|
---|
2565 | /* Destroyer */
|
---|
2566 | /****************/
|
---|
2567 | GeoMeshViewUI::~GeoMeshViewUI()
|
---|
2568 | {
|
---|
2569 | delete geoMeshLoader;
|
---|
2570 | mMainWindow->destroy();
|
---|
2571 | }
|
---|
2572 |
|
---|
2573 | // Shows the main window.
|
---|
2574 | void GeoMeshViewUI::show()
|
---|
2575 | {
|
---|
2576 | }
|
---|
2577 |
|
---|