Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/core/renderer/tiles/optimizedTraverseFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function toggleTiles( tile, renderer ) {

}

} else {
} else if ( tile.internal.hasContent ) {

tile.traversal.active = false;

Expand All @@ -449,7 +449,7 @@ function toggleTiles( tile, renderer ) {
}

// if the tile is loaded and in frustum we can mark it as visible
tile.traversal.visible = tile.internal.hasRenderableContent && tile.traversal.active && tile.traversal.inFrustum && tile.internal.loadingState === LOADED;
tile.traversal.visible = tile.traversal.active && tile.traversal.inFrustum && ( tile.internal.hasRenderableContent && tile.internal.loadingState === LOADED || ! tile.internal.hasContent );
renderer.stats.used ++;

if ( tile.traversal.inFrustum ) {
Expand Down Expand Up @@ -488,7 +488,8 @@ function toggleTiles( tile, renderer ) {
}

// If the active or visible state changed then call the functions.
if ( tile.internal.hasRenderableContent && tile.internal.loadingState === LOADED ) {
// Fire for tiles with loaded renderable content, or for empty tiles (no content at all).
if ( ( tile.internal.hasRenderableContent && tile.internal.loadingState === LOADED ) || ! tile.internal.hasContent ) {

if ( tile.traversal.wasSetActive !== setActive ) {

Expand Down
5 changes: 3 additions & 2 deletions src/core/renderer/tiles/traverseFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function markVisibleTiles( tile, renderer ) {
// Request the tile contents or mark it as visible if we've found a leaf.
if ( tile.traversal.isLeaf ) {

if ( tile.internal.loadingState === LOADED ) {
if ( tile.internal.loadingState === LOADED || ! tile.internal.hasContent ) {

if ( tile.traversal.inFrustum ) {

Expand Down Expand Up @@ -449,7 +449,8 @@ function toggleTiles( tile, renderer ) {
}

// If the active or visible state changed then call the functions.
if ( tile.internal.hasRenderableContent && tile.internal.loadingState === LOADED ) {
// Fire for tiles with loaded renderable content, or for empty tiles (no content at all).
if ( ( tile.internal.hasRenderableContent && tile.internal.loadingState === LOADED ) || ! tile.internal.hasContent ) {

if ( tile.traversal.wasSetActive !== setActive ) {

Expand Down
11 changes: 8 additions & 3 deletions src/three/plugins/DebugTilesPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class DebugTilesPlugin {

};

this._onTileVisibilityChangeCB = ( { scene, tile, visible } ) => {
this._onTileVisibilityChangeCB = ( { tile, visible } ) => {

this._onTileVisibilityChange( tile, visible );

Expand Down Expand Up @@ -367,7 +367,7 @@ export class DebugTilesPlugin {

if ( result ) {

return true;
return;

}

Expand Down Expand Up @@ -647,7 +647,12 @@ export class DebugTilesPlugin {
// update tile materials
visibleTiles.forEach( tile => {

const scene = tile.engineData.scene;
const { scene } = tile.engineData;
if ( ! scene ) {

return;

}

// create a random color per-tile
let h, s, l;
Expand Down
9 changes: 7 additions & 2 deletions src/three/plugins/TileFlatteningPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,15 @@ export class TileFlatteningPlugin {
_updateTile( tile ) {

const { positionsUpdated, positionsMap, shapes, tiles } = this;
const { scene } = tile.engineData;
positionsUpdated.add( tile );

const scene = tile.engineData.scene;
if ( ! scene ) {

return;

}

if ( ! positionsMap.has( tile ) ) {

// save the geometry positions for resetting after
Expand Down Expand Up @@ -222,7 +228,6 @@ export class TileFlatteningPlugin {

} );


this.tiles.dispatchEvent( { type: 'needs-render' } );

}
Expand Down
6 changes: 6 additions & 0 deletions src/three/plugins/batched/BatchedTilesPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ export class BatchedTilesPlugin {
setTileVisible( tile, visible ) {

const scene = tile.engineData.scene;
if ( ! scene ) {

return false;

}

if ( visible ) {

// Add tileset to the batched mesh if it hasn't been added already
Expand Down
6 changes: 6 additions & 0 deletions src/three/plugins/fade/TilesFadePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,12 @@ export class TilesFadePlugin {
// callback for fading to prevent tiles from being removed until the fade effect has completed
setTileVisible( tile, visible ) {

if ( ! tile.engineData.scene ) {

return false;

}

const fadeManager = this._fadeManager;

// track the fade state
Expand Down
6 changes: 6 additions & 0 deletions src/three/renderer/tiles/raycastTraverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ function distanceSort( a, b ) {
function intersectTileScene( tile, raycaster, renderer, intersects ) {

const { scene } = tile.engineData;
if ( ! scene ) {

return;

}

const didRaycast = renderer.invokeOnePlugin( plugin => plugin.raycastTile && plugin.raycastTile( tile, scene, raycaster, intersects ) );
if ( ! didRaycast ) {

Expand Down
Loading