Skip to content

Commit 051915b

Browse files
authored
ImageOverlayPlugin: Improve tile splitting behavior (#1386)
* Adjust tile splitting refine strategy, adjust non-zero error plugin behavior * Add comment * update comment
1 parent 937e464 commit 051915b

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/core/plugins/EnforceNonZeroErrorPlugin.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ export class EnforceNonZeroErrorPlugin {
1616

1717
let parent = tile.parent;
1818
let depth = 1;
19-
20-
let targetDepth = - 1;
21-
let targetError = Infinity;
2219
while ( parent !== null ) {
2320

24-
if ( parent.geometricError !== 0 && parent.geometricError < targetError ) {
21+
if ( parent.geometricError !== 0 ) {
2522

26-
targetError = parent.geometricError;
27-
targetDepth = depth;
23+
tile.geometricError = parent.geometricError * ( 2 ** - depth );
24+
break;
2825

2926
}
3027

@@ -33,14 +30,6 @@ export class EnforceNonZeroErrorPlugin {
3330

3431
}
3532

36-
// find the smallest error in the parent list to avoid grabbing artificially inflated error values
37-
// for the sake of forced refinement. Then scale the error by the depth.
38-
if ( targetDepth !== - 1 ) {
39-
40-
tile.geometricError = targetError * ( 2 ** - depth );
41-
42-
}
43-
4433
}
4534

4635
}

src/three/plugins/images/ImageOverlayPlugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,11 @@ export class ImageOverlayPlugin {
816816

817817
} );
818818

819+
// force the tile "refine" mode to be set to "REPLACE" if we're splitting tiles
820+
// TODO: If a tile is of type "ADD" refine and it has children then it will not be split
821+
// as expected since only geometry tiles with no children are split. Instead we'd want
822+
// to split this tiles geometry in addition to adding the child tiles.
823+
tile.refine = 'REPLACE';
819824
tile.children.push( ...children );
820825

821826
}

0 commit comments

Comments
 (0)