Changeset 891 for GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Timestamp:
- 05/04/06 12:56:05 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.