- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_managers.cpp
r12538 r13041 149 149 throw std::invalid_argument( 150 150 "trpgManagedTile::GetChildLocationInfo(): index argument out of bound."); 151 151 152 152 153 153 return childLocationInfo[childIdx]; … … 161 161 TileLocationInfo const& info = childLocationInfo[childIdx]; 162 162 163 x = info.x; 164 y = info.y; 163 x = info.x; 164 y = info.y; 165 165 lod = info.lod; 166 166 167 167 return true; 168 168 } 169 169 170 170 const trpgwAppAddress& trpgManagedTile::GetChildTileAddress(int childIdx) const 171 171 { … … 193 193 if (id <0 || id >= (int)matList->size()) 194 194 return NULL; 195 195 196 196 return &(*matList)[id]; 197 197 } … … 241 241 // Note: Should print the rest too, probably. 242 242 } 243 243 244 244 /* Page Manager LOD Page Info class. 245 245 Used by the page manager to keep track of paging information … … 301 301 302 302 head->GetVersion(majorVersion, minorVersion); 303 303 304 304 305 305 // Area of interest size (in cells) … … 316 316 allocate a free list by supposing that the tiles exist. 317 317 So only for version 2.1 an over we will use the divider to allocate less 318 */ 318 */ 319 319 maxNumTiles = (int)(1.15*(2*aoiSize.x+1)*(2*aoiSize.y+1)); 320 320 if(majorVersion == 2 && minorVersion >= 1) … … 324 324 325 325 326 326 327 327 328 328 // Allocate 'em … … 423 423 int tileX,tileY,tileLod; 424 424 tile->GetTileLoc(tileX,tileY,tileLod); 425 if (tileX >= sw.x && 425 if (tileX >= sw.x && 426 426 tileX <= ne.x && 427 tileY >= sw.y && 427 tileY >= sw.y && 428 428 tileY <= ne.y) 429 429 return true; … … 457 457 sw.x = cell.x - aoiSize.x; 458 458 sw.y = cell.y - aoiSize.y; 459 ne.x = cell.x + aoiSize.x; 459 ne.x = cell.x + aoiSize.x; 460 460 ne.y = cell.y + aoiSize.y; 461 sw.x = MAX(0,sw.x); 461 sw.x = MAX(0,sw.x); 462 462 sw.y = MAX(0,sw.y); 463 ne.x = MIN(lodSize.x-1,ne.x); 463 ne.x = MIN(lodSize.x-1,ne.x); 464 464 ne.y = MIN(lodSize.y-1,ne.y); 465 465 … … 488 488 489 489 for(unsigned int parentIdx = 0; parentIdx < parentList.size(); ++parentIdx) { 490 490 491 491 trpgManagedTile* parentTile = parentList[parentIdx]; 492 492 unsigned int nbChildren = parentTile->GetNbChildren(); … … 517 517 } 518 518 } 519 519 520 520 bool trpgPageManager::LodPageInfo::AddToLoadList(int x, int y, const trpgwAppAddress& addr) 521 521 { … … 524 524 // Figure out the lower left and upper right corners 525 525 // in cell coordinates 526 sw.x = cell.x - aoiSize.x; 526 sw.x = cell.x - aoiSize.x; 527 527 sw.y = cell.y - aoiSize.y; 528 ne.x = cell.x + aoiSize.x; 528 ne.x = cell.x + aoiSize.x; 529 529 ne.y = cell.y + aoiSize.y; 530 sw.x = MAX(0,sw.x); 530 sw.x = MAX(0,sw.x); 531 531 sw.y = MAX(0,sw.y); 532 ne.x = MIN(lodSize.x-1,ne.x); 532 ne.x = MIN(lodSize.x-1,ne.x); 533 533 ne.y = MIN(lodSize.y-1,ne.y); 534 534 … … 537 537 y >= sw.y && 538 538 y <= ne.y) { 539 539 540 540 trpgManagedTile *tile = 0; 541 541 if(freeList.size() > 0){ … … 618 618 } 619 619 current.resize(curPos); 620 620 621 621 bool doUpdate = true; 622 622 if(majorVersion == 2 && minorVersion >= 1) … … 683 683 // Calculate the area that we must check, in parent cell coordinate 684 684 trpg2iPoint sw, ne; 685 sw.x = cell.x - aoi_size.x; 685 sw.x = cell.x - aoi_size.x; 686 686 sw.y = cell.y - aoi_size.y; 687 ne.x = cell.x + aoi_size.x; 687 ne.x = cell.x + aoi_size.x; 688 688 ne.y = cell.y + aoi_size.y; 689 sw.x = MAX(0,sw.x); 689 sw.x = MAX(0,sw.x); 690 690 sw.y = MAX(0,sw.y); 691 ne.x = MIN(lodSize.x-1,ne.x); 691 ne.x = MIN(lodSize.x-1,ne.x); 692 692 ne.y = MIN(lodSize.y-1,ne.y); 693 693 … … 765 765 head->GetNumLods(numLod); 766 766 head->GetVersion(majorVersion, minorVersion); 767 767 768 768 // Reset the terrain LOD paging classes. 769 769 valid = true; … … 799 799 if(maxLod > numLod) 800 800 maxLod = numLod; 801 801 802 802 // Reset the terrain LOD paging classes. 803 803 valid = true; … … 922 922 } 923 923 } 924 924 925 925 pageInfo[lastLod].AckLoad(); 926 926 lastLoad = None;
