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