// generated by Fast Light User Interface Designer (fluid) version 2.0100 #include "GeoMeshViewUI.h" #include "resource.h" using namespace Geometry; using namespace std; //--------------------------------------------------------------------------- // Menu File Open Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuFileOpen_i(fltk::Item*, void*) { // Sets menus application state to NONE. mApplicationState = NONE; // Loads a mesh file. openMeshFile(); // Debug. cout << "Vertex Count SubMesh 0: " << mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount << endl; //---------------------------------------------------------- // Deactive Lod strip visualization. geoMeshView->deactiveLodStrip(); // Repaint the window. mMainWindow->redraw(); } //--------------------------------------------------------------------------- // Repaint the FPS label. //--------------------------------------------------------------------------- void GeoMeshViewUI::refreshFPS(int fps) { static char char_value[10]; // Translate the FPS count to a char value. sprintf(char_value,"FPS %d",fps); mFPS->label(char_value); // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuFileOpen(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuFileOpen_i(o,v); } //--------------------------------------------------------------------------- // Save callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuFileSave_i(fltk::Item*, void*) { GeoMeshSaver *mesh_saver; // If there is a mesh object created. if (mGeoMesh != NULL) { // Create a mesh saver with mesh bounds. mesh_saver = new GeoMeshSaver(mMeshBounds); // Save the file mesh. mesh_saver->save( mGeoMesh, mFileName); // Free memory. delete mesh_saver; } } void GeoMeshViewUI::cb_menuFileSave(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuFileSave_i(o,v); } //--------------------------------------------------------------------------- // Save As Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuOpenSaveAs_i(fltk::Item*, void*) { fltk::FileChooser *fcho; GeoMeshSaver *mesh_saver; if (mGeoMesh != NULL) { fcho = new fltk::FileChooser("", "*.mesh", fltk::FileChooser::CREATE, "Save Mesh as"); fcho->exec(); if (fcho->value()) { mesh_saver = new GeoMeshSaver(mMeshBounds); mesh_saver->save( mGeoMesh, filename_name(fcho->value())); delete mesh_saver; } // Repaint the window. mMainWindow->redraw(); delete fcho; } } void GeoMeshViewUI::cb_menuOpenSaveAs(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuOpenSaveAs_i(o,v); } //--------------------------------------------------------------------------- // Mesh info callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuMeshInfo_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Mesh Info"); showMeshInfo(); mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuMeshInfo(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuMeshInfo_i(o,v); } //--------------------------------------------------------------------------- // Mesh Export to OBJ callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuMeshExportOBJ_i(fltk::Item*, void*) { char *p; // Sets menus application state to NONE. mApplicationState = NONE; // Open file chooser dialog. p = fltk::file_chooser( "Export to OBJ", "*.obj", ""); if (p && mGeoMesh) { mGeoMesh->exportToOBJ(p); } } void GeoMeshViewUI::cb_menuMeshExportOBJ(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuMeshExportOBJ_i(o,v); } //--------------------------------------------------------------------------- // Transform to Shared Vertex callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item*, void*) { Mesh *mesh_aux; // if the undo mesh is not initialized. if (mGeoMesh != NULL) { // Deletes the actual mesh. delete mUndoMesh; mUndoMesh = new Mesh(); // Restore the previous mesh. *mUndoMesh = *mGeoMesh; // Transform NoSV Mesh to a SV Mesh. mesh_aux = mGeoMesh->toSharedVertex(); // Deletes the mesh No Shared Vertex. delete mGeoMesh; // Gets the mesh Shared Vertex. mGeoMesh = mesh_aux; // Visualize the mesh stripified. geoMeshView->setMesh(mGeoMesh); // Refresh mesh information. showMeshInfo(); // Repaint the window. mMainWindow->redraw(); } } void GeoMeshViewUI::cb_menuFileTransformSharedVertex(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuTransformSharedVertex_i(o,v); } //--------------------------------------------------------------------------- // Quit Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuOpenQuit_i(fltk::Item*, void*) { delete this; } void GeoMeshViewUI::cb_menuOpenQuit(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuOpenQuit_i(o,v); } //--------------------------------------------------------------------------- // Undo Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuEditUndo_i(fltk::Item*, void*) { // Undo the mesh changes. undo(); } void GeoMeshViewUI::cb_menuEditUndo(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuEditUndo_i(o,v); } //--------------------------------------------------------------------------- // Fit Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuEditFit_i(fltk::Item*, void*) { geoMeshView->fit(); mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuEditFit(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuEditFit_i(o,v); } //--------------------------------------------------------------------------- // Rotate Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuEditRotate_i(fltk::Item *item, void*) { // If the item is activated. if (item->value()) { menuEditPan->clear_value(); geoMeshView->deactivePan(); geoMeshView->activeRotate(); } else { menuEditPan->set_value(); geoMeshView->activePan(); geoMeshView->deactiveRotate(); } // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuEditRotate(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuEditRotate_i(o,v); } //--------------------------------------------------------------------------- // Pan Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuEditPan_i(fltk::Item *item, void*) { // If the item is activated. if (item->value()) { geoMeshView->activePan(); menuEditRotate->clear_value(); geoMeshView->deactiveRotate(); } else { geoMeshView->deactivePan(); menuEditRotate->set_value(); geoMeshView->activeRotate(); } // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuEditPan(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuEditPan_i(o,v); } //--------------------------------------------------------------------------- // Zoom Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuEditZoom_i(fltk::Item*, void*) { } void GeoMeshViewUI::cb_menuEditZoom(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuEditZoom_i(o,v); } //--------------------------------------------------------------------------- // Wire Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderWire_i(fltk::Item *item, void*) { if (item->value()) { geoMeshView->activeWire(); } else { geoMeshView->deactiveWire(); } // Repaint the canvas. //geoMeshView->redraw(); // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderWire(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderWire_i(o,v); } //--------------------------------------------------------------------------- // Solid Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderSolid_i(fltk::Item *item, void*) { if (item->value()) { geoMeshView->activeSolid(); } else { geoMeshView->deactiveSolid(); } // Repaint the canvas. //geoMeshView->redraw(); // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderSolid(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderSolid_i(o,v); } //--------------------------------------------------------------------------- // CW callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderCW_i(fltk::Item *item, void*) { // Clear the CCW state. menuRenderCCW->clear_value(); geoMeshView->deactiveCCW(); // If the item is activated. if (item->value()) { geoMeshView->activeCW(); } else { geoMeshView->deactiveCW(); } // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderCW(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderCW_i(o,v); } //--------------------------------------------------------------------------- // CCW callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderCCW_i(fltk::Item *item, void*) { // Clear the CW state. menuRenderCW->clear_value(); geoMeshView->deactiveCW(); // If the item is activated. if (item->value()) { geoMeshView->activeCCW(); } else { geoMeshView->deactiveCCW(); } // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderCCW(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderCCW_i(o,v); } //--------------------------------------------------------------------------- // Flat callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderFlat_i(fltk::Item*, void*) { // Deactive smooth flag. menuRenderSmooth->clear_value(); // Sets flat lighting. geoMeshView->flat(); // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderFlat(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderFlat_i(o,v); } //--------------------------------------------------------------------------- // Smooth Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderSmooth_i(fltk::Item*, void*) { // Deactive flat flag. menuRenderFlat->clear_value(); // Sets smooth lighting. geoMeshView->smooth(); // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderSmooth(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderSmooth_i(o,v); } //--------------------------------------------------------------------------- // Textures callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuRenderTextures_i(fltk::Item*, void*) { // Repaint the main window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuRenderTextures(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuRenderTextures_i(o,v); } //--------------------------------------------------------------------------- // Stripify Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuStripify_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Stripify"); mProcessBar->position(0); // Hide the right panel. hideRightPanel(); // Show the stripify panel. showStripify(); // Sets menus application state to STRIPIFY. mApplicationState = STRIPIFY; // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuStripify(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->user_data())) -> cb_menuStripify_i(o,v); } //--------------------------------------------------------------------------- // Simplify Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuSimplify_i(fltk::ItemGroup*, void*) { } void GeoMeshViewUI::cb_menuSimplify(fltk::ItemGroup* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->user_data())) -> cb_menuSimplify_i(o,v); } //--------------------------------------------------------------------------- // Edge collapse Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Mesh Simplification"); mProcessBar->position(0); // Hide the right panel. hideRightPanel(); // Show the edge collapse panel. showEdgeCollapse(); // Sets menus application state to EDGE_COLLAPSE. mApplicationState = EDGE_COLLAPSE; // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuSimplifyEdgeCollapse(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuSimplifyEdgeCollapse_i(o,v); } //--------------------------------------------------------------------------- // Leaves collapse Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Leaves Simplification"); mProcessBar->position(0); // Hide the right panel. hideRightPanel(); // Show the leaves collapse panel. showLeavesCollapse(); // Sets menus application state to LEAVES_COLLAPSE. mApplicationState = LEAVES_COLLAPSE; // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuSimplifyLeavesCollapse(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuSimplifyLeavesCollapse_i(o,v); } //--------------------------------------------------------------------------- // Tree select leaves simplification Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuSelectLeaves_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Select Leaves"); showMeshInfo(); mButtonProcess->show(); mButtonProcess->activate(); mApplicationState = SELECT_LEAVES; } void GeoMeshViewUI::cb_menuSelectLeaves(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuSelectLeaves_i(o,v); } //--------------------------------------------------------------------------- // Auto Generate LodStrips Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuLodStripsGenerate_i(fltk::Item*, void*) { // Show title. mProcessTitle->label("Generate LodStrips"); mProcessBar->position(0); mBuildBar->position(0); // Hide the right panel. hideRightPanel(); // Show the LodStrips panel. showAutoGenerateLodStrips(); // Sets menus application state to LODSTRIPS_AUTO. mApplicationState = LODSTRIPS_AUTO; // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuLodStripsGenerate(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuLodStripsGenerate_i(o,v); } //--------------------------------------------------------------------------- // Visualize LodStrips Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuLodStripsVisualize_i(fltk::Item*, void*) { fltk::FileChooser *fcho; const char *lod_file; // Sets menus application state to NONE. mApplicationState = NONE; // Deactive Lod strip visualization. geoMeshView->deactiveLodStrip(); // Loads a mesh file. openMeshFile(); // Show title. mProcessTitle->label("Visualize LodStrips"); // If an object is loaded. if (mGeoMesh != NULL) { fcho = new fltk::FileChooser("", "*.lod", fltk::FileChooser::CREATE, "Open Lod file"); fcho->exec(); // If a file was selected. if (fcho->value()) { // Build lod strips library. setLodStripsLibrary(string(fcho->value()), mGeoMesh); // Sets the aplication mode. mApplicationState = VISUALIZE_LODSTRIPS; } // Free memory. delete fcho; } // Hide the right panel. hideRightPanel(); // Show the Visulize LodStrips panel. showVisualizeLodStrips(); // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuLodStripsVisualize(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuLodStripsVisualize_i(o,v); } //--------------------------------------------------------------------------- // Open LodStrip trunk Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk_i(fltk::Item*, void*) { } void GeoMeshViewUI::cb_menuLodTreesOpenLodStripTrunk(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuLodTreesOpenLodStripTrunk_i(o,v); } //--------------------------------------------------------------------------- // Open leaves simplification Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification_i(fltk::Item*, void*) { // Hide the right panel. hideRightPanel(); // Show the LodTrees panel. showOpenLeavesSimplification(); // Sets menus application state to LODTREES. mApplicationState = LODTREES; // Repaint the window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_menuLodTreesOpenLeavesSimplification(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuLodTreesOpenLeavesSimplification_i(o,v); } //--------------------------------------------------------------------------- // About Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_menuHelpAbout_i(fltk::Item*, void*) { new GTAboutDialog(); } void GeoMeshViewUI::cb_menuHelpAbout(fltk::Item* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_menuHelpAbout_i(o,v); } //--------------------------------------------------------------------------- // Button Process Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mButtonProcess_i(fltk::Button*, void*) { Mesh *mesh_aux; // Sets the progress bar to process bar. progressBarType = PROCESS; mProcessBar->position(0); // If there is a mesh object. if (mGeoMesh != NULL) { // Choose between aplication state. switch(mApplicationState) { // Stripify state. case STRIPIFY: // Stripify the mesh object. stripify(); break; // Simplify edge collapse state. case EDGE_COLLAPSE: // if the mesh is stripified. if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS) { fltk::alert("Can't simplify a mesh in triagle strips."); } else { // Simplify the mesh object. simplifyEdgeCollapse(); } break; // Simplify leaves case LEAVES_COLLAPSE: // Simplify the mesh object. simplifyLeavesCollapse(); break; // Simplify and generate simplification sequence. case LODSTRIPS_AUTO: // if the mesh is stripified. if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS) { fltk::alert("Can't simplify a mesh in triagle strips."); } else { // Transform NoSV Mesh to a SV Mesh. mesh_aux = mGeoMesh->toSharedVertex(); // Deletes the mesh No Shared Vertex. delete mGeoMesh; // Gets the mesh Shared Vertex. mGeoMesh = mesh_aux; // Simplify the mesh object. simplifyEdgeCollapse(); // Create the qslim simplification sequence. createQslimSequence(); } break; // Añadido 23-12-2005 case SELECT_LEAVES: idMeshLeaves = paintMesh(); // Set the leaves submesh. geoMeshView->setLeavesSubmesh(idMeshLeaves); // Refresh mesh info. showMeshInfo(); break; } // Refresh geometry attributes. refreshApplicationBar(); } // Repaint the GL Window. mMainWindow->redraw(); } void GeoMeshViewUI::cb_mButtonProcess(fltk::Button* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_mButtonProcess_i(o,v); } //--------------------------------------------------------------------------- // Button Sort Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mButtonSort_i(fltk::Button*, void*) { } void GeoMeshViewUI::cb_mButtonSort(fltk::Button* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_mButtonSort_i(o,v); } //--------------------------------------------------------------------------- // Button Build Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*) { char *file_name; GeoMeshSaver *mesh_saver; Serializer *oSerializer; // Sets the progress bar to process bar. progressBarType = BUILD; // Reset the build bar. mBuildBar->position(0); // If there is a mesh object. if (mGeoMesh != NULL) { // Choose between aplication state. switch(mApplicationState) { // Build the LOD file. case LODSTRIPS_AUTO: // Builder // Open file chooser dialog. file_name = fltk::file_chooser( "Build LOD", "*", ""); // If a file was selected. if (file_name) { // Undo the simplification changes. undo(); // Stripify the mesh object. stripify(); // Reset the build bar. mBuildBar->position(0); // Simplification sequence. oMeshSimpSequence = new MeshSimplificationSequence(); // Loads a simplification sequence file. oMeshSimpSequence->Load(Serializer( "mqslimSequence.txt", Serializer::READ)); // If the simplification sequence and the mesh exist. if (oMeshSimpSequence && mGeoMesh) { oLodStrip = new LodStripsConstructor( mGeoMesh, oMeshSimpSequence, progress_function); oSerializer = new Serializer( strcat(file_name,".lod"), Serializer::Mode::WRITE); oLodStrip->LodStripsConstructor::Save(*oSerializer); // Close file. delete oSerializer; // Deletes the previous mesh. delete mUndoMesh; mUndoMesh = new Mesh(); // Sets the undo mesh. *mUndoMesh = *mGeoMesh; delete mGeoMesh; mGeoMesh = oLodStrip->GetMesh(); geoMeshView->setMesh(mGeoMesh); mesh_saver = new GeoMeshSaver(mMeshBounds); file_name[strlen(file_name) - 4] = '\0'; mesh_saver->save( mGeoMesh, strcat(file_name,".mesh")); delete mesh_saver; } else { // Error message. fltk::alert("There is no simplification sequence."); } // Deletes the siplification sequence object. delete oMeshSimpSequence; } break; } // Refresh data aplication. refreshApplicationBar(); } } void GeoMeshViewUI::cb_mButtonBuild(fltk::Button *o, void *v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_mButtonBuild_i(o,v); } //--------------------------------------------------------------------------- // Lod Slider Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mLodSlider_i(fltk::Slider *o, void *) { // Change the lod. geoMeshView->GoToLod((unsigned int)o->value()); // Refresh data aplication. refreshApplicationBar(); mMainWindow->flush(); } void GeoMeshViewUI::cb_mLodSlider(fltk::Slider *o, void *v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_mLodSlider_i(o,v); } //--------------------------------------------------------------------------- // Mesh Info Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mMeshInfo_i(fltk::Browser *, void *) { paintMesh(); } void GeoMeshViewUI::cb_mMeshInfo(fltk::Browser* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->parent()->user_data())) -> cb_mMeshInfo_i(o,v); } //--------------------------------------------------------------------------- // Logo Callback //--------------------------------------------------------------------------- inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) { } void GeoMeshViewUI::cb_mLogo(fltk::InvisibleBox* o, void* v) { ((GeoMeshViewUI*) (o->parent()->parent()->user_data())) -> cb_mLogo_i(o,v); } //--------------------------------------------------------------------------- // Show the stripify panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showStripify() { /* mTypeLabel->set_visible(); mTypeLabel->activate(); mOneCacheStrip->set_visible(); mOneCacheStrip->activate(); mQualityStrips->set_visible(); mQualityStrips->activate(); */ mButtonProcess->set_visible(); mButtonProcess->activate(); mProcessBar->set_visible(); mProcessBar->activate(); } //--------------------------------------------------------------------------- // Hide the stripify panel //--------------------------------------------------------------------------- void GeoMeshViewUI::hideStripify() { /* mTypeLabel->hide(); mTypeLabel->deactivate(); */ mOneCacheStrip->hide(); mOneCacheStrip->deactivate(); mQualityStrips->hide(); mQualityStrips->deactivate(); mButtonProcess->hide(); mButtonProcess->deactivate(); mProcessBar->hide(); mProcessBar->deactivate(); } //--------------------------------------------------------------------------- // Show the Simplify Edge Collapse panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showEdgeCollapse() { mMetricLabel->set_visible(); mMetricLabel->activate(); mGeometryBased->set_visible(); mGeometryBased->activate(); mGeometryBased->set(); mImageBased->set_visible(); mImageBased->activate(); /* mTypeLabel->set_visible(); mTypeLabel->activate(); mChangeVertices->set_visible(); mChangeVertices->activate(); */ mMeshReductionLabel->set_visible(); mMeshReductionLabel->activate(); mPercent->set_visible(); mPercent->activate(); mPercent->set(); mVerticesNumber->set_visible(); mVerticesNumber->activate(); mMeshReduction->set_visible(); // JGA // Allows floating point. mMeshReduction->type(fltk::FloatInput::FLOAT); mMeshReduction->activate(); mButtonProcess->set_visible(); mButtonProcess->activate(); mProcessBar->set_visible(); mProcessBar->activate(); } //--------------------------------------------------------------------------- // Hide the Simplify Edge Collapse //--------------------------------------------------------------------------- void GeoMeshViewUI::hideEdgeCollapse() { mMetricLabel->hide(); mMetricLabel->deactivate(); mGeometryBased->hide(); mGeometryBased->deactivate(); mImageBased->hide(); mImageBased->deactivate(); /* mTypeLabel->hide(); mTypeLabel->deactivate(); mChangeVertices->hide(); mChangeVertices->deactivate(); */ mMeshReductionLabel->hide(); mMeshReductionLabel->deactivate(); mPercent->hide(); mPercent->deactivate(); mVerticesNumber->hide(); mVerticesNumber->deactivate(); mMeshReduction->hide(); mMeshReduction->deactivate(); mButtonProcess->hide(); mButtonProcess->deactivate(); mProcessBar->hide(); mProcessBar->deactivate(); } //--------------------------------------------------------------------------- // Show the Simlify Leaves Collapse //--------------------------------------------------------------------------- void GeoMeshViewUI::showLeavesCollapse() { mMetricLabel->set_visible(); mMetricLabel->activate(); mGeometryBased->set_visible(); mGeometryBased->activate(); mGeometryBased->set(); mImageBased->set_visible(); mImageBased->activate(); /* mTypeLabel->set_visible(); mTypeLabel->activate(); mChangeTexture->set_visible(); mChangeTexture->activate(); */ mMeshReductionLabel->set_visible(); mMeshReductionLabel->activate(); mPercent->set_visible(); mPercent->activate(); mPercent->set(); mVerticesNumber->set_visible(); mVerticesNumber->activate(); mMeshReduction->set_visible(); mMeshReduction->type(fltk::FloatInput::FLOAT); mMeshReduction->activate(); mButtonProcess->set_visible(); mButtonProcess->activate(); mProcessBar->set_visible(); mProcessBar->activate(); } //--------------------------------------------------------------------------- // Hide the Simplify Leaves Collapse //--------------------------------------------------------------------------- void GeoMeshViewUI::hideLeavesCollapse() { mMetricLabel->hide(); mMetricLabel->deactivate(); mGeometryBased->hide(); mGeometryBased->deactivate(); mImageBased->hide(); mImageBased->deactivate(); /* mTypeLabel->hide(); mTypeLabel->deactivate(); mChangeTexture->hide(); mChangeTexture->deactivate(); */ mMeshReductionLabel->hide(); mMeshReductionLabel->deactivate(); mPercent->hide(); mPercent->deactivate(); mVerticesNumber->hide(); mVerticesNumber->deactivate(); mMeshReduction->hide(); mMeshReduction->deactivate(); mButtonProcess->hide(); mButtonProcess->deactivate(); mProcessBar->hide(); mProcessBar->deactivate(); } //--------------------------------------------------------------------------- // Show the LodStrips Panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showOpenMeshSimplification() { mButtonProcess->set_visible(); mButtonProcess->activate(); mProcessBar->set_visible(); mProcessBar->activate(); mButtonBuild->set_visible(); mButtonBuild->activate(); mBuildBar->set_visible(); mBuildBar->activate(); } //--------------------------------------------------------------------------- // Hide the LodStrips Panel //--------------------------------------------------------------------------- void GeoMeshViewUI::hideOpenMeshSimplification() { mButtonProcess->hide(); mButtonProcess->deactivate(); mProcessBar->hide(); mProcessBar->deactivate(); mButtonBuild->hide(); mButtonBuild->deactivate(); mBuildBar->hide(); mBuildBar->deactivate(); } //--------------------------------------------------------------------------- // Shows the auto generate LodStrips panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showAutoGenerateLodStrips() { // Shows the simplify panel. showEdgeCollapse(); mButtonBuild->set_visible(); mButtonBuild->activate(); mBuildBar->set_visible(); mBuildBar->activate(); } //--------------------------------------------------------------------------- // Show the LodStrips visulization panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showVisualizeLodStrips() { mLodSlider->set_visible(); mLodSlider->activate(); } //--------------------------------------------------------------------------- // Hide the LodStrips visualization panel //--------------------------------------------------------------------------- void GeoMeshViewUI::hideVisualizeLodStrips() { mLodSlider->hide(); mLodSlider->deactivate(); } //--------------------------------------------------------------------------- // Show the LodTrees Panel //--------------------------------------------------------------------------- void GeoMeshViewUI::showOpenLeavesSimplification() { mButtonBuild->set_visible(); mButtonBuild->activate(); mBuildBar->set_visible(); mBuildBar->activate(); } //--------------------------------------------------------------------------- // Hide the LodTrees Panel //--------------------------------------------------------------------------- void GeoMeshViewUI::hideOpenLeavesSimplification() { mButtonBuild->hide(); mButtonBuild->deactivate(); mBuildBar->hide(); mBuildBar->deactivate(); } //--------------------------------------------------------------------------- // Show the mesh info browser //--------------------------------------------------------------------------- void GeoMeshViewUI::showMeshInfo() { char type[10]; if (mGeoMesh) { // Remove previous mesh information this->mMeshInfo->remove_all(); ogeometry = new fltk::ItemGroup("Geometry"); ogeometry->begin(); fltk::ItemGroup **oprueba; oprueba=new fltk::ItemGroup*[mGeoMesh->mSubMeshCount]; for(int i=0; imSubMeshCount;i++) { char *cadena=new char[12]; if (geoMeshView->getLeavesSubmesh() >= 0) { if (geoMeshView->getLeavesSubmesh() == i) { strcpy(type,"(Leaves)"); } else { strcpy(type,"(Trunc)"); } } else { strcpy(type,""); } // Submesh identifier. sprintf(cadena,"SubMesh %d %s",i,type); oprueba[i] = new fltk::ItemGroup(cadena); oprueba[i]->begin(); fltk::Item *sharedGeometry; if (mGeoMesh->mSubMesh[i].mSharedVertexBuffer) { sharedGeometry = new fltk::Item("Shared Geometry: Yes"); } else { sharedGeometry = new fltk::Item("Shared Geometry: No"); } char *cadena2=new char[30]; sprintf(cadena2, "Number of indexes: %d",mGeoMesh->mSubMesh[i].mIndexCount); fltk::Item *numberIndex = new fltk::Item(cadena2); if (mGeoMesh->mType==Geometry::GEO_TRIANGLE_LIST) { fltk::Item *type = new fltk::Item("Triangle list"); } else { fltk::Item *type = new fltk::Item("Triangle strips"); } char *cadenavertex=new char[30]; sprintf(cadenavertex, "Number of vertices: %d",mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount); fltk::Item *numberVertex = new fltk::Item(cadenavertex); if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) { fltk::Item *normals = new fltk::Item("Normals: Yes"); } else { fltk::Item *normals = new fltk::Item("Normals: No"); } if (mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) { fltk::Item *textures = new fltk::Item("Textures: Yes"); } else { fltk::Item *textures = new fltk::Item("Textures: No"); } oprueba[i]->end(); } ogeometry->end(); this->mMeshInfo->add(ogeometry); } // Hide the right panel. hideRightPanel(); mMeshInfo->set_visible(); mMeshInfo->activate(); } //--------------------------------------------------------------------------- // Hide the mesh info browser //--------------------------------------------------------------------------- void GeoMeshViewUI::hideMeshInfo() { mMeshInfo->hide(); mMeshInfo->deactivate(); } //--------------------------------------------------------------------------- // Hide the right panel //--------------------------------------------------------------------------- void GeoMeshViewUI::hideRightPanel() { hideStripify(); hideEdgeCollapse(); hideLeavesCollapse(); hideOpenMeshSimplification(); hideOpenLeavesSimplification(); hideVisualizeLodStrips(); hideMeshInfo(); } //--------------------------------------------------------------------------- // Get the number of vertices //--------------------------------------------------------------------------- size_t GeoMeshViewUI::getVertexCount(Mesh *geoMesh) { size_t vertex_count; SubMesh *geoSubMesh; vertex_count = geoMesh->mVertexBuffer->mVertexCount; // For each submesh. for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) { // Gets the actual submesh. geoSubMesh = &geoMesh->mSubMesh[submesh]; // If the mesh does not have shared vertex. if (!geoSubMesh->mSharedVertexBuffer) { // Adds the vertex of the submesh to the total count. vertex_count += geoSubMesh->mVertexBuffer->mVertexCount; } } return vertex_count; } //--------------------------------------------------------------------------- // Get the number of triangles //--------------------------------------------------------------------------- size_t GeoMeshViewUI::getTriangleCount(Geometry::Mesh *geoMesh) { size_t triangle_count; SubMesh *geoSubMesh; // Initialize the triangle count. triangle_count = 0; // If the application is in visualize lodstrips mode. if (mApplicationState == VISUALIZE_LODSTRIPS) { triangle_count = geoMeshView->getLodStripsTriangleCount(); } else { // For each submesh. for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) { // Gets the actual submesh. geoSubMesh = &geoMesh->mSubMesh[submesh]; switch (geoMesh->mType) { case GEO_TRIANGLE_LIST: triangle_count += geoSubMesh->mIndexCount / 3; break; case GEO_TRIANGLE_STRIPS: triangle_count += geoSubMesh->mIndexCount - 2; break; } } } return triangle_count; } //--------------------------------------------------------------------------- // Get the number of strips //--------------------------------------------------------------------------- size_t GeoMeshViewUI::getStripCount(Geometry::Mesh *geoMesh) { size_t strip_count; SubMesh *geoSubMesh; // Initialize the triangle count. strip_count = 0; if (geoMesh->mType == GEO_TRIANGLE_STRIPS) { // For each submesh. for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) { // Gets the actual submesh. geoSubMesh = &geoMesh->mSubMesh[submesh]; strip_count += geoSubMesh->mStripCount; } } return strip_count; } //--------------------------------------------------------------------------- // It paints the submesh selected by the mMeshInfo tree // Trate the mMeshInfo event //--------------------------------------------------------------------------- int GeoMeshViewUI::paintMesh(void) { char selectedTag[100]; char *pch; char *p; int meshNumber; // Initializa mesh to not selected. meshNumber = -1; // Shows the selected object label strcpy(selectedTag,mMeshInfo->goto_focus()->label()); p=strstr(selectedTag,"SubMesh "); // If the item begins with string "SubMesh" if (p!=NULL) { pch = strtok (selectedTag," "); pch = strtok (NULL, " "); sscanf(pch,"%d",&meshNumber); } geoMeshView->setColorSubmeshi(meshNumber); geoMeshView->redraw(); return meshNumber; } //--------------------------------------------------------------------------- // Simplify the mesh object. //--------------------------------------------------------------------------- void GeoMeshViewUI::simplifyEdgeCollapse() { Real percent; simplificacionState = QSLIM; ms = new ImageBasedSimplifier(mGeoMesh, progress_function); ms->setMeshLeaves(idMeshLeaves); if (mPercent->value() == true) { // Simplificación por porcentaje if (mMeshReduction->fvalue() <= 100.0 && mMeshReduction->fvalue()>0.0) { percent = mMeshReduction->fvalue(); percent = percent / 100.0; // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. ms->Simplify(percent); // Deletes the previous mesh. delete mUndoMesh; mUndoMesh = new Mesh(); // Sets the undo mesh. *mUndoMesh = *mGeoMesh; delete mGeoMesh; mGeoMesh = ms->GetMesh(); // Visualize mesh. geoMeshView->setMesh(mGeoMesh); } else { fltk::alert("Wrong value for simplification.\n" "Valid values [0..100]"); } } else { // Simplificar hasta un número de vértices. uint32 v = (uint32)mMeshReduction->fvalue(); // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. ms->Simplify(v); // Deletes the previous mesh. delete mUndoMesh; mUndoMesh = new Mesh(); // Sets the undo mesh. *mUndoMesh = *mGeoMesh; delete mGeoMesh; mGeoMesh = ms->GetMesh(); // Visualize the mesh. geoMeshView->setMesh(mGeoMesh); } } //--------------------------------------------------------------------------- // Simplify the mesh object. //--------------------------------------------------------------------------- void GeoMeshViewUI::simplifyLeavesCollapse() { uint32 vi; // if the mesh is stripified. if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS) { fltk::alert("Can't simplify a tree in triagle strips."); } // if the mesh is in triangle list. else { simplificacionState = HOJAS; mts = new TreeSimplifier(mGeoMesh, progress_function); vi = (uint32)mMeshReduction->fvalue(); // Simplify if(idMeshLeaves != (unsigned short)-1) { // Simplify mts->Simplify(vi, idMeshLeaves); // Deletes the previous mesh. delete mUndoMesh; mUndoMesh = new Mesh(); // Sets the undo mesh. *mUndoMesh = *mGeoMesh; delete mGeoMesh; mGeoMesh = mts->GetMesh(); geoMeshView->setMesh(mGeoMesh); } else { fltk::alert("You must select the mesh that contains the leaves."); } } } //--------------------------------------------------------------------------- // Create a simplification sequence of the QSLIM method. //--------------------------------------------------------------------------- void GeoMeshViewUI::createQslimSequence() { MeshSimplificationSequence *secsimpl; secsimpl = ms->GetSimplificationSequence(); secsimpl->putMeshName(nombremesh); // Nombre del mesh para guardar la secuencia de simplificación secsimpl->Save(Geometry::Serializer("mqslimSequence.txt",Serializer::WRITE)); delete secsimpl; } //--------------------------------------------------------------------------- // Stripify the mesh object. //--------------------------------------------------------------------------- void GeoMeshViewUI::stripify() { char char_value[10]; CustomStripifier *geoStripifier; // if the mesh is stripified. if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS) { fltk::alert("The mesh is already in strips."); } // if the mesh is in triangle list. else { //Stripify. geoStripifier = new CustomStripifier(mGeoMesh); // Set the progress bar function. geoStripifier->SetProgressFunc(progress_function); if (geoStripifier->Stripify()) { // Deletes the mesh object. delete mUndoMesh; mUndoMesh = new Mesh(); *mUndoMesh = *mGeoMesh; delete mGeoMesh; // Gets the mesh stripified. mGeoMesh = geoStripifier->GetMesh(); // Visualize the mesh stripified. geoMeshView->setMesh(mGeoMesh); // Store the color of the strips. geoMeshView->setStripColors(); } else { // Error message. fltk::alert("Impossible to stripify. The mesh is not manifold"); } // Deletes the stripifier object. delete geoStripifier; } } //--------------------------------------------------------------------------- // Method that undo then mesh changes. //--------------------------------------------------------------------------- void GeoMeshViewUI::undo() { // if the undo mesh is not initialized. if (mUndoMesh != NULL) { // Deletes the actual mesh. delete mGeoMesh; mGeoMesh = new Mesh(); // Restore the previous mesh. *mGeoMesh = *mUndoMesh; // Visualize the mesh. geoMeshView->setMesh(mGeoMesh); // Refresh geometry attributes. refreshApplicationBar(); // Repaint the window. mMainWindow->redraw(); } } //--------------------------------------------------------------------------- // Refresh number of vertices, triangles, strips, ... //--------------------------------------------------------------------------- void GeoMeshViewUI::refreshApplicationBar() { static char vertices_value[50]; static char triangles_value[50]; static char strips_value[50]; // Translate the vertex count to a char value. sprintf(vertices_value,"Vertices %d",getVertexCount(mGeoMesh)); mVertices->label(vertices_value); // Translate the triangle count to a char value. sprintf(triangles_value,"Triangles %d",getTriangleCount(mGeoMesh)); mTriangles->label(triangles_value); // Translate the triangle count to a char value. sprintf(strips_value,"Strips %d",getStripCount(mGeoMesh)); mStrips->label(strips_value); } // Method that updates the porgress bar. float GeoMeshViewUI::updateProgressBar(float v) { fltk::ProgressBar *progressBar; // Choose progress bar to update. switch(progressBarType) { case PROCESS: progressBar = mProcessBar; break; case BUILD: progressBar = mBuildBar; break; } // Update progress bar. progressBar->step(v); progressBar->step(); mMainWindow->flush(); //mMainWindow->redraw(); return 0; } //--------------------------------------------------------------------------- // Initialize the lodstripslibrary for visualization. //--------------------------------------------------------------------------- void GeoMeshViewUI::setLodStripsLibrary(std::string lodfile, Mesh *geomesh) { // If there is no lod strips object. if (lodStripsLib) { delete lodStripsLib; } // New lod strips object. lodStripsLib = new LodStripsLibrary(lodfile, geomesh); // Sets the slider range. mLodSlider->range(lodStripsLib->MaxLod(), lodStripsLib->MinLod()); // Pass to geomeshview the lod strips object. geoMeshView->setLodStripsLibrary(lodStripsLib); // Puts the slider in the max position. mLodSlider->value(lodStripsLib->MinLod()); } //--------------------------------------------------------------------------- // Open a mesh file. //--------------------------------------------------------------------------- void GeoMeshViewUI::openMeshFile() { fltk::FileChooser *fcho; static char char_value[10]; static char title[256]; fcho = new fltk::FileChooser("", "*.mesh", fltk::FileChooser::CREATE, "Open mesh file"); fcho->exec(); // File name. mFileName = (char *)fcho->value(); if (mFileName) { // Set Window Title. strcpy(title,mFileName); mMainWindow->label(strcat(title," - GeoTool")); // Identify the mesh that stores the leaves idMeshLeaves = -1; // Stores the name of the mesh. nombremesh = new char[255]; strcpy(nombremesh,mFileName); // Delete the current mesh. delete mGeoMesh; delete mUndoMesh; // Loads a new mesh. mGeoMesh = geoMeshLoader->load(mFileName); // Reset the undo mesh. mUndoMesh = new Mesh(); *mUndoMesh = *mGeoMesh; // Translate the MB count to a char value. sprintf(char_value, "MB %.3f", (float)geoMeshLoader->getFileSize()/1024/1024); mMB->label(char_value); // Visualize mesh. geoMeshView->setMesh(mGeoMesh); // Get the mesh bounds. mMeshBounds = geoMeshView->getBoundingBox(); // Hide right panel. hideRightPanel(); // Quit culling. menuRenderCW->clear_value(); menuRenderCCW->clear_value(); geoMeshView->deactiveCW(); geoMeshView->deactiveCCW(); // Deactive solid mode and wire. menuRenderSolid->clear_value(); menuRenderWire->clear_value(); geoMeshView->deactiveSolid(); geoMeshView->deactiveWire(); // Fit model in midle. geoMeshView->fit(); // Lighting smooth. menuRenderFlat->clear_value(); menuRenderSmooth->set_value(); geoMeshView->smooth(); // Show title. mProcessTitle->label("Mesh Info"); // Shows the mesh info. showMeshInfo(); // if the mesh is stripified. if (mGeoMesh->mType == GEO_TRIANGLE_STRIPS) { geoMeshView->setStripColors(); } // Refresh geometry attributes. refreshApplicationBar(); } // Free memory. delete fcho; } /******************/ /* Constructor */ /******************/ GeoMeshViewUI::GeoMeshViewUI(TIPOFUNC fun) { progress_function = fun; fltk::gifImage *logo; // Initialize the file name. mFileName = NULL; // Initialize the 3D object. mGeoMesh = NULL; mUndoMesh = NULL; // Initialize the lod strip object. lodStripsLib = NULL; // Identify the mesh that stores the leaves idMeshLeaves = -1; // Initialize the loader of meshes. geoMeshLoader = new GeoMeshLoader(); // Initialize the menus application state. mApplicationState = NONE; { fltk::Window* o = new fltk::Window(800, 600,"GeoTool"); mMainWindow = o; // Program Icon for Win32. mMainWindow->icon((char *)LoadIcon( GetModuleHandle(0), MAKEINTRESOURCE(GEOICON))); // Double buffer. mMainWindow->set_double_buffer(); o->user_data((void*)(this)); o->begin(); { fltk::Group* o = new fltk::Group(0, 27, 806, 559); o->begin(); { fltk::Group* o; o = MainView = new fltk::Group(0, 0, 600, 500); o->begin(); { fltk::InvisibleBox* o; o = cframe = new fltk::InvisibleBox(0, 0, 600, 500); o->box(fltk::FLAT_BOX); o->color((fltk::Color)0xffffff00); //fltk::Group::current()->resizable(o); } { GeoMeshView* o; o = geoMeshView = new GeoMeshView( 0,0,600,500,0,this); } o->end(); fltk::Group::current()->resizable(o); } { fltk::Group* o; o = MainView = new fltk::Group(600, 0, 200, 500); o->begin(); { fltk::Button* o; //o = mButtonProcess = new fltk::Button(665, 410, 73, 25, "Process"); o = mButtonProcess = new fltk::Button(65, 410, 73, 25, "Process"); o->callback((fltk::Callback*)cb_mButtonProcess); o->hide(); o->deactivate(); } { fltk::ProgressBar* o; //o = mProcessBar = new fltk::ProgressBar(616, 435, 175, 18); o = mProcessBar = new fltk::ProgressBar(16, 435, 175, 18); o->hide(); o->deactivate(); } { fltk::Button* o; o = mButtonSort = new fltk::Button(65, 375, 73, 25, "Sort"); o->callback((fltk::Callback*)cb_mButtonSort); o->hide(); o->deactivate(); } { fltk::ProgressBar* o; o = mSortBar = new fltk::ProgressBar(16, 390, 175, 18); o->hide(); o->deactivate(); } { fltk::Button* o; o = mButtonBuild = new fltk::Button(65, 455, 73, 25, "Build"); o->callback((fltk::Callback*)cb_mButtonBuild); o->hide(); o->deactivate(); } { fltk::ProgressBar* o; o = mBuildBar = new fltk::ProgressBar(16, 480, 175, 18); o->hide(); o->deactivate(); } { fltk::Slider* o; o = mLodSlider = new fltk::Slider(16, 50, 30, 450); o->type(fltk::Slider::TICK_BELOW); o->set_vertical(); o->callback((fltk::Callback*)cb_mLodSlider); o->hide(); o->deactivate(); } { mMetricLabel = new fltk::Output(26, 28, 5, 25, "Metric"); fltk::Output* o = mMetricLabel; o->set_vertical(); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); o->align(fltk::ALIGN_RIGHT); } { fltk::Group* o; o = MainView = new fltk::Group(30, 40, 30, 60); o->begin(); { mGeometryBased = new fltk::RadioButton(0, 8, 25, 25, "Geometry based"); mImageBased = new fltk::RadioButton(0, 23, 25, 25, "Image based"); } o->end(); } //mChangeVertices = new fltk::CheckButton(30, 104, 25, 25, "Change vertices"); { mProcessTitle = new fltk::Widget(0, 0, 200, 25, ""); fltk::Widget* o = mProcessTitle; o->set_vertical(); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->labelsize(15.0); o->color((fltk::Color)0xe0dfe300); o->align(fltk::ALIGN_CENTER); } /* { mTypeLabel = new fltk::Output(26, 82, 5, 25, "Type"); fltk::Output* o = mTypeLabel; o->set_vertical(); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); o->align(fltk::ALIGN_RIGHT); } */ { mMeshReductionLabel = new fltk::Output(26, 124, 5, 25, "Mesh Reduction"); fltk::Output* o = mMeshReductionLabel; o->set_vertical(); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); o->align(fltk::ALIGN_RIGHT); } //mChangeTexture = new fltk::CheckButton(30, 104, 25, 25, "Change texture"); { fltk::Group* o; o = MainView = new fltk::Group(30, 140, 30, 60); o->begin(); { mPercent = new fltk::RadioButton(0, 5, 25, 25, "%"); mVerticesNumber = new fltk::RadioButton(0, 20, 25, 25, "Vertices number"); } o->end(); } { mMeshReduction = new fltk::FloatInput(75, 181, 75, 21, "Value:"); fltk::FloatInput* o = mMeshReduction; o->type(1); } { fltk::Group* o; o = MainView = new fltk::Group(30, 100, 30, 60); o->begin(); { mOneCacheStrip = new fltk::RadioButton(0, 4, 25, 25, "One cache strip"); mQualityStrips = new fltk::RadioButton(0, 23, 25, 25, "Quality strips"); } o->end(); } { fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 200, 380); o->set_vertical(); o->callback((fltk::Callback*)cb_mMeshInfo); } o->end(); } o->end(); fltk::Group::current()->resizable(o); } { fltk::MenuBar* o = menuBar = new fltk::MenuBar(1, 2, 801, 21); o->begin(); // Menu File. { fltk::ItemGroup* o = menuFile = new fltk::ItemGroup("File"); o->begin(); { fltk::Item* o = menuFileOpen = new fltk::Item("Open"); o->callback((fltk::Callback*)cb_menuFileOpen); } { fltk::Item* o = menuFileSave = new fltk::Item("Save"); o->callback((fltk::Callback*)cb_menuFileSave); } { fltk::Item* o = menuOpenSaveAs = new fltk::Item("Save As"); o->callback((fltk::Callback*)cb_menuOpenSaveAs); } //{ // fltk::Item* o = menuMeshExportOBJ = new fltk::Item("Export to OBJ"); // o->callback((fltk::Callback*)cb_menuMeshExportOBJ); //} //{ // fltk::Item* o = menuFileTransformSharedVertex = new fltk::Item("Transform to Shared Vertex"); // o->callback((fltk::Callback*)cb_menuFileTransformSharedVertex); //} { fltk::Item* o = menuOpenQuit = new fltk::Item("Quit"); o->callback((fltk::Callback*)cb_menuOpenQuit); } o->end(); } // Menu Edit. { fltk::ItemGroup* o = menuEdit = new fltk::ItemGroup("Edit"); o->begin(); { fltk::Item* o = menuEditUndo = new fltk::Item("Undo"); o->callback((fltk::Callback*)cb_menuEditUndo); } { fltk::Item* o = menuEditFit = new fltk::Item("Fit"); o->callback((fltk::Callback*)cb_menuEditFit); } { fltk::Item* o = menuEditRotate = new fltk::Item("Rotate"); o->type(fltk::Item::RADIO); o->set_value(); o->callback((fltk::Callback*)cb_menuEditRotate); } { fltk::Item* o = menuEditPan = new fltk::Item("Pan"); o->type(fltk::Item::RADIO); o->callback((fltk::Callback*)cb_menuEditPan); } //{ // fltk::Item* o = menuEditZoom = new fltk::Item("Zoom"); // o->callback((fltk::Callback*)cb_menuEditZoom); //} new fltk::Divider(); { fltk::Item* o = menuMeshInfo = new fltk::Item("Mesh info"); o->callback((fltk::Callback*)cb_menuMeshInfo); } //{ // fltk::Item* o; // o = menuSelectLeaves = new fltk::Item("Select leaves"); // o->callback((fltk::Callback*)cb_menuSelectLeaves); //} o->end(); } // Menu Render. { fltk::ItemGroup* o = menuRender = new fltk::ItemGroup("Render"); o->begin(); { fltk::Item* o = menuRenderWire = new fltk::Item("Wire"); o->type(fltk::Item::RADIO); o->callback((fltk::Callback*)cb_menuRenderWire); } { fltk::Item* o = menuRenderSolid = new fltk::Item("Solid"); o->type(fltk::Item::RADIO); o->callback((fltk::Callback*)cb_menuRenderSolid); } //new fltk::Divider(); { fltk::Item* o = menuRenderCW = new fltk::Item("CW"); o->type(fltk::Item::RADIO); o->callback((fltk::Callback*)cb_menuRenderCW); o->hide(); } { fltk::Item* o = menuRenderCCW = new fltk::Item("CCW"); o->type(fltk::Item::RADIO); o->set_value(); o->callback((fltk::Callback*)cb_menuRenderCCW); o->hide(); } new fltk::Divider(); { fltk::Item* o = menuRenderFlat = new fltk::Item("Flat"); o->type(fltk::Item::RADIO); o->clear_value(); o->callback((fltk::Callback*)cb_menuRenderFlat); } { fltk::Item* o = menuRenderSmooth = new fltk::Item("Smooth"); o->type(fltk::Item::RADIO); o->set_value(); o->callback((fltk::Callback*)cb_menuRenderSmooth); } //new fltk::Divider(); //{ // fltk::Item* o = menuRenderTextures = new fltk::Item("Textures"); // o->callback((fltk::Callback*)cb_menuRenderTextures); //} o->end(); } // Menu Stripify. { fltk::Item* o = menuStripify = new fltk::Item("Stripify"); o->callback((fltk::Callback*)cb_menuStripify); } // Menu Simplify. { fltk::ItemGroup* o = menuSimplify = new fltk::ItemGroup("Simplify"); o->callback((fltk::Callback*)cb_menuSimplify); o->begin(); { fltk::Item* o; o = menuSimplifyEdgeCollapse = new fltk::Item("Mesh Simplification"); o->callback((fltk::Callback*)cb_menuSimplifyEdgeCollapse); } //{ // fltk::Item* o; // o = menuSimplifyLeavesCollapse = new fltk::Item("Leaves Simplification"); // o->callback((fltk::Callback*)cb_menuSimplifyLeavesCollapse); //} o->end(); } // Menu LodStrips. { fltk::ItemGroup* o; o = menuLodStrips = new fltk::ItemGroup("LodStrips"); o->begin(); { fltk::Item* o; o = menuLodStripsGenerate = new fltk::Item("Generate"); o->callback((fltk::Callback*)cb_menuLodStripsGenerate); } { fltk::Item* o; o = menuLodStripsVisualize = new fltk::Item("Visualize"); o->callback((fltk::Callback*)cb_menuLodStripsVisualize); } o->end(); } // Menu LodTrees. /* { fltk::ItemGroup* o; o = menuLodTrees = new fltk::ItemGroup("LodTrees"); o->begin(); { fltk::Item* o; o = menuLodTreesOpenLodStripTrunk = new fltk::Item("Open LodStrip trunk"); o->callback((fltk::Callback*)cb_menuLodTreesOpenLodStripTrunk); } { fltk::Item* o; o = menuLodTreesOpenLeavesSimplification = new fltk::Item("Open leaves simplification"); o->callback((fltk::Callback*)cb_menuLodTreesOpenLeavesSimplification); } o->end(); } */ { fltk::ItemGroup* o = new fltk::ItemGroup("?"); o->begin(); { fltk::Item* o = menuHelpAbout = new fltk::Item("About"); o->callback((fltk::Callback*)cb_menuHelpAbout); } o->end(); } { fltk::SharedImage *gifLogo = logo->get("media\\logos\\logo.gif"); //o->callback((fltk::Callback*)cb_mLogo); mLogo = new fltk::InvisibleBox(406, 1, 43, 13); mLogo->image(gifLogo); } o->end(); } { fltk::Group* o; o = ApplicationBar = new fltk::Group(0, 570, 807, 28); o->box(fltk::BORDER_BOX); o->begin(); { fltk::Widget* o; o = mFPS = new fltk::Widget(10, 4, 30, 15, "FPS "); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); } { fltk::Widget* o; o = mVertices = new fltk::Widget(154, 4, 40, 15, "Vertices"); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); } { fltk::Widget* o; o = mTriangles = new fltk::Widget(254, 3, 40, 15, "Triangles"); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); // Hide triangle count. o->hide(); } { fltk::Widget* o; o = mStrips = new fltk::Widget(354, 3, 30, 15, "Strips"); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); } //{ // fltk::Widget* o; // o = mQuads = new fltk::Widget(454, 4, 40, 15, "Quads"); // o->box(fltk::NO_BOX); // o->labelfont(fltk::HELVETICA_BOLD); // o->color((fltk::Color)0xe0dfe300); //} { fltk::Widget* o; o = mMB = new fltk::Widget(740, 3, 30, 15, "MB"); o->box(fltk::NO_BOX); o->labelfont(fltk::HELVETICA_BOLD); o->color((fltk::Color)0xe0dfe300); } o->end(); } o->end(); } fltk::focus(geoMeshView); /*Hide Right Panel*/ hideRightPanel(); mMainWindow->show(); } /****************/ /* Destroyer */ /****************/ GeoMeshViewUI::~GeoMeshViewUI() { delete geoMeshLoader; mMainWindow->destroy(); } // Shows the main window. void GeoMeshViewUI::show() { }