Skip to content

Commit 1740e9e

Browse files
authored
Docs: Add default value annotations (#1587)
* EnvironmentControls: Add flight support * Add free rotation * Updates * fix focus * Remove lines * Stylistic * Add "@default" annotations * Update docs build functions * Update more defaults * Update new defaults * Update docs * Update
1 parent 03f1cf2 commit 1740e9e

13 files changed

Lines changed: 171 additions & 124 deletions

File tree

src/core/renderer/API.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Base class for all 3D Tiles content loaders. Handles fetching and parsing tile c
8585
### .fetchOptions
8686

8787
```js
88-
fetchOptions: Object
88+
fetchOptions: Object = {}
8989
```
9090

9191
Options passed to `fetch` when loading tile content.
@@ -94,7 +94,7 @@ Options passed to `fetch` when loading tile content.
9494
### .workingPath
9595

9696
```js
97-
workingPath: string
97+
workingPath: string = ''
9898
```
9999

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

350350
```js
351-
unloadPriorityCallback: ( a: any, b: any ) => number | null
351+
unloadPriorityCallback: ( a: any, b: any ) => number | null = null
352352
```
353353

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

357357

358358
### .minSize
359359

360360
```js
361-
minSize: number
361+
minSize: number = 6000
362362
```
363363

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

369369
```js
370-
maxSize: number
370+
maxSize: number = 8000
371371
```
372372

373373
Maximum number of items before eviction is triggered.
@@ -376,7 +376,7 @@ Maximum number of items before eviction is triggered.
376376
### .minBytesSize
377377

378378
```js
379-
minBytesSize: number
379+
minBytesSize: number = ~322MB
380380
```
381381

382382
Minimum total bytes to retain after eviction.
@@ -387,7 +387,7 @@ Minimum total bytes to retain after eviction.
387387
### .maxBytesSize
388388

389389
```js
390-
maxBytesSize: number
390+
maxBytesSize: number = ~430MB
391391
```
392392

393393
Maximum total bytes before eviction is triggered.
@@ -398,7 +398,7 @@ Maximum total bytes before eviction is triggered.
398398
### .unloadPercent
399399

400400
```js
401-
unloadPercent: number
401+
unloadPercent: number = 0.05
402402
```
403403

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

409409
```js
410-
autoMarkUnused: boolean
410+
autoMarkUnused: boolean = true
411411
```
412412

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

553553
```js
554-
maxJobs: number
554+
maxJobs: number = 6
555555
```
556556

557557
Maximum number of jobs that can run concurrently.
@@ -560,7 +560,7 @@ Maximum number of jobs that can run concurrently.
560560
### .autoUpdate
561561

562562
```js
563-
autoUpdate: boolean
563+
autoUpdate: boolean = true
564564
```
565565

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

571571
```js
572-
priorityCallback: ( a: any, b: any ) => number | null
572+
priorityCallback: ( a: any, b: any ) => number | null = null
573573
```
574574

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

578578

579579
### .sort
@@ -773,7 +773,7 @@ The loaded root tileset object, or null if not yet loaded.
773773
### .fetchOptions
774774
775775
```js
776-
fetchOptions: RequestInit
776+
fetchOptions: RequestInit = {}
777777
```
778778
779779
Options passed to `fetch` when loading tile and tileset resources.
@@ -863,7 +863,7 @@ Loading and rendering statistics updated each frame. Fields:
863863
### .errorTarget
864864
865865
```js
866-
errorTarget: number
866+
errorTarget: number = 16
867867
```
868868
869869
Target screen-space error in pixels to aim for when updating the geometry. Tiles will
@@ -875,7 +875,7 @@ of the 3D Tiles specification for more information.
875875
### .displayActiveTiles
876876
877877
```js
878-
displayActiveTiles: boolean
878+
displayActiveTiles: boolean = false
879879
```
880880
881881
"Active tiles" are those that are loaded and available but not necessarily visible.
@@ -888,7 +888,7 @@ camera view not accounted for by the tiles renderer.
888888
### .maxDepth
889889
890890
```js
891-
maxDepth: number
891+
maxDepth: number = Infinity
892892
```
893893
894894
Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skipped.
@@ -897,7 +897,7 @@ Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skip
897897
### .optimizedLoadStrategy
898898
899899
```js
900-
optimizedLoadStrategy: boolean
900+
optimizedLoadStrategy: boolean = false
901901
```
902902
903903
**Experimental.** Enables an optimized tile loading strategy that loads only the tiles
@@ -907,9 +907,6 @@ tiles to load first. Prevents visual gaps and flashing during camera movement.
907907
908908
Based in part on [Cesium Native tile selection](https://cesium.com/learn/cesium-native/ref-doc/selection-algorithm-details.html).
909909
910-
Default is `false`, which uses the previous approach of loading all parent and sibling
911-
tiles for guaranteed smooth transitions.
912-
913910
> [!WARNING]
914911
> Setting is currently incompatible with plugins that split tiles and on-the-fly generate and
915912
> dispose of child tiles including the `ImageOverlayPlugin` `enableTileSplitting` setting,
@@ -919,7 +916,7 @@ tiles for guaranteed smooth transitions.
919916
### .loadSiblings
920917
921918
```js
922-
loadSiblings: boolean
919+
loadSiblings: boolean = true
923920
```
924921
925922
**Experimental.** When `true`, sibling tiles are loaded together to prevent gaps during
@@ -933,7 +930,7 @@ Only applies when `optimizedLoadStrategy` is enabled.
933930
### .loadAncestors
934931
935932
```js
936-
loadAncestors: boolean
933+
loadAncestors: boolean = false
937934
```
938935
939936
**Experimental.** When `true`, ancestor tiles are queued for download and displayed as a
@@ -947,7 +944,7 @@ Only applies when `optimizedLoadStrategy` is enabled.
947944
### .maxTilesProcessed
948945
949946
```js
950-
maxTilesProcessed: number
947+
maxTilesProcessed: number = 250
951948
```
952949
953950
The number of tiles to process immediately when traversing the tile set to determine

src/core/renderer/loaders/LoaderBase.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ export class LoaderBase {
1010
/**
1111
* Options passed to `fetch` when loading tile content.
1212
* @type {Object}
13+
* @default {}
1314
*/
1415
this.fetchOptions = {};
1516

1617
/**
1718
* Base URL used to resolve relative external URLs.
1819
* @type {string}
20+
* @default ''
1921
*/
2022
this.workingPath = '';
2123

src/core/renderer/tiles/TilesRendererBase.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ export class TilesRendererBase {
403403
/**
404404
* Options passed to `fetch` when loading tile and tileset resources.
405405
* @type {RequestInit}
406+
* @default {}
406407
*/
407408
this.fetchOptions = {};
408409
this.plugins = [];
@@ -544,6 +545,7 @@ export class TilesRendererBase {
544545
* {@link https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error geometric error section}
545546
* of the 3D Tiles specification for more information.
546547
* @type {number}
548+
* @default 16
547549
*/
548550
this.errorTarget = 16.0;
549551
this._errorThreshold = Infinity;
@@ -555,12 +557,14 @@ export class TilesRendererBase {
555557
* Setting this to `true` keeps them in the scene so they can be rendered from an outside
556558
* camera view not accounted for by the tiles renderer.
557559
* @type {boolean}
560+
* @default false
558561
*/
559562
this.displayActiveTiles = false;
560563

561564
/**
562565
* Maximum depth in the tile hierarchy to traverse. Tiles deeper than this are skipped.
563566
* @type {number}
567+
* @default Infinity
564568
*/
565569
this.maxDepth = Infinity;
566570

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

@@ -590,6 +592,7 @@ export class TilesRendererBase {
590592
*
591593
* Only applies when `optimizedLoadStrategy` is enabled.
592594
* @type {boolean}
595+
* @default true
593596
*/
594597
this.loadSiblings = true;
595598

@@ -601,6 +604,7 @@ export class TilesRendererBase {
601604
*
602605
* Only applies when `optimizedLoadStrategy` is enabled.
603606
* @type {boolean}
607+
* @default false
604608
*/
605609
this.loadAncestors = false;
606610

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

src/core/renderer/utilities/LRUCache.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ class LRUCache {
2222

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

@@ -60,38 +61,44 @@ class LRUCache {
6061
/**
6162
* Minimum number of items to keep in the cache after eviction.
6263
* @type {number}
64+
* @default 6000
6365
*/
6466
this.minSize = 6000;
6567

6668
/**
6769
* Maximum number of items before eviction is triggered.
6870
* @type {number}
71+
* @default 8000
6972
*/
7073
this.maxSize = 8000;
7174

7275
/**
7376
* Minimum total bytes to retain after eviction.
7477
* @note Only works with three.js r166 or higher.
7578
* @type {number}
79+
* @default ~322MB
7680
*/
7781
this.minBytesSize = 0.3 * GIGABYTE_BYTES;
7882

7983
/**
8084
* Maximum total bytes before eviction is triggered.
8185
* @note Only works with three.js r166 or higher.
8286
* @type {number}
87+
* @default ~430MB
8388
*/
8489
this.maxBytesSize = 0.4 * GIGABYTE_BYTES;
8590

8691
/**
8792
* Fraction of excess items/bytes to unload per eviction pass.
8893
* @type {number}
94+
* @default 0.05
8995
*/
9096
this.unloadPercent = 0.05;
9197

9298
/**
9399
* If true, items are automatically marked as unused at the start of each eviction pass.
94100
* @type {boolean}
101+
* @default true
95102
*/
96103
this.autoMarkUnused = true;
97104

src/core/renderer/utilities/PriorityQueue.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ export class PriorityQueue {
6060

6161
/**
6262
* Callback used to schedule when to run jobs next, so more work doesn't happen in a
63-
* single frame than there is time for. Defaults to `requestAnimationFrame`. Should be
64-
* overridden in scenarios where `requestAnimationFrame` is not reliable, such as when
65-
* running in WebXR.
63+
* single frame than there is time for. Should be overridden in scenarios where
64+
* `requestAnimationFrame` is not reliable, such as when running in WebXR.
6665
* @type {SchedulingCallback}
66+
* @default requestAnimationFrame
6767
* @deprecated
6868
*/
6969
get schedulingCallback() {
@@ -84,6 +84,7 @@ export class PriorityQueue {
8484
/**
8585
* Maximum number of jobs that can run concurrently.
8686
* @type {number}
87+
* @default 6
8788
*/
8889
this.maxJobs = 6;
8990

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

101103
/**
102104
* Comparator used to sort queued items. Higher-priority items should sort last
103-
* (i.e. return positive when `itemA` should run before `itemB`). Defaults to `null`.
105+
* (i.e. return positive when `itemA` should run before `itemB`).
104106
* @type {PriorityCallback|null}
107+
* @default null
105108
*/
106109
this.priorityCallback = null;
107110

src/three/plugins/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ order, and an unlit rendering mode. Color modes are available via the static
709709
### .getDebugColor
710710

711711
```js
712-
getDebugColor: ( val: number, target: Color ) => void
712+
getDebugColor: ( val: number, target: Color ) => void = ( value, target ) => target.setRGB( value, value, value )
713713
```
714714

715715
Maps a normalized [0, 1] value to a `Color` for debug visualizations. Defaults to

src/three/plugins/DebugTilesPlugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export class DebugTilesPlugin {
262262
* a black-to-white gradient. Replace with a custom function to use a different color
263263
* ramp.
264264
* @type {GetDebugColorCallback}
265+
* @default ( value, target ) => target.setRGB( value, value, value )
265266
*/
266267
this.getDebugColor = ( value, target ) => {
267268

0 commit comments

Comments
 (0)