Skip to content
Merged
47 changes: 22 additions & 25 deletions src/core/renderer/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Base class for all 3D Tiles content loaders. Handles fetching and parsing tile c
### .fetchOptions

```js
fetchOptions: Object
fetchOptions: Object = {}
```

Options passed to `fetch` when loading tile content.
Expand All @@ -94,7 +94,7 @@ Options passed to `fetch` when loading tile content.
### .workingPath

```js
workingPath: string
workingPath: string = ''
```

Base URL used to resolve relative external URLs.
Expand Down Expand Up @@ -348,17 +348,17 @@ are in use each frame and evicts unused items when the cache exceeds its size li
### .unloadPriorityCallback

```js
unloadPriorityCallback: ( a: any, b: any ) => number | null
unloadPriorityCallback: ( a: any, b: any ) => number | null = null
```

Comparator used to determine eviction order. Items that sort last are evicted first.
Defaults to `null` (eviction order is by last-used time).
When `null`, eviction order is by last-used time.


### .minSize

```js
minSize: number
minSize: number = 6000
```

Minimum number of items to keep in the cache after eviction.
Expand All @@ -367,7 +367,7 @@ Minimum number of items to keep in the cache after eviction.
### .maxSize

```js
maxSize: number
maxSize: number = 8000
```

Maximum number of items before eviction is triggered.
Expand All @@ -376,7 +376,7 @@ Maximum number of items before eviction is triggered.
### .minBytesSize

```js
minBytesSize: number
minBytesSize: number = ~322MB
```

Minimum total bytes to retain after eviction.
Expand All @@ -387,7 +387,7 @@ Minimum total bytes to retain after eviction.
### .maxBytesSize

```js
maxBytesSize: number
maxBytesSize: number = ~430MB
```

Maximum total bytes before eviction is triggered.
Expand All @@ -398,7 +398,7 @@ Maximum total bytes before eviction is triggered.
### .unloadPercent

```js
unloadPercent: number
unloadPercent: number = 0.05
```

Fraction of excess items/bytes to unload per eviction pass.
Expand All @@ -407,7 +407,7 @@ Fraction of excess items/bytes to unload per eviction pass.
### .autoMarkUnused

```js
autoMarkUnused: boolean
autoMarkUnused: boolean = true
```

If true, items are automatically marked as unused at the start of each eviction pass.
Expand Down Expand Up @@ -551,7 +551,7 @@ returns whether tasks are queued or actively running
### .maxJobs

```js
maxJobs: number
maxJobs: number = 6
```

Maximum number of jobs that can run concurrently.
Expand All @@ -560,7 +560,7 @@ Maximum number of jobs that can run concurrently.
### .autoUpdate

```js
autoUpdate: boolean
autoUpdate: boolean = true
```

If true, job runs are automatically scheduled after `add` and after each job completes.
Expand All @@ -569,11 +569,11 @@ If true, job runs are automatically scheduled after `add` and after each job com
### .priorityCallback

```js
priorityCallback: ( a: any, b: any ) => number | null
priorityCallback: ( a: any, b: any ) => number | null = null
```

Comparator used to sort queued items. Higher-priority items should sort last
(i.e. return positive when `itemA` should run before `itemB`). Defaults to `null`.
(i.e. return positive when `itemA` should run before `itemB`).


### .sort
Expand Down Expand Up @@ -773,7 +773,7 @@ The loaded root tileset object, or null if not yet loaded.
### .fetchOptions

```js
fetchOptions: RequestInit
fetchOptions: RequestInit = {}
```

Options passed to `fetch` when loading tile and tileset resources.
Expand Down Expand Up @@ -863,7 +863,7 @@ Loading and rendering statistics updated each frame. Fields:
### .errorTarget

```js
errorTarget: number
errorTarget: number = 16
```

Target screen-space error in pixels to aim for when updating the geometry. Tiles will
Expand All @@ -875,7 +875,7 @@ of the 3D Tiles specification for more information.
### .displayActiveTiles

```js
displayActiveTiles: boolean
displayActiveTiles: boolean = false
```

"Active tiles" are those that are loaded and available but not necessarily visible.
Expand All @@ -888,7 +888,7 @@ camera view not accounted for by the tiles renderer.
### .maxDepth

```js
maxDepth: number
maxDepth: number = Infinity
```

Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skipped.
Expand All @@ -897,7 +897,7 @@ Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skip
### .optimizedLoadStrategy

```js
optimizedLoadStrategy: boolean
optimizedLoadStrategy: boolean = false
```

**Experimental.** Enables an optimized tile loading strategy that loads only the tiles
Expand All @@ -907,9 +907,6 @@ tiles to load first. Prevents visual gaps and flashing during camera movement.

Based in part on [Cesium Native tile selection](https://cesium.com/learn/cesium-native/ref-doc/selection-algorithm-details.html).

Default is `false`, which uses the previous approach of loading all parent and sibling
tiles for guaranteed smooth transitions.

> [!WARNING]
> Setting is currently incompatible with plugins that split tiles and on-the-fly generate and
> dispose of child tiles including the `ImageOverlayPlugin` `enableTileSplitting` setting,
Expand All @@ -919,7 +916,7 @@ tiles for guaranteed smooth transitions.
### .loadSiblings

```js
loadSiblings: boolean
loadSiblings: boolean = true
```

**Experimental.** When `true`, sibling tiles are loaded together to prevent gaps during
Expand All @@ -933,7 +930,7 @@ Only applies when `optimizedLoadStrategy` is enabled.
### .loadAncestors

```js
loadAncestors: boolean
loadAncestors: boolean = false
```

**Experimental.** When `true`, ancestor tiles are queued for download and displayed as a
Expand All @@ -947,7 +944,7 @@ Only applies when `optimizedLoadStrategy` is enabled.
### .maxTilesProcessed

```js
maxTilesProcessed: number
maxTilesProcessed: number = 250
```

The number of tiles to process immediately when traversing the tile set to determine
Expand Down
2 changes: 2 additions & 0 deletions src/core/renderer/loaders/LoaderBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export class LoaderBase {
/**
* Options passed to `fetch` when loading tile content.
* @type {Object}
* @default {}
*/
this.fetchOptions = {};

/**
* Base URL used to resolve relative external URLs.
* @type {string}
* @default ''
*/
this.workingPath = '';

Expand Down
11 changes: 8 additions & 3 deletions src/core/renderer/tiles/TilesRendererBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export class TilesRendererBase {
/**
* Options passed to `fetch` when loading tile and tileset resources.
* @type {RequestInit}
* @default {}
*/
this.fetchOptions = {};
this.plugins = [];
Expand Down Expand Up @@ -544,6 +545,7 @@ export class TilesRendererBase {
* {@link https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error geometric error section}
* of the 3D Tiles specification for more information.
* @type {number}
* @default 16
*/
this.errorTarget = 16.0;
this._errorThreshold = Infinity;
Expand All @@ -555,12 +557,14 @@ export class TilesRendererBase {
* Setting this to `true` keeps them in the scene so they can be rendered from an outside
* camera view not accounted for by the tiles renderer.
* @type {boolean}
* @default false
*/
this.displayActiveTiles = false;

/**
* Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skipped.
* @type {number}
* @default Infinity
*/
this.maxDepth = Infinity;

Expand All @@ -571,14 +575,12 @@ export class TilesRendererBase {
* tiles to load first. Prevents visual gaps and flashing during camera movement.
*
* Based in part on {@link https://cesium.com/learn/cesium-native/ref-doc/selection-algorithm-details.html Cesium Native tile selection}.
*
* Default is `false`, which uses the previous approach of loading all parent and sibling
* tiles for guaranteed smooth transitions.
* @warn Setting is currently incompatible with plugins that split tiles and on-the-fly generate and
* dispose of child tiles including the `ImageOverlayPlugin` `enableTileSplitting` setting,
* `QuantizedMeshPlugin`, & `ImageFormatPlugin` subclasses (XYZ, TMS, etc). Any tile sets
* that share caches or queues must also use the same setting.
* @type {boolean}
* @default false
*/
this.optimizedLoadStrategy = false;

Expand All @@ -590,6 +592,7 @@ export class TilesRendererBase {
*
* Only applies when `optimizedLoadStrategy` is enabled.
* @type {boolean}
* @default true
*/
this.loadSiblings = true;

Expand All @@ -601,6 +604,7 @@ export class TilesRendererBase {
*
* Only applies when `optimizedLoadStrategy` is enabled.
* @type {boolean}
* @default false
*/
this.loadAncestors = false;

Expand All @@ -610,6 +614,7 @@ export class TilesRendererBase {
* at once when a new tile set is available, while higher values process more tiles
* immediately so data can be downloaded and displayed sooner.
* @type {number}
* @default 250
*/
this.maxTilesProcessed = 250;

Expand Down
9 changes: 8 additions & 1 deletion src/core/renderer/utilities/LRUCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class LRUCache {

/**
* Comparator used to determine eviction order. Items that sort last are evicted first.
* Defaults to `null` (eviction order is by last-used time).
* When `null`, eviction order is by last-used time.
* @type {UnloadPriorityCallback|null}
* @default null
*/
get unloadPriorityCallback() {

Expand Down Expand Up @@ -60,38 +61,44 @@ class LRUCache {
/**
* Minimum number of items to keep in the cache after eviction.
* @type {number}
* @default 6000
*/
this.minSize = 6000;

/**
* Maximum number of items before eviction is triggered.
* @type {number}
* @default 8000
*/
this.maxSize = 8000;

/**
* Minimum total bytes to retain after eviction.
* @note Only works with three.js r166 or higher.
* @type {number}
* @default ~322MB
*/
this.minBytesSize = 0.3 * GIGABYTE_BYTES;

/**
* Maximum total bytes before eviction is triggered.
* @note Only works with three.js r166 or higher.
* @type {number}
* @default ~430MB
*/
this.maxBytesSize = 0.4 * GIGABYTE_BYTES;

/**
* Fraction of excess items/bytes to unload per eviction pass.
* @type {number}
* @default 0.05
*/
this.unloadPercent = 0.05;

/**
* If true, items are automatically marked as unused at the start of each eviction pass.
* @type {boolean}
* @default true
*/
this.autoMarkUnused = true;

Expand Down
11 changes: 7 additions & 4 deletions src/core/renderer/utilities/PriorityQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export class PriorityQueue {

/**
* Callback used to schedule when to run jobs next, so more work doesn't happen in a
* single frame than there is time for. Defaults to `requestAnimationFrame`. Should be
* overridden in scenarios where `requestAnimationFrame` is not reliable, such as when
* running in WebXR.
* single frame than there is time for. Should be overridden in scenarios where
* `requestAnimationFrame` is not reliable, such as when running in WebXR.
* @type {SchedulingCallback}
* @default requestAnimationFrame
* @deprecated
*/
get schedulingCallback() {
Expand All @@ -84,6 +84,7 @@ export class PriorityQueue {
/**
* Maximum number of jobs that can run concurrently.
* @type {number}
* @default 6
*/
this.maxJobs = 6;

Expand All @@ -95,13 +96,15 @@ export class PriorityQueue {
/**
* If true, job runs are automatically scheduled after `add` and after each job completes.
* @type {boolean}
* @default true
*/
this.autoUpdate = true;

/**
* Comparator used to sort queued items. Higher-priority items should sort last
* (i.e. return positive when `itemA` should run before `itemB`). Defaults to `null`.
* (i.e. return positive when `itemA` should run before `itemB`).
* @type {PriorityCallback|null}
* @default null
*/
this.priorityCallback = null;

Expand Down
2 changes: 1 addition & 1 deletion src/three/plugins/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ order, and an unlit rendering mode. Color modes are available via the static
### .getDebugColor

```js
getDebugColor: ( val: number, target: Color ) => void
getDebugColor: ( val: number, target: Color ) => void = ( value, target ) => target.setRGB( value, value, value )
```

Maps a normalized [0, 1] value to a `Color` for debug visualizations. Defaults to
Expand Down
1 change: 1 addition & 0 deletions src/three/plugins/DebugTilesPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export class DebugTilesPlugin {
* a black-to-white gradient. Replace with a custom function to use a different color
* ramp.
* @type {GetDebugColorCallback}
* @default ( value, target ) => target.setRGB( value, value, value )
*/
this.getDebugColor = ( value, target ) => {

Expand Down
Loading
Loading