Changeset 986 for GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs
- Timestamp:
- 05/25/06 14:26:04 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.cpp
r985 r986 26 26 SimplificationMethod::~SimplificationMethod() 27 27 { 28 /* for (std::vector<qslim::pair_info*>::iterator it=pointers_to_remove.begin(); it!=pointers_to_remove.end(); it++)29 {30 if (*it!=NULL)31 {32 delete *it;33 *it=NULL;34 }35 }36 */37 38 28 delete heap; 39 29 delete [] first_index_submesh; … … 1012 1002 1013 1003 mGeoMesh->mSubMeshCount = objmesh->mSubMeshCount; 1014 1004 1015 1005 // Memory allocation for the submeshes. 1016 1006 mGeoMesh->mSubMesh = new SubMesh[objmesh->mSubMeshCount]; … … 1030 1020 { 1031 1021 mGeoMesh->hasSkeleton = true; 1032 1022 1033 1023 strcpy(mGeoMesh->mSkeletonName,objmesh->mSkeletonName); 1034 1024 } … … 1047 1037 for (size_t i = 0; i < objmesh->mSubMeshCount; i++) 1048 1038 { 1049 mGeoMesh->mSubMesh[i].mSharedVertexBuffer = false;1050 1039 mGeoMesh->mSubMesh[i].mStripCount = 0; 1051 1040 mGeoMesh->mSubMesh[i].mStrip = NULL; 1052 1041 1042 mGeoMesh-> 1043 mSubMesh[i].mSharedVertexBuffer = false; 1044 1053 1045 strcpy( mGeoMesh->mSubMesh[i].mMaterialName, 1054 1046 objmesh->mSubMesh[i].mMaterialName); 1055 1047 1056 1048 // Copy submesh bones. … … 1060 1052 { 1061 1053 mGeoMesh->mSubMesh[i].mBones.push_back(objmesh-> 1062 1054 mSubMesh[i].mBones[j]); 1063 1055 } 1064 1056 } … … 1069 1061 mGeoMesh->mSubMesh[i].mIndexCount = ver_inds_rep_by_geo[i].size(); 1070 1062 mGeoMesh->mSubMesh[i].mIndex = new Index[mGeoMesh-> 1071 1063 mSubMesh[i].mIndexCount]; 1072 1064 1073 1065 // Store the indices. … … 1104 1096 mGeoMesh->mSubMesh[i].mVertexBuffer->mTexCoords = new Vector2[mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount]; 1105 1097 1106 for (MAPAINDIND::iterator mapit = unique_verts_inds_by_geo[i].begin(); mapit != unique_verts_inds_by_geo[i].end(); mapit++) 1098 for ( MAPAINDIND::iterator mapit = unique_verts_inds_by_geo[i].begin(); 1099 mapit != unique_verts_inds_by_geo[i].end(); 1100 mapit++) 1107 1101 { 1108 1102 // Key and value. … … 1133 1127 1134 1128 // Copy the leaves submesh indexes. 1135 for (unsigned int j=0; j<mGeoMesh->mSubMesh[i].mIndexCount; j++) 1129 for (unsigned int j=0; j<mGeoMesh->mSubMesh[i].mIndexCount; j++) 1136 1130 { 1137 1131 mGeoMesh->mSubMesh[i].mIndex[j]=objmesh->mSubMesh[i].mIndex[j]; … … 1147 1141 mGeoMesh->mSubMesh[i].mVertexBuffer->mNormal=new Vector3[mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount]; 1148 1142 mGeoMesh->mSubMesh[i].mVertexBuffer->mTexCoords=new Vector2[mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount]; 1149 1143 1150 1144 for ( unsigned int j = 0; 1151 1152 1145 j < mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; 1146 j++) 1153 1147 { 1154 1148 // Position. … … 1175 1169 // Store the simplification steps in MeshSimplificationSequence. 1176 1170 int acum = 0; 1177 1171 1178 1172 for (size_t i = 0; i < objmesh->mSubMeshCount; i++) 1179 1173 { … … 1186 1180 first_index_submesh[i] = acum; 1187 1181 } 1188 1182 1189 1183 acum += (int)objmesh->mSubMesh[i].mVertexBuffer->mVertexCount; 1190 1184 } 1191 1185 1192 1186 MeshSimplificationSequence::Step stepaux, newstep; 1193 1187 vector<int> v0,v1,submesh0,submesh1; 1194 1188 MeshSimplificationSequence *msimpseq; 1195 1189 1196 1190 msimpseq = new MeshSimplificationSequence(); 1197 1191 … … 1203 1197 v1 = vertexbuffermap[stepaux.mV1]; 1204 1198 submesh1 = submeshmap[stepaux.mV1]; 1205 1199 1206 1200 for (unsigned j = 0; j < v0.size(); j++) 1207 1201 { … … 1215 1209 newstep.y = stepaux.y; 1216 1210 newstep.z = stepaux.z; 1217 1211 1218 1212 // mT0 y mT1 are unique triangles identifiers 1219 1213 // returned by the simplification method 1220 1214 newstep.mT0 = stepaux.mT0; 1221 1215 newstep.mT1 = stepaux.mT1; 1222 1216 1223 1217 if (j == v0.size() - 1 && k == v1.size() - 1) 1224 1218 { … … 1229 1223 newstep.obligatorio = 1; 1230 1224 } 1231 1225 1232 1226 if (j == 0 && k == 0) 1233 1227 { … … 1240 1234 { 1241 1235 std::vector<Index> vvacio; 1242 1236 1243 1237 newstep.mModfaces = vvacio; 1244 1238 }
Note: See TracChangeset
for help on using the changeset viewer.