- Timestamp:
- 06/13/06 10:45:56 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
r1007 r1014 62 62 <Tool 63 63 Name="VCCLCompilerTool" 64 Optimization=" 0"64 Optimization="2" 65 65 AdditionalIncludeDirectories=".\src\libs;.\include;.\src\libs\vmi\include" 66 66 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GLEW_STATIC" 67 67 MinimalRebuild="TRUE" 68 BasicRuntimeChecks=" 3"68 BasicRuntimeChecks="0" 69 69 RuntimeLibrary="4" 70 70 UsePrecompiledHeader="0" 71 WarningLevel=" 3"71 WarningLevel="0" 72 72 Detect64BitPortabilityProblems="TRUE" 73 DebugInformationFormat=" 4"73 DebugInformationFormat="0" 74 74 CompileAs="2"/> 75 75 <Tool -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h
r980 r1014 14 14 namespace Geometry { 15 15 16 // Basic types16 // Basic types. 17 17 typedef float Real; 18 18 typedef unsigned int Index; … … 22 22 typedef std::string String; 23 23 24 // Vertex Info24 // Vertex Info. 25 25 static const unsigned short VERTEX_EMPTY = 0x00; 26 26 static const unsigned short VERTEX_POSITION = 0x01; … … 29 29 static const unsigned short VERTEX_ALL = VERTEX_POSITION | VERTEX_NORMAL | VERTEX_TEXCOORDS; 30 30 31 // Mmesh primitives31 // Mesh primitives. 32 32 typedef enum 33 33 { … … 36 36 } MeshType; 37 37 38 //OSCAR39 38 struct VertexBoneAssignment 40 39 { … … 57 56 }; 58 57 59 // 2006-02-1460 // Gustavo Puche.61 58 // Needed to update the progress bar. 62 59 typedef float updateProgressBar(float); … … 78 75 79 76 #endif 77 -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
r1009 r1014 50 50 51 51 /// LodStripsLibrary interface class. 52 /** This module contains functions that handle the levels of detail of the input multiresolution objects made of polygonal meshes. For any given resolution and object, this module returns a set of triangle strips representing the object at that resolution, that is, at the level of detail requested. These models use triangle strips to reduce storage usage and to speed up realistic rendering. 52 /** This module contains functions that handle the levels of detail 53 * of the input multiresolution objects made of polygonal meshes. 54 * For any given resolution and object, this module returns a set 55 * of triangle strips representing the object at that resolution, 56 * that is, at the level of detail requested. These models use 57 * triangle strips to reduce storage usage and to speed up realistic 58 * rendering. 53 59 \n\n 54 60 … … 58 64 59 65 Outputs:\n 60 - The module returns a strip set that represents the level of detail requested. 66 - The module returns a strip set that represents the level of 67 detail requested. 61 68 . 62 69 … … 65 72 { 66 73 private: 74 75 // The name of the object. 76 String mName; 67 77 68 String mName; /// The name of the object. 69 70 ///Structures with the data read from the file 71 ///We won't work with these structures 78 // Structures with the data read from the file 79 // We won't work with these structures 72 80 SmallIntVector mFileVertices; 73 81 std::vector <LODRegisterType> mFileChangesLOD; … … 75 83 LongVector mData; 76 84 77 ///Structures with the data to work with 78 SmallInt mTotalStrips; ///Total strips of the multiresolution object. 79 SmallInt mTotalVertices; ///Total vertices of the multiresolution object. 80 SmallInt mMaxVerticesLOD;///Number of vertices of the max LOD. 81 SmallInt mTotalChanges; ///Total changes of the multiresolution object. 82 SmallInt mLods; ///Available Lods. 83 SmallInt mMaxLod; ///Max level of detail. 84 SmallInt mMinLod; ///Min level of detail. 85 SmallInt mCurrentLod; ///Current Lod. 85 // Structures with the data to work with 86 87 // Total strips of the multiresolution object. 88 SmallInt mTotalStrips; 89 90 // Total vertices of the multiresolution object. 91 SmallInt mTotalVertices; 92 93 // Number of vertices of the max LOD. 94 SmallInt mMaxVerticesLOD; 95 96 // Total changes of the multiresolution object. 97 SmallInt mTotalChanges; 98 99 SmallInt mLods; // Available Lods. 100 SmallInt mMaxLod; // Max level of detail. 101 SmallInt mMinLod; // Min level of detail. 102 SmallInt mCurrentLod; // Current Lod. 86 103 87 104 // For the efficient version. … … 112 129 SmallIntVector *mStrips; 113 130 114 /// Constructor, receives as a parameter the name of the file including the multiresolution object. 131 /** Constructor, receives as a parameter the name of the file 132 * including the multiresolution object. 133 */ 115 134 LodStripsLibrary(std::string, Mesh *geomesh); 116 135 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r996 r1014 23 23 } 24 24 25 //---------------------------------------------------------------------------- -------26 // It makes Lods changes and count them27 //---------------------------------------------------------------------------- -------25 //---------------------------------------------------------------------------- 26 // It makes Lods changes and count them. 27 //---------------------------------------------------------------------------- 28 28 void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb) 29 29 { 30 // LODPosition pos;31 // vector <LODPosition> listaPos;32 30 long int k; 33 31 long int i; … … 36 34 unsigned long int v; 37 35 long int p0; 38 long int lod = 0;39 36 long int sigue; 40 long int ac[3] = {0,0,0}; 37 unsigned long int lod = 0; 38 long int ac[3] = {0,0,0}; 41 39 long int totalRegs = 0; 42 40 long int RegsCambios; … … 44 42 LODData regLOD; 45 43 LODChanges listaCambios; 44 45 // Progress bar. 46 46 float percent; 47 47 float increment; 48 48 long int update; 49 49 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 50 57 // Saves original copy. 51 58 TiraOriginal = this->cStrips; … … 55 62 listaCambios.clear(); 56 63 64 // Progress bar. 57 65 // Initialize increment. 58 66 increment = 0.0; … … 67 75 percent = 1.0; 68 76 69 this->LodsDisp = this->TOTALCAMBIOS = lod;77 this->LodsDisp = this->TOTALCAMBIOS;// = lod; 70 78 pCambios = new uint32[this->TOTALCAMBIOS]; 71 79 pCambios[0] = 0; 72 80 73 for (lod = 0; ((this->cVerts[lod].Next) != -1); lod++) 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. 75 91 if (update != (int)(increment * lod)) 76 92 { 77 93 update = (int)(increment * lod); 78 94 upb(percent); 79 } 80 81 RegsCambios = 0; 82 regLOD.obligatory = this->Ordenacion[lod].obligatorio; 83 84 for(t = 0; t < this->cStrips.size(); t++) 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++) 85 112 { 86 113 // Initialize. … … 90 117 totalRegs = 0; 91 118 92 for (v = 0; v < this->cStrips[t].size(); v++) 93 { 94 if (this->cStrips[t][v] == lod) 95 { 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 { 96 128 // Strips. 97 129 if (regLOD.strip == this->MARCAVACIO) … … 104 136 cDatos.push_back(v); 105 137 106 this->cStrips[t][v] = this->cVerts[lod].Next;138 *it = itVertex->Next; 107 139 } 108 140 } … … 116 148 r = 0; 117 149 sigue = 0; 118 k = long(this->cStrips[t].size()-3); 119 150 k = long(itTiras->size() - 3); 151 it = itTiras->begin(); 152 120 153 while (i < k) 121 154 { 122 if ( (this->cStrips[t][i] == this->cStrips[t][i+1]) 123 && 124 (this->cStrips[t][i+1] == this->cStrips[t][i+2]) 125 ) 126 { 155 if ( ((*it) == (*(it + 1))) && ((*(it + 1)) == (*(it + 2)))) 156 { 127 157 // Saves beginning of repetition. 128 158 if (!r) … … 131 161 } 132 162 133 this->cStrips[t].erase(this->cStrips[t].begin()+i);163 itTiras->erase(itTiras->begin() + i); 134 164 i--; 165 it--; 135 166 r++; 136 167 137 if ((i +1) != this->cStrips[t].size()-1)168 if ((i + 1) != (itTiras->size() - 1)) 138 169 { 139 170 sigue = 1; … … 163 194 164 195 r = 0; 165 k = long( this->cStrips[t].size()-r-3);196 k = long(itTiras->size() - r - 3); 166 197 } 167 198 168 199 i++; 200 it++; 169 201 } 170 202 … … 176 208 r = 0; 177 209 sigue = 0; 178 k = long( this->cStrips[t].size() - 4);210 k = long(itTiras->size() - 4); 179 211 212 it = itTiras->begin(); 213 180 214 while (i < k) 181 215 { 182 if ( (this->cStrips[t][i] == this->cStrips[t][i+2]) 183 && 184 (this->cStrips[t][i+1] == this->cStrips[t][i+3]) 185 ) 216 if (((*it) == (*(it + 2))) && ((*(it + 1)) == (*(it + 3)))) 186 217 { 187 218 if (!r) … … 190 221 } 191 222 192 this->cStrips[t].erase(this->cStrips[t].begin()+i); 193 this->cStrips[t].erase(this->cStrips[t].begin()+i); 223 itTiras->erase(itTiras->begin() + i); 224 itTiras->erase(itTiras->begin() + i); 225 194 226 r++; 195 227 196 228 i -= 2; 197 229 198 if ((i+1) != this->cStrips[t].size()-3) 230 it--; 231 it--; 232 233 if ((i + 1) != itTiras->size() - 3) 199 234 { 200 235 sigue = 1; … … 204 239 sigue = 0; 205 240 } 206 207 241 } 208 242 else … … 224 258 225 259 r = 0; 226 k = long( (this->cStrips[t].size()-4-2*r));260 k = long(itTiras->size() - 4 - 2 * r); 227 261 } 228 262 229 263 i++; 264 it++; 230 265 } 231 266 … … 242 277 }// End for lod. 243 278 279 printf("\nFin de los cambios..."); 280 244 281 this->cCambios = listaCambios; 245 282 246 283 // Guardar el numero de LODS disponibles. 247 this->TOTALCAMBIOS = this->LodsDisp=lod;284 //this->TOTALCAMBIOS = this->LodsDisp=lod; 248 285 249 286 //Retornar a la lista original … … 261 298 unsigned long int v; 262 299 long int vSig; 263 long int k;300 //long int k; 264 301 VECTORVERTEX Vertices; 265 302 VECTORVERTEX NuevosVerts; 266 303 vector <VECTORINT> NuevasTiras; 267 304 VECTORINT tira; 305 VECTORINT::iterator it; 306 VECTORINT::iterator itFin; 268 307 vector <Index> mV1Aux; 269 308 tipoOrden Orden; 270 309 tipoOrden *Ord; 310 tipoOrden *Ord2; 271 311 bool bEncontrado; 272 312 long int c1; 273 313 long int c2; 274 // Progress bar 314 315 // Progress bar. 275 316 float percent; 276 317 float increment; 277 318 long int update; 278 319 320 unsigned long int totalSize; 321 279 322 bEncontrado = false; 323 324 printf("\n---->Lectura de Ordenacion"); 325 326 totalSize = (long int)this->geoMeshSQ->mSteps.size(); 280 327 281 328 c1 = 0; 282 329 c2 = 0; 283 330 331 // Progress bar. 284 332 update = -1; 285 333 percent = 1.0; 286 increment = (float)(10.0) / (float)( geoMeshSQ->mSteps.size());287 288 for (i = 0; i < t his->geoMeshSQ->mSteps.size(); i++)334 increment = (float)(10.0) / (float)(totalSize); 335 336 for (i = 0; i < totalSize; i++) 289 337 { 290 338 if (update != (int)(i * increment)) … … 310 358 this->NumVertsRepetidos = c2; 311 359 360 printf("\n---->Cambiar vertices con x!0, Verts: %d",Ordenacion.size()); 361 362 // Change all vertices that have x != 0. 363 totalSize = (long int)Ordenacion.size(); 364 Ord = &(Ordenacion[0]); 365 366 // Progress bar. 312 367 update = -1; 313 increment = (float)(10.0) / (float)( Ordenacion.size());368 increment = (float)(10.0) / (float)(totalSize); 314 369 percent = 1.0; 315 370 316 371 // Change all vertices that have x != 0. 317 for(i = 0; i < Ordenacion.size(); i++) 318 { 372 for(i = 0; i < totalSize; i++) 373 { 374 // Progress bar. 319 375 if (update != (int)(i * increment)) 320 376 { … … 323 379 } 324 380 325 Ord = &(Ordenacion[i]); 326 327 if (Ord->x!=0) 381 if (Ord->x != 0) 328 382 { 329 383 // Change the simplification order. … … 331 385 Ord->vQslim = Ord->vQslimNext; 332 386 Ord->vQslimNext = v; 333 334 for (j = i+1; j < Ordenacion.size(); j++) 335 { 336 if (Ordenacion[j].vQslim == Ord->vQslim) 337 { 338 Ordenacion[j].vQslim = Ord->vQslimNext; 339 Ordenacion[j].cambio = "y"; 340 } 341 else if (Ordenacion[j].vQslimNext == Ord->vQslim) 342 { 343 Ordenacion[j].vQslimNext = Ord->vQslimNext; 344 Ordenacion[j].cambio = "y"; 345 } 346 } 347 } 348 } 349 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 413 update = -1; 351 increment = (float)(10.0) / (float)( Ordenacion.size());414 increment = (float)(10.0) / (float)(totalSize); 352 415 percent = 1.0; 353 416 354 // 3 seg.355 //Ordenacion de los vertices356 for(i = 0; i < Ordenacion.size(); i++)357 {417 // Vertex sort. 418 for(i = 0; i < totalSize; i++) 419 { 420 // Progress bar. 358 421 if (update != (int)(i * increment)) 359 422 { … … 363 426 364 427 c1++; 365 NuevosVerts.push_back(this->cVerts[Ordenacion[i].vQslim]); 366 367 cVerts[Ordenacion[i].vQslim].Next = -1; 368 369 } 370 371 // Añadir aquellos vertices que no estaban en NuevosVerts 372 // y no se simplificaban. 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. 373 441 int cont = 0; 374 442 int contestaban = 0; … … 394 462 } 395 463 464 totalSize = (long int)Ordenacion.size(); 465 466 printf("\n---->Siguientes QSLIM: %d",totalSize); 467 468 // Progress bar. 396 469 update = -1; 397 increment = (float)(10.0) / (float)( Ordenacion.size());470 increment = (float)(10.0) / (float)(totalSize); 398 471 percent = 1.0; 399 472 400 // 2 min. 401 // Calcular los siguiente teniendo en cuenta el QSLIM. 402 for (i = 0; i < Ordenacion.size(); i++) 403 { 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. 404 482 if (update != (int)(i * increment)) 405 483 { … … 408 486 } 409 487 410 v = Ordenacion[i].vQslimNext; 411 412 //Buscar ese vertice v cual es ahora 488 v = Ord->vQslimNext; 413 489 vSig = 0; 414 415 for (t = 0; t < Ordenacion.size() && !vSig;t++) 416 { 417 if (Ordenacion[t].vQslim==v) 418 { 419 vSig=Ordenacion[t].vLS; 420 } 421 } 422 423 if (vSig!=0) 424 { 425 Ordenacion[i].vLSNext = vSig; 426 } 427 } 428 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++) 515 { 516 tira.clear(); 517 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 } 536 537 NuevasTiras.push_back(tira); 538 } 539 */ 540 429 541 //Creacion de nuevas tiras con las mismas dimensiones 430 542 for(t = 0; t < this->cStrips.size(); t++) … … 439 551 NuevasTiras.push_back(tira); 440 552 } 441 442 update = -1; 443 increment = (float)(20.0) / (float)(NuevosVerts.size()); 444 percent = 1.0; 445 446 k = 0; 553 554 update = long(NuevosVerts.size() / 40); 555 percent = 0.5; 447 556 448 557 // 2 min. … … 450 559 for(v = 0; v < NuevosVerts.size(); v++) 451 560 { 452 if (update != (int)(v * increment)) 453 { 454 update = (int)(v * increment); 561 if ((v % update) == 0) 562 { 455 563 upb(percent); 456 564 } 457 565 458 566 for(t = 0; t < this->cStrips.size(); t++) 459 567 { … … 462 570 if (this->cStrips[t][i] == Ordenacion[v].vQslim) 463 571 { 464 k++;465 572 NuevasTiras[t][i] = v; 466 573 } … … 469 576 } 470 577 471 //Cambiar a Tiras Nuevas 578 printf("\n---->Copiar los datos"); 579 580 // Change to new strips. 472 581 this->cStrips = NuevasTiras; 473 582 474 //NuevosVerts y Ordenacion = tamaño. 475 for(i = 0; i < NuevosVerts.size(); i++) 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++) 476 590 { 477 591 NuevosVerts[i].Next = Ordenacion[i].vLSNext; 592 593 if ((this->TOTALCAMBIOS == 0) && (NuevosVerts[i].Next == -1)) 594 { 595 this->TOTALCAMBIOS = i; 596 } 478 597 } 479 598 480 599 //Cambiar cVerts por nuevosVerts. 481 600 this->cVerts = NuevosVerts; 601 602 printf( "--->Vertices: %d * Cambios: %d", 603 NuevosVerts.size(), 604 this->TOTALCAMBIOS); 482 605 483 606 //percent = 100.0; … … 1124 1247 // Error. 1125 1248 } 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 1126 1265 } 1127 1266 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r1009 r1014 40 40 LodStripsLibrary::~LodStripsLibrary() 41 41 { 42 delete[] mStrips;42 delete [] mStrips; 43 43 } 44 44 … … 57 57 long int k; 58 58 long int b_change_ok = 1; 59 unsigned long int 59 unsigned long int lod; 60 60 long int t; 61 61 long int r; 62 long int sig;62 long int next; 63 63 long int el1; 64 64 long int el2; … … 76 76 if (newLOD > mCurrentLod) 77 77 { 78 //HACIA ADELANTE 79 //CurrentRegLOD 80 //Incrementamos el LOD -> Calcular siguientes 78 // Forwards. 79 // Increments LOD. 81 80 for (lod = mCurrentLod; lod < newLOD; lod++) 82 81 { 83 sig= mVertex[lod];82 next = mVertex[lod]; 84 83 total_changes = mPChanges[lod]; 85 84 86 85 for (i = 0; i < total_changes; i++) 87 86 { 88 // Strip q Cambia.87 // Strip change. 89 88 t = mCurrentRegLOD->strip; 90 89 strip = &(mStrips[t]); … … 96 95 for (j = totalR - 1; j >= 0; j--) 97 96 { 98 start[*mCurrentData] = sig;97 start[*mCurrentData] = next; 99 98 100 99 ++mCurrentData; … … 132 131 2*(*(mCurrentData + 1))); 133 132 134 ++mCurrentData;135 ++mCurrentData;133 mCurrentData++; 134 mCurrentData++; 136 135 } 137 136 138 ++mCurrentRegLOD;137 mCurrentRegLOD++; 139 138 140 139 mStripsChanges[t] = 1; … … 146 145 147 146 } 148 // Si el nuevo LOD es menos que elactual.147 // If LOD is less than actual. 149 148 else 150 149 { 151 --mCurrentRegLOD;152 --mCurrentData;150 mCurrentRegLOD--; 151 mCurrentData--; 153 152 154 // Decrement amos el LOD -> Calcular anteriores.153 // Decrements LOD. 155 154 for (lod = mCurrentLod; lod > newLOD; lod--) 156 155 { … … 178 177 } 179 178 180 --mCurrentData;181 --mCurrentData;179 mCurrentData--; 180 mCurrentData--; 182 181 } 183 182 … … 195 194 } 196 195 197 --mCurrentData;198 --mCurrentData;196 mCurrentData--; 197 mCurrentData--; 199 198 } 200 199 … … 205 204 { 206 205 (*strip)[*mCurrentData] = lod - 1; 207 --mCurrentData;206 mCurrentData--; 208 207 } 209 208 210 --mCurrentRegLOD;209 mCurrentRegLOD--; 211 210 mStripsChanges[t] = 1; 212 211 } 213 212 214 // ActualizarLOD.213 // Update LOD. 215 214 mCurrentLod = lod - 1; 216 215 } 217 216 218 ++mCurrentData;219 ++mCurrentRegLOD;217 mCurrentData++; 218 mCurrentRegLOD++; 220 219 } 221 222 } 223 224 /* 225 // Visualizar. 226 k = 0; 227 228 for (uint32 i = 0; i < mTotalStrips; i++) 229 { 230 l = mStrips[i].size(); 231 232 // Los dos degenerados. 233 k = k + l + 2; 234 235 // If is not the first strip. 236 if (i != 0) 237 { 238 start = mStrips[i].begin(); 239 240 // Degenerado. 241 mStrips[i].insert(start,mStrips[i][0]); 242 } 243 244 // If is not the last strip. 245 if (i != (mTotalStrips - 1)) 246 { 247 // Degenerado. 248 mStrips[i].push_back(mStrips[i][mStrips[i].size() - 1]); 249 } 250 251 } 252 */ 253 254 /* 255 * Write in the hardware buffer. 256 * 257 int contTira = 0; 258 259 // Vuelca los datos en el buffer de pantalla. 260 //Ogre::HardwareIndexBufferSharedPtr ibuf; 261 for(unsigned int j = 0; j < mGeoMesh->mSubMeshCount; j++) 262 { 263 k = 0; 264 for(unsigned int s = 0; s < mGeoMesh->mSubMesh[j].mStripCount; s++) 265 { 266 l = mStrips[contTira].size(); 267 268 mIndexBuffer[j]->writeData(k*sizeof(unsigned long), 269 l*sizeof(unsigned long), 270 &mStrips[contTira][0]); 271 272 k = k + l; 273 274 contTira++; 275 } 276 277 indexes[j]->indexCount = k; 278 } 279 */ 280 281 /* 282 // Para el bunny. 283 start = mStrips[0].begin(); 284 mStrips[0].erase(start); 285 */ 286 /* 287 for (uint32 i = 0; i < mTotalStrips; i++) 288 { 289 start = mStrips[i].begin(); 290 291 // If is not the first strip. 292 if (i != 0) 293 { 294 mStrips[i].erase(start); 295 } 296 297 // If is not the last strip. 298 if (i != (mTotalStrips - 1)) 299 { 300 mStrips[i].pop_back(); 301 } 302 303 } 304 */ 305 220 } 221 306 222 return return_value; 307 223 } 308 224 309 310 225 //----------------------------------------------------------------------------- 311 226 // Gets the maximum level of detail. … … 339 254 uint32 number_of_vertices; 340 255 341 // Total vertices less totallod.256 // Total vertices of minimum lod. 342 257 number_of_vertices = mMaxVerticesLOD - (mMinLod + 1); 343 258 … … 432 347 void LodStripsLibrary::CopyVectors2Arrays() 433 348 { 434 unsigned int 435 unsigned int 349 unsigned int i; 350 unsigned int j; 436 351 SmallInt max; 437 352 SmallInt t; … … 447 362 data_array = new SmallInt[mData.size()]; 448 363 449 //Calcular el tamaño maximo de tira y el numero de caras total450 364 max = 0; 451 365 mTotalFaces = 0; … … 463 377 } 464 378 465 //Nueva version de ALLOCATE.466 379 changes_array = new LODRegisterType[mFileChangesLOD.size()]; 467 380 468 // Rellenar vChanges381 // Fill up changes array. 469 382 for (i = 0; i < mFileChangesLOD.size(); ++i) 470 383 { … … 474 387 mCurrentRegLOD = changes_array; 475 388 476 //COPY---------------------------------- 477 //Copiar las tiras 389 // Copy strips. 478 390 for (i = 0; i < mFileStrips.size(); i++) 479 391 { 480 392 for (j = 0; j < mFileStrips[i].size(); j++) 481 393 { 482 //Rellenar el vVector483 394 mStrips[i].push_back(mFileStrips[i][j]); 484 395 } 485 396 486 // Poner a 0 los flags de modificados.397 // Reset flags of strips changed. 487 398 mStripsChanges[i] = 0; 488 399 } … … 495 406 mCurrentData = data_array; 496 407 497 // Meter los vertices en mVertex408 // Fill up mVertex. 498 409 for(i = 0; i < mFileVertices.size(); i++) 499 410 { … … 513 424 std::vector <unsigned int> p_changes; 514 425 int value; 515 int v = 0;516 int t = -1;517 int s = 0;518 int sig= 0;519 int c = -1;426 int v = 0; 427 int t = -1; 428 int s = 0; 429 int next = 0; 430 int c = -1; 520 431 char buff[80]; 521 432 Index *index; … … 583 494 mTotalChanges = 0; 584 495 585 586 496 while (!feof (fp)) 587 497 { … … 590 500 if (*buff == 'v') 591 501 { 592 //VERTICES593 502 sscanf (buff+2,"%d",&value); 594 503 … … 600 509 if (*buff == 'c') 601 510 { 602 // c indica que empieza un nuevo cambio603 511 c++; 604 512 } … … 628 536 sscanf (buff+2,"%u",&value); 629 537 p_changes.push_back(value); 630 }//Fin ElseIf 631 632 } // End WhileEOF 538 } 539 } 633 540 634 541 fclose(fp); … … 639 546 mMinLod = mLods; 640 547 641 //// CHAPUZA PROVISIONAL: EL ULTIMO ELEMENTO SE REPITE 2 VECES V.v642 548 mPChanges = new SmallInt[mLods]; 643 549 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
r1009 r1014 68 68 69 69 //--------------------------------------------------------------------------- 70 // Constructor. 70 71 //--------------------------------------------------------------------------- 71 72 GeometryBasedSimplifier::GeometryBasedSimplifier( const Mesh *m, … … 76 77 77 78 //--------------------------------------------------------------------------- 79 // Destroyer. 78 80 //--------------------------------------------------------------------------- 79 81 GeometryBasedSimplifier::~GeometryBasedSimplifier() … … 126 128 :MeshSimplifier(m,upb) 127 129 { 128 //char s[MAX_CHAR];129 130 130 // Set progress update function 131 131 VMI::mUPB = upb; … … 162 162 VMI::mesh = initMeshStructure(mGeoMesh); 163 163 164 //VMI::printMesh(mesh);165 //getchar();166 167 // Get a filename without extension168 //strncpy(VMI::filename, argv[argc - 1], strlen(argv[argc - 1]) - 4);169 170 //glutInit(&argc, argv);171 164 // RGB and Alpha. 172 165 glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA); … … 174 167 glutInitWindowPosition(100, 100); 175 168 176 //#ifdef KL // Kullback-Leibler 177 // sprintf(s, "VKL - [%s]", argv[argc-1]); 178 //#endif 179 //#ifdef MI // Mutual Information 180 // sprintf(s, "VMI - [%s]", argv[argc-1]); 181 //#endif 182 //#ifdef HE // Hellinger 183 // sprintf(s, "VHE - [%s]", argv[argc-1]); 184 //#endif 185 //#ifdef CS // Chi-Square 186 // sprintf(s, "VCS - [%s]", argv[argc-1]); 187 //#endif 188 189 VMI::vmiWin = glutCreateWindow("VMI"/*s*/); 169 VMI::vmiWin = glutCreateWindow("VMI"); 190 170 191 171 glewInit(); … … 213 193 } 214 194 } 215 else216 {217 // Loads a cameras file218 //sprintf(s,"%s.cam", VMI::filename);219 220 //VMI::cameras = VMI::loadCameras(VMI::radius, s, &VMI::numCameras);221 //getchar();222 }223 195 224 196 VMI::histogram = VMI::initHistogram( VMI::mesh->currentNumTriangles, … … 247 219 void ViewPointDrivenSimplifier::Simplify(Real percent) 248 220 { 249 // TODO: parametros libreria globales250 251 252 221 VMI::numDemandedTriangles = (int)(VMI::mesh->numTriangles * percent); 253 222 … … 440 409 for (j = 0; j < 3; j++) 441 410 { 442 // Adding triangle index adjacent to 3 vertices 411 // Adding triangle index adjacent to 3 vertices. 443 412 v1 = vmi_mesh->triangles[index].indices[j]; 444 413 445 // Reallocate memory for the new adjacent triangle 414 // Reallocate memory for the new adjacent triangle. 446 415 vmi_mesh->vertices[v1].triangles = (GLuint *)realloc(vmi_mesh->vertices[v1].triangles, (vmi_mesh->vertices[v1].numTriangles + 1) * sizeof(GLuint)); 447 416 VMI::addItem((int *)vmi_mesh->vertices[v1].triangles, (int *)&vmi_mesh->vertices[v1].numTriangles, index); … … 453 422 } 454 423 455 //printf("\n");456 424 printf("Ok\n"); 457 425 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp
r1007 r1014 141 141 long int triangleID=0; 142 142 143 countv += vertex_count = (int)mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;143 countv += vertex_count = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; 144 144 Vertex = new float[2*countv][3]; 145 145 146 int update_each = (int)(mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount / 5);146 int update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5; 147 147 148 148 for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; j++) … … 174 174 pos=0; 175 175 176 update_each = (int)(mesh->mSubMesh[meshLeaves].mIndexCount / 5);176 update_each = mesh->mSubMesh[meshLeaves].mIndexCount / 5; 177 177 178 178 // Each leaf is composed of 6 vertices -
GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj
r998 r1014 82 82 <Tool 83 83 Name="VCCLCompilerTool" 84 Optimization=" 0"85 AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include "84 Optimization="2" 85 AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include;..\..\..\..\..\..\nongtp\Devil\include" 86 86 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN" 87 87 RuntimeLibrary="4" 88 BufferSecurityCheck="FALSE" 88 89 UsePrecompiledHeader="0" 89 90 WarningLevel="0" -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r1007 r1014 1231 1231 { 1232 1232 // Build the LOD file. 1233 case LODTREES_AUTO: 1233 case LODTREES_AUTO: 1234 1234 1235 1235 // Open file chooser dialog. 1236 1236 file_name = fltk::file_chooser("Build LOD","*",""); 1237 1237 1238 if (!file_name) 1239 { 1238 1240 break; 1241 } 1239 1242 1240 1243 std::cout << "Creando secuencia de simplificacion de hojas..."; 1244 1241 1245 createLeavesSequence(file_name+std::string(".leafseq")); 1246 1242 1247 std::cout << "OK!" << std::endl; 1243 1248 … … 1259 1264 delete auxTreeSimpSequence;*/ 1260 1265 1261 1262 1266 case LODSTRIPS_AUTO: 1263 1267 1264 // Builder1268 // Builder 1265 1269 if (!file_name) 1270 { 1266 1271 file_name = fltk::file_chooser("Build LOD","*",""); 1272 } 1273 1267 1274 // If a file was selected. 1268 1275 if (file_name) … … 1281 1288 1282 1289 // Loads a simplification sequence file. 1283 oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ)); 1290 oMeshSimpSequence->Load(Serializer( "SimplifSequence.txt", 1291 Serializer::READ)); 1284 1292 1285 1293 // If the simplification sequence and the mesh exist. … … 1291 1299 progress_function); 1292 1300 1293 oSerializer = new Serializer(strcat(file_name,".lod"),Serializer::Mode::WRITE); 1301 oSerializer = new Serializer( strcat(file_name,".lod"), 1302 Serializer::Mode::WRITE); 1294 1303 1295 1304 oLodStrip->Save(*oSerializer); … … 1314 1323 mesh_saver = new GeoMeshSaver(); 1315 1324 file_name[strlen(file_name) - 4] = '\0'; 1316 mesh_saver->save(mGeoMesh, strcat(file_name,".mesh")); 1325 1326 mesh_saver->save( mGeoMesh, 1327 strcat(file_name,".mesh")); 1328 1317 1329 delete mesh_saver; 1318 1319 1330 } 1320 1331 else … … 1362 1373 } 1363 1374 1364 1365 1375 //--------------------------------------------------------------------------- 1366 1376 // Lod Slider Callback for the foliage … … 1384 1394 } 1385 1395 1386 1387 1388 1396 //--------------------------------------------------------------------------- 1389 1397 // Mesh Info Callback … … 1402 1410 1403 1411 //--------------------------------------------------------------------------- 1404 // Logo Callback 1412 // Logo Callback. 1405 1413 //--------------------------------------------------------------------------- 1406 1414 inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) … … 1428 1436 1429 1437 //--------------------------------------------------------------------------- 1430 // Show the stripify panel 1438 // Show the stripify panel. 1431 1439 //--------------------------------------------------------------------------- 1432 1440 void GeoMeshViewUI::showStripify() … … 1451 1459 1452 1460 //--------------------------------------------------------------------------- 1453 // Hide the stripify panel 1461 // Hide the stripify panel. 1454 1462 //--------------------------------------------------------------------------- 1455 1463 void GeoMeshViewUI::hideStripify() … … 1474 1482 1475 1483 //--------------------------------------------------------------------------- 1476 // Show the Simplify Edge Collapse panel 1484 // Show the Simplify Edge Collapse panel. 1477 1485 //--------------------------------------------------------------------------- 1478 1486 void GeoMeshViewUI::showEdgeCollapse() … … 1562 1570 1563 1571 //--------------------------------------------------------------------------- 1564 // Show the Simlify Leaves Collapse 1572 // Show the Simlify Leaves Collapse. 1565 1573 //--------------------------------------------------------------------------- 1566 1574 void GeoMeshViewUI::showLeavesCollapse() … … 1606 1614 1607 1615 //--------------------------------------------------------------------------- 1608 // Hide the Simplify Leaves Collapse 1616 // Hide the Simplify Leaves Collapse. 1609 1617 //--------------------------------------------------------------------------- 1610 1618 void GeoMeshViewUI::hideLeavesCollapse() … … 1647 1655 1648 1656 //--------------------------------------------------------------------------- 1649 // Show the LodStrips Panel 1657 // Show the LodStrips Panel. 1650 1658 //--------------------------------------------------------------------------- 1651 1659 void GeoMeshViewUI::showOpenMeshSimplification() … … 1665 1673 1666 1674 //--------------------------------------------------------------------------- 1667 // Hide the LodStrips Panel 1675 // Hide the LodStrips Panel. 1668 1676 //--------------------------------------------------------------------------- 1669 1677 void GeoMeshViewUI::hideOpenMeshSimplification() … … 1683 1691 1684 1692 //--------------------------------------------------------------------------- 1685 // Shows the auto generate LodStrips panel 1693 // Shows the auto generate LodStrips panel. 1686 1694 //--------------------------------------------------------------------------- 1687 1695 void GeoMeshViewUI::showAutoGenerateLodStrips() … … 1696 1704 //mBuildBar->activate(); 1697 1705 } 1698 //--------------------------------------------------------------------------- 1699 // Shows the auto generate LodStrips panel 1706 1707 //--------------------------------------------------------------------------- 1708 // Shows the auto generate LodStrips panel. 1700 1709 //--------------------------------------------------------------------------- 1701 1710 void GeoMeshViewUI::showAutoGenerateLodTrees() … … 1712 1721 1713 1722 //--------------------------------------------------------------------------- 1714 // Show the LodStrips visulization panel 1723 // Show the LodStrips visulization panel. 1715 1724 //--------------------------------------------------------------------------- 1716 1725 void GeoMeshViewUI::showLodStripSlider() … … 1721 1730 1722 1731 //--------------------------------------------------------------------------- 1723 // Hide the LodStrips visualization panel 1732 // Hide the LodStrips visualization panel. 1724 1733 //--------------------------------------------------------------------------- 1725 1734 void GeoMeshViewUI::hideLodStripSlider() … … 1730 1739 1731 1740 //--------------------------------------------------------------------------- 1732 // Show the LodTree visulization panel 1741 // Show the LodTree visulization panel. 1733 1742 //--------------------------------------------------------------------------- 1734 1743 void GeoMeshViewUI::showLodTreeSlider() … … 1739 1748 1740 1749 //--------------------------------------------------------------------------- 1741 // Hide the LodTree visualization panel 1750 // Hide the LodTree visualization panel. 1742 1751 //--------------------------------------------------------------------------- 1743 1752 void GeoMeshViewUI::hideLodTreeSlider() … … 1747 1756 } 1748 1757 1749 1750 //--------------------------------------------------------------------------- 1751 // Show the LodTrees Panel 1758 //--------------------------------------------------------------------------- 1759 // Show the LodTrees Panel. 1752 1760 //--------------------------------------------------------------------------- 1753 1761 void GeoMeshViewUI::showOpenLeavesSimplification() … … 1761 1769 1762 1770 //--------------------------------------------------------------------------- 1763 // Hide the LodTrees Panel 1771 // Hide the LodTrees Panel. 1764 1772 //--------------------------------------------------------------------------- 1765 1773 void GeoMeshViewUI::hideOpenLeavesSimplification() … … 1773 1781 1774 1782 //--------------------------------------------------------------------------- 1775 // Show the mesh info browser 1783 // Show the mesh info browser. 1776 1784 //--------------------------------------------------------------------------- 1777 1785 void GeoMeshViewUI::showMeshInfo() … … 1879 1887 1880 1888 //--------------------------------------------------------------------------- 1881 // Hide the mesh info browser 1889 // Hide the mesh info browser. 1882 1890 //--------------------------------------------------------------------------- 1883 1891 void GeoMeshViewUI::hideMeshInfo() … … 1888 1896 1889 1897 //--------------------------------------------------------------------------- 1890 // Hide the right panel 1898 // Hide the right panel. 1891 1899 //--------------------------------------------------------------------------- 1892 1900 void GeoMeshViewUI::hideRightPanel() … … 1903 1911 1904 1912 //--------------------------------------------------------------------------- 1905 // Get the number of vertices 1913 // Get the number of vertices. 1906 1914 //--------------------------------------------------------------------------- 1907 1915 size_t GeoMeshViewUI::getVertexCount(Mesh *geoMesh) … … 1930 1938 1931 1939 //--------------------------------------------------------------------------- 1932 // Get the number of triangles 1940 // Get the number of triangles. 1933 1941 //--------------------------------------------------------------------------- 1934 1942 size_t GeoMeshViewUI::getTriangleCount(Geometry::Mesh *geoMesh) … … 1969 1977 1970 1978 //--------------------------------------------------------------------------- 1971 // Get the number of strips 1979 // Get the number of strips. 1972 1980 //--------------------------------------------------------------------------- 1973 1981 size_t GeoMeshViewUI::getStripCount(Geometry::Mesh *geoMesh) … … 1995 2003 1996 2004 //--------------------------------------------------------------------------- 1997 // It paints the submesh selected by the mMeshInfo tree 1998 // Trate the mMeshInfo event 2005 // It paints the submesh selected by the mMeshInfo tree. 2006 // Trate the mMeshInfo event. 1999 2007 //--------------------------------------------------------------------------- 2000 2008 int GeoMeshViewUI::paintMesh(void) … … 2008 2016 meshNumber = -1; 2009 2017 2010 // Shows the selected object label 2018 // Shows the selected object label. 2011 2019 strcpy(selectedTag,mMeshInfo->goto_focus()->label()); 2012 2020 2013 2021 p=strstr(selectedTag,"SubMesh "); 2014 2022 2015 // If the item begins with string "SubMesh" 2023 // If the item begins with string "SubMesh". 2016 2024 if (p!=NULL) 2017 2025 { … … 2032 2040 bool GeoMeshViewUI::simplifyEdgeCollapse() 2033 2041 { 2034 Real percent; 2035 2036 // If input field empty. 2037 if (mMeshReduction->fvalue() <= 0.0) 2038 { 2039 return false; 2040 } 2041 2042 geoMeshView->saveContext(); 2043 2044 // Debug. 2045 cout << "Mesh Reduction: " 2046 << mMeshReduction->fvalue() 2047 << endl; 2048 2049 // Gets simplify option. 2050 if (mGeometryBased->value()) 2051 { 2052 simplificationState = MESHSIMP; 2053 mMeshSimplifier = new GeometryBasedSimplifier(mGeoMesh, 2054 2055 progress_function); 2056 } 2057 else 2058 { 2059 simplificationState = VIEWPOINTDRIVEN; 2060 mMeshSimplifier = new ViewPointDrivenSimplifier(mGeoMesh, 2061 2062 progress_function); 2063 } 2064 2065 mMeshSimplifier->setMeshLeaves(idMeshLeaves); 2066 2067 if (mPercent->value()) 2068 { 2069 // Simplificación por porcentaje 2070 if (mMeshReduction->fvalue() <= 100.0 && 2071 mMeshReduction->fvalue() > 0.0) 2072 { 2073 percent = mMeshReduction->fvalue(); 2074 percent = percent / 100.0; 2075 2076 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2077 mMeshSimplifier->Simplify(percent); 2078 2079 // Deletes the previous mesh. 2080 delete mUndoMesh; 2081 2082 mUndoMesh = new Mesh(); 2083 2084 // Sets the undo mesh. 2085 *mUndoMesh = *mGeoMesh; 2086 2087 delete mGeoMesh; 2088 2089 mGeoMesh = mMeshSimplifier->GetMesh(); 2090 2091 // Visualize mesh. 2092 geoMeshView->setMesh(mGeoMesh); 2093 2094 } 2095 else 2096 { 2097 fltk::alert("Wrong value for simplification.\n" 2098 "Valid values [0..100]"); 2099 2100 return false; 2101 } 2102 } 2103 else 2104 { 2105 // Simplificar hasta un número de vértices. 2106 uint32 v = (uint32)mMeshReduction->fvalue(); 2107 2108 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2109 mMeshSimplifier->Simplify(v); 2110 2111 // Deletes the previous mesh. 2112 delete mUndoMesh; 2113 2114 mUndoMesh = new Mesh(); 2115 2116 // Sets the undo mesh. 2117 *mUndoMesh = *mGeoMesh; 2118 2119 delete mGeoMesh; 2120 2121 mGeoMesh = mMeshSimplifier->GetMesh(); 2122 2123 // Visualize the mesh. 2124 geoMeshView->setMesh(mGeoMesh); 2125 } 2126 2127 return true; 2042 Real percent; 2043 2044 // If input field empty. 2045 if (mMeshReduction->fvalue() <= 0.0) 2046 { 2047 return false; 2048 } 2049 2050 geoMeshView->saveContext(); 2051 2052 // Debug. 2053 cout << "Mesh Reduction: " 2054 << mMeshReduction->fvalue() 2055 << endl; 2056 2057 // Gets simplify option. 2058 if (mGeometryBased->value()) 2059 { 2060 simplificationState = MESHSIMP; 2061 mMeshSimplifier = new GeometryBasedSimplifier(mGeoMesh, 2062 progress_function); 2063 } 2064 else 2065 { 2066 simplificationState = VIEWPOINTDRIVEN; 2067 mMeshSimplifier = new ViewPointDrivenSimplifier(mGeoMesh, 2068 progress_function); 2069 } 2070 2071 mMeshSimplifier->setMeshLeaves(idMeshLeaves); 2072 2073 if (mPercent->value()) 2074 { 2075 // Simplificación por porcentaje 2076 if (mMeshReduction->fvalue() <= 100.0 && 2077 mMeshReduction->fvalue() > 0.0) 2078 { 2079 percent = mMeshReduction->fvalue(); 2080 percent = percent / 100.0; 2081 2082 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2083 mMeshSimplifier->Simplify(percent); 2084 2085 // Deletes the previous mesh. 2086 delete mUndoMesh; 2087 2088 mUndoMesh = new Mesh(); 2089 2090 // Sets the undo mesh. 2091 *mUndoMesh = *mGeoMesh; 2092 2093 delete mGeoMesh; 2094 2095 mGeoMesh = mMeshSimplifier->GetMesh(); 2096 2097 // Visualize mesh. 2098 geoMeshView->setMesh(mGeoMesh); 2099 } 2100 else 2101 { 2102 fltk::alert("Wrong value for simplification.\n" 2103 "Valid values [0..100]"); 2104 2105 return false; 2106 } 2107 } 2108 else 2109 { 2110 // Simplificar hasta un número de vértices. 2111 uint32 v = (uint32)mMeshReduction->fvalue(); 2112 2113 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 2114 mMeshSimplifier->Simplify(v); 2115 2116 // Deletes the previous mesh. 2117 delete mUndoMesh; 2118 2119 mUndoMesh = new Mesh(); 2120 2121 // Sets the undo mesh. 2122 *mUndoMesh = *mGeoMesh; 2123 2124 delete mGeoMesh; 2125 2126 mGeoMesh = mMeshSimplifier->GetMesh(); 2127 2128 // Visualize the mesh. 2129 geoMeshView->setMesh(mGeoMesh); 2130 } 2131 2132 return true; 2128 2133 } 2129 2134
Note: See TracChangeset
for help on using the changeset viewer.