Skip to content
Merged
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
4 changes: 2 additions & 2 deletions example/three/cesiumCompare.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
shallowTilesLoaded = 0;
traverse( threeViewer.root, t => {

if ( t.__hasRenderableContent && t.__loadingState !== 0 ) {
if ( t.internal && t.internal.hasRenderableContent && t.internal.loadingState !== 0 ) {

shallowTilesLoaded ++;
return true;
Expand All @@ -147,7 +147,7 @@
allLoadedTiles = 0;
traverse( threeViewer.root, ( t, d ) => {

if ( t.__hasContent && t.__loadingState !== 0 ) {
if ( t.internal && t.internal.hasContent && t.internal.loadingState !== 0 ) {

allLoadedTiles ++;

Expand Down Expand Up @@ -411,17 +411,17 @@
async function initCesium() {

// initialize the viewer
const viewer = new Cesium.CesiumWidget( cesiumContainer );

Check warning on line 414 in example/three/cesiumCompare.js

View workflow job for this annotation

GitHub Actions / build (20.x)

'Cesium' is not defined
viewer.scene.terrainProvider = false;
viewer.scene.skyBox.destroy();
viewer.scene.skyBox = undefined;
viewer.scene.sun.destroy();
viewer.scene.sun = undefined;
viewer.scene.backgroundColor = Cesium.Color.BLACK.clone();

Check warning on line 420 in example/three/cesiumCompare.js

View workflow job for this annotation

GitHub Actions / build (20.x)

'Cesium' is not defined
viewer.creditDisplay.container.style.display = 'none';

// initialize the tileset
const tileset = await Cesium.Cesium3DTileset.fromUrl( url, {

Check warning on line 424 in example/three/cesiumCompare.js

View workflow job for this annotation

GitHub Actions / build (20.x)

'Cesium' is not defined
// loadSiblings: true,
maximumCacheOverflowBytes: 1e20,
cacheBytes: 0,
Expand Down
7 changes: 4 additions & 3 deletions example/three/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function reinstantiateTiles() {
ktx2loader.detectSupport( renderer );

tiles = new TilesRenderer( url );
tiles.registerPlugin( new DebugTilesPlugin() );
tiles.registerPlugin( new ImplicitTilingPlugin() );
tiles.registerPlugin( new GLTFExtensionsPlugin( {
rtc: true,
Expand All @@ -109,9 +108,11 @@ function reinstantiateTiles() {
geospatialRotationParent.add( tiles.group );

// Used with CUSTOM_COLOR
tiles.customColorCallback = ( tile, object ) => {
const debugPlugin = new DebugTilesPlugin();
tiles.registerPlugin( debugPlugin );
debugPlugin.customColorCallback = ( tile, object ) => {

const depthIsEven = tile.__depth % 2 === 0;
const depthIsEven = tile.internal.depth % 2 === 0;
const hex = depthIsEven ? 0xff0000 : 0xffffff;
object.traverse( c => {

Expand Down
2 changes: 1 addition & 1 deletion example/three/src/plugins/overlays/TextureOverlayPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class TextureOverlayPlugin {
// public functions
getTileKey( tile ) {

return new URL( tile.content.uri, tile.__basePath + '/' ).toString();
return new URL( tile.content.uri, tile.internal.basePath + '/' ).toString();

}

Expand Down
14 changes: 7 additions & 7 deletions src/core/plugins/ImplicitTilingPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class ImplicitTilingPlugin {

if ( tile.implicitTiling ) {

tile.__hasUnrenderableContent = true;
tile.__hasRenderableContent = false;
tile.internal.hasUnrenderableContent = true;
tile.internal.hasRenderableContent = false;

// Declare some properties
tile.__subtreeIdx = 0; // Idx of the tile in its subtree
Expand All @@ -34,8 +34,8 @@ export class ImplicitTilingPlugin {
} else if ( /.subtree$/i.test( tile.content?.uri ) ) {

// Handling content uri pointing to a subtree file
tile.__hasUnrenderableContent = true;
tile.__hasRenderableContent = false;
tile.internal.hasUnrenderableContent = true;
tile.internal.hasRenderableContent = false;

}

Expand All @@ -46,7 +46,7 @@ export class ImplicitTilingPlugin {
if ( /^subtree$/i.test( extension ) ) {

const loader = new SUBTREELoader( tile );
loader.workingPath = tile.__basePath;
loader.workingPath = tile.internal.basePath;
loader.fetchOptions = this.tiles.fetchOptions;
return loader.parse( buffer );

Expand All @@ -64,7 +64,7 @@ export class ImplicitTilingPlugin {
.replace( '{y}', tile.__y )
.replace( '{z}', tile.__z );

return new URL( implicitUri, tile.__basePath + '/' ).toString();
return new URL( implicitUri, tile.internal.basePath + '/' ).toString();

}

Expand All @@ -84,7 +84,7 @@ export class ImplicitTilingPlugin {

} );
tile.children.length = 0;
tile.__childrenProcessed = 0;
tile.internal.childrenProcessed = 0;

}

Expand Down
70 changes: 44 additions & 26 deletions src/core/renderer/tiles/Tile.d.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,68 @@
import { TileBase } from './TileBase.js';

/**
* Documented 3d-tile state managed by the TilesRenderer* / used/usable in priority / traverseFunctions!
* Internal implementation details for tile management
*/
export interface Tile extends TileBase {

parent: Tile;
export interface TileInternalData {
hasContent: boolean;
hasRenderableContent: boolean;
hasUnrenderableContent: boolean;
loadingState: number;
basePath: string;
childrenProcessed: number;
depth: number;
depthFromRenderedParent: number;
}

/**
* Traversal state data updated during each frame's tile traversal
*/
export interface TileTraversalData {
/**
* Hierarchy Depth from the TileGroup
* How far this tile's bounds are from the nearest active camera.
* Expected to be filled in during calculateError implementations.
*/
__depth : number;
distanceFromCamera: number;
/**
* The screen space error for this tile
*/
__error : number;
error: number;
/**
* How far is this tiles bounds from the nearest active Camera.
* Expected to be filled in during calculateError implementations.
* Whether or not the tile was within the frustum on the last update run
*/
inFrustum: boolean;
/**
* Whether this tile is a leaf node in the used tree
*/
__distanceFromCamera : number;
isLeaf: boolean;
/**
* This tile is currently active if:
* 1: Tile content is loaded and ready to be made visible if needed
* Whether or not the tile was visited during the last update run
*/
__active : boolean;
used: boolean;
/**
* Whether or not the tile was used in the previous frame
*/
usedLastFrame: boolean;
/**
* This tile is currently visible if:
* 1: Tile content is loaded
* 2: Tile is within a camera frustum
* 3: Tile meets the SSE requirements
*/
__visible : boolean;
/**
* Whether or not the tile was visited during the last update run.
*/
__used : boolean;
visible: boolean;
}

/**
* Whether or not the tile was within the frustum on the last update run.
*/
__inFrustum : boolean;
/**
* Documented 3d-tile state managed by the TilesRenderer* / used/usable in priority / traverseFunctions!
*/
export interface Tile extends TileBase {

/**
* The depth of the tiles that increments only when a child with geometry content is encountered
*/
__depthFromRenderedParent : number;
parent: Tile;

// Internal implementation details for tile management
internal: TileInternalData;

// Traversal state data updated during each frame's tile traversal
traversal: TileTraversalData;

}
35 changes: 0 additions & 35 deletions src/core/renderer/tiles/TileInternal.d.ts

This file was deleted.

Loading
Loading