Changeset 891 for GTP/trunk/Lib/Geom
- Timestamp:
- 05/04/06 12:56:05 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMesh.h
r774 r891 46 46 SubMesh *mSubMesh; ///< Array of subMesehs 47 47 size_t mSubMeshCount; ///< Total count of subMeshes 48 MeshType mType; ///< Type of mesh49 48 50 49 //OSCAR -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimplifier.h
r774 r891 65 65 }; 66 66 67 /// Implementation of a simplification algorithm based on images.68 /** This class implements a simplification algorithm based on a n imageevaluation technique. */69 class ImageBasedSimplifier : public MeshSimplifier67 /// Implementation of a simplification algorithm based on viewpoint. 68 /** This class implements a simplification algorithm based on a viewpoint evaluation technique. */ 69 class ViewPointDrivenSimplifier : public MeshSimplifier 70 70 { 71 private: 72 71 73 public: 72 74 /// Class constructor. Will call Simplifier class constructor. 73 ImageBasedSimplifier (const Geometry::Mesh *,75 ViewPointDrivenSimplifier (const Geometry::Mesh *, 74 76 Geometry::TIPOFUNC upb=0); 75 77 76 78 /// Class destructor. 77 virtual ~ ImageBasedSimplifier (void);79 virtual ~ViewPointDrivenSimplifier (void); 78 80 79 81 /// Copy constructor 80 // ImageBasedSimplifier(const ImageBasedSimplifier&);82 //ViewPointDrivenSimplifier(const ViewPointDrivenSimplifier&); 81 83 82 84 /// Assignment operator 83 // ImageBasedSimplifier& operator =(const ImageBasedSimplifier&);85 //ViewPointDrivenSimplifier& operator =(const ViewPointDrivenSimplifier&); 84 86 85 87 /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. Implements the Simplifier::Simplify method to perform an image based simplification. -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoSubMesh.h
r826 r891 9 9 #include "GeoSerializable.h" 10 10 11 namespace Geometry { 11 namespace Geometry 12 { 12 13 13 14 /// SubMesh interface -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r841 r891 1065 1065 Index *aux = this->geoMesh->mSubMesh[i].mStrip[j]; 1066 1066 1067 /* 1067 1068 if (j != 0) 1068 1069 { … … 1072 1073 indice_acum++; 1073 1074 } 1075 */ 1074 1076 1075 1077 if (j+1 < this->geoMesh->mSubMesh[i].mStripCount) … … 1087 1089 } 1088 1090 1089 tira.pop_back(); 1091 //tira.pop_back(); 1092 1090 1093 this->cStrips.push_back(tira); 1091 1094 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r829 r891 540 540 541 541 // If the strips is not the first. 542 /* 542 543 if (strip != 0) 543 544 { 544 545 indexBegin++; 545 546 } 547 */ 546 548 547 549 // If is the final strip … … 557 559 558 560 // Remove degenerated 559 indexEnd--;561 //indexEnd--; 560 562 } 561 563 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp
r826 r891 6 6 //---------------------------------------------------------------------------- 7 7 Mesh::Mesh(): 8 mVertexBuffer(0), mSubMeshCount(0), mSubMesh(0) , mType(GEO_TRIANGLE_LIST)8 mVertexBuffer(0), mSubMeshCount(0), mSubMesh(0) 9 9 { 10 10 } … … 21 21 // constructor copia 22 22 mVertexBuffer=new VertexBuffer(); 23 mType=objmesh.mType;24 23 mSubMeshCount=objmesh.mSubMeshCount; 25 24 mSubMesh = new Geometry::SubMesh[objmesh.mSubMeshCount]; … … 121 120 bool copiados = false; // indica si los vértices compartidos han sido copiados 122 121 mVertexBuffer = new VertexBuffer(); 123 mType = objmesh.mType;124 122 mSubMeshCount = objmesh.mSubMeshCount; 125 123 mSubMesh = new Geometry::SubMesh[objmesh.mSubMeshCount]; … … 321 319 322 320 mesh->mVertexBuffer=new VertexBuffer(); 323 mesh->mType=this->mType;324 321 mesh->mSubMeshCount = this->mSubMeshCount; 325 322 // Reserva memoria para los submeshes -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
r774 r891 42 42 } 43 43 44 ImageBasedSimplifier::ImageBasedSimplifier (const Geometry::Mesh *m,44 GeometryBasedSimplifier::GeometryBasedSimplifier (const Geometry::Mesh *m, 45 45 Geometry::TIPOFUNC upb) 46 46 :MeshSimplifier(m,upb) … … 48 48 } 49 49 50 ImageBasedSimplifier::~ImageBasedSimplifier()50 GeometryBasedSimplifier::~GeometryBasedSimplifier() 51 51 { 52 52 } 53 53 54 54 // Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. Implements the Simplifier::Simplify method to perform an image based simplification. 55 void ImageBasedSimplifier::Simplify (Geometry::Real paramlod)55 void GeometryBasedSimplifier::Simplify (Geometry::Real paramlod) 56 56 { 57 57 SimplificationMethod *m_qslim = new SimplificationMethod(objmesh); … … 65 65 66 66 // Starts the simplification process. Receives as a parameter the number of vertices of the resulting mesh. Implements the Simplifier::Simplify method to perform an image based simplification. 67 void ImageBasedSimplifier::Simplify (Geometry::uint32 numvertices)67 void GeometryBasedSimplifier::Simplify (Geometry::uint32 numvertices) 68 68 { 69 69 SimplificationMethod *m_qslim = new SimplificationMethod(objmesh); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp
r826 r891 73 73 size_t index_count; 74 74 size_t strip_count; 75 size_t strip_index_count; 75 76 SubMesh *geosubmesh; 76 77 primitive_vector PrimitivesVector; … … 82 83 for (int submesh = 0; submesh < mGeoMesh->mSubMeshCount; submesh++) 83 84 { 84 // If is not the Leaveas submesh. 85 if (submesh != mSubMeshLeaves) 85 // Gets the submesh. 86 geosubmesh = &mGeoMesh->mSubMesh[submesh]; 87 88 // Free index vector. 89 Indices.clear(); 90 91 // Progress bar increment. 92 increment = 20 / mGeoMesh->mSubMeshCount; 93 increment = increment / geosubmesh->mIndexCount; 94 update = 0.0; 95 96 // For each index. 97 for (int index = 0; index < geosubmesh->mIndexCount; index++) 86 98 { 87 88 // Gets the submesh. 89 geosubmesh = &mGeoMesh->mSubMesh[submesh]; 90 91 // Free index vector. 92 Indices.clear(); 93 94 // Progress bar increment. 95 increment = 20 / mGeoMesh->mSubMeshCount; 96 increment = increment / geosubmesh->mIndexCount; 97 update = 0.0; 98 99 // For each index. 100 for (int index = 0; index < geosubmesh->mIndexCount; index++) 101 { 102 // Update progress bar. 103 if (mUPB) 99 // Update progress bar. 100 if (mUPB) 101 { 102 update = update + increment; 103 104 if (update > 0.9) 104 105 { 105 update = update + increment; 106 107 if (update > 0.9) 108 { 109 mUPB(1.0); 110 111 update = 0; 112 } 106 mUPB(1.0); 107 108 update = 0; 113 109 } 114 115 // Add an index. 116 Indices.push_back(geosubmesh->mIndex[index]); 117 } 118 119 // we want to time the tri_stripper object destruction as well. 120 tri_stripper TriStripper(Indices); 121 122 // Sets the progress bar function for stripper algorithm. 123 TriStripper.SetProgressFunc(mUPB,60/mGeoMesh->mSubMeshCount); 124 125 TriStripper.SetMinStripSize(2); 126 TriStripper.SetCacheSize(32); 127 //TriStripper.SetBackwardSearch(false); 128 129 TriStripper.Strip(&PrimitivesVector); 130 131 // Free submesh indices. 132 delete [] geosubmesh->mIndex; 133 134 // Initialize index count. 135 geosubmesh->mIndexCount = 0; 136 137 // Initialize strip count. 138 strip_count = 0; 139 140 // For each strip or triangle list. 141 for (size_t i = 0; i < PrimitivesVector.size(); ++i) 142 { 143 if (PrimitivesVector[i].Type == TRIANGLE_STRIP) 110 } 111 112 // Add an index. 113 Indices.push_back(geosubmesh->mIndex[index]); 114 } 115 116 // we want to time the tri_stripper object destruction as well. 117 tri_stripper TriStripper(Indices); 118 119 // Sets the progress bar function for stripper algorithm. 120 TriStripper.SetProgressFunc(mUPB,60/mGeoMesh->mSubMeshCount); 121 122 TriStripper.SetMinStripSize(2); 123 TriStripper.SetCacheSize(32); 124 //TriStripper.SetBackwardSearch(false); 125 126 TriStripper.Strip(&PrimitivesVector); 127 128 // Free submesh indices. 129 delete [] geosubmesh->mIndex; 130 131 // Initialize index count. 132 geosubmesh->mIndexCount = 0; 133 134 // Initialize strip count. 135 strip_count = 0; 136 137 // For each strip or triangle list. 138 for (size_t strip = 0; strip < PrimitivesVector.size(); ++strip) 139 { 140 if (PrimitivesVector[strip].Type == TRIANGLE_STRIP) 141 { 142 strip_count++; 143 144 // Gets the index count. 145 strip_index_count = PrimitivesVector[strip].Indices.size(); 146 147 // Adds indices of the current strip to total index count. 148 geosubmesh->mIndexCount += strip_index_count; 149 } 150 else 151 { 152 strip_count += PrimitivesVector[strip].Indices.size() / 3; 153 154 geosubmesh->mIndexCount += PrimitivesVector[strip].Indices.size(); 155 } 156 157 } 158 159 // Reserve memory for strips list. 160 geosubmesh->mStrip = new Index*[strip_count]; 161 geosubmesh->mStripCount = strip_count; 162 163 // Reserve memory for indices. 164 geosubmesh->mIndex = new Index[geosubmesh->mIndexCount]; 165 166 // Initialize index count. 167 index_count = 0; 168 169 // For each strip. 170 for (size_t strip = 0; strip < PrimitivesVector.size(); strip++) 171 { 172 if (PrimitivesVector[strip].Type == TRIANGLE_STRIP) 173 { 174 // Asigns the beginning of the strip. 175 geosubmesh->mStrip[strip] = &geosubmesh->mIndex[index_count]; 176 177 // Gets the index count of the current strip. 178 strip_index_count = PrimitivesVector[strip].Indices.size(); 179 180 181 // Fill up the index array. 182 for ( size_t index = 0; 183 index < PrimitivesVector[strip].Indices.size(); 184 index++) 144 185 { 145 strip_count++; 146 geosubmesh->mIndexCount += PrimitivesVector[i].Indices.size(); 147 148 // Degenerate triangles. 149 geosubmesh->mIndexCount += 2; 186 geosubmesh->mIndex[index + index_count] = PrimitivesVector[strip].Indices[index]; 150 187 } 151 else 152 { 153 strip_count += PrimitivesVector[i].Indices.size()/3; 154 155 geosubmesh->mIndexCount += PrimitivesVector[i].Indices.size(); 156 157 // Degenerate triangles. 158 geosubmesh->mIndexCount += 2*(PrimitivesVector[i].Indices.size()/3); 159 } 160 161 } 162 163 // Reserve memory for strips list. 164 geosubmesh->mStrip = new Index*[strip_count]; 165 geosubmesh->mStripCount = strip_count; 166 167 // Adjust the index count. 168 geosubmesh->mIndexCount -= 2; 169 170 // Reserve memory for indices. 171 geosubmesh->mIndex = new Index[geosubmesh->mIndexCount]; 172 173 // Initialize index count. 174 index_count = 0; 175 176 // For each strip. 177 for (size_t strip = 0; strip < PrimitivesVector.size(); strip++) 178 { 179 if (PrimitivesVector[strip].Type == TRIANGLE_STRIP) 188 189 // Adds the current strip size to index count. 190 index_count += PrimitivesVector[strip].Indices.size(); 191 } 192 else 193 { 194 // For each index. 195 for ( size_t itri = 0; 196 itri < PrimitivesVector[strip].Indices.size() / 3; 197 itri ++) 180 198 { 181 199 // Asigns the beginning of the strip. 182 geosubmesh->mStrip[strip] = &geosubmesh->mIndex[index_count]; 183 184 // If is not the first strip. 185 if (strip != 0) 186 { 187 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[0]; 188 } 189 190 // Fill up the index array. 191 for ( size_t index = 0; 192 index < PrimitivesVector[strip].Indices.size(); 193 index++) 194 { 195 geosubmesh->mIndex[index + index_count] = PrimitivesVector[strip].Indices[index]; 196 } 197 198 // Adds the current strip size to index count. 199 index_count += PrimitivesVector[strip].Indices.size(); 200 201 if ((strip + 1) != strip_count) 202 { 203 // Degenerate triangle. 204 geosubmesh->mIndex[index_count++] = geosubmesh->mIndex[index_count - 1]; 205 } 200 geosubmesh->mStrip[strip + itri] = &geosubmesh->mIndex[index_count]; 201 202 // Triangle indeces. 203 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+0]; 204 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+1]; 205 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+2]; 206 206 207 } 207 else 208 { 209 // For each index. 210 for ( size_t itri = 0; 211 itri < PrimitivesVector[strip].Indices.size() / 3; 212 itri ++) 213 { 214 // Asigns the beginning of the strip. 215 geosubmesh->mStrip[strip + itri] = &geosubmesh->mIndex[index_count]; 216 217 // Degenerate triangle. 218 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+0]; 219 220 // Triangle indeces. 221 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+0]; 222 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+1]; 223 geosubmesh->mIndex[index_count++] = PrimitivesVector[strip].Indices[itri*3+2]; 224 225 // If is not the last strip. 226 if ((strip + itri + 1) != strip_count) 227 { 228 geosubmesh->mIndex[index_count++] = geosubmesh->mIndex[index_count - 1]; 229 } 230 } 231 232 } 233 } 234 235 // Sets the actual submesh type to triangle strips. 236 geosubmesh->mType = GEO_TRIANGLE_STRIPS; 237 208 } 238 209 } 210 211 // Sets the actual submesh type to triangle strips. 212 geosubmesh->mType = GEO_TRIANGLE_STRIPS; 239 213 } 240 214 … … 245 219 } 246 220 247 248 221 // All wright. 249 222 return 1; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/SimplificationMethod.cpp
r774 r891 963 963 *mesh=new Geometry::Mesh(); 964 964 (*mesh)->mVertexBuffer = new Geometry::VertexBuffer(); 965 (*mesh)->mType=objmesh->mType;965 //(*mesh)->mType=objmesh->mType; 966 966 967 967 (*mesh)->mSubMeshCount = objmesh->mSubMeshCount; -
GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h
r826 r891 166 166 167 167 // Writes the strips list. 168 SubMesh* GeoMeshLoader::BuildStripsGeoSubMesh(SubMesh* geoSubMesh); 168 SubMesh* GeoMeshLoader::BuildStripsGeoSubMesh(SubMesh *geoSubMesh); 169 170 // Remove degenerate triangles of a submesh given. 171 SubMesh * removeDegenerateTriangles(SubMesh *geoSubMesh); 169 172 170 173 public: -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp
r826 r891 858 858 } 859 859 860 // Remove degenerate triangles of a submesh given. 861 geoSubMesh = removeDegenerateTriangles(geoSubMesh); 862 863 return geoSubMesh; 864 } 865 866 // Remove degenerate triangles of a submesh given. 867 SubMesh * GeoMeshLoader::removeDegenerateTriangles(SubMesh *geoSubMesh) 868 { 869 Index *indices; 870 Index *index; 871 Index *indexBegin; 872 Index *indexEnd; 873 Index *new_strip_starts; 874 size_t new_index_count; 875 size_t current_index; 876 877 // Stores the new starts of strips. 878 new_strip_starts = new Index[geoSubMesh->mStripCount]; 879 880 // Calculate the new index count. 881 new_index_count = geoSubMesh->mIndexCount 882 - 883 (2 * geoSubMesh->mStripCount) 884 + 885 2; 886 887 // Auxiliar index array. 888 indices = new Index[new_index_count]; 889 890 // Initialize the current index; 891 current_index = 0; 892 893 // For each one of the strips. 894 for (int strip = 0; strip < geoSubMesh->mStripCount; strip++) 895 { 896 // Stars of strip without degenerate triangles. 897 new_strip_starts[strip] = current_index; 898 899 // First index of the strip. 900 indexBegin = geoSubMesh->mStrip[strip]; 901 902 // If is the final strip 903 if (strip == (geoSubMesh->mStripCount - 1)) 904 { 905 // The end of the index array. 906 indexEnd = &geoSubMesh->mIndex[geoSubMesh->mIndexCount]; 907 } 908 else 909 { 910 // The beginning of the next strip. 911 indexEnd = geoSubMesh->mStrip[strip + 1]; 912 } 913 914 int i; 915 i = 0; 916 917 // If is not the first strip. 918 if (strip != 0) 919 { 920 indexBegin++; 921 } 922 923 // If is not the last strip. 924 if (strip != (geoSubMesh->mStripCount - 1)) 925 { 926 indexEnd--; 927 } 928 929 // For each index of the strip. 930 for (index = indexBegin; index < indexEnd; index++) 931 { 932 indices[current_index++] = indexBegin[i]; 933 934 // Increments i. 935 i++; 936 } 937 938 } 939 940 // Free Index memory. 941 delete []geoSubMesh->mIndex; 942 943 // Update index count. 944 geoSubMesh->mIndexCount = new_index_count; 945 946 geoSubMesh->mIndex = new Index[new_index_count]; 947 948 // Store new index array without degenerate triangles. 949 for (size_t i = 0; i < geoSubMesh->mIndexCount; i++) 950 { 951 geoSubMesh->mIndex[i] = indices[i]; 952 } 953 954 // Free auxiliar index array; 955 delete []indices; 956 957 // Update start of the strip. 958 for (int strip = 0; strip < geoSubMesh->mStripCount; strip++) 959 { 960 geoSubMesh->mStrip[strip] = &geoSubMesh->mIndex[new_strip_starts[strip]]; 961 } 962 963 // Free auxiliar strip starts. 964 delete []new_strip_starts; 965 860 966 return geoSubMesh; 861 967 } -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
r826 r891 194 194 unsigned long indexCount; 195 195 String materialName; 196 Index *index; 197 Index *indexBegin; 198 Index *indexEnd; 196 199 197 200 // Debug. … … 219 222 indexCount = geoSubMesh->mIndexCount; 220 223 224 // If the submesh is in triangle strips. 225 if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS) 226 { 227 indexCount += 2 * geoSubMesh->mStripCount - 2; 228 } 229 221 230 writeInts(indexCount, 1); 222 231 … … 229 238 << endl; 230 239 231 // Write the index array. 232 for (int i = 0; i < geoSubMesh->mIndexCount; i++) 233 { 234 writeInts(geoSubMesh->mIndex[i], 1); 240 // If the submesh is in triangle strips. 241 if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS) 242 { 243 // Debug. 244 cout << "Write triangle strips" 245 << endl; 246 247 // For each one of the strips. 248 for (int strip = 0; strip < geoSubMesh->mStripCount; strip++) 249 { 250 // First index of the strip. 251 indexBegin = geoSubMesh->mStrip[strip]; 252 253 // If is the final strip 254 if (strip == (geoSubMesh->mStripCount - 1)) 255 { 256 // The end of the index array. 257 indexEnd = &geoSubMesh->mIndex[geoSubMesh->mIndexCount]; 258 } 259 else 260 { 261 // The beginning of the next strip. 262 indexEnd = geoSubMesh->mStrip[strip + 1]; 263 } 264 265 int i; 266 i = 0; 267 268 if (strip != 0) 269 { 270 writeInts(indexBegin[i], 1); 271 } 272 273 // For each index of the strip. 274 for (index = indexBegin; index < indexEnd; index++) 275 { 276 writeInts(indexBegin[i], 1); 277 278 // Increments i. 279 i++; 280 } 281 282 if (strip != (geoSubMesh->mStripCount - 1)) 283 { 284 writeInts(indexBegin[i - 1], 1); 285 } 286 287 } 288 } 289 // If the submesh is in triangle list. 290 else 291 { 292 // Write the index array. 293 for (int i = 0; i < geoSubMesh->mIndexCount; i++) 294 { 295 writeInts(geoSubMesh->mIndex[i], 1); 296 } 235 297 } 236 298 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r842 r891 17 17 // Loads a mesh file. 18 18 openMeshFile(); 19 20 // Debug.21 cout << "Vertex Count SubMesh 0: "22 << mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount23 << endl;24 //----------------------------------------------------------25 19 26 20 // Deactive Lod strip visualization. … … 854 848 inline void GeoMeshViewUI::cb_mButtonProcess_i(fltk::Button*, void*) 855 849 { 850 bool error; 856 851 Mesh *mesh_aux; 857 852 … … 860 855 mProcessBar->position(0); 861 856 857 // Initialize error flag. 858 error = false; 859 862 860 // If there is a mesh object. 863 861 if (mGeoMesh != NULL) … … 877 875 case EDGE_COLLAPSE: 878 876 877 // Check submeshes for triangles strips. 878 for (int i = 0; i < mGeoMesh->mSubMeshCount; i++) 879 { 880 // If current submesh is in triangle strips. 881 if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS) 882 { 883 error = true; 884 } 885 } 886 879 887 // if the mesh is stripified. 880 if ( mGeoMesh->mType == GEO_TRIANGLE_STRIPS)888 if (error) 881 889 { 882 890 fltk::alert("Can't simplify a mesh in triagle strips."); … … 903 911 case LODSTRIPS_AUTO: 904 912 913 // Check submeshes for triangles strips. 914 for (int i = 0; i < mGeoMesh->mSubMeshCount; i++) 915 { 916 // If current submesh is in triangle strips. 917 if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS) 918 { 919 error = true; 920 } 921 } 922 905 923 // if the mesh is stripified. 906 if ( mGeoMesh->mType == GEO_TRIANGLE_STRIPS)924 if (error) 907 925 { 908 926 fltk::alert("Can't simplify a mesh in triagle strips."); … … 1617 1635 geoSubMesh = &geoMesh->mSubMesh[submesh]; 1618 1636 1619 switch (geo Mesh->mType)1637 switch (geoSubMesh->mType) 1620 1638 { 1621 1639 case GEO_TRIANGLE_LIST: … … 1643 1661 strip_count = 0; 1644 1662 1645 if (geoMesh->mType == GEO_TRIANGLE_STRIPS) 1646 { 1647 // For each submesh. 1648 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 1663 // For each submesh. 1664 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 1665 { 1666 // Gets the actual submesh. 1667 geoSubMesh = &geoMesh->mSubMesh[submesh]; 1668 1669 if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS) 1649 1670 { 1650 // Gets the actual submesh.1651 geoSubMesh = &geoMesh->mSubMesh[submesh];1652 1653 1671 strip_count += geoSubMesh->mStripCount; 1654 1672 } 1655 1673 } 1674 1656 1675 return strip_count; 1657 1676 } … … 1699 1718 simplificacionState = QSLIM; 1700 1719 1701 mMeshSimplifier = new ImageBasedSimplifier(mGeoMesh, progress_function);1720 mMeshSimplifier = new GeometryBasedSimplifier(mGeoMesh, progress_function); 1702 1721 1703 1722 mMeshSimplifier->setMeshLeaves(idMeshLeaves); … … 1765 1784 void GeoMeshViewUI::simplifyLeavesCollapse() 1766 1785 { 1767 uint32 vi; 1768 1786 bool error; 1787 uint32 vi; 1788 1789 // Initialize error flag. 1790 error = false; 1791 1792 // Check submeshes for triangles strips. 1793 for (int i = 0; i < mGeoMesh->mSubMeshCount; i++) 1794 { 1795 // If current submesh is in triangle strips. 1796 if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS) 1797 { 1798 error = true; 1799 } 1800 } 1801 1769 1802 // if the mesh is stripified. 1770 if ( mGeoMesh->mType == GEO_TRIANGLE_STRIPS)1803 if (error) 1771 1804 { 1772 1805 fltk::alert("Can't simplify a tree in triagle strips."); … … 1842 1875 void GeoMeshViewUI::stripify() 1843 1876 { 1877 bool error; 1844 1878 char char_value[10]; 1845 1879 CustomStripifier *geoStripifier; 1846 1880 1881 // Initialize error flag. 1882 error = false; 1883 1884 // Check submeshes for triangles strips. 1885 for (int i = 0; i < mGeoMesh->mSubMeshCount; i++) 1886 { 1887 // If current submesh is in triangle strips. 1888 if (mGeoMesh->mSubMesh[i].mType == GEO_TRIANGLE_STRIPS) 1889 { 1890 error = true; 1891 } 1892 } 1893 1847 1894 // if the mesh is stripified. 1848 if ( mGeoMesh->mType == GEO_TRIANGLE_STRIPS)1895 if (error) 1849 1896 { 1850 1897 fltk::alert("The mesh is already in strips.");
Note: See TracChangeset
for help on using the changeset viewer.