Changeset 2103 for GTP/trunk/Lib
- Timestamp:
- 02/08/07 12:18:57 (18 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
r2086 r2103 137 137 138 138 //------------------------------------------------------------------------- 139 // Destr oyer.139 // Destructor. 140 140 //------------------------------------------------------------------------- 141 141 GeometryBasedSimplifier::~GeometryBasedSimplifier() … … 247 247 VMI::vTexCoords = vTexCoords; 248 248 249 250 249 251 mGeoMesh = new Mesh(); 250 252 … … 288 290 // Free memory 289 291 VMI::freeMemory(); 292 293 delete VMI::mSequence; 294 VMI::mSequence = NULL; 290 295 } 291 296 … … 375 380 msimpsequence->mSteps = VMI::mSequence->mSteps; 376 381 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; 377 388 } 378 389 … … 871 882 EdgesMultimap::EdgesMultimap() 872 883 { 884 } 885 886 //------------------------------------------------------------------------- 887 // Destructor. 888 //------------------------------------------------------------------------- 889 EdgesMultimap::~EdgesMultimap() 890 { 873 891 edges.clear(); 874 892 } … … 1005 1023 { 1006 1024 delete mGeoMesh; 1025 delete mEdges; 1007 1026 } 1008 1027 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/simplify.cpp
r2090 r2103 764 764 mSequence->mSteps.clear(); 765 765 766 // Debug. 767 cout << "Simplification steps: " 768 << steps.size() 769 << " new vertices: " 770 << mSequence->mNewVertices.size() 771 << endl; 772 766 773 for (size_t i = 0; i < steps.size(); i++) 767 774 { … … 843 850 << endl; 844 851 845 // 852 // Collapse new edge. 846 853 doChange(mesh, c); // the mesh has been updated. 847 854 848 // 855 // Write Simplification sequence. 849 856 saveSimplificationSequence(c,0); 850 857 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r2090 r2103 282 282 // Transform to Shared Vertex callback 283 283 //------------------------------------------------------------------------- 284 inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item*, void*) 284 inline void GeoMeshViewUI::cb_menuTransformSharedVertex_i(fltk::Item *, 285 void *) 285 286 { 286 287 Mesh *mesh_aux; … … 1171 1172 if (simplifyEdgeCollapse()) 1172 1173 { 1173 //delete mMeshSimplifier;1174 1174 geoMeshView->restoreContext(); 1175 1175 … … 1213 1213 } 1214 1214 1215 //------------------------------------------------------------------------- --1215 //------------------------------------------------------------------------- 1216 1216 // Button Sort Callback 1217 //------------------------------------------------------------------------- --1217 //------------------------------------------------------------------------- 1218 1218 inline void GeoMeshViewUI::cb_mButtonSort_i(fltk::Button*, void*) 1219 1219 { … … 1227 1227 } 1228 1228 1229 //------------------------------------------------------------------------- --1229 //------------------------------------------------------------------------- 1230 1230 // Button Build Callback 1231 //------------------------------------------------------------------------- --1231 //------------------------------------------------------------------------- 1232 1232 inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*) 1233 1233 { … … 1304 1304 1305 1305 oLodStrip->Save(file_name); 1306 1307 // Delete simplified mesh.1308 delete mMeshSimplifier;1309 1306 } 1310 1307 else … … 1333 1330 } 1334 1331 1335 //------------------------------------------------------------------------- --1332 //------------------------------------------------------------------------- 1336 1333 // Lod Slider Callback 1337 //------------------------------------------------------------------------- --1334 //------------------------------------------------------------------------- 1338 1335 inline void GeoMeshViewUI::cb_mLodStripSlider_i(fltk::Slider *o, void *) 1339 1336 { … … 1354 1351 } 1355 1352 1356 //------------------------------------------------------------------------- --1353 //------------------------------------------------------------------------- 1357 1354 // Lod Slider Callback for the foliage 1358 //------------------------------------------------------------------------- --1355 //------------------------------------------------------------------------- 1359 1356 inline void GeoMeshViewUI::cb_mLodTreeSlider_i(fltk::Slider *o, void *) 1360 1357 { … … 1375 1372 } 1376 1373 1377 //------------------------------------------------------------------------- --1374 //------------------------------------------------------------------------- 1378 1375 // Mesh Info Callback 1379 //------------------------------------------------------------------------- --1376 //------------------------------------------------------------------------- 1380 1377 inline void GeoMeshViewUI::cb_mMeshInfo_i(fltk::Browser *, void *) 1381 1378 { … … 1390 1387 } 1391 1388 1392 //------------------------------------------------------------------------- --1389 //------------------------------------------------------------------------- 1393 1390 // Logo Callback. 1394 //------------------------------------------------------------------------- --1391 //------------------------------------------------------------------------- 1395 1392 inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) 1396 1393 { … … 1404 1401 } 1405 1402 1406 //------------------------------------------------------------------------- --1403 //------------------------------------------------------------------------- 1407 1404 // Active Build process. 1408 //------------------------------------------------------------------------- --1405 //------------------------------------------------------------------------- 1409 1406 void GeoMeshViewUI::activeBuildProcess() 1410 1407 { … … 1416 1413 } 1417 1414 1418 //------------------------------------------------------------------------- --1415 //------------------------------------------------------------------------- 1419 1416 // Show the stripify panel. 1420 //------------------------------------------------------------------------- --1417 //------------------------------------------------------------------------- 1421 1418 void GeoMeshViewUI::showStripify() 1422 1419 { … … 1439 1436 } 1440 1437 1441 //------------------------------------------------------------------------- --1438 //------------------------------------------------------------------------- 1442 1439 // Hide the stripify panel. 1443 //------------------------------------------------------------------------- --1440 //------------------------------------------------------------------------- 1444 1441 void GeoMeshViewUI::hideStripify() 1445 1442 { … … 1462 1459 } 1463 1460 1464 //------------------------------------------------------------------------- --1461 //------------------------------------------------------------------------- 1465 1462 // Show the Simplify Edge Collapse panel. 1466 //------------------------------------------------------------------------- --1463 //------------------------------------------------------------------------- 1467 1464 void GeoMeshViewUI::showEdgeCollapse() 1468 1465 { … … 1512 1509 } 1513 1510 1514 //------------------------------------------------------------------------- --1511 //------------------------------------------------------------------------- 1515 1512 // Hide the Simplify Edge Collapse 1516 //------------------------------------------------------------------------- --1513 //------------------------------------------------------------------------- 1517 1514 void GeoMeshViewUI::hideEdgeCollapse() 1518 1515 { … … 1597 1594 } 1598 1595 1599 //------------------------------------------------------------------------- --1596 //------------------------------------------------------------------------- 1600 1597 // Hide the Simplify Leaves Collapse. 1601 //------------------------------------------------------------------------- --1598 //------------------------------------------------------------------------- 1602 1599 void GeoMeshViewUI::hideLeavesCollapse() 1603 1600 { … … 1638 1635 } 1639 1636 1640 //------------------------------------------------------------------------- --1637 //------------------------------------------------------------------------- 1641 1638 // Show the LodStrips Panel. 1642 //------------------------------------------------------------------------- --1639 //------------------------------------------------------------------------- 1643 1640 void GeoMeshViewUI::showOpenMeshSimplification() 1644 1641 { … … 1656 1653 } 1657 1654 1658 //------------------------------------------------------------------------- --1655 //------------------------------------------------------------------------- 1659 1656 // Hide the LodStrips Panel. 1660 //------------------------------------------------------------------------- --1657 //------------------------------------------------------------------------- 1661 1658 void GeoMeshViewUI::hideOpenMeshSimplification() 1662 1659 { … … 1674 1671 } 1675 1672 1676 //------------------------------------------------------------------------- --1673 //------------------------------------------------------------------------- 1677 1674 // Shows the auto generate LodStrips panel. 1678 //------------------------------------------------------------------------- --1675 //------------------------------------------------------------------------- 1679 1676 void GeoMeshViewUI::showAutoGenerateLodStrips() 1680 1677 { … … 1692 1689 } 1693 1690 1694 //------------------------------------------------------------------------- --1691 //------------------------------------------------------------------------- 1695 1692 // Shows the auto generate LodStrips panel. 1696 //------------------------------------------------------------------------- --1693 //------------------------------------------------------------------------- 1697 1694 void GeoMeshViewUI::showAutoGenerateLodTrees() 1698 1695 { … … 1710 1707 } 1711 1708 1712 //------------------------------------------------------------------------- --1709 //------------------------------------------------------------------------- 1713 1710 // Show the LodStrips visulization panel. 1714 //------------------------------------------------------------------------- --1711 //------------------------------------------------------------------------- 1715 1712 void GeoMeshViewUI::showLodStripSlider() 1716 1713 { … … 1719 1716 } 1720 1717 1721 //------------------------------------------------------------------------- --1718 //------------------------------------------------------------------------- 1722 1719 // Hide the LodStrips visualization panel. 1723 //------------------------------------------------------------------------- --1720 //------------------------------------------------------------------------- 1724 1721 void GeoMeshViewUI::hideLodStripSlider() 1725 1722 { … … 1728 1725 } 1729 1726 1730 //------------------------------------------------------------------------- --1727 //------------------------------------------------------------------------- 1731 1728 // Show the LodTree visulization panel. 1732 //------------------------------------------------------------------------- --1729 //------------------------------------------------------------------------- 1733 1730 void GeoMeshViewUI::showLodTreeSlider() 1734 1731 { … … 1737 1734 } 1738 1735 1739 //------------------------------------------------------------------------- --1736 //------------------------------------------------------------------------- 1740 1737 // Hide the LodTree visualization panel. 1741 //------------------------------------------------------------------------- --1738 //------------------------------------------------------------------------- 1742 1739 void GeoMeshViewUI::hideLodTreeSlider() 1743 1740 { … … 1746 1743 } 1747 1744 1748 //------------------------------------------------------------------------- --1745 //------------------------------------------------------------------------- 1749 1746 // Show the LodTrees Panel. 1750 //------------------------------------------------------------------------- --1747 //------------------------------------------------------------------------- 1751 1748 void GeoMeshViewUI::showOpenLeavesSimplification() 1752 1749 { … … 1758 1755 } 1759 1756 1760 //------------------------------------------------------------------------- --1757 //------------------------------------------------------------------------- 1761 1758 // Hide the LodTrees Panel. 1762 //------------------------------------------------------------------------- --1759 //------------------------------------------------------------------------- 1763 1760 void GeoMeshViewUI::hideOpenLeavesSimplification() 1764 1761 { … … 1770 1767 } 1771 1768 1772 //------------------------------------------------------------------------- -1769 //------------------------------------------------------------------------- 1773 1770 // Show the mesh info browser. 1774 //------------------------------------------------------------------------- -1771 //------------------------------------------------------------------------- 1775 1772 void GeoMeshViewUI::showMeshInfo() 1776 1773 { … … 1915 1912 } 1916 1913 1917 //------------------------------------------------------------------------- -1914 //------------------------------------------------------------------------- 1918 1915 // Hide the mesh info browser. 1919 //------------------------------------------------------------------------- -1916 //------------------------------------------------------------------------- 1920 1917 void GeoMeshViewUI::hideMeshInfo() 1921 1918 { … … 1924 1921 } 1925 1922 1926 //------------------------------------------------------------------------- -1923 //------------------------------------------------------------------------- 1927 1924 // Hide the right panel. 1928 //------------------------------------------------------------------------- -1925 //------------------------------------------------------------------------- 1929 1926 void GeoMeshViewUI::hideRightPanel() 1930 1927 { … … 1939 1936 } 1940 1937 1941 //------------------------------------------------------------------------- -1938 //------------------------------------------------------------------------- 1942 1939 // Get the number of vertices. 1943 //------------------------------------------------------------------------- -1940 //------------------------------------------------------------------------- 1944 1941 size_t GeoMeshViewUI::getVertexCount(Mesh *geoMesh) 1945 1942 { … … 1966 1963 } 1967 1964 1968 //------------------------------------------------------------------------- --1965 //------------------------------------------------------------------------- 1969 1966 // Get the number of triangles. 1970 //------------------------------------------------------------------------- --1967 //------------------------------------------------------------------------- 1971 1968 size_t GeoMeshViewUI::getTriangleCount(Geometry::Mesh *geoMesh) 1972 1969 { … … 2005 2002 } 2006 2003 2007 //------------------------------------------------------------------------- --2004 //------------------------------------------------------------------------- 2008 2005 // Get the number of strips. 2009 //------------------------------------------------------------------------- --2006 //------------------------------------------------------------------------- 2010 2007 size_t GeoMeshViewUI::getStripCount(Geometry::Mesh *geoMesh) 2011 2008 { … … 2031 2028 } 2032 2029 2033 //------------------------------------------------------------------------- --2030 //------------------------------------------------------------------------- 2034 2031 // It paints the submesh selected by the mMeshInfo tree. 2035 2032 // Trate the mMeshInfo event. 2036 //------------------------------------------------------------------------- --2033 //------------------------------------------------------------------------- 2037 2034 int GeoMeshViewUI::paintMesh(void) 2038 2035 { … … 2064 2061 } 2065 2062 2066 //------------------------------------------------------------------------- --2063 //------------------------------------------------------------------------- 2067 2064 // Simplify the mesh object. 2068 //------------------------------------------------------------------------- --2065 //------------------------------------------------------------------------- 2069 2066 bool GeoMeshViewUI::simplifyEdgeCollapse() 2070 2067 { 2071 2068 Real percent; 2069 2070 // Free memory. 2071 if (mMeshSimplifier != NULL) 2072 { 2073 delete mMeshSimplifier; 2074 } 2072 2075 2073 2076 // If input field empty. … … 2158 2161 } 2159 2162 2160 //------------------------------------------------------------------------- --2163 //------------------------------------------------------------------------- 2161 2164 // Simplify the mesh object. 2162 //------------------------------------------------------------------------- --2165 //------------------------------------------------------------------------- 2163 2166 void GeoMeshViewUI::simplifyLeavesCollapse() 2164 2167 { … … 2219 2222 } 2220 2223 2221 //------------------------------------------------------------------------- --2224 //------------------------------------------------------------------------- 2222 2225 // Create a simplification sequence of the simplification method. 2223 //------------------------------------------------------------------------- --2226 //------------------------------------------------------------------------- 2224 2227 void GeoMeshViewUI::createSimplificationSequence() 2225 2228 { … … 2233 2236 } 2234 2237 2235 //------------------------------------------------------------------------- --2238 //------------------------------------------------------------------------- 2236 2239 // Create a simplification sequence of the leaves. 2237 //------------------------------------------------------------------------- --2240 //------------------------------------------------------------------------- 2238 2241 void GeoMeshViewUI::createLeavesSequence(const std::string &filename) 2239 2242 { … … 2248 2251 } 2249 2252 2250 //------------------------------------------------------------------------- --2253 //------------------------------------------------------------------------- 2251 2254 // Stripify the mesh object. 2252 //------------------------------------------------------------------------- --2255 //------------------------------------------------------------------------- 2253 2256 void GeoMeshViewUI::stripify() 2254 2257 { … … 2318 2321 } 2319 2322 2320 //------------------------------------------------------------------------- --2323 //------------------------------------------------------------------------- 2321 2324 // Method that undo then mesh changes. 2322 //------------------------------------------------------------------------- --2325 //------------------------------------------------------------------------- 2323 2326 void GeoMeshViewUI::undo() 2324 2327 { … … 2347 2350 } 2348 2351 2349 //------------------------------------------------------------------------- --2352 //------------------------------------------------------------------------- 2350 2353 // Refresh number of vertices, triangles, strips, ... 2351 //------------------------------------------------------------------------- --2354 //------------------------------------------------------------------------- 2352 2355 void GeoMeshViewUI::refreshApplicationBar() 2353 2356 { … … 2399 2402 } 2400 2403 2401 //------------------------------------------------------------------------- --2404 //------------------------------------------------------------------------- 2402 2405 // Initialize the lodstripslibrary for visualization. 2403 //------------------------------------------------------------------------- --2406 //------------------------------------------------------------------------- 2404 2407 void GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData *loddata, Mesh *geomesh) 2405 2408 { … … 2426 2429 } 2427 2430 2428 //------------------------------------------------------------------------- --2431 //------------------------------------------------------------------------- 2429 2432 // Initialize the lodTreelibrary for visualization. 2430 //------------------------------------------------------------------------- --2433 //------------------------------------------------------------------------- 2431 2434 void GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh/*, uint32 ileafSubMesh*/) 2432 2435 { … … 2455 2458 } 2456 2459 2457 //------------------------------------------------------------------------- --2460 //------------------------------------------------------------------------- 2458 2461 // Open a mesh file. 2459 //------------------------------------------------------------------------- --2462 //------------------------------------------------------------------------- 2460 2463 void GeoMeshViewUI::openMeshFile(void) 2461 2464 { … … 2594 2597 } 2595 2598 2596 //------------------------------------------------------------------------- --2599 //------------------------------------------------------------------------- 2597 2600 // If file exists. 2598 //------------------------------------------------------------------------- --2601 //------------------------------------------------------------------------- 2599 2602 bool GeoMeshViewUI::fileExists(const char *fileNameMesh) 2600 2603 { … … 2614 2617 } 2615 2618 2616 / ******************/2617 / * Constructor */2618 / ******************/2619 //------------------------------------------------------------------------- 2620 // Constructor 2621 //------------------------------------------------------------------------- 2619 2622 GeoMeshViewUI::GeoMeshViewUI(TIPOFUNC fun) 2620 2623 { … … 2628 2631 mGeoMesh = NULL; 2629 2632 mUndoMesh = NULL; 2633 2634 // Initialize mesh simplifier. 2635 mMeshSimplifier = NULL; 2630 2636 2631 2637 // Initialize the lod strip object. … … 3130 3136 } 3131 3137 3132 / ****************/3133 / * Destroyer */3134 / ****************/3138 //------------------------------------------------------------------------- 3139 // Destructor. 3140 //------------------------------------------------------------------------- 3135 3141 GeoMeshViewUI::~GeoMeshViewUI() 3136 3142 { … … 3139 3145 } 3140 3146 3147 //------------------------------------------------------------------------- 3141 3148 // Shows the main window. 3149 //------------------------------------------------------------------------- 3142 3150 void GeoMeshViewUI::show() 3143 3151 { 3144 3152 } 3145 3153 3154 //------------------------------------------------------------------------- 3146 3155 // Build Textures menu. 3156 //------------------------------------------------------------------------- 3147 3157 void GeoMeshViewUI::BuildLoadTextureSubMeshMenu(void) 3148 3158 {
Note: See TracChangeset
for help on using the changeset viewer.