Changeset 986 for GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Timestamp:
- 05/25/06 14:26:04 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp
r985 r986 379 379 Mesh *Mesh::toSharedVertex() 380 380 { 381 382 381 // Move all vertex to the shared vertex buffer. 383 382 Mesh *mesh = new Mesh(); … … 500 499 501 500 acumVerts += long(mSubMesh[i].mVertexBuffer->mVertexCount); 501 502 // Copy submesh bones. 503 if (!mSubMesh[i].mBones.empty()) 504 { 505 for (unsigned int j = 0; j < mSubMesh[i].mBones.size(); j++) 506 { 507 mesh->mSubMesh[i].mBones.push_back(mSubMesh[i].mBones[j]); 508 } 509 } 510 511 } 512 513 // Copy skeleton name. 514 if (hasSkeleton) 515 { 516 mesh->hasSkeleton = true; 517 518 strcpy(mesh->mSkeletonName,mSkeletonName); 519 } 520 521 // Copy mesh bones. 522 if (!mBones.empty()) 523 { 524 for (unsigned int j = 0; j < mBones.size(); j++) 525 { 526 mesh->mBones.push_back(mBones[j]); 527 } 502 528 } 503 529 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp
r985 r986 8448 8448 { 8449 8449 v_indices = mi_vector[i]; 8450 geoSubMesh->mIndexCount += v_indices.size() + 2; 8451 8450 geoSubMesh->mIndexCount += v_indices.size() /*+ 2*/; 8451 8452 /* 8452 8453 // Insert a new vertex if the strip es odd. 8453 8454 if(oddStrip) … … 8465 8466 oddStrip = FALSE; 8466 8467 } 8468 */ 8467 8469 } 8468 8470 … … 8497 8499 //----------------------- 8498 8500 8499 8501 /* 8500 8502 // Number of vertices of a strip odd or even. 8501 8503 if(v_indices.size() % 2) … … 8507 8509 oddStrip = FALSE; 8508 8510 } 8511 */ 8509 8512 8510 8513 // Para todas las tiras menos la primera. 8511 for(i = 2; i <= num_tiras;i++)8514 for(i = 2; i <= num_tiras; i++) 8512 8515 { 8516 8513 8517 /* copia en el inicio de la tira el final de la anterior. 8514 8518 triangulos degenerados. */ 8519 /* 8515 8520 geoSubMesh->mIndex[totalStripIndices++] = geoSubMesh-> 8516 8521 mIndex[totalStripIndices-1]; 8522 */ 8517 8523 8518 8524 v_indices = mi_vector[i]; … … 8523 8529 triangulos degenerados. 8524 8530 */ 8531 8525 8532 geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8526 8533 … … 8529 8536 8530 8537 // Triangulo Degenerado. 8531 geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8532 8538 //geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8539 8540 /* 8533 8541 // Insert a new vertex if the strip es odd. 8534 8542 if(oddStrip) … … 8547 8555 oddStrip = FALSE; 8548 8556 } 8549 8557 */ 8558 8550 8559 // Copia la tira en curso en el array de indices. 8551 8560 for(j=1;j<v_indices.size();j++) -
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.