Changeset 1541 for GTP/trunk/Lib
- Timestamp:
- 09/29/06 11:19:25 (18 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r1526 r1541 326 326 327 327 Orden.vQslimNext = theStep.mV0; 328 Orden.vQslim = theStep.mV1;328 Orden.vQslim = theStep.mV1; 329 329 Orden.obligatory = theStep.obligatory; 330 Orden.vLS = i;331 332 Orden.x = theStep.x;330 Orden.vLS = i; 331 332 Orden.x = theStep.x; 333 333 Orden.vLSNext = -1; 334 334 Orden.cambio = "n"; … … 337 337 } 338 338 339 340 339 update = -1; 341 340 increment = (float)(10.0) / (float)(Ordenacion.size()); … … 362 361 363 362 cVerts[OrdvQslim].Next = -1; 364 365 363 } 366 364 … … 569 567 int vertexCount = (int)this->cVerts.size(); 570 568 int changesCount = (int)this->cCambios.size(); 571 int dataCount = (int)this->cDatos.size();569 int dataCount = (int)this->cDatos.size(); 572 570 int cambiosCount = this->TOTALCAMBIOS; 573 int size = changesCount*sizeof(LODData) + 574 (vertexCount + dataCount + cambiosCount + 4)*sizeof(int) + 575 CHUNK_OVERHEAD_SIZE; 576 577 FILE *f = fopen(filename.c_str(),"ab"); 578 579 unsigned short chunkid = 0xabcd; 580 fwrite(&chunkid,sizeof(unsigned short),1,f); 571 int size = changesCount*sizeof(LODData) 572 + 573 (vertexCount + dataCount + cambiosCount + 4) 574 * 575 sizeof(int) 576 + 577 CHUNK_OVERHEAD_SIZE; 578 579 FILE *f = fopen(filename.c_str(),"ab"); 580 581 unsigned short chunkid = 0xabcd; 582 583 fwrite(&chunkid,sizeof(unsigned short),1,f); 581 584 fwrite(&size,sizeof(unsigned long),1,f); 582 585 583 // VERTICES 586 // VERTICES. 584 587 fwrite(&vertexCount, sizeof(int), 1, f); 585 for(size_t i = 0; i < this->cVerts.size(); i++) 586 { 587 int auxv = cVerts[i].Next; 588 589 for (size_t i = 0; i < this->cVerts.size(); i++) 590 { 591 int auxv = cVerts[i].Next; 588 592 fwrite(&auxv, sizeof(int), 1, f); 589 593 } 590 594 591 595 // CSTRIPS. 592 596 this->TOTALINDICES = 0; 593 597 594 598 for(size_t i = 0; i < this->cStrips.size(); i++) 599 { 595 600 this->TOTALINDICES += int(this->cStrips[i].size()); 601 } 596 602 597 603 // lines starting with a d. -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r1530 r1541 13 13 14 14 using namespace Geometry; 15 using namespace std; 15 16 16 17 //----------------------------------------------------------------------------- … … 82 83 void LodStripsLibrary::GoToLod(float lodfactor) 83 84 { 84 register int 85 register int 85 register int j; 86 register int offset; 86 87 long int i; 87 88 long int k; 88 89 long int b_change_ok = 1; 89 unsigned long int 90 unsigned long int lod; 90 91 long int t; 91 92 long int r; … … 95 96 long int total_changes; 96 97 long int totalR; 97 SmallIntVector *strip;98 SmallIntVector *strip; 98 99 SmallIntVector::iterator start; 99 100 … … 104 105 105 106 lodFactor=lodfactor; 106 // LODRegisterType * lastLOD = mCurrentRegLOD;107 107 108 108 if (newLOD != mCurrentLod) … … 112 112 // Forwards. 113 113 // Increments LOD (decreases level of detail) 114 for (lod = mCurrentLod; lod < newLOD || (mCurrentRegLOD->obligatory==1 && mCurrentLod<mLods-1); lod++) 115 { 116 next = mVertex[lod]; 114 for ( lod = mCurrentLod; 115 (lod < newLOD) 116 || 117 ((mCurrentRegLOD->obligatory == 1) && (lod < (mLods - 1))); 118 lod++) 119 { 120 next = mVertex[lod]; 117 121 total_changes = mPChanges[lod]; 118 122 … … 120 124 { 121 125 // Strip change. 122 t = mCurrentRegLOD->strip;126 t = mCurrentRegLOD->strip; 123 127 strip = &(mStrips[t]); 124 start = strip->begin(); 128 start = strip->begin(); 129 125 130 int stripsize_ini = strip->size(); 126 131 … … 188 193 mCurrentRegLOD--; 189 194 mCurrentData--; 190 195 196 191 197 // Decrements LOD. 192 for (lod = mCurrentLod; lod > newLOD || (mCurrentRegLOD->obligatory==1 && mCurrentLod>0); lod--) 193 { 198 for ( lod = mCurrentLod; 199 (lod > newLOD) 200 || 201 ((mCurrentRegLOD->obligatory == 1) && (lod > 0)) 202 || 203 ((mCurrentRegLOD[1].obligatory == 1) && (lod > 0)); 204 lod--) 205 { 206 194 207 total_changes = mPChanges[lod - 1]; 195 208 … … 252 265 int stripsize_end = strip->size(); 253 266 indices_x_submesh[submesh_x_strip[t]] += (stripsize_end - stripsize_ini); 254 255 267 } 256 268 257 // Update LOD. 269 // Update LOD. 258 270 mCurrentLod = lod - 1; 271 272 // Debug. 273 cout << "Obligatory: " 274 << (int)mCurrentRegLOD->obligatory 275 << endl; 259 276 } 260 277
Note: See TracChangeset
for help on using the changeset viewer.