Changeset 1017 for GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Timestamp:
- 06/15/06 11:50:48 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r1014 r1017 5 5 6 6 using namespace Geometry; 7 7 8 8 9 //-------------------------------------------------------------------------- … … 23 24 } 24 25 25 //---------------------------------------------------------------------------- 26 // It makes Lods changes and count them.27 //---------------------------------------------------------------------------- 26 //----------------------------------------------------------------------------------- 27 //It makes Lods changes and count them 28 //----------------------------------------------------------------------------------- 28 29 void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb) 29 30 { 31 // LODPosition pos; 32 // vector <LODPosition> listaPos; 30 33 long int k; 31 34 long int i; … … 34 37 unsigned long int v; 35 38 long int p0; 39 long int lod = 0; 36 40 long int sigue; 37 unsigned long int lod = 0; 38 long int ac[3] = {0,0,0}; 41 long int ac[3] = {0,0,0}; 39 42 long int totalRegs = 0; 40 43 long int RegsCambios; 41 vector <VECTORINT> TiraOriginal;44 ObjList<ObjList<int> > TiraOriginal; 42 45 LODData regLOD; 43 LODChanges listaCambios; 44 45 // Progress bar. 46 //LODChanges listaCambios; 47 ObjList<LODData> listaCambios; 46 48 float percent; 47 49 float increment; 48 50 long int update; 49 51 50 VECTORINT::iterator it;51 VECTORINT::iterator itFin;52 vector <VECTORINT>::iterator itTiras;53 vector <VECTORINT>::iterator itTirasFin;54 VECTORVERTEX::iterator itVertex;55 VECTORVERTEX::iterator itVertexFin;56 57 52 // Saves original copy. 58 53 TiraOriginal = this->cStrips; … … 62 57 listaCambios.clear(); 63 58 64 // Progress bar.65 59 // Initialize increment. 66 60 increment = 0.0; … … 75 69 percent = 1.0; 76 70 77 this->LodsDisp = this->TOTALCAMBIOS ;//= lod;71 this->LodsDisp = this->TOTALCAMBIOS = lod; 78 72 pCambios = new uint32[this->TOTALCAMBIOS]; 79 73 pCambios[0] = 0; 80 74 81 listaCambios.reserve(this->TOTALCAMBIOS * 2); 82 cDatos.reserve(this->TOTALCAMBIOS * 2 * 2); 83 84 printf("\nEmpiezan los cambios...%d",this->TOTALCAMBIOS); 85 86 for ( lod = 0, itVertex = this->cVerts.begin(); 87 lod < this->TOTALCAMBIOS; 88 lod++, itVertex++) 89 { 90 // Progress bar. 91 if (update != (int)(increment * lod)) 75 for (lod = 0; ((this->cVerts[lod].Next) != -1); lod++) 76 { 77 /* if (update != (int)(increment * lod)) 92 78 { 93 79 update = (int)(increment * lod); 94 80 upb(percent); 95 } 96 97 /* 98 if ((lod % 100)==0) 99 { 100 printf("*%d*",lod); 101 } 102 */ 103 104 RegsCambios = 0; 105 106 // Last strip. 107 itTirasFin = this->cStrips.end(); 108 109 for(t = 0, itTiras = this->cStrips.begin(); 110 itTiras != itTirasFin; 111 itTiras++, t++) 112 { 81 }*/ 82 83 tipoVertice & cVertsLOD = this->cVerts[lod]; 84 85 RegsCambios = 0; 86 regLOD.obligatory = this->Ordenacion[lod].obligatorio; 87 88 for(t = 0; t < this->cStrips.size(); t++) 89 { 90 91 ObjList<int> & cStripsT = this->cStrips[t]; 92 113 93 // Initialize. 114 94 regLOD.strip = this->MARCAVACIO; … … 117 97 totalRegs = 0; 118 98 119 // Last index of the current strip. 120 itFin = itTiras->end(); 121 122 for ( it = itTiras->begin(), v = 0; 123 it != itFin; 124 it++, v++) 125 { 126 if ((*it) == lod) 127 { 99 for (v = 0; v < cStripsT.size(); v++) 100 { 101 if (cStripsT[v] == lod) 102 { 128 103 // Strips. 129 104 if (regLOD.strip == this->MARCAVACIO) … … 136 111 cDatos.push_back(v); 137 112 138 *it = itVertex->Next;113 cStripsT[v] = cVertsLOD.Next; 139 114 } 140 115 } … … 148 123 r = 0; 149 124 sigue = 0; 150 k = long(itTiras->size() - 3); 151 it = itTiras->begin(); 152 125 k = long(cStripsT.size()-3); 126 153 127 while (i < k) 154 128 { 155 if ( ((*it) == (*(it + 1))) && ((*(it + 1)) == (*(it + 2)))) 156 { 129 if ( (cStripsT[i] == cStripsT[i+1]) 130 && 131 (cStripsT[i+1] == cStripsT[i+2]) 132 ) 133 { 157 134 // Saves beginning of repetition. 158 135 if (!r) … … 161 138 } 162 139 163 itTiras->erase(itTiras->begin() + i); 140 cStripsT.eraseAtPos(i); 141 //this->cStrips[t].erase(this->cStrips[t].begin()+i); 164 142 i--; 165 it--;166 143 r++; 167 144 168 if ((i + 1) != (itTiras->size() - 1))145 if ((i+1) != cStripsT.size()-1) 169 146 { 170 147 sigue = 1; … … 194 171 195 172 r = 0; 196 k = long( itTiras->size() - r -3);173 k = long(cStripsT.size()-r-3); 197 174 } 198 175 199 176 i++; 200 it++;201 177 } 202 178 … … 208 184 r = 0; 209 185 sigue = 0; 210 k = long( itTiras->size() - 4);186 k = long(cStripsT.size() - 4); 211 187 212 it = itTiras->begin();213 214 188 while (i < k) 215 189 { 216 if (((*it) == (*(it + 2))) && ((*(it + 1)) == (*(it + 3)))) 190 if ( (cStripsT[i] == cStripsT[i+2]) 191 && 192 (cStripsT[i+1] == cStripsT[i+3]) 193 ) 217 194 { 218 195 if (!r) … … 221 198 } 222 199 223 itTiras->erase(itTiras->begin() + i); 224 itTiras->erase(itTiras->begin() + i); 225 200 cStripsT.eraseAtPos(i); 201 //this->cStrips[t].erase(this->cStrips[t].begin()+i); 202 cStripsT.eraseAtPos(i); 203 //this->cStrips[t].erase(this->cStrips[t].begin()+i); 226 204 r++; 227 205 228 206 i -= 2; 229 207 230 it--; 231 it--; 208 if ((i+1) != cStripsT.size()-3) 209 { 210 sigue = 1; 211 } 212 else 213 { 214 sigue = 0; 215 } 232 216 233 if ((i + 1) != itTiras->size() - 3)234 {235 sigue = 1;236 }237 else238 {239 sigue = 0;240 }241 217 } 242 218 else … … 258 234 259 235 r = 0; 260 k = long( itTiras->size() - 4 - 2 * r);236 k = long((cStripsT.size()-4-2*r)); 261 237 } 262 238 263 239 i++; 264 it++;265 240 } 266 241 … … 277 252 }// End for lod. 278 253 279 printf("\nFin de los cambios...");280 281 254 this->cCambios = listaCambios; 282 255 283 256 // Guardar el numero de LODS disponibles. 284 //this->TOTALCAMBIOS = this->LodsDisp=lod;257 this->TOTALCAMBIOS = this->LodsDisp=lod; 285 258 286 259 //Retornar a la lista original … … 291 264 //Put in order vertex of Mesh from simplification sequence 292 265 //----------------------------------------------------------------------- 266 #include <time.h> 293 267 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC upb) 294 268 { … … 298 272 unsigned long int v; 299 273 long int vSig; 300 //long int k;274 long int k; 301 275 VECTORVERTEX Vertices; 302 VECTORVERTEXNuevosVerts;303 vector <VECTORINT> NuevasTiras;304 VECTORINT tira;305 VECTORINT::iterator it;306 VECTORINT::iterator itFin;276 ObjList<tipoVertice> NuevosVerts; 277 //vector <VECTORINT> NuevasTiras; 278 ObjList<ObjList<int> > NuevasTiras; 279 // VECTORINT tira; 280 ObjList<int> tira; 307 281 vector <Index> mV1Aux; 308 282 tipoOrden Orden; 309 283 tipoOrden *Ord; 310 tipoOrden *Ord2;311 284 bool bEncontrado; 312 285 long int c1; 313 286 long int c2; 314 315 // Progress bar. 287 // Progress bar 316 288 float percent; 317 289 float increment; 318 290 long int update; 319 291 320 unsigned long int totalSize;321 322 292 bEncontrado = false; 323 293 324 printf("\n---->Lectura de Ordenacion"); 325 326 totalSize = (long int)this->geoMeshSQ->mSteps.size(); 294 int mStepsSize = geoMeshSQ->mSteps.size(); 327 295 328 296 c1 = 0; 329 297 c2 = 0; 330 298 331 // Progress bar.332 299 update = -1; 333 300 percent = 1.0; 334 increment = (float)(10.0) / (float) (totalSize);335 336 for (i = 0; i < totalSize; i++)301 increment = (float)(10.0) / (float)mStepsSize; 302 303 for (i = 0; i < mStepsSize; i++) 337 304 { 338 305 if (update != (int)(i * increment)) … … 342 309 } 343 310 344 mV1Aux.push_back(this->geoMeshSQ->mSteps[i].mV1); 345 346 Orden.vQslimNext = this->geoMeshSQ->mSteps[i].mV0; 347 Orden.vQslim = this->geoMeshSQ->mSteps[i].mV1; 348 Orden.obligatorio = this->geoMeshSQ->mSteps[i].obligatorio; 311 const Geometry::MeshSimplificationSequence::Step & theStep = this->geoMeshSQ->mSteps[i]; 312 313 mV1Aux.push_back(theStep.mV1); 314 315 Orden.vQslimNext = theStep.mV0; 316 Orden.vQslim = theStep.mV1; 317 Orden.obligatorio = theStep.obligatorio; 349 318 Orden.vLS = i; 350 319 351 Orden.x = th is->geoMeshSQ->mSteps[i].x;320 Orden.x = theStep.x; 352 321 Orden.vLSNext = -1; 353 322 Orden.cambio = "n"; … … 355 324 Ordenacion.push_back(Orden); 356 325 } 357 326 358 327 this->NumVertsRepetidos = c2; 359 328 360 printf("\n---->Cambiar vertices con x!0, Verts: %d",Ordenacion.size()); 329 update = -1; 330 increment = (float)(10.0) / (float)(Ordenacion.size()); 331 percent = 1.0; 361 332 362 333 // Change all vertices that have x != 0. 363 totalSize = (long int)Ordenacion.size(); 364 Ord = &(Ordenacion[0]); 365 366 // Progress bar. 367 update = -1; 368 increment = (float)(10.0) / (float)(totalSize); 369 percent = 1.0; 370 371 // Change all vertices that have x != 0. 372 for(i = 0; i < totalSize; i++) 373 { 374 // Progress bar. 334 for(i = 0; i < Ordenacion.size(); i++) 335 { 375 336 if (update != (int)(i * increment)) 376 337 { … … 379 340 } 380 341 381 if (Ord->x != 0) 342 Ord = &(Ordenacion[i]); 343 344 if (Ord->x!=0) 382 345 { 383 346 // Change the simplification order. … … 385 348 Ord->vQslim = Ord->vQslimNext; 386 349 Ord->vQslimNext = v; 387 Ord2 = &(Ordenacion[i + 1]); 388 389 for (j = i + 1; j < totalSize; j++,Ord2++) 390 { 391 if (Ord2->vQslim == Ord->vQslim) 392 { 393 Ord2->vQslim = Ord->vQslimNext; 394 Ord2->cambio = "y"; 395 } 396 else if (Ord2->vQslimNext == Ord->vQslim) 397 { 398 Ord2->vQslimNext = Ord->vQslimNext; 399 Ord2->cambio = "y"; 400 } 401 } 402 } 403 404 Ord++; 405 } 406 407 printf("\n---->Nuevos vertices"); 408 409 totalSize = (long int)Ordenacion.size(); 410 Ord = &(Ordenacion[0]); 411 412 // Progress bar. 350 351 for (j = i+1; j < Ordenacion.size(); j++) 352 { 353 tipoOrden & ordJ = Ordenacion[j]; 354 if (ordJ.vQslim == Ord->vQslim) 355 { 356 ordJ.vQslim = Ord->vQslimNext; 357 ordJ.cambio = "y"; 358 } 359 else if (ordJ.vQslimNext == Ord->vQslim) 360 { 361 ordJ.vQslimNext = Ord->vQslimNext; 362 ordJ.cambio = "y"; 363 } 364 } 365 } 366 } 367 413 368 update = -1; 414 increment = (float)(10.0) / (float)( totalSize);369 increment = (float)(10.0) / (float)(Ordenacion.size()); 415 370 percent = 1.0; 416 371 417 // Vertex sort.418 for(i = 0; i < totalSize; i++)419 {420 // Progress bar.372 // 3 seg. 373 //Ordenacion de los vertices 374 for(i = 0; i < Ordenacion.size(); i++) 375 { 421 376 if (update != (int)(i * increment)) 422 377 { … … 426 381 427 382 c1++; 428 NuevosVerts.push_back(this->cVerts[Ord->vQslim]); 429 430 cVerts[Ord->vQslim].Next = -1; 431 432 //-------- 433 Ord++; 434 //-------- 435 } 436 437 printf( "\n---->Meter los que no se simplifican -> Ahora Hay: %d", 438 Ordenacion.size()); 439 440 // Adds new vertices not in NuevosVerts. 383 NuevosVerts.push_back(this->cVerts[Ordenacion[i].vQslim]); 384 385 cVerts[Ordenacion[i].vQslim].Next = -1; 386 387 } 388 389 // Añadir aquellos vertices que no estaban en NuevosVerts 390 // y no se simplificaban. 441 391 int cont = 0; 442 392 int contestaban = 0; 443 393 444 for(i = 0; i < this->cVerts.size(); i++) 394 int cVertsSize = this->cVerts.size(); 395 for(i = 0; i < cVertsSize; i++) 445 396 { 446 397 if (this->cVerts[i].Next != -1) … … 462 413 } 463 414 464 totalSize = (long int)Ordenacion.size();465 466 printf("\n---->Siguientes QSLIM: %d",totalSize);467 468 // Progress bar.469 415 update = -1; 470 increment = (float)(10.0) / (float)( totalSize);416 increment = (float)(10.0) / (float)(Ordenacion.size()); 471 417 percent = 1.0; 472 418 473 // Obtain nexts. 474 if (totalSize > 0) 475 { 476 Ord = &(Ordenacion[0]); 477 } 478 479 for (i = 0; i < totalSize; i++) 480 { 481 // Progress bar. 419 // 2 min. 420 // Calcular los siguiente teniendo en cuenta el QSLIM. 421 for (i = 0; i < Ordenacion.size(); i++) 422 { 482 423 if (update != (int)(i * increment)) 483 424 { … … 486 427 } 487 428 488 v = Ord->vQslimNext; 429 v = Ordenacion[i].vQslimNext; 430 431 //Buscar ese vertice v cual es ahora 489 432 vSig = 0; 490 Ord2 = &(Ordenacion[0]); 491 492 for (t = 0; (t < totalSize) && !vSig; t++) 493 { 494 if (Ord2->vQslim == v) 495 { 496 vSig = Ord2->vLS; 497 } 498 499 Ord2++; 500 } 501 502 if (vSig != 0) 503 { 504 Ord->vLSNext = vSig; 505 } 506 507 Ord++; 508 } 509 510 printf("\n---->Crear nuevas de tiras"); 511 512 /* 513 // Create new strips with same dimensions. 514 for(t = 0; t < this->cStrips.size(); t++) 433 434 for (t = 0; t < Ordenacion.size() && !vSig;t++) 435 { 436 if (Ordenacion[t].vQslim==v) 437 { 438 vSig=Ordenacion[t].vLS; 439 } 440 } 441 442 if (vSig!=0) 443 { 444 Ordenacion[i].vLSNext = vSig; 445 } 446 } 447 448 //Creacion de nuevas tiras con las mismas dimensiones 449 int cStripsSize = this->cStrips.size(); 450 for(t = 0; t < cStripsSize; t++) 515 451 { 516 452 tira.clear(); 517 453 518 itFin = this->cStrips[t].end(); 519 520 for(it = cStrips[t].begin(); it != itFin; it++) 521 { 522 // For each new vertex. 523 for (v = 0; v < NuevosVerts.size(); v++) 524 { 525 Ord = &(Ordenacion[v]); 526 527 if ((*it) == Ord->vQslim) 528 { 529 tira.push_back(v); 530 531 // Delete vertex inserted. 532 //NuevosVerts.erase(v); 533 } 534 } 535 } 454 int cStripsSizeT = this->cStrips[t].size(); 455 for(i = 0; i < cStripsSizeT; i++) 456 tira.push_back(0); 536 457 537 458 NuevasTiras.push_back(tira); 538 459 } 539 */ 540 541 //Creacion de nuevas tiras con las mismas dimensiones 542 for(t = 0; t < this->cStrips.size(); t++) 543 { 544 tira.clear(); 545 546 for(i = 0; i < this->cStrips[t].size(); i++) 547 { 548 tira.push_back(0); 549 } 550 551 NuevasTiras.push_back(tira); 552 } 553 554 update = long(NuevosVerts.size() / 40); 555 percent = 0.5; 460 461 update = -1; 462 increment = (float)(20.0) / (float)(NuevosVerts.size()); 463 percent = 1.0; 464 465 k = 0; 556 466 557 467 // 2 min. 558 468 //Cambiar los vertices de las tiras 559 for(v = 0; v < NuevosVerts.size(); v++) 560 { 561 if ((v % update) == 0) 562 { 469 int NuevosVertsSize = NuevosVerts.size(); 470 for(v = 0; v < NuevosVertsSize; v++) 471 { 472 if (update != (int)(v * increment)) 473 { 474 update = (int)(v * increment); 563 475 upb(percent); 564 } 565 566 for(t = 0; t < this->cStrips.size(); t++) 567 { 568 for(i = 0; i < this->cStrips[t].size(); i++) 569 { 570 if (this->cStrips[t][i] == Ordenacion[v].vQslim) 571 { 572 NuevasTiras[t][i] = v; 573 } 574 } 575 } 576 } 577 578 printf("\n---->Copiar los datos"); 579 580 // Change to new strips. 476 } 477 478 const tipoOrden & OrdenacionV = Ordenacion[v]; 479 480 for(t = 0; t < cStrips.size(); t++) 481 { 482 ObjList<int> & thisStrip = cStrips[t]; 483 ObjList<int> & NuevasTirasT = NuevasTiras[t]; 484 int cStripsSizeT = thisStrip.size(); 485 for(i = 0; i < cStripsSizeT; i++) 486 { 487 if (thisStrip[i] == OrdenacionV.vQslim) 488 { 489 k++; 490 NuevasTirasT[i] = v; 491 } 492 } 493 } 494 } 495 496 //Cambiar a Tiras Nuevas 581 497 this->cStrips = NuevasTiras; 582 498 583 // Same size for NuevosVerts and Ordenacion. 584 this->TOTALCAMBIOS = 0; 585 586 totalSize = (long int)NuevosVerts.size(); 587 588 // For each new vertex. 589 for(i = 0; i < totalSize; i++) 499 //NuevosVerts y Ordenacion = tamaño. 500 NuevosVertsSize = NuevosVerts.size(); 501 for(i = 0; i < NuevosVertsSize; i++) 590 502 { 591 503 NuevosVerts[i].Next = Ordenacion[i].vLSNext; 592 593 if ((this->TOTALCAMBIOS == 0) && (NuevosVerts[i].Next == -1))594 {595 this->TOTALCAMBIOS = i;596 }597 504 } 598 505 599 506 //Cambiar cVerts por nuevosVerts. 600 507 this->cVerts = NuevosVerts; 601 602 printf( "--->Vertices: %d * Cambios: %d",603 NuevosVerts.size(),604 this->TOTALCAMBIOS);605 508 606 509 //percent = 100.0; … … 626 529 this->geoMesh = new Geometry::Mesh(); 627 530 *this->geoMesh = *m; 628 this->geoMeshSQ = ms;531 this->geoMeshSQ = const_cast<MeshSimplificationSequence*>(ms); 629 532 630 533 // Set the leaves submesh. 631 534 mSubMeshLeaves = submesh; 632 633 634 535 this->GenerarModeloCompleto(upb); 635 536 } … … 643 544 delete [] vDatos; 644 545 delete [] vCambios; 645 vector <LODData> cCambiosTemp; 646 cCambios.swap(cCambiosTemp); 647 648 VECTORUNINT cDatosTemp; 649 cDatos.swap(cDatosTemp); 546 /* vector <LODData> cCambiosTemp; 547 cCambios.swap(cCambiosTemp);*/ 548 cCambios.clear(); 549 550 /* VECTORUNINT cDatosTemp; 551 cDatos.swap(cDatosTemp);*/ 552 cDatos.clear(); 650 553 651 554 delete [] vStrips; … … 653 556 delete [] vVerts; 654 557 655 vector <VECTORINT> cStripsTemp; 656 cStrips.swap(cStripsTemp);; 657 658 VECTORVERTEX cVertsTemp; 659 cVerts.swap(cVertsTemp); 558 // vector <VECTORINT> cStripsTemp; 559 // cStrips.swap(cStripsTemp);; 560 cStrips.clear(); 561 562 // VECTORVERTEX cVertsTemp; 563 // cVerts.swap(cVertsTemp); 564 cVerts.clear(); 660 565 661 566 delete [] pCambios; … … 713 618 oSerializer.WriteData(simp,sizeof(char),strlen(simp)); 714 619 } 715 716 620 // Lines starting with a b. 717 621 // Data. … … 853 757 } 854 758 759 760 855 761 int indice_acum = 0; 856 762 for(i=0;i<this->geoMesh->mSubMeshCount;i++) 857 763 { 858 for (size_t ind=0; ind < meshoriginal->mSubMesh[i].mIndexCount; ind++) 859 { 860 if (meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 764 Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i]; 765 Geometry::SubMesh & geoMeshSubMesh = this->geoMesh->mSubMesh[i]; 766 767 for (size_t ind=0; ind < subMesh.mIndexCount; ind++) 768 { 769 Index indIndex = subMesh.mIndex[ind]; 770 if (subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 861 771 { 862 772 //Hay coordenadas de textura y normales 863 if( meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)864 { 865 for (size_t indvo=0; indvo< this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)866 { 867 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))773 if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 774 { 775 for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 776 { 777 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 868 778 { 869 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mNormal[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mNormal[indvo]))779 if (igual(subMesh.mVertexBuffer->mNormal[indIndex],geoMeshSubMesh.mVertexBuffer->mNormal[indvo])) 870 780 { 871 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mTexCoords[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mTexCoords[indvo]))781 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo])) 872 782 { 873 this->geoMesh->mSubMesh[i].mIndex[ind]= int(indvo);//+indice_acum;783 geoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum; 874 784 } 875 785 } … … 879 789 else //Hay coordenadas de textura pero no hay normales 880 790 { 881 for (size_t indvo=0; indvo< this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)882 { 883 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))791 for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 792 { 793 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 884 794 { 885 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mTexCoords[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mTexCoords[indvo]))795 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo])) 886 796 { 887 this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;797 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 888 798 } 889 799 } … … 894 804 { 895 805 // No hay coordenadas de textura pero si normales 896 if( meshoriginal->mSubMesh[i].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL)897 { 898 for (size_t indvo=0; indvo< this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)899 { 900 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))806 if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 807 { 808 for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 809 { 810 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 901 811 { 902 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mNormal[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mNormal[indvo]))812 if (igual(subMesh.mVertexBuffer->mNormal[indIndex],geoMeshSubMesh.mVertexBuffer->mNormal[indvo])) 903 813 { 904 this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;814 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 905 815 } 906 816 } … … 909 819 else //No hay coordenadas de texturas ni normales 910 820 { 911 for (size_t indvo=0; indvo< this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; indvo++)912 { 913 if (igual( meshoriginal->mSubMesh[i].mVertexBuffer->mPosition[meshoriginal->mSubMesh[i].mIndex[ind]],this->geoMesh->mSubMesh[i].mVertexBuffer->mPosition[indvo]))821 for (size_t indvo=0; indvo<geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 822 { 823 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],geoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 914 824 { 915 this->geoMesh->mSubMesh[i].mIndex[ind]=int(indvo);//+indice_acum;825 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 916 826 } 917 827 } … … 920 830 } 921 831 } 922 832 923 833 } 924 834 … … 949 859 //de los vertices y los indices 950 860 //----------------------------------------------------------------------------------------------- 861 951 862 void LodStripsConstructor::GenerarModeloV(TIPOFUNC upb) 952 863 { … … 962 873 upb(percent); 963 874 964 // 6 min. 875 // 6 min. 965 876 this->OrdenarModeloVQSLIM(upb); 966 877 … … 979 890 980 891 this->MARCA = max + 1; 981 982 // 5 min.983 892 this->CalcularCambiosLODsVNuevaED(upb); 984 985 893 } 986 894 … … 1067 975 { 1068 976 tipoVertice vAux; 1069 VECTORINTtira;977 ObjList<int> tira; 1070 978 size_t i; 1071 979 size_t j; … … 1247 1155 // Error. 1248 1156 } 1249 1250 //---------------------------------------------1251 // Debug.1252 //---------------------------------------------1253 FILE *file_aux;1254 file_aux = fopen("StripsModel.txt","w");1255 for (unsigned int i = 0; i < cStrips.size(); i++)1256 {1257 for (unsigned int j = 0; j < cStrips[i].size(); j++)1258 {1259 fprintf(file_aux,"%d ",cStrips[i][j]);1260 }1261 fprintf(file_aux,"\n");1262 }1263 //---------------------------------------------1264 1265 1157 } 1266 1158
Note: See TracChangeset
for help on using the changeset viewer.