Changeset 2078 for GTP/trunk/Lib/Geom
- Timestamp:
- 02/05/07 13:11:33 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r1600 r2078 283 283 } 284 284 285 //------------------------------------------------------------------------- --285 //------------------------------------------------------------------------- 286 286 //Put in order vertex of Mesh from simplification sequence 287 //------------------------------------------------------------------------- --287 //------------------------------------------------------------------------- 288 288 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC upb) 289 289 { … … 292 292 unsigned long int t; 293 293 unsigned long int v; 294 long int vSig;295 long int k;294 long int vSig; 295 long int k; 296 296 VECTORVERTEX Vertices; 297 std::vector<tipoVertice> NuevosVerts; 297 298 std::vector<tipoVertice> NuevosVerts; 298 299 std::vector<std::vector<int> > NuevasTiras; 299 std::vector<int> tira; 300 tipoOrden Orden; 301 tipoOrden *Ord; 300 std::vector<int> tira; 301 302 tipoOrden Orden; 303 tipoOrden *Ord; 302 304 bool bEncontrado; 303 304 305 305 306 // Progress bar … … 308 309 long int update; 309 310 311 VertexBoneAssignment bone; 312 310 313 bEncontrado = false; 311 314 … … 348 351 // 3 seg. 349 352 //Ordenacion de los vertices 350 for (i = 0; i < Ordenacion.size(); i++)353 for (i = 0; i < Ordenacion.size(); i++) 351 354 { 352 355 if (update != (int)(i * increment)) … … 357 360 358 361 int OrdvQslim = Ordenacion[i].vQslim; 359 int OrdvQslimNext = Ordenacion[i].vQslimNext;362 //int OrdvQslimNext = Ordenacion[i].vQslimNext; 360 363 361 364 NuevosVerts.push_back(this->cVerts[OrdvQslim]); … … 421 424 Ordenacion[i].vLSNext = vSig; 422 425 } 426 427 // Bone reassignment. 428 for (size_t assig = 0; assig < mInitialMesh->mBones.size(); assig++) 429 { 430 if (mInitialMesh->mBones[assig].vertexIndex == Ordenacion[i].vQslim) 431 { 432 bone.vertexIndex = i; 433 bone.boneIndex = mInitialMesh->mBones[assig].boneIndex; 434 bone.weight = mInitialMesh->mBones[assig].weight; 435 436 mGeoMesh->mBones.push_back(bone); 437 } 438 } 423 439 } 424 440 … … 494 510 } 495 511 496 //------------------------------------------------------------------------- --512 //------------------------------------------------------------------------- 497 513 // Constructor of LodStripsConstructor object from 498 514 // a Mesh and MeshSimplificationSequence. 499 //------------------------------------------------------------------------- --515 //------------------------------------------------------------------------- 500 516 LodStripsConstructor::LodStripsConstructor(const Mesh *m, 501 517 const MeshSimplificationSequence *ms, … … 509 525 mGeoMesh = new Mesh(); 510 526 *mGeoMesh = *m; 511 527 528 // Initialize bones assignments. 529 mGeoMesh->mBones.clear(); 530 512 531 mInitialMesh = new Mesh(); 513 532 *mInitialMesh = *m; … … 524 543 } 525 544 526 //------------------------------------------------------------------------- --545 //------------------------------------------------------------------------- 527 546 // Destructor LodStripsConstructor object 528 //------------------------------------------------------------------------- --547 //------------------------------------------------------------------------- 529 548 LodStripsConstructor::~LodStripsConstructor() 530 549 { … … 540 559 541 560 delete [] vStrips; 542 543 561 delete [] vVerts; 544 562 … … 552 570 553 571 delete [] pCambios; 554 555 572 delete mInitialMesh; 556 573 delete mGeoMesh; 557 574 } 558 575 559 //------------------------------------------------------------------------- --576 //------------------------------------------------------------------------- 560 577 // Build lod file with necessary information and save all changes at 561 578 // lodStripConstructor object. 562 //------------------------------------------------------------------------- --579 //------------------------------------------------------------------------- 563 580 void LodStripsConstructor::Save(std::string filename) 564 581 { … … 594 611 this->TOTALINDICES = 0; 595 612 596 for (size_t i = 0; i < this->cStrips.size(); i++)613 for (size_t i = 0; i < this->cStrips.size(); i++) 597 614 { 598 615 this->TOTALINDICES += int(this->cStrips[i].size()); … … 602 619 // Changes 603 620 fwrite(&changesCount, sizeof(int), 1, f); 621 604 622 for(size_t i = 0; i < this->cCambios.size(); i++) 605 623 { … … 610 628 // Data. 611 629 fwrite(&dataCount, sizeof(int), 1, f); 630 612 631 for(size_t i = 0; i < this->cDatos.size(); i++) 613 632 { … … 967 986 968 987 //--------------------------------------------------------------------------- 969 // Sort submesh bones. 970 //--------------------------------------------------------------------------- 988 // Update mesh. 989 //--------------------------------------------------------------------------- 990 <<<<<<< .mine 991 ======= 971 992 void LodStripsConstructor::sortBones() 972 993 { … … 1021 1042 } 1022 1043 1044 >>>>>>> .r2077 1023 1045 void LodStripsConstructor::UpdateMesh(void) 1024 1046 { … … 1216 1238 } 1217 1239 1218 //------------------------------------------------------------------------- --1240 //------------------------------------------------------------------------- 1219 1241 // Add new vertices to mesh. 1220 //------------------------------------------------------------------------- --1242 //------------------------------------------------------------------------- 1221 1243 void LodStripsConstructor::AddNewVertices() 1222 1244 { 1223 int num_vertices; 1224 SubMesh *geosubmesh; 1245 size_t num_vertices; 1246 size_t bones_count; 1247 SubMesh *geosubmesh; 1225 1248 VertexBuffer *vertex_buffer; 1226 1249 VertexBuffer *new_vertex_buffer; 1250 1251 vector<VertexBoneAssignment>::iterator it; 1227 1252 1228 1253 // Gets old vertex buffer. … … 1255 1280 } 1256 1281 1257 1258 1282 // Copy new vertices. 1259 1283 std::vector<VertexBoneAssignment> newbones; 1260 1284 for (unsigned int i = 0; i < mGeoMeshSQ->mNewVertices.size(); i++) 1261 1285 { 1262 new_vertex_buffer->mPosition[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].position; 1263 new_vertex_buffer->mTexCoords[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].texcoord; 1264 new_vertex_buffer->mNormal[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].normal; 1265 1266 // check if my twin-vertex-bone has a bone assignment 1267 // we check only the GeoMesh bones because the lodstrips only works for sharedvertex bones 1268 for (std::vector<VertexBoneAssignment>::iterator it = mGeoMesh->mBones.begin(); it != mGeoMesh->mBones.end(); it ++) 1269 { 1286 new_vertex_buffer->mPosition[num_vertices + i] = 1287 mGeoMeshSQ->mNewVertices[i].position; 1288 1289 new_vertex_buffer->mTexCoords[num_vertices + i] = 1290 mGeoMeshSQ->mNewVertices[i].texcoord; 1291 1292 new_vertex_buffer->mNormal[num_vertices + i] = 1293 mGeoMeshSQ->mNewVertices[i].normal; 1294 1295 // Initialize number of bones. 1296 bones_count = mInitialMesh->mBones.size(); 1297 1298 // Check if my twin-vertex-bone has a bone assignment 1299 // we check only the GeoMesh bones because the lodstrips 1300 // only works for sharedvertex bones 1301 for (int bone = 0; bone < bones_count; bone++) 1302 { 1303 it = mInitialMesh->mBones.begin() + bone; 1304 1270 1305 if (it->vertexIndex == mGeoMeshSQ->mNewVertices[i].bonefrom) 1271 1306 { 1272 1307 VertexBoneAssignment vba; 1308 <<<<<<< .mine 1309 1310 vba.boneIndex = it->boneIndex; 1311 vba.vertexIndex = mGeoMeshSQ->mNewVertices[i].id; 1312 vba.weight = it->weight; 1313 1314 mInitialMesh->mBones.push_back(vba); 1315 bones_count++; 1316 ======= 1273 1317 vba.boneIndex = it->boneIndex; 1274 1318 vba.vertexIndex = mGeoMeshSQ->mNewVertices[i].id; 1275 1319 vba.weight = it->weight; 1276 1320 newbones.push_back(vba); 1321 >>>>>>> .r2077 1277 1322 } 1278 1323 }
Note: See TracChangeset
for help on using the changeset viewer.