@@ -137,8 +137,11 @@ class ModelBucket implements Bucket {
137
137
this . maxScale = 0 ;
138
138
this . maxHeight = 0 ;
139
139
// reduce density, more on lower zooms and almost no reduction in overscale range.
140
- // Heuristics is related to trees performance.
141
- this . lookupDim = this . zoom > this . canonical . z ? 256 : this . zoom > 15 ? 75 : 100 ;
140
+ // Heuristics is related to trees performance. Disable density check after maxZoom + 2.
141
+ // For vector tiles this means:
142
+ // z15 and lower: lookup grid of size 75x75 per tile
143
+ // z16: 100x100, z17: 256x256, z18: no density reduction.
144
+ this . lookupDim = this . zoom > ( this . canonical . z + 1 ) ? 0 : ( this . zoom > this . canonical . z ? 256 : this . zoom > 15 ? 75 : 100 ) ;
142
145
this . instanceCount = 0 ;
143
146
144
147
this . terrainElevationMin = 0 ;
@@ -380,13 +383,15 @@ class ModelBucket implements Bucket {
380
383
continue ; // Clip on tile borders to prevent duplicates
381
384
}
382
385
// reduce density
383
- const tileToLookup = ( this . lookupDim - 1.0 ) / EXTENT ;
384
- const lookupIndex = this . lookupDim * ( ( point . y * tileToLookup ) | 0 ) + ( point . x * tileToLookup ) | 0 ;
385
- if ( this . lookup ) {
386
- if ( this . lookup [ lookupIndex ] !== 0 ) {
387
- continue ;
386
+ if ( this . lookupDim !== 0 ) {
387
+ const tileToLookup = ( this . lookupDim - 1.0 ) / EXTENT ;
388
+ const lookupIndex = this . lookupDim * ( ( point . y * tileToLookup ) | 0 ) + ( point . x * tileToLookup ) | 0 ;
389
+ if ( this . lookup ) {
390
+ if ( this . lookup [ lookupIndex ] !== 0 ) {
391
+ continue ;
392
+ }
393
+ this . lookup [ lookupIndex ] = 1 ;
388
394
}
389
- this . lookup [ lookupIndex ] = 1 ;
390
395
}
391
396
this . instanceCount ++ ;
392
397
const i = instancedDataArray . length ;
0 commit comments