Changeset 1014 for GTP/trunk/Lib/Geom/shared/GeoTool
- Timestamp:
- 06/13/06 10:45:56 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GeoTool
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj
r998 r1014 82 82 <Tool 83 83 Name="VCCLCompilerTool" 84 Optimization=" 0"85 AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include "84 Optimization="2" 85 AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include;..\..\..\..\..\..\nongtp\Devil\include" 86 86 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN" 87 87 RuntimeLibrary="4" 88 BufferSecurityCheck="FALSE" 88 89 UsePrecompiledHeader="0" 89 90 WarningLevel="0" -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r1007 r1014 1231 1231 { 1232 1232 // Build the LOD file. 1233 case LODTREES_AUTO: 1233 case LODTREES_AUTO: 1234 1234 1235 1235 // Open file chooser dialog. 1236 1236 file_name = fltk::file_chooser("Build LOD","*",""); 1237 1237 1238 if (!file_name) 1239 { 1238 1240 break; 1241 } 1239 1242 1240 1243 std::cout << "Creando secuencia de simplificacion de hojas..."; 1244 1241 1245 createLeavesSequence(file_name+std::string(".leafseq")); 1246 1242 1247 std::cout << "OK!" << std::endl; 1243 1248 … … 1259 1264 delete auxTreeSimpSequence;*/ 1260 1265 1261 1262 1266 case LODSTRIPS_AUTO: 1263 1267 1264 // Builder1268 // Builder 1265 1269 if (!file_name) 1270 { 1266 1271 file_name = fltk::file_chooser("Build LOD","*",""); 1272 } 1273 1267 1274 // If a file was selected. 1268 1275 if (file_name) … … 1281 1288 1282 1289 // Loads a simplification sequence file. 1283 oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ)); 1290 oMeshSimpSequence->Load(Serializer( "SimplifSequence.txt", 1291 Serializer::READ)); 1284 1292 1285 1293 // If the simplification sequence and the mesh exist. … … 1291 1299 progress_function); 1292 1300 1293 oSerializer = new Serializer(strcat(file_name,".lod"),Serializer::Mode::WRITE); 1301 oSerializer = new Serializer( strcat(file_name,".lod"), 1302 Serializer::Mode::WRITE); 1294 1303 1295 1304 oLodStrip->Save(*oSerializer); … … 1314 1323 mesh_saver = new GeoMeshSaver(); 1315 1324 file_name[strlen(file_name) - 4] = '\0'; 1316 mesh_saver->save(mGeoMesh, strcat(file_name,".mesh")); 1325 1326 mesh_saver->save( mGeoMesh, 1327 strcat(file_name,".mesh")); 1328 1317 1329 delete mesh_saver; 1318 1319 1330 } 1320 1331 else … … 1362 1373 } 1363 1374 1364 1365 1375 //--------------------------------------------------------------------------- 1366 1376 // Lod Slider Callback for the foliage … … 1384 1394 } 1385 1395 1386 1387 1388 1396 //--------------------------------------------------------------------------- 1389 1397 // Mesh Info Callback … … 1402 1410 1403 1411 //--------------------------------------------------------------------------- 1404 // Logo Callback 1412 // Logo Callback. 1405 1413 //--------------------------------------------------------------------------- 1406 1414 inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) … … 1428 1436 1429 1437 //--------------------------------------------------------------------------- 1430 // Show the stripify panel 1438 // Show the stripify panel. 1431 1439 //--------------------------------------------------------------------------- 1432 1440 void GeoMeshViewUI::showStripify() … … 1451 1459 1452 1460 //--------------------------------------------------------------------------- 1453 // Hide the stripify panel 1461 // Hide the stripify panel. 1454 1462 //--------------------------------------------------------------------------- 1455 1463 void GeoMeshViewUI::hideStripify() … … 1474 1482 1475 1483 //--------------------------------------------------------------------------- 1476 // Show the Simplify Edge Collapse panel 1484 // Show the Simplify Edge Collapse panel. 1477 1485 //--------------------------------------------------------------------------- 1478 1486 void GeoMeshViewUI::showEdgeCollapse() … … 1562 1570 1563 1571 //--------------------------------------------------------------------------- 1564 // Show the Simlify Leaves Collapse 1572 // Show the Simlify Leaves Collapse. 1565 1573 //--------------------------------------------------------------------------- 1566 1574 void GeoMeshViewUI::showLeavesCollapse() … … 1606 1614 1607 1615 //--------------------------------------------------------------------------- 1608 // Hide the Simplify Leaves Collapse 1616 // Hide the Simplify Leaves Collapse. 1609 1617 //--------------------------------------------------------------------------- 1610 1618 void GeoMeshViewUI::hideLeavesCollapse() … … 1647 1655 1648 1656 //--------------------------------------------------------------------------- 1649 // Show the LodStrips Panel 1657 // Show the LodStrips Panel. 1650 1658 //--------------------------------------------------------------------------- 1651 1659 void GeoMeshViewUI::showOpenMeshSimplification() … … 1665 1673 1666 1674 //--------------------------------------------------------------------------- 1667 // Hide the LodStrips Panel 1675 // Hide the LodStrips Panel. 1668 1676 //--------------------------------------------------------------------------- 1669 1677 void GeoMeshViewUI::hideOpenMeshSimplification() … … 1683 1691 1684 1692 //--------------------------------------------------------------------------- 1685 // Shows the auto generate LodStrips panel 1693 // Shows the auto generate LodStrips panel. 1686 1694 //--------------------------------------------------------------------------- 1687 1695 void GeoMeshViewUI::showAutoGenerateLodStrips() … … 1696 1704 //mBuildBar->activate(); 1697 1705 } 1698 //--------------------------------------------------------------------------- 1699 // Shows the auto generate LodStrips panel 1706 1707 //--------------------------------------------------------------------------- 1708 // Shows the auto generate LodStrips panel. 1700 1709 //--------------------------------------------------------------------------- 1701 1710 void GeoMeshViewUI::showAutoGenerateLodTrees() … … 1712 1721 1713 1722 //--------------------------------------------------------------------------- 1714 // Show the LodStrips visulization panel 1723 // Show the LodStrips visulization panel. 1715 1724 //--------------------------------------------------------------------------- 1716 1725 void GeoMeshViewUI::showLodStripSlider() … … 1721 1730 1722 1731 //--------------------------------------------------------------------------- 1723 // Hide the LodStrips visualization panel 1732 // Hide the LodStrips visualization panel. 1724 1733 //--------------------------------------------------------------------------- 1725 1734 void GeoMeshViewUI::hideLodStripSlider() … … 1730 1739 1731 1740 //--------------------------------------------------------------------------- 1732 // Show the LodTree visulization panel 1741 // Show the LodTree visulization panel. 1733 1742 //--------------------------------------------------------------------------- 1734 1743 void GeoMeshViewUI::showLodTreeSlider() … … 1739 1748 1740 1749 //--------------------------------------------------------------------------- 1741 // Hide the LodTree visualization panel 1750 // Hide the LodTree visualization panel. 1742 1751 //--------------------------------------------------------------------------- 1743 1752 void GeoMeshViewUI::hideLodTreeSlider() … … 1747 1756 } 1748 1757 1749 1750 //--------------------------------------------------------------------------- 1751 // Show the LodTrees Panel 1758 //--------------------------------------------------------------------------- 1759 // Show the LodTrees Panel. 1752 1760 //--------------------------------------------------------------------------- 1753 1761 void GeoMeshViewUI::showOpenLeavesSimplification() … … 1761 1769 1762 1770 //--------------------------------------------------------------------------- 1763 // Hide the LodTrees Panel 1771 // Hide the LodTrees Panel. 1764 1772 //--------------------------------------------------------------------------- 1765 1773 void GeoMeshViewUI::hideOpenLeavesSimplification() … … 1773 1781 1774 1782 //--------------------------------------------------------------------------- 1775 // Show the mesh info browser 1783 // Show the mesh info browser. 1776 1784 //--------------------------------------------------------------------------- 1777 1785 void GeoMeshViewUI::showMeshInfo() … … 1879 1887 1880 1888 //--------------------------------------------------------------------------- 1881 // Hide the mesh info browser 1889 // Hide the mesh info browser. 1882 1890 //--------------------------------------------------------------------------- 1883 1891 void GeoMeshViewUI::hideMeshInfo() … … 1888 1896 1889 1897 //--------------------------------------------------------------------------- 1890 // Hide the right panel 1898 // Hide the right panel. 1891 1899 //--------------------------------------------------------------------------- 1892 1900 void GeoMeshViewUI::hideRightPanel() … … 1903 1911 1904 1912 //--------------------------------------------------------------------------- 1905 // Get the number of vertices 1913 // Get the number of vertices. 1906 1914 //--------------------------------------------------------------------------- 1907 1915 size_t GeoMeshViewUI::getVertexCount(Mesh *geoMesh) … … 1930 1938 1931 1939 //--------------------------------------------------------------------------- 1932 // Get the number of triangles 1940 // Get the number of triangles. 1933 1941 //--------------------------------------------------------------------------- 1934 1942 size_t GeoMeshViewUI::getTriangleCount(Geometry::Mesh *geoMesh) … … 1969 1977 1970 1978 //--------------------------------------------------------------------------- 1971 // Get the number of strips 1979 // Get the number of strips. 1972 1980 //--------------------------------------------------------------------------- 1973 1981 size_t GeoMeshViewUI::getStripCount(Geometry::Mesh *geoMesh) … … 1995 2003 1996 2004 //--------------------------------------------------------------------------- 1997 // It paints the submesh selected by the mMeshInfo tree 1998 // Trate the mMeshInfo event 2005 // It paints the submesh selected by the mMeshInfo tree. 2006 // Trate the mMeshInfo event. 1999 2007 //--------------------------------------------------------------------------- 2000 2008 int GeoMeshViewUI::paintMesh(void) … … 2008 2016 meshNumber = -1; 2009 2017 2010 // Shows the selected object label 2018 // Shows the selected object label. 2011 2019 strcpy(selectedTag,mMeshInfo->goto_focus()->label()); 2012 2020 2013 2021 p=strstr(selectedTag,"SubMesh "); 2014 2022 2015 // If the item begins with string "SubMesh" 2023 // If the item begins with string "SubMesh". 2016 2024 if (p!=NULL) 2017 2025 { … … 2032 2040 bool GeoMeshViewUI::simplifyEdgeCollapse() 2033 2041 { 2034 Real percent; 2035 2036 // If input field empty. 2037 if (mMeshReduction->fvalue() <= 0.0) 2038 { 2039 return false; 2040 } 2041 2042 geoMeshView->saveContext(); 2043 2044 // Debug. 2045 cout << "Mesh Reduction: " 2046 << mMeshReduction->fvalue() 2047 << endl; 2048 2049 // Gets simplify option. 2050 if (mGeometryBased->value()) 2051 { 2052 simplificationState = MESHSIMP; 2053 mMeshSimplifier = new GeometryBasedSimplifier(mGeoMesh, 2054 2055 progress_function); 2056 } 2057 else 2058 { 2059 simplificationState = VIEWPOINTDRIVEN; 2060 mMeshSimplifier = new ViewPointDrivenSimplifier(mGeoMesh, 2061 2062 progress_function); 2063 } 2064 2065 mMeshSimplifier->setMeshLeaves(idMeshLeaves); 2066 2067 if (mPercent->value()) 2068 { 2069 // Simplificación por porcentaje 2070 if (mMeshReduction->fvalue() <= 100.0 && 2071 mMeshReduction->fvalue() > 0.0) 2072 { 2073 percent = mMeshReduction->fvalue(); 2074 percent = percent / 100.0; 2075 2076 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2077 mMeshSimplifier->Simplify(percent); 2078 2079 // Deletes the previous mesh. 2080 delete mUndoMesh; 2081 2082 mUndoMesh = new Mesh(); 2083 2084 // Sets the undo mesh. 2085 *mUndoMesh = *mGeoMesh; 2086 2087 delete mGeoMesh; 2088 2089 mGeoMesh = mMeshSimplifier->GetMesh(); 2090 2091 // Visualize mesh. 2092 geoMeshView->setMesh(mGeoMesh); 2093 2094 } 2095 else 2096 { 2097 fltk::alert("Wrong value for simplification.\n" 2098 "Valid values [0..100]"); 2099 2100 return false; 2101 } 2102 } 2103 else 2104 { 2105 // Simplificar hasta un número de vértices. 2106 uint32 v = (uint32)mMeshReduction->fvalue(); 2107 2108 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2109 mMeshSimplifier->Simplify(v); 2110 2111 // Deletes the previous mesh. 2112 delete mUndoMesh; 2113 2114 mUndoMesh = new Mesh(); 2115 2116 // Sets the undo mesh. 2117 *mUndoMesh = *mGeoMesh; 2118 2119 delete mGeoMesh; 2120 2121 mGeoMesh = mMeshSimplifier->GetMesh(); 2122 2123 // Visualize the mesh. 2124 geoMeshView->setMesh(mGeoMesh); 2125 } 2126 2127 return true; 2042 Real percent; 2043 2044 // If input field empty. 2045 if (mMeshReduction->fvalue() <= 0.0) 2046 { 2047 return false; 2048 } 2049 2050 geoMeshView->saveContext(); 2051 2052 // Debug. 2053 cout << "Mesh Reduction: " 2054 << mMeshReduction->fvalue() 2055 << endl; 2056 2057 // Gets simplify option. 2058 if (mGeometryBased->value()) 2059 { 2060 simplificationState = MESHSIMP; 2061 mMeshSimplifier = new GeometryBasedSimplifier(mGeoMesh, 2062 progress_function); 2063 } 2064 else 2065 { 2066 simplificationState = VIEWPOINTDRIVEN; 2067 mMeshSimplifier = new ViewPointDrivenSimplifier(mGeoMesh, 2068 progress_function); 2069 } 2070 2071 mMeshSimplifier->setMeshLeaves(idMeshLeaves); 2072 2073 if (mPercent->value()) 2074 { 2075 // Simplificación por porcentaje 2076 if (mMeshReduction->fvalue() <= 100.0 && 2077 mMeshReduction->fvalue() > 0.0) 2078 { 2079 percent = mMeshReduction->fvalue(); 2080 percent = percent / 100.0; 2081 2082 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2083 mMeshSimplifier->Simplify(percent); 2084 2085 // Deletes the previous mesh. 2086 delete mUndoMesh; 2087 2088 mUndoMesh = new Mesh(); 2089 2090 // Sets the undo mesh. 2091 *mUndoMesh = *mGeoMesh; 2092 2093 delete mGeoMesh; 2094 2095 mGeoMesh = mMeshSimplifier->GetMesh(); 2096 2097 // Visualize mesh. 2098 geoMeshView->setMesh(mGeoMesh); 2099 } 2100 else 2101 { 2102 fltk::alert("Wrong value for simplification.\n" 2103 "Valid values [0..100]"); 2104 2105 return false; 2106 } 2107 } 2108 else 2109 { 2110 // Simplificar hasta un número de vértices. 2111 uint32 v = (uint32)mMeshReduction->fvalue(); 2112 2113 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2114 mMeshSimplifier->Simplify(v); 2115 2116 // Deletes the previous mesh. 2117 delete mUndoMesh; 2118 2119 mUndoMesh = new Mesh(); 2120 2121 // Sets the undo mesh. 2122 *mUndoMesh = *mGeoMesh; 2123 2124 delete mGeoMesh; 2125 2126 mGeoMesh = mMeshSimplifier->GetMesh(); 2127 2128 // Visualize the mesh. 2129 geoMeshView->setMesh(mGeoMesh); 2130 } 2131 2132 return true; 2128 2133 } 2129 2134
Note: See TracChangeset
for help on using the changeset viewer.