1 | // generated by Fast Light User Interface Designer (fluid) version 2.0100
|
---|
2 | #ifndef GeoMeshViewUI_h
|
---|
3 | #define GeoMeshViewUI_h
|
---|
4 | #include <stdio.h>
|
---|
5 | #include <stdlib.h>
|
---|
6 | #include <string.h>
|
---|
7 | #include <fltk/run.h>
|
---|
8 | #include <fltk/Group.h>
|
---|
9 | #include <fltk/Window.h>
|
---|
10 | #include <fltk/ask.h>
|
---|
11 | #include <fltk/file_chooser.h>
|
---|
12 | #include <fltk/FileChooser.h>
|
---|
13 | #include <fltk/MenuBar.h>
|
---|
14 | #include <fltk/Input.h>
|
---|
15 | #include <fltk/Button.h>
|
---|
16 | #include <fltk/ReturnButton.h>
|
---|
17 | #include <fltk/TextBuffer.h>
|
---|
18 | #include <fltk/TextEditor.h>
|
---|
19 | #include <fltk/Input.h>
|
---|
20 | #include <fltk/events.h>
|
---|
21 | #include <fltk/InvisibleBox.h>
|
---|
22 | #include <fltk/ItemGroup.h>
|
---|
23 | #include <fltk/Item.h>
|
---|
24 | #include <fltk/Divider.h>
|
---|
25 | #include <fltk/Output.h>
|
---|
26 | #include <fltk/Button.h>
|
---|
27 | #include <fltk/ProgressBar.h>
|
---|
28 | #include <fltk/CheckButton.h>
|
---|
29 | #include <fltk/RadioButton.h>
|
---|
30 | #include <fltk/FloatInput.h>
|
---|
31 | #include <fltk/Browser.h>
|
---|
32 | #include <fltk/Image.h>
|
---|
33 | #include <fltk/SharedImage.h>
|
---|
34 | #include <fltk/Slider.h>
|
---|
35 | #include <GeoMesh.h>
|
---|
36 | #include <GeoLodStripsLibrary.h>
|
---|
37 | #include <GeoMeshView.h>
|
---|
38 | #include <GeoMeshSaver.h>
|
---|
39 | #include <GeoMeshStripifier.h>
|
---|
40 | #include <GeoMeshSimplifier.h>
|
---|
41 | #include <GeoTreeSimplifier.h>
|
---|
42 | #include "GeoTreeSimpSequence.h"
|
---|
43 | #include "GeoLodStripsConstructor.h"
|
---|
44 | #include "GeoLodTreeLibrary.h"
|
---|
45 |
|
---|
46 | // About Dialog.
|
---|
47 | #include "GTAboutDialog.h"
|
---|
48 | #include "../resource.h"
|
---|
49 |
|
---|
50 | // State of the button process.
|
---|
51 | enum ProcessState
|
---|
52 | {
|
---|
53 | NONE,
|
---|
54 | STRIPIFY,
|
---|
55 | EDGE_COLLAPSE,
|
---|
56 | LEAVES_COLLAPSE,
|
---|
57 | LODSTRIPS,
|
---|
58 | LODSTRIPS_AUTO,
|
---|
59 | LODTREES,
|
---|
60 | SELECT_LEAVES,
|
---|
61 | VISUALIZE_LODSTRIPS,
|
---|
62 | VISUALIZE_LODTREES
|
---|
63 | };
|
---|
64 |
|
---|
65 | // Simplification types
|
---|
66 | enum SimplificationType
|
---|
67 | {
|
---|
68 | QSLIM,
|
---|
69 | HOJAS
|
---|
70 | };
|
---|
71 |
|
---|
72 | enum ProgressBarType
|
---|
73 | {
|
---|
74 | PROCESS,
|
---|
75 | BUILD
|
---|
76 | };
|
---|
77 |
|
---|
78 | using namespace Geometry;
|
---|
79 |
|
---|
80 | class GeoMeshViewUI
|
---|
81 | {
|
---|
82 | friend class GeoMeshView;
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | // File name Selected.
|
---|
87 | char *mFileName;
|
---|
88 |
|
---|
89 | // The state of the application menus.
|
---|
90 | ProcessState mApplicationState;
|
---|
91 |
|
---|
92 | // Mesh object(Model).
|
---|
93 | Mesh *mGeoMesh;
|
---|
94 |
|
---|
95 | // Mesh for undo operation.
|
---|
96 | Mesh *mUndoMesh;
|
---|
97 |
|
---|
98 | // Lod strips object.
|
---|
99 | LodStripsLibrary *lodStripsLib;
|
---|
100 | // Lod tree object.
|
---|
101 | LodTreeLibrary *lodTreeLib;
|
---|
102 |
|
---|
103 | // Mesh Bounds.
|
---|
104 | GeometryBounds mMeshBounds;
|
---|
105 |
|
---|
106 | MeshSimplifier *mMeshSimplifier;
|
---|
107 | TreeSimplifier *mTreeSimplifier;
|
---|
108 | char *nombremesh;
|
---|
109 | SimplificationType simplificacionState;
|
---|
110 | ProgressBarType progressBarType;
|
---|
111 |
|
---|
112 | MeshSimplificationSequence *oMeshSimpSequence;
|
---|
113 | LodStripsConstructor *oLodStrip;
|
---|
114 | GeoMeshLoader *geoMeshLoader;
|
---|
115 |
|
---|
116 | inline void cb_menuFileOpen_i(fltk::Item*, void*);
|
---|
117 | static void cb_menuFileOpen(fltk::Item*, void*);
|
---|
118 | inline void cb_menuFileSave_i(fltk::Item*, void*);
|
---|
119 | static void cb_menuFileSave(fltk::Item*, void*);
|
---|
120 | inline void cb_menuOpenSaveAs_i(fltk::Item*, void*);
|
---|
121 | static void cb_menuOpenSaveAs(fltk::Item*, void*);
|
---|
122 |
|
---|
123 | inline void cb_menuMeshInfo_i(fltk::Item*, void*);
|
---|
124 | static void cb_menuMeshInfo(fltk::Item*, void*);
|
---|
125 | inline void cb_menuMeshExportOBJ_i(fltk::Item*, void*);
|
---|
126 | static void cb_menuMeshExportOBJ(fltk::Item*, void*);
|
---|
127 | inline void cb_menuTransformSharedVertex_i(fltk::Item*, void*);
|
---|
128 | static void cb_menuFileTransformSharedVertex(fltk::Item* o, void* v);
|
---|
129 |
|
---|
130 | inline void cb_menuOpenQuit_i(fltk::Item*, void*);
|
---|
131 | static void cb_menuOpenQuit(fltk::Item*, void*);
|
---|
132 | inline void cb_menuEditUndo_i(fltk::Item*, void*);
|
---|
133 | static void cb_menuEditUndo(fltk::Item*, void*);
|
---|
134 | inline void cb_menuEditFit_i(fltk::Item*, void*);
|
---|
135 | static void cb_menuEditFit(fltk::Item*, void*);
|
---|
136 | inline void cb_menuEditRotate_i(fltk::Item*, void*);
|
---|
137 | static void cb_menuEditRotate(fltk::Item*, void*);
|
---|
138 | inline void cb_menuEditPan_i(fltk::Item*, void*);
|
---|
139 | static void cb_menuEditPan(fltk::Item*, void*);
|
---|
140 | inline void cb_menuEditZoom_i(fltk::Item*, void*);
|
---|
141 | static void cb_menuEditZoom(fltk::Item*, void*);
|
---|
142 | inline void cb_menuRenderWire_i(fltk::Item*, void*);
|
---|
143 | static void cb_menuRenderWire(fltk::Item*, void*);
|
---|
144 | inline void cb_menuRenderSolid_i(fltk::Item*, void*);
|
---|
145 | static void cb_menuRenderSolid(fltk::Item*, void*);
|
---|
146 | inline void cb_menuRenderCW_i(fltk::Item*, void*);
|
---|
147 | static void cb_menuRenderCW(fltk::Item*, void*);
|
---|
148 | inline void cb_menuRenderCCW_i(fltk::Item*, void*);
|
---|
149 | static void cb_menuRenderCCW(fltk::Item*, void*);
|
---|
150 | inline void cb_menuRenderFlat_i(fltk::Item*, void*);
|
---|
151 | static void cb_menuRenderFlat(fltk::Item*, void*);
|
---|
152 | inline void cb_menuRenderSmooth_i(fltk::Item*, void*);
|
---|
153 | static void cb_menuRenderSmooth(fltk::Item*, void*);
|
---|
154 | inline void cb_menuRenderTextures_i(fltk::Item*, void*);
|
---|
155 | static void cb_menuRenderTextures(fltk::Item*, void*);
|
---|
156 | inline void cb_menuStripify_i(fltk::Item*, void*);
|
---|
157 | static void cb_menuStripify(fltk::Item*, void*);
|
---|
158 | inline void cb_menuSimplify_i(fltk::ItemGroup*, void*);
|
---|
159 | static void cb_menuSimplify(fltk::ItemGroup*, void*);
|
---|
160 | inline void cb_menuSimplifyEdgeCollapse_i(fltk::Item*, void*);
|
---|
161 | static void cb_menuSimplifyEdgeCollapse(fltk::Item*, void*);
|
---|
162 | inline void cb_menuSimplifyLeavesCollapse_i(fltk::Item*, void*);
|
---|
163 | static void cb_menuSimplifyLeavesCollapse(fltk::Item*, void*);
|
---|
164 |
|
---|
165 | inline void cb_menuLodStripsGenerate_i(fltk::Item*, void*);
|
---|
166 | static void cb_menuLodStripsGenerate(fltk::Item*, void*);
|
---|
167 | inline void cb_menuLodStripsVisualize_i(fltk::Item*, void*);
|
---|
168 | static void cb_menuLodStripsVisualize(fltk::Item*, void*);
|
---|
169 |
|
---|
170 | inline void cb_menuSelectLeaves_i(fltk::Item*, void*);
|
---|
171 | static void cb_menuSelectLeaves(fltk::Item*, void*);
|
---|
172 | inline void cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*);
|
---|
173 | static void cb_menuLodTreesOpenLodStripTrunk(fltk::Item*, void*);
|
---|
174 | inline void cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*);
|
---|
175 | static void cb_menuLodTreesOpenLeavesSimplification(fltk::Item*, void*);
|
---|
176 | inline void cb_menuLodTreesVisualize_i(fltk::Item*, void*);
|
---|
177 | static void cb_menuLodTreesVisualize(fltk::Item*, void*);
|
---|
178 | inline void cb_menuHelpAbout_i(fltk::Item*, void*);
|
---|
179 | static void cb_menuHelpAbout(fltk::Item*, void*);
|
---|
180 |
|
---|
181 | inline void cb_mButtonProcess_i(fltk::Button*, void*);
|
---|
182 | static void cb_mButtonProcess(fltk::Button*, void*);
|
---|
183 | inline void cb_mButtonSort_i(fltk::Button*, void*);
|
---|
184 | static void cb_mButtonSort(fltk::Button*, void*);
|
---|
185 | inline void cb_mButtonBuild_i(fltk::Button*, void*);
|
---|
186 | static void cb_mButtonBuild(fltk::Button*, void*);
|
---|
187 | inline void cb_mMeshInfo_i(fltk::Browser*, void*);
|
---|
188 | static void cb_mMeshInfo(fltk::Browser*, void*);
|
---|
189 | inline void cb_mLodSlider_i(fltk::Slider*, void*);
|
---|
190 | static void cb_mLodSlider(fltk::Slider*, void*);
|
---|
191 |
|
---|
192 | // Logo's callback.
|
---|
193 | inline void cb_mLogo_i(fltk::InvisibleBox*, void*);
|
---|
194 | static void cb_mLogo(fltk::InvisibleBox*, void*);
|
---|
195 |
|
---|
196 | // Shows the stripify panel.
|
---|
197 | void showStripify();
|
---|
198 |
|
---|
199 | // Shows the simplify panels.
|
---|
200 | void showEdgeCollapse();
|
---|
201 | void showLeavesCollapse();
|
---|
202 |
|
---|
203 | // Shows the LodStrips panels.
|
---|
204 | void showOpenMeshSimplification();
|
---|
205 | void showAutoGenerateLodStrips();
|
---|
206 |
|
---|
207 | // Shows the LodTrees panel.
|
---|
208 | void showOpenLeavesSimplification();
|
---|
209 |
|
---|
210 | // Show the mesh info browser.
|
---|
211 | void showMeshInfo();
|
---|
212 |
|
---|
213 | // Show the LodStrips visulization panel.
|
---|
214 | void showSlider();
|
---|
215 |
|
---|
216 | void hideStripify();
|
---|
217 | void hideEdgeCollapse();
|
---|
218 | void hideLeavesCollapse();
|
---|
219 | void hideOpenMeshSimplification();
|
---|
220 | void hideOpenLeavesSimplification();
|
---|
221 | void hideRightPanel();
|
---|
222 | // Hide the mesh info browser.
|
---|
223 | void hideMeshInfo();
|
---|
224 |
|
---|
225 | // Hide the LodStrips visualization panel.
|
---|
226 | void hideSlider();
|
---|
227 |
|
---|
228 | // Get the number of vertices.
|
---|
229 | size_t getVertexCount(Mesh *geoMesh);
|
---|
230 |
|
---|
231 | // Get the number of triangles.
|
---|
232 | size_t getTriangleCount(Mesh *geoMesh);
|
---|
233 |
|
---|
234 | // Get the number of strips.
|
---|
235 | size_t getStripCount(Mesh *geoMesh);
|
---|
236 |
|
---|
237 | int paintMesh();
|
---|
238 |
|
---|
239 | // Simplify the mesh object.
|
---|
240 | void simplifyEdgeCollapse();
|
---|
241 |
|
---|
242 | // Simplify the mesh object.
|
---|
243 | void simplifyLeavesCollapse();
|
---|
244 |
|
---|
245 | // Create a siplification sequence of the QSLIM sequence.
|
---|
246 | void createQslimSequence();
|
---|
247 |
|
---|
248 | // Create a siplification sequence of the leaves.
|
---|
249 | void createLeavesSequence();
|
---|
250 |
|
---|
251 | // Stripify the mesh object.
|
---|
252 | void stripify();
|
---|
253 |
|
---|
254 | // Method that undo then mesh changes.
|
---|
255 | void undo();
|
---|
256 |
|
---|
257 | // Refresh number of vertices, triangles, strips, ...
|
---|
258 | void refreshApplicationBar();
|
---|
259 |
|
---|
260 | // Open a mesh file.
|
---|
261 | void openMeshFile();
|
---|
262 |
|
---|
263 | public:
|
---|
264 |
|
---|
265 | GeoMeshView *geoMeshView;
|
---|
266 | fltk::Window *mMainWindow;
|
---|
267 | fltk::Group *MainView;
|
---|
268 | fltk::InvisibleBox *cframe;
|
---|
269 | fltk::MenuBar *menuBar;
|
---|
270 | fltk::ItemGroup *menuFile;
|
---|
271 | fltk::Item *menuFileOpen;
|
---|
272 | fltk::Item *menuFileSave;
|
---|
273 | fltk::Item *menuOpenSaveAs;
|
---|
274 | fltk::Item *menuMeshInfo;
|
---|
275 | fltk::Item *menuMeshExportOBJ;
|
---|
276 | fltk::Item *menuFileTransformSharedVertex;
|
---|
277 |
|
---|
278 | fltk::Item *menuOpenQuit;
|
---|
279 | fltk::ItemGroup *menuEdit;
|
---|
280 | fltk::Item *menuEditUndo;
|
---|
281 | fltk::Item *menuEditFit;
|
---|
282 | fltk::Item *menuEditRotate;
|
---|
283 | fltk::Item *menuEditPan;
|
---|
284 | fltk::Item *menuEditZoom;
|
---|
285 | fltk::ItemGroup *menuRender;
|
---|
286 | fltk::Item *menuRenderWire;
|
---|
287 | fltk::Item *menuRenderSolid;
|
---|
288 | fltk::Item *menuRenderCW;
|
---|
289 | fltk::Item *menuRenderCCW;
|
---|
290 | fltk::Item *menuRenderFlat;
|
---|
291 | fltk::Item *menuRenderSmooth;
|
---|
292 | fltk::Item *menuRenderTextures;
|
---|
293 | fltk::Item *menuStripify;
|
---|
294 | fltk::ItemGroup *menuSimplify;
|
---|
295 | fltk::Item *menuSimplifyEdgeCollapse;
|
---|
296 | fltk::Item *menuSimplifyLeavesCollapse;
|
---|
297 | fltk::Item *menuSimplifySaveSequence;
|
---|
298 |
|
---|
299 | fltk::ItemGroup *menuLodStrips;
|
---|
300 | fltk::Item *menuLodStripsGenerate;
|
---|
301 | fltk::Item *menuLodStripsVisualize;
|
---|
302 | fltk::ItemGroup *menuLodTrees;
|
---|
303 | fltk::Item *menuLodTreesVisualize;
|
---|
304 |
|
---|
305 | fltk::Item *menuSelectLeaves;
|
---|
306 | fltk::Item *menuLodTreesOpenLodStripTrunk;
|
---|
307 | fltk::Item *menuLodTreesOpenLeavesSimplification;
|
---|
308 | fltk::Item *menuHelpAbout;
|
---|
309 | fltk::InvisibleBox *mLogo;
|
---|
310 | fltk::Group *ApplicationBar;
|
---|
311 | fltk::Widget *mFPS;
|
---|
312 | fltk::Widget *mVertices;
|
---|
313 | fltk::Widget *mTriangles;
|
---|
314 | fltk::Widget *mStrips;
|
---|
315 | fltk::Widget *mQuads;
|
---|
316 | fltk::Widget *mMB;
|
---|
317 | fltk::Button *mButtonProcess;
|
---|
318 | fltk::ProgressBar *mProcessBar;
|
---|
319 | fltk::Button *mButtonSort;
|
---|
320 | fltk::ProgressBar *mSortBar;
|
---|
321 | fltk::Button *mButtonBuild;
|
---|
322 | fltk::ProgressBar *mBuildBar;
|
---|
323 | fltk::Slider *mLodSlider;
|
---|
324 | fltk::CheckButton *mGeometryBased;
|
---|
325 | fltk::CheckButton *mImageBased;
|
---|
326 | fltk::CheckButton *mChangeVertices;
|
---|
327 | fltk::CheckButton *mChangeTexture;
|
---|
328 | fltk::CheckButton *mPercent;
|
---|
329 | fltk::CheckButton *mVerticesNumber;
|
---|
330 | fltk::CheckButton *mOneCacheStrip;
|
---|
331 | fltk::CheckButton *mQualityStrips;
|
---|
332 | fltk::FloatInput *mMeshReduction;
|
---|
333 | fltk::Widget *mProcessTitle;
|
---|
334 | fltk::Output *mMetricLabel;
|
---|
335 | fltk::Output *mTypeLabel;
|
---|
336 | fltk::Output *mMeshReductionLabel;
|
---|
337 | fltk::Browser *mMeshInfo;
|
---|
338 | fltk::ItemGroup *ogeometry;
|
---|
339 |
|
---|
340 | // Repaint the FPS label.
|
---|
341 | void refreshFPS(int fps);
|
---|
342 |
|
---|
343 | // Initialize the lodstripslibrary for visualization.
|
---|
344 | void setLodStripsLibrary(std::string lodfile, Mesh *geomesh);
|
---|
345 | // Initialize the lodtreelibrary for visualization.
|
---|
346 | void setLodTreesLibrary(std::string lodfile, Mesh *geomesh);
|
---|
347 |
|
---|
348 | // 26-12-2005
|
---|
349 | // Indentify the mesh of leaves.
|
---|
350 | unsigned short idMeshLeaves;
|
---|
351 |
|
---|
352 | GeoMeshViewUI(TIPOFUNC fun=NULL);
|
---|
353 | ~GeoMeshViewUI();
|
---|
354 | void show();
|
---|
355 |
|
---|
356 | TIPOFUNC progress_function;
|
---|
357 | float updateProgressBar(float);
|
---|
358 |
|
---|
359 | };
|
---|
360 |
|
---|
361 | #endif
|
---|
362 |
|
---|