Changeset 2103


Ignore:
Timestamp:
02/08/07 12:18:57 (17 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp

    r2086 r2103  
    137137 
    138138//------------------------------------------------------------------------- 
    139 //      Destroyer. 
     139//      Destructor. 
    140140//------------------------------------------------------------------------- 
    141141GeometryBasedSimplifier::~GeometryBasedSimplifier() 
     
    247247        VMI::vTexCoords =       vTexCoords; 
    248248 
     249         
     250 
    249251        mGeoMesh        =       new Mesh(); 
    250252 
     
    288290        // Free memory 
    289291        VMI::freeMemory(); 
     292 
     293        delete  VMI::mSequence; 
     294        VMI::mSequence  =       NULL; 
    290295} 
    291296 
     
    375380        msimpsequence->mSteps                           =       VMI::mSequence->mSteps; 
    376381        msimpsequence->mNewVertices     =       VMI::mSequence->mNewVertices; 
     382 
     383        cout    <<      "Steps of simplification: " 
     384                                <<      msimpsequence->mSteps.size() 
     385                                <<      " Number of new vertices: " 
     386                                <<      msimpsequence->mNewVertices.size() 
     387                                <<      endl; 
    377388} 
    378389 
     
    871882EdgesMultimap::EdgesMultimap() 
    872883{ 
     884} 
     885 
     886//------------------------------------------------------------------------- 
     887//      Destructor. 
     888//------------------------------------------------------------------------- 
     889EdgesMultimap::~EdgesMultimap() 
     890{ 
    873891        edges.clear(); 
    874892} 
     
    10051023{ 
    10061024        delete  mGeoMesh; 
     1025        delete  mEdges; 
    10071026} 
    10081027 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/simplify.cpp

    r2090 r2103  
    764764        mSequence->mSteps.clear(); 
    765765 
     766        //      Debug. 
     767        cout    <<      "Simplification steps: " 
     768                                <<      steps.size() 
     769                                <<      " new vertices: " 
     770                                <<      mSequence->mNewVertices.size() 
     771                                <<      endl; 
     772 
    766773        for     (size_t i       =       0;      i < steps.size(); i++) 
    767774        { 
     
    843850                                                <<      endl; 
    844851         
    845                         // Collapse new edge. 
     852                        //      Collapse new edge. 
    846853                        doChange(mesh, c); // the mesh has been updated. 
    847854 
    848                         // Write Simplification sequence. 
     855                        //      Write Simplification sequence. 
    849856                        saveSimplificationSequence(c,0); 
    850857 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r2090 r2103  
    282282//      Transform to Shared Vertex callback 
    283283//------------------------------------------------------------------------- 
    284 inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item*, void*) 
     284inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item    *, 
     285                                                                                                                                                                                                                                        void                            *) 
    285286{ 
    286287        Mesh    *mesh_aux; 
     
    11711172                                        if (simplifyEdgeCollapse()) 
    11721173                                        { 
    1173                                                 //delete        mMeshSimplifier; 
    11741174                                                geoMeshView->restoreContext(); 
    11751175 
     
    12131213} 
    12141214 
    1215 //--------------------------------------------------------------------------- 
     1215//------------------------------------------------------------------------- 
    12161216//      Button Sort Callback 
    1217 //--------------------------------------------------------------------------- 
     1217//------------------------------------------------------------------------- 
    12181218inline void GeoMeshViewUI::cb_mButtonSort_i(fltk::Button*, void*) 
    12191219{ 
     
    12271227} 
    12281228 
    1229 //--------------------------------------------------------------------------- 
     1229//------------------------------------------------------------------------- 
    12301230//      Button Build Callback 
    1231 //--------------------------------------------------------------------------- 
     1231//------------------------------------------------------------------------- 
    12321232inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*) 
    12331233{ 
     
    13041304 
    13051305                                        oLodStrip->Save(file_name); 
    1306  
    1307                                         //      Delete simplified mesh. 
    1308                                         delete  mMeshSimplifier; 
    13091306                                } 
    13101307                                else 
     
    13331330} 
    13341331 
    1335 //--------------------------------------------------------------------------- 
     1332//------------------------------------------------------------------------- 
    13361333//      Lod Slider Callback 
    1337 //--------------------------------------------------------------------------- 
     1334//------------------------------------------------------------------------- 
    13381335inline void GeoMeshViewUI::cb_mLodStripSlider_i(fltk::Slider    *o, void        *) 
    13391336{ 
     
    13541351} 
    13551352 
    1356 //--------------------------------------------------------------------------- 
     1353//------------------------------------------------------------------------- 
    13571354//      Lod Slider Callback for the foliage 
    1358 //--------------------------------------------------------------------------- 
     1355//------------------------------------------------------------------------- 
    13591356inline void GeoMeshViewUI::cb_mLodTreeSlider_i(fltk::Slider     *o, void        *) 
    13601357{ 
     
    13751372} 
    13761373 
    1377 //--------------------------------------------------------------------------- 
     1374//------------------------------------------------------------------------- 
    13781375//      Mesh Info Callback 
    1379 //--------------------------------------------------------------------------- 
     1376//------------------------------------------------------------------------- 
    13801377inline void GeoMeshViewUI::cb_mMeshInfo_i(fltk::Browser *, void *) 
    13811378{        
     
    13901387} 
    13911388 
    1392 //--------------------------------------------------------------------------- 
     1389//------------------------------------------------------------------------- 
    13931390//      Logo Callback. 
    1394 //--------------------------------------------------------------------------- 
     1391//------------------------------------------------------------------------- 
    13951392inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) 
    13961393{ 
     
    14041401} 
    14051402 
    1406 //--------------------------------------------------------------------------- 
     1403//------------------------------------------------------------------------- 
    14071404//      Active Build process. 
    1408 //--------------------------------------------------------------------------- 
     1405//------------------------------------------------------------------------- 
    14091406void    GeoMeshViewUI::activeBuildProcess() 
    14101407{ 
     
    14161413} 
    14171414 
    1418 //--------------------------------------------------------------------------- 
     1415//------------------------------------------------------------------------- 
    14191416//      Show the stripify panel. 
    1420 //--------------------------------------------------------------------------- 
     1417//------------------------------------------------------------------------- 
    14211418void    GeoMeshViewUI::showStripify() 
    14221419{ 
     
    14391436} 
    14401437 
    1441 //--------------------------------------------------------------------------- 
     1438//------------------------------------------------------------------------- 
    14421439//      Hide the stripify panel. 
    1443 //--------------------------------------------------------------------------- 
     1440//------------------------------------------------------------------------- 
    14441441void    GeoMeshViewUI::hideStripify() 
    14451442{ 
     
    14621459} 
    14631460 
    1464 //--------------------------------------------------------------------------- 
     1461//------------------------------------------------------------------------- 
    14651462//      Show the Simplify Edge Collapse panel. 
    1466 //--------------------------------------------------------------------------- 
     1463//------------------------------------------------------------------------- 
    14671464void    GeoMeshViewUI::showEdgeCollapse() 
    14681465{ 
     
    15121509} 
    15131510 
    1514 //--------------------------------------------------------------------------- 
     1511//------------------------------------------------------------------------- 
    15151512//      Hide the Simplify Edge Collapse 
    1516 //--------------------------------------------------------------------------- 
     1513//------------------------------------------------------------------------- 
    15171514void    GeoMeshViewUI::hideEdgeCollapse() 
    15181515{ 
     
    15971594} 
    15981595 
    1599 //--------------------------------------------------------------------------- 
     1596//------------------------------------------------------------------------- 
    16001597//      Hide the Simplify Leaves Collapse. 
    1601 //--------------------------------------------------------------------------- 
     1598//------------------------------------------------------------------------- 
    16021599void    GeoMeshViewUI::hideLeavesCollapse() 
    16031600{ 
     
    16381635} 
    16391636 
    1640 //--------------------------------------------------------------------------- 
     1637//------------------------------------------------------------------------- 
    16411638//      Show the LodStrips Panel. 
    1642 //--------------------------------------------------------------------------- 
     1639//------------------------------------------------------------------------- 
    16431640void    GeoMeshViewUI::showOpenMeshSimplification() 
    16441641{ 
     
    16561653} 
    16571654 
    1658 //--------------------------------------------------------------------------- 
     1655//------------------------------------------------------------------------- 
    16591656//      Hide the LodStrips Panel. 
    1660 //--------------------------------------------------------------------------- 
     1657//------------------------------------------------------------------------- 
    16611658void    GeoMeshViewUI::hideOpenMeshSimplification() 
    16621659{ 
     
    16741671} 
    16751672 
    1676 //--------------------------------------------------------------------------- 
     1673//------------------------------------------------------------------------- 
    16771674//      Shows the auto generate LodStrips panel. 
    1678 //--------------------------------------------------------------------------- 
     1675//------------------------------------------------------------------------- 
    16791676void    GeoMeshViewUI::showAutoGenerateLodStrips() 
    16801677{ 
     
    16921689} 
    16931690 
    1694 //--------------------------------------------------------------------------- 
     1691//------------------------------------------------------------------------- 
    16951692//      Shows the auto generate LodStrips panel. 
    1696 //--------------------------------------------------------------------------- 
     1693//------------------------------------------------------------------------- 
    16971694void    GeoMeshViewUI::showAutoGenerateLodTrees() 
    16981695{ 
     
    17101707} 
    17111708 
    1712 //--------------------------------------------------------------------------- 
     1709//------------------------------------------------------------------------- 
    17131710//      Show the LodStrips visulization panel. 
    1714 //--------------------------------------------------------------------------- 
     1711//------------------------------------------------------------------------- 
    17151712void    GeoMeshViewUI::showLodStripSlider() 
    17161713{ 
     
    17191716} 
    17201717 
    1721 //--------------------------------------------------------------------------- 
     1718//------------------------------------------------------------------------- 
    17221719//      Hide the LodStrips visualization panel. 
    1723 //--------------------------------------------------------------------------- 
     1720//------------------------------------------------------------------------- 
    17241721void    GeoMeshViewUI::hideLodStripSlider() 
    17251722{ 
     
    17281725} 
    17291726 
    1730 //--------------------------------------------------------------------------- 
     1727//------------------------------------------------------------------------- 
    17311728//      Show the LodTree visulization panel. 
    1732 //--------------------------------------------------------------------------- 
     1729//------------------------------------------------------------------------- 
    17331730void    GeoMeshViewUI::showLodTreeSlider() 
    17341731{ 
     
    17371734} 
    17381735 
    1739 //--------------------------------------------------------------------------- 
     1736//------------------------------------------------------------------------- 
    17401737//      Hide the LodTree visualization panel. 
    1741 //--------------------------------------------------------------------------- 
     1738//------------------------------------------------------------------------- 
    17421739void    GeoMeshViewUI::hideLodTreeSlider() 
    17431740{ 
     
    17461743} 
    17471744 
    1748 //--------------------------------------------------------------------------- 
     1745//------------------------------------------------------------------------- 
    17491746//      Show the LodTrees Panel. 
    1750 //--------------------------------------------------------------------------- 
     1747//------------------------------------------------------------------------- 
    17511748void    GeoMeshViewUI::showOpenLeavesSimplification() 
    17521749{ 
     
    17581755} 
    17591756 
    1760 //--------------------------------------------------------------------------- 
     1757//------------------------------------------------------------------------- 
    17611758//      Hide the LodTrees Panel. 
    1762 //--------------------------------------------------------------------------- 
     1759//------------------------------------------------------------------------- 
    17631760void    GeoMeshViewUI::hideOpenLeavesSimplification() 
    17641761{ 
     
    17701767} 
    17711768 
    1772 //-------------------------------------------------------------------------- 
     1769//------------------------------------------------------------------------- 
    17731770//      Show the mesh info browser. 
    1774 //-------------------------------------------------------------------------- 
     1771//------------------------------------------------------------------------- 
    17751772void    GeoMeshViewUI::showMeshInfo() 
    17761773{ 
     
    19151912} 
    19161913 
    1917 //-------------------------------------------------------------------------- 
     1914//------------------------------------------------------------------------- 
    19181915//      Hide the mesh info browser. 
    1919 //-------------------------------------------------------------------------- 
     1916//------------------------------------------------------------------------- 
    19201917void    GeoMeshViewUI::hideMeshInfo() 
    19211918{ 
     
    19241921} 
    19251922 
    1926 //-------------------------------------------------------------------------- 
     1923//------------------------------------------------------------------------- 
    19271924//      Hide the right panel. 
    1928 //-------------------------------------------------------------------------- 
     1925//------------------------------------------------------------------------- 
    19291926void    GeoMeshViewUI::hideRightPanel() 
    19301927{ 
     
    19391936} 
    19401937 
    1941 //-------------------------------------------------------------------------- 
     1938//------------------------------------------------------------------------- 
    19421939//      Get the number of vertices. 
    1943 //-------------------------------------------------------------------------- 
     1940//------------------------------------------------------------------------- 
    19441941size_t  GeoMeshViewUI::getVertexCount(Mesh      *geoMesh) 
    19451942{ 
     
    19661963} 
    19671964 
    1968 //--------------------------------------------------------------------------- 
     1965//------------------------------------------------------------------------- 
    19691966//      Get the number of triangles. 
    1970 //--------------------------------------------------------------------------- 
     1967//------------------------------------------------------------------------- 
    19711968size_t  GeoMeshViewUI::getTriangleCount(Geometry::Mesh  *geoMesh) 
    19721969{ 
     
    20052002} 
    20062003 
    2007 //--------------------------------------------------------------------------- 
     2004//------------------------------------------------------------------------- 
    20082005//      Get the number of strips. 
    2009 //--------------------------------------------------------------------------- 
     2006//------------------------------------------------------------------------- 
    20102007size_t  GeoMeshViewUI::getStripCount(Geometry::Mesh     *geoMesh) 
    20112008{ 
     
    20312028} 
    20322029 
    2033 //--------------------------------------------------------------------------- 
     2030//------------------------------------------------------------------------- 
    20342031//      It paints the submesh selected by the mMeshInfo tree. 
    20352032//      Trate the mMeshInfo event. 
    2036 //--------------------------------------------------------------------------- 
     2033//------------------------------------------------------------------------- 
    20372034int GeoMeshViewUI::paintMesh(void) 
    20382035{ 
     
    20642061} 
    20652062 
    2066 //--------------------------------------------------------------------------- 
     2063//------------------------------------------------------------------------- 
    20672064//      Simplify the mesh object. 
    2068 //--------------------------------------------------------------------------- 
     2065//------------------------------------------------------------------------- 
    20692066bool GeoMeshViewUI::simplifyEdgeCollapse() 
    20702067{ 
    20712068        Real    percent; 
     2069 
     2070        //      Free memory. 
     2071        if (mMeshSimplifier != NULL) 
     2072        { 
     2073                delete  mMeshSimplifier; 
     2074        } 
    20722075 
    20732076        //    If input field empty. 
     
    21582161} 
    21592162 
    2160 //--------------------------------------------------------------------------- 
     2163//------------------------------------------------------------------------- 
    21612164//      Simplify the mesh object. 
    2162 //--------------------------------------------------------------------------- 
     2165//------------------------------------------------------------------------- 
    21632166void    GeoMeshViewUI::simplifyLeavesCollapse() 
    21642167{ 
     
    22192222} 
    22202223 
    2221 //--------------------------------------------------------------------------- 
     2224//------------------------------------------------------------------------- 
    22222225//      Create a simplification sequence of the simplification method. 
    2223 //--------------------------------------------------------------------------- 
     2226//------------------------------------------------------------------------- 
    22242227void    GeoMeshViewUI::createSimplificationSequence() 
    22252228{ 
     
    22332236} 
    22342237 
    2235 //--------------------------------------------------------------------------- 
     2238//------------------------------------------------------------------------- 
    22362239//      Create a simplification sequence of the leaves. 
    2237 //--------------------------------------------------------------------------- 
     2240//------------------------------------------------------------------------- 
    22382241void    GeoMeshViewUI::createLeavesSequence(const std::string &filename) 
    22392242{ 
     
    22482251} 
    22492252 
    2250 //--------------------------------------------------------------------------- 
     2253//------------------------------------------------------------------------- 
    22512254//      Stripify the mesh object. 
    2252 //--------------------------------------------------------------------------- 
     2255//------------------------------------------------------------------------- 
    22532256void    GeoMeshViewUI::stripify() 
    22542257{        
     
    23182321} 
    23192322 
    2320 //--------------------------------------------------------------------------- 
     2323//------------------------------------------------------------------------- 
    23212324//      Method that undo then mesh changes. 
    2322 //--------------------------------------------------------------------------- 
     2325//------------------------------------------------------------------------- 
    23232326void    GeoMeshViewUI::undo() 
    23242327{ 
     
    23472350} 
    23482351 
    2349 //--------------------------------------------------------------------------- 
     2352//------------------------------------------------------------------------- 
    23502353//      Refresh number of vertices, triangles, strips, ... 
    2351 //--------------------------------------------------------------------------- 
     2354//------------------------------------------------------------------------- 
    23522355void    GeoMeshViewUI::refreshApplicationBar() 
    23532356{ 
     
    23992402} 
    24002403 
    2401 //--------------------------------------------------------------------------- 
     2404//------------------------------------------------------------------------- 
    24022405//      Initialize the lodstripslibrary for visualization. 
    2403 //--------------------------------------------------------------------------- 
     2406//------------------------------------------------------------------------- 
    24042407void    GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData *loddata, Mesh  *geomesh) 
    24052408{ 
     
    24262429} 
    24272430 
    2428 //--------------------------------------------------------------------------- 
     2431//------------------------------------------------------------------------- 
    24292432//      Initialize the lodTreelibrary for visualization. 
    2430 //--------------------------------------------------------------------------- 
     2433//------------------------------------------------------------------------- 
    24312434void    GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh/*, uint32 ileafSubMesh*/) 
    24322435{ 
     
    24552458} 
    24562459 
    2457 //--------------------------------------------------------------------------- 
     2460//------------------------------------------------------------------------- 
    24582461//      Open a mesh file. 
    2459 //--------------------------------------------------------------------------- 
     2462//------------------------------------------------------------------------- 
    24602463void    GeoMeshViewUI::openMeshFile(void) 
    24612464{ 
     
    25942597} 
    25952598 
    2596 //--------------------------------------------------------------------------- 
     2599//------------------------------------------------------------------------- 
    25972600//      If file exists. 
    2598 //--------------------------------------------------------------------------- 
     2601//------------------------------------------------------------------------- 
    25992602bool    GeoMeshViewUI::fileExists(const char    *fileNameMesh) 
    26002603{ 
     
    26142617} 
    26152618 
    2616 /******************/ 
    2617 /*      Constructor             */ 
    2618 /******************/ 
     2619//------------------------------------------------------------------------- 
     2620//      Constructor 
     2621//------------------------------------------------------------------------- 
    26192622GeoMeshViewUI::GeoMeshViewUI(TIPOFUNC fun) 
    26202623{ 
     
    26282631        mGeoMesh        =       NULL; 
    26292632        mUndoMesh       =       NULL; 
     2633 
     2634        //      Initialize mesh simplifier. 
     2635        mMeshSimplifier =       NULL; 
    26302636 
    26312637        //      Initialize the lod strip object. 
     
    31303136} 
    31313137 
    3132 /****************/ 
    3133 /*      Destroyer               */ 
    3134 /****************/ 
     3138//------------------------------------------------------------------------- 
     3139//      Destructor. 
     3140//------------------------------------------------------------------------- 
    31353141GeoMeshViewUI::~GeoMeshViewUI() 
    31363142{ 
     
    31393145} 
    31403146 
     3147//------------------------------------------------------------------------- 
    31413148//      Shows the main window. 
     3149//------------------------------------------------------------------------- 
    31423150void GeoMeshViewUI::show() 
    31433151{ 
    31443152} 
    31453153 
     3154//------------------------------------------------------------------------- 
    31463155//      Build Textures menu. 
     3156//------------------------------------------------------------------------- 
    31473157void GeoMeshViewUI::BuildLoadTextureSubMeshMenu(void) 
    31483158{ 
Note: See TracChangeset for help on using the changeset viewer.