@idetik/core 0.45.4 → 0.45.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +249 -206
- package/dist/index.js +292 -276
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +19 -19
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/stats.d.ts +51 -0
- package/dist/types/src/core/stats.d.ts.map +1 -0
- package/dist/types/src/idetik.d.ts +4 -31
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1011,181 +1011,6 @@ declare class EventDispatcher {
|
|
|
1011
1011
|
private readonly handleEvent;
|
|
1012
1012
|
}
|
|
1013
1013
|
|
|
1014
|
-
/**
|
|
1015
|
-
* The loading lifecycle state of a layer.
|
|
1016
|
-
*/
|
|
1017
|
-
type LayerState = "initialized" | "loading" | "ready";
|
|
1018
|
-
/**
|
|
1019
|
-
* How a layer's output blends with previously drawn content.
|
|
1020
|
-
*/
|
|
1021
|
-
type BlendMode = "none" | "normal" | "additive" | "subtractive" | "multiply" | "premultipliedOver";
|
|
1022
|
-
/**
|
|
1023
|
-
* A callback invoked after a layer's state changes.
|
|
1024
|
-
*/
|
|
1025
|
-
type StateChangeCallback = (newState: LayerState, prevState?: LayerState) => void;
|
|
1026
|
-
/**
|
|
1027
|
-
* Initialization properties for constructing a layer.
|
|
1028
|
-
*/
|
|
1029
|
-
type LayerProps = {
|
|
1030
|
-
/** Layer opacity in `[0, 1]`. Defaults to `1`. */
|
|
1031
|
-
opacity?: number;
|
|
1032
|
-
/** How the layer blends. Defaults to `"none"`. */
|
|
1033
|
-
blendMode?: BlendMode;
|
|
1034
|
-
/** Hides content behind. Inferred from `blendMode`. */
|
|
1035
|
-
occludes?: boolean;
|
|
1036
|
-
};
|
|
1037
|
-
/**
|
|
1038
|
-
* Abstract base class for any layer that can be added to a viewport.
|
|
1039
|
-
*
|
|
1040
|
-
* A layer owns a set of renderable objects and contributes them to the
|
|
1041
|
-
* scene each frame. Subclasses such as {@link ImageLayer},
|
|
1042
|
-
* {@link VolumeLayer}, and {@link LabelLayer} implement {@link update} to
|
|
1043
|
-
* build or refresh those objects for the current view. Custom layers
|
|
1044
|
-
* register objects with {@link addObject} and report readiness through
|
|
1045
|
-
* {@link setState}.
|
|
1046
|
-
*
|
|
1047
|
-
* Layers carry shared presentation state in {@link opacity},
|
|
1048
|
-
* {@link blendMode}, and {@link occludes}, and expose a lifecycle
|
|
1049
|
-
* {@link LayerState} that observers can subscribe to. A layer instance may
|
|
1050
|
-
* be attached to only one viewport at a time.
|
|
1051
|
-
*
|
|
1052
|
-
* ```ts
|
|
1053
|
-
* class Particles extends Layer {
|
|
1054
|
-
* public readonly type = "Particles";
|
|
1055
|
-
*
|
|
1056
|
-
* constructor(points: PointProps[]) {
|
|
1057
|
-
* super();
|
|
1058
|
-
* this.addObject(new PointsRenderable(points));
|
|
1059
|
-
* this.setState("ready");
|
|
1060
|
-
* }
|
|
1061
|
-
*
|
|
1062
|
-
* public update() {}
|
|
1063
|
-
* }
|
|
1064
|
-
*
|
|
1065
|
-
* viewport.addLayer(new Particles(points));
|
|
1066
|
-
* ```
|
|
1067
|
-
*
|
|
1068
|
-
* @group Layers
|
|
1069
|
-
*/
|
|
1070
|
-
declare abstract class Layer {
|
|
1071
|
-
/** A string identifying the concrete layer type. */
|
|
1072
|
-
abstract readonly type: string;
|
|
1073
|
-
/**
|
|
1074
|
-
* How the layer's output blends with previously drawn content. Also
|
|
1075
|
-
* applies to blending between objects within the layer.
|
|
1076
|
-
*/
|
|
1077
|
-
blendMode: BlendMode;
|
|
1078
|
-
/**
|
|
1079
|
-
* Whether the layer writes depth and hides content drawn behind it.
|
|
1080
|
-
*
|
|
1081
|
-
* Occluding layers render a depth pass and always draw before
|
|
1082
|
-
* non-occluding layers regardless of their order in the viewport. When
|
|
1083
|
-
* not set explicitly this value is inferred from `blendMode` at
|
|
1084
|
-
* construction only. Reassigning {@link blendMode} later does not update
|
|
1085
|
-
* it.
|
|
1086
|
-
*/
|
|
1087
|
-
occludes: boolean;
|
|
1088
|
-
/** Set to `true` by subclasses whose shaders read scene depth. */
|
|
1089
|
-
protected requiresSceneDepth_: boolean;
|
|
1090
|
-
private readonly coverageGroups_;
|
|
1091
|
-
private state_;
|
|
1092
|
-
private attached_;
|
|
1093
|
-
private readonly callbacks_;
|
|
1094
|
-
private opacity_;
|
|
1095
|
-
/**
|
|
1096
|
-
* Creates a layer with the given presentation state.
|
|
1097
|
-
*
|
|
1098
|
-
* @param props - Initialization properties.
|
|
1099
|
-
*/
|
|
1100
|
-
constructor({ opacity, blendMode, occludes, }?: LayerProps);
|
|
1101
|
-
/**
|
|
1102
|
-
* Whether the layer's shaders read scene depth. When `true` the renderer
|
|
1103
|
-
* draws occluding layers to a depth texture the layer's shaders can
|
|
1104
|
-
* sample. A layer cannot both occlude and read scene depth.
|
|
1105
|
-
*/
|
|
1106
|
-
get requiresSceneDepth(): boolean;
|
|
1107
|
-
/** The layer's opacity in `[0, 1]`. Values outside are clamped. */
|
|
1108
|
-
get opacity(): number;
|
|
1109
|
-
/** @param value - The new opacity in `[0, 1]`. */
|
|
1110
|
-
set opacity(value: number);
|
|
1111
|
-
/**
|
|
1112
|
-
* Builds or refreshes the layer's renderable objects for the current
|
|
1113
|
-
* view. Called automatically once per frame for every layer in a
|
|
1114
|
-
* viewport.
|
|
1115
|
-
*
|
|
1116
|
-
* @param viewport - The viewport being rendered.
|
|
1117
|
-
*/
|
|
1118
|
-
abstract update(viewport?: Viewport): void;
|
|
1119
|
-
/**
|
|
1120
|
-
* Handles a pointer or wheel event from the owning viewport. Called
|
|
1121
|
-
* automatically for each event before the camera controls. The default
|
|
1122
|
-
* implementation does nothing.
|
|
1123
|
-
*
|
|
1124
|
-
* @param _event - The event with clip and world coordinates attached.
|
|
1125
|
-
*/
|
|
1126
|
-
onEvent(_event: EventContext): void;
|
|
1127
|
-
/**
|
|
1128
|
-
* Lifecycle hook that is called automatically when a layer is
|
|
1129
|
-
* is attached to a viewport. A layer can only be attached to one viewport
|
|
1130
|
-
* at a time.
|
|
1131
|
-
*
|
|
1132
|
-
* @param context - The shared runtime context.
|
|
1133
|
-
*/
|
|
1134
|
-
onAttached(context: IdetikContext): void;
|
|
1135
|
-
/**
|
|
1136
|
-
* Lifecycle hook that is called automatically when a layer is detached
|
|
1137
|
-
* from a viewport.
|
|
1138
|
-
*
|
|
1139
|
-
* @param context - The shared runtime context.
|
|
1140
|
-
*/
|
|
1141
|
-
onDetached(context: IdetikContext): void;
|
|
1142
|
-
/** @hidden */
|
|
1143
|
-
protected attach(_context: IdetikContext): void;
|
|
1144
|
-
/** @hidden */
|
|
1145
|
-
protected detach(_context: IdetikContext): void;
|
|
1146
|
-
/**
|
|
1147
|
-
* The layer's renderable objects grouped by coverage group. Objects in
|
|
1148
|
-
* a group draw each pixel at most once, letting chunks at multiple
|
|
1149
|
-
* levels of detail overlap correctly.
|
|
1150
|
-
*/
|
|
1151
|
-
get coverageGroups(): ReadonlyMap<number | null, readonly RenderableObject[]>;
|
|
1152
|
-
/** The layer's current lifecycle state. */
|
|
1153
|
-
get state(): LayerState;
|
|
1154
|
-
/**
|
|
1155
|
-
* Registers a callback invoked after every state change.
|
|
1156
|
-
*
|
|
1157
|
-
* @param callback - Receives the new and previous states.
|
|
1158
|
-
*/
|
|
1159
|
-
addStateChangeCallback(callback: StateChangeCallback): void;
|
|
1160
|
-
/**
|
|
1161
|
-
* Removes a previously registered state change callback.
|
|
1162
|
-
*
|
|
1163
|
-
* @param callback - The callback to remove.
|
|
1164
|
-
*/
|
|
1165
|
-
removeStateChangeCallback(callback: StateChangeCallback): void;
|
|
1166
|
-
/**
|
|
1167
|
-
* Sets the lifecycle state and notifies state change callbacks.
|
|
1168
|
-
*
|
|
1169
|
-
* @param newState - The state to enter.
|
|
1170
|
-
*/
|
|
1171
|
-
protected setState(newState: LayerState): void;
|
|
1172
|
-
/**
|
|
1173
|
-
* Registers a renderable object for drawing. Objects in the same
|
|
1174
|
-
* coverage group draw each pixel at most once.
|
|
1175
|
-
*
|
|
1176
|
-
* @param object - The object to add.
|
|
1177
|
-
* @param coverageGroup - The group key.
|
|
1178
|
-
*/
|
|
1179
|
-
protected addObject(object: RenderableObject, coverageGroup?: number | null): void;
|
|
1180
|
-
/** Removes all registered renderable objects. */
|
|
1181
|
-
protected clearObjects(): void;
|
|
1182
|
-
/**
|
|
1183
|
-
* Returns uniform name-value pairs applied to every object drawn by
|
|
1184
|
-
* this layer. Override in subclasses that need custom shader uniforms.
|
|
1185
|
-
*/
|
|
1186
|
-
getUniforms(): Record<string, unknown>;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
1014
|
/**
|
|
1190
1015
|
* A world-space rectangle for the camera to frame.
|
|
1191
1016
|
*/
|
|
@@ -1556,6 +1381,251 @@ declare class Viewport {
|
|
|
1556
1381
|
private updateAspectRatio;
|
|
1557
1382
|
}
|
|
1558
1383
|
|
|
1384
|
+
/**
|
|
1385
|
+
* The loading lifecycle state of a layer.
|
|
1386
|
+
*/
|
|
1387
|
+
type LayerState = "initialized" | "loading" | "ready";
|
|
1388
|
+
/**
|
|
1389
|
+
* How a layer's output blends with previously drawn content.
|
|
1390
|
+
*/
|
|
1391
|
+
type BlendMode = "none" | "normal" | "additive" | "subtractive" | "multiply" | "premultipliedOver";
|
|
1392
|
+
/**
|
|
1393
|
+
* A callback invoked after a layer's state changes.
|
|
1394
|
+
*/
|
|
1395
|
+
type StateChangeCallback = (newState: LayerState, prevState?: LayerState) => void;
|
|
1396
|
+
/**
|
|
1397
|
+
* Initialization properties for constructing a layer.
|
|
1398
|
+
*/
|
|
1399
|
+
type LayerProps = {
|
|
1400
|
+
/** Layer opacity in `[0, 1]`. Defaults to `1`. */
|
|
1401
|
+
opacity?: number;
|
|
1402
|
+
/** How the layer blends. Defaults to `"none"`. */
|
|
1403
|
+
blendMode?: BlendMode;
|
|
1404
|
+
/** Hides content behind. Inferred from `blendMode`. */
|
|
1405
|
+
occludes?: boolean;
|
|
1406
|
+
};
|
|
1407
|
+
/**
|
|
1408
|
+
* Abstract base class for any layer that can be added to a viewport.
|
|
1409
|
+
*
|
|
1410
|
+
* A layer owns a set of renderable objects and contributes them to the
|
|
1411
|
+
* scene each frame. Subclasses such as {@link ImageLayer},
|
|
1412
|
+
* {@link VolumeLayer}, and {@link LabelLayer} implement {@link update} to
|
|
1413
|
+
* build or refresh those objects for the current view. Custom layers
|
|
1414
|
+
* register objects with {@link addObject} and report readiness through
|
|
1415
|
+
* {@link setState}.
|
|
1416
|
+
*
|
|
1417
|
+
* Layers carry shared presentation state in {@link opacity},
|
|
1418
|
+
* {@link blendMode}, and {@link occludes}, and expose a lifecycle
|
|
1419
|
+
* {@link LayerState} that observers can subscribe to. A layer instance may
|
|
1420
|
+
* be attached to only one viewport at a time.
|
|
1421
|
+
*
|
|
1422
|
+
* ```ts
|
|
1423
|
+
* class Particles extends Layer {
|
|
1424
|
+
* public readonly type = "Particles";
|
|
1425
|
+
*
|
|
1426
|
+
* constructor(points: PointProps[]) {
|
|
1427
|
+
* super();
|
|
1428
|
+
* this.addObject(new PointsRenderable(points));
|
|
1429
|
+
* this.setState("ready");
|
|
1430
|
+
* }
|
|
1431
|
+
*
|
|
1432
|
+
* public update() {}
|
|
1433
|
+
* }
|
|
1434
|
+
*
|
|
1435
|
+
* viewport.addLayer(new Particles(points));
|
|
1436
|
+
* ```
|
|
1437
|
+
*
|
|
1438
|
+
* @group Layers
|
|
1439
|
+
*/
|
|
1440
|
+
declare abstract class Layer {
|
|
1441
|
+
/** A string identifying the concrete layer type. */
|
|
1442
|
+
abstract readonly type: string;
|
|
1443
|
+
/**
|
|
1444
|
+
* How the layer's output blends with previously drawn content. Also
|
|
1445
|
+
* applies to blending between objects within the layer.
|
|
1446
|
+
*/
|
|
1447
|
+
blendMode: BlendMode;
|
|
1448
|
+
/**
|
|
1449
|
+
* Whether the layer writes depth and hides content drawn behind it.
|
|
1450
|
+
*
|
|
1451
|
+
* Occluding layers render a depth pass and always draw before
|
|
1452
|
+
* non-occluding layers regardless of their order in the viewport. When
|
|
1453
|
+
* not set explicitly this value is inferred from `blendMode` at
|
|
1454
|
+
* construction only. Reassigning {@link blendMode} later does not update
|
|
1455
|
+
* it.
|
|
1456
|
+
*/
|
|
1457
|
+
occludes: boolean;
|
|
1458
|
+
/** Set to `true` by subclasses whose shaders read scene depth. */
|
|
1459
|
+
protected requiresSceneDepth_: boolean;
|
|
1460
|
+
private readonly coverageGroups_;
|
|
1461
|
+
private state_;
|
|
1462
|
+
private attached_;
|
|
1463
|
+
private readonly callbacks_;
|
|
1464
|
+
private opacity_;
|
|
1465
|
+
/**
|
|
1466
|
+
* Creates a layer with the given presentation state.
|
|
1467
|
+
*
|
|
1468
|
+
* @param props - Initialization properties.
|
|
1469
|
+
*/
|
|
1470
|
+
constructor({ opacity, blendMode, occludes, }?: LayerProps);
|
|
1471
|
+
/**
|
|
1472
|
+
* Whether the layer's shaders read scene depth. When `true` the renderer
|
|
1473
|
+
* draws occluding layers to a depth texture the layer's shaders can
|
|
1474
|
+
* sample. A layer cannot both occlude and read scene depth.
|
|
1475
|
+
*/
|
|
1476
|
+
get requiresSceneDepth(): boolean;
|
|
1477
|
+
/** The layer's opacity in `[0, 1]`. Values outside are clamped. */
|
|
1478
|
+
get opacity(): number;
|
|
1479
|
+
/** @param value - The new opacity in `[0, 1]`. */
|
|
1480
|
+
set opacity(value: number);
|
|
1481
|
+
/**
|
|
1482
|
+
* Builds or refreshes the layer's renderable objects for the current
|
|
1483
|
+
* view. Called automatically once per frame for every layer in a
|
|
1484
|
+
* viewport.
|
|
1485
|
+
*
|
|
1486
|
+
* @param viewport - The viewport being rendered.
|
|
1487
|
+
*/
|
|
1488
|
+
abstract update(viewport?: Viewport): void;
|
|
1489
|
+
/**
|
|
1490
|
+
* Handles a pointer or wheel event from the owning viewport. Called
|
|
1491
|
+
* automatically for each event before the camera controls. The default
|
|
1492
|
+
* implementation does nothing.
|
|
1493
|
+
*
|
|
1494
|
+
* @param _event - The event with clip and world coordinates attached.
|
|
1495
|
+
*/
|
|
1496
|
+
onEvent(_event: EventContext): void;
|
|
1497
|
+
/**
|
|
1498
|
+
* Lifecycle hook that is called automatically when a layer is
|
|
1499
|
+
* is attached to a viewport. A layer can only be attached to one viewport
|
|
1500
|
+
* at a time.
|
|
1501
|
+
*
|
|
1502
|
+
* @param context - The shared runtime context.
|
|
1503
|
+
*/
|
|
1504
|
+
onAttached(context: IdetikContext): void;
|
|
1505
|
+
/**
|
|
1506
|
+
* Lifecycle hook that is called automatically when a layer is detached
|
|
1507
|
+
* from a viewport.
|
|
1508
|
+
*
|
|
1509
|
+
* @param context - The shared runtime context.
|
|
1510
|
+
*/
|
|
1511
|
+
onDetached(context: IdetikContext): void;
|
|
1512
|
+
/** @hidden */
|
|
1513
|
+
protected attach(_context: IdetikContext): void;
|
|
1514
|
+
/** @hidden */
|
|
1515
|
+
protected detach(_context: IdetikContext): void;
|
|
1516
|
+
/**
|
|
1517
|
+
* The layer's renderable objects grouped by coverage group. Objects in
|
|
1518
|
+
* a group draw each pixel at most once, letting chunks at multiple
|
|
1519
|
+
* levels of detail overlap correctly.
|
|
1520
|
+
*/
|
|
1521
|
+
get coverageGroups(): ReadonlyMap<number | null, readonly RenderableObject[]>;
|
|
1522
|
+
/** The layer's current lifecycle state. */
|
|
1523
|
+
get state(): LayerState;
|
|
1524
|
+
/**
|
|
1525
|
+
* Registers a callback invoked after every state change.
|
|
1526
|
+
*
|
|
1527
|
+
* @param callback - Receives the new and previous states.
|
|
1528
|
+
*/
|
|
1529
|
+
addStateChangeCallback(callback: StateChangeCallback): void;
|
|
1530
|
+
/**
|
|
1531
|
+
* Removes a previously registered state change callback.
|
|
1532
|
+
*
|
|
1533
|
+
* @param callback - The callback to remove.
|
|
1534
|
+
*/
|
|
1535
|
+
removeStateChangeCallback(callback: StateChangeCallback): void;
|
|
1536
|
+
/**
|
|
1537
|
+
* Sets the lifecycle state and notifies state change callbacks.
|
|
1538
|
+
*
|
|
1539
|
+
* @param newState - The state to enter.
|
|
1540
|
+
*/
|
|
1541
|
+
protected setState(newState: LayerState): void;
|
|
1542
|
+
/**
|
|
1543
|
+
* Registers a renderable object for drawing. Objects in the same
|
|
1544
|
+
* coverage group draw each pixel at most once.
|
|
1545
|
+
*
|
|
1546
|
+
* @param object - The object to add.
|
|
1547
|
+
* @param coverageGroup - The group key.
|
|
1548
|
+
*/
|
|
1549
|
+
protected addObject(object: RenderableObject, coverageGroup?: number | null): void;
|
|
1550
|
+
/** Removes all registered renderable objects. */
|
|
1551
|
+
protected clearObjects(): void;
|
|
1552
|
+
/**
|
|
1553
|
+
* Returns uniform name-value pairs applied to every object drawn by
|
|
1554
|
+
* this layer. Override in subclasses that need custom shader uniforms.
|
|
1555
|
+
*/
|
|
1556
|
+
getUniforms(): Record<string, unknown>;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
declare abstract class Renderer {
|
|
1560
|
+
private readonly canvas_;
|
|
1561
|
+
private width_;
|
|
1562
|
+
private height_;
|
|
1563
|
+
protected renderedObjects_: number;
|
|
1564
|
+
protected abstract resize(width: number, height: number): void;
|
|
1565
|
+
protected abstract renderObject(layer: Layer, object: RenderableObject, camera: Camera): void;
|
|
1566
|
+
protected abstract clear(): void;
|
|
1567
|
+
constructor(canvas: HTMLCanvasElement);
|
|
1568
|
+
beginFrame(): void;
|
|
1569
|
+
abstract render(viewport: Viewport): void;
|
|
1570
|
+
updateSize(): void;
|
|
1571
|
+
private updateRendererSize;
|
|
1572
|
+
protected get canvas(): HTMLCanvasElement;
|
|
1573
|
+
get width(): number;
|
|
1574
|
+
get height(): number;
|
|
1575
|
+
get renderedObjects(): number;
|
|
1576
|
+
abstract get gpuTextureBytes(): number;
|
|
1577
|
+
abstract get gpuTextureCount(): number;
|
|
1578
|
+
abstract uploadTexture(texture: Texture): void;
|
|
1579
|
+
abstract disposeTexture(texture: Texture): void;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/** A snapshot of memory used by chunks, renderer textures, and the JS heap. */
|
|
1583
|
+
type MemoryStats = {
|
|
1584
|
+
/** Bytes of chunk data in CPU memory, shared across all Idetik instances. */
|
|
1585
|
+
cpuChunkBytes: number;
|
|
1586
|
+
/** Number of chunks in CPU memory, shared across all Idetik instances. */
|
|
1587
|
+
cpuChunkCount: number;
|
|
1588
|
+
/** Bytes of texture data resident on this instance's GPU renderer. */
|
|
1589
|
+
gpuTextureBytes: number;
|
|
1590
|
+
/** Number of textures resident on this instance's GPU renderer. */
|
|
1591
|
+
gpuTextureCount: number;
|
|
1592
|
+
/** Used JS heap in bytes, when the browser exposes it. Not instance-specific. */
|
|
1593
|
+
jsHeapUsedBytes?: number;
|
|
1594
|
+
/** JS heap size limit in bytes, when the browser exposes it. */
|
|
1595
|
+
jsHeapLimitBytes?: number;
|
|
1596
|
+
};
|
|
1597
|
+
/**
|
|
1598
|
+
* Statistics available through `idetik.stats`.
|
|
1599
|
+
*
|
|
1600
|
+
* Getters read the current state. Only `chunks` walks chunk states. Reading
|
|
1601
|
+
* memory usage, queue counts, or rendered objects does not scan chunks.
|
|
1602
|
+
*
|
|
1603
|
+
* @group Core
|
|
1604
|
+
*/
|
|
1605
|
+
declare class Stats {
|
|
1606
|
+
private readonly renderer_;
|
|
1607
|
+
private readonly chunkManager_;
|
|
1608
|
+
private readonly viewports_;
|
|
1609
|
+
/** @hidden */
|
|
1610
|
+
constructor(renderer: Renderer, chunkManager: ChunkManager, viewports: readonly Viewport[]);
|
|
1611
|
+
/**
|
|
1612
|
+
* CPU chunk memory shared across instances, this renderer's GPU texture
|
|
1613
|
+
* memory, and optional JS heap figures. Heap figures are not specific to
|
|
1614
|
+
* this instance. Sizes are in bytes.
|
|
1615
|
+
*/
|
|
1616
|
+
get memory(): MemoryStats;
|
|
1617
|
+
/** Counts of queued and in-flight chunk requests for this instance. */
|
|
1618
|
+
get queue(): QueueStats;
|
|
1619
|
+
/**
|
|
1620
|
+
* Chunk demand and GPU residency per source, by timepoint, and loading
|
|
1621
|
+
* progress per viewport. Each read walks every view's chunk states, so poll
|
|
1622
|
+
* it at the rate you need rather than every frame.
|
|
1623
|
+
*/
|
|
1624
|
+
get chunks(): ChunkStats;
|
|
1625
|
+
/** Objects reported by the renderer for the last viewport render. */
|
|
1626
|
+
get renderedObjects(): number;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1559
1629
|
/**
|
|
1560
1630
|
* An object updated once per frame after all viewports have rendered.
|
|
1561
1631
|
*
|
|
@@ -1565,7 +1635,7 @@ declare class Viewport {
|
|
|
1565
1635
|
* ```ts
|
|
1566
1636
|
* const chunkReadout: Overlay = {
|
|
1567
1637
|
* update(idetik) {
|
|
1568
|
-
* div.textContent = `${idetik.
|
|
1638
|
+
* div.textContent = `${idetik.stats.memory.cpuChunkCount} chunks`;
|
|
1569
1639
|
* },
|
|
1570
1640
|
* };
|
|
1571
1641
|
*
|
|
@@ -1598,23 +1668,6 @@ type IdetikProps = {
|
|
|
1598
1668
|
type IdetikContext = {
|
|
1599
1669
|
chunkManager: ChunkManager;
|
|
1600
1670
|
};
|
|
1601
|
-
/**
|
|
1602
|
-
* A snapshot of the runtime's memory usage.
|
|
1603
|
-
*/
|
|
1604
|
-
type MemoryStats = {
|
|
1605
|
-
/** Bytes of chunk data held in CPU memory. */
|
|
1606
|
-
cpuChunkBytes: number;
|
|
1607
|
-
/** Number of chunks held in CPU memory. */
|
|
1608
|
-
cpuChunkCount: number;
|
|
1609
|
-
/** Bytes of texture data resident on the GPU. */
|
|
1610
|
-
gpuTextureBytes: number;
|
|
1611
|
-
/** Number of textures resident on the GPU. */
|
|
1612
|
-
gpuTextureCount: number;
|
|
1613
|
-
/** Used JS heap in bytes. */
|
|
1614
|
-
jsHeapUsedBytes?: number;
|
|
1615
|
-
/** JS heap size limit in bytes. */
|
|
1616
|
-
jsHeapLimitBytes?: number;
|
|
1617
|
-
};
|
|
1618
1671
|
/**
|
|
1619
1672
|
* The entry point of an Idetik application.
|
|
1620
1673
|
*
|
|
@@ -1660,6 +1713,8 @@ declare class Idetik {
|
|
|
1660
1713
|
readonly canvas: HTMLCanvasElement;
|
|
1661
1714
|
/** The registered overlays that update once per frame in order. */
|
|
1662
1715
|
readonly overlays: Overlay[];
|
|
1716
|
+
/** Memory, queue, chunk, and rendered-object statistics. */
|
|
1717
|
+
readonly stats: Stats;
|
|
1663
1718
|
private readonly chunkManager_;
|
|
1664
1719
|
private readonly context_;
|
|
1665
1720
|
private readonly renderer_;
|
|
@@ -1674,18 +1729,6 @@ declare class Idetik {
|
|
|
1674
1729
|
* @param params - Initialization properties.
|
|
1675
1730
|
*/
|
|
1676
1731
|
constructor(params: IdetikProps);
|
|
1677
|
-
/** Counts of queued and in-flight chunk requests. */
|
|
1678
|
-
get chunkQueueStats(): QueueStats;
|
|
1679
|
-
/**
|
|
1680
|
-
* Chunk demand and GPU residency per source, by timepoint, and loading
|
|
1681
|
-
* progress per viewport. Each read walks every view's chunk states and returns a
|
|
1682
|
-
* new snapshot, so poll it at the rate you need rather than every frame.
|
|
1683
|
-
*/
|
|
1684
|
-
get chunkStats(): ChunkStats;
|
|
1685
|
-
/** A snapshot of current CPU/GPU/JS heap memory usage. */
|
|
1686
|
-
get memoryStats(): MemoryStats;
|
|
1687
|
-
/** The number of objects drawn in the last rendered frame. */
|
|
1688
|
-
get renderedObjects(): number;
|
|
1689
1732
|
/** The width of the rendering surface in pixels. */
|
|
1690
1733
|
get width(): number;
|
|
1691
1734
|
/** The height of the rendering surface in pixels. */
|
|
@@ -3532,5 +3575,5 @@ declare class OrbitControls implements CameraControls {
|
|
|
3532
3575
|
private cutoffLowVelocity;
|
|
3533
3576
|
}
|
|
3534
3577
|
|
|
3535
|
-
export { AxesLayer, Box2, Box3, Camera, Color, Frustum, Idetik, ImageLayer, ImageRenderable, LabelImageRenderable, LabelLayer, Layer, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, PointsRenderable, ProjectedLineRenderable, RenderableObject, TrsTransform, Viewport, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
|
|
3578
|
+
export { AxesLayer, Box2, Box3, Camera, Color, Frustum, Idetik, ImageLayer, ImageRenderable, LabelImageRenderable, LabelLayer, Layer, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, PointsRenderable, ProjectedLineRenderable, RenderableObject, Stats, TrsTransform, Viewport, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
|
|
3536
3579
|
export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ChunkStats, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PanZoomControlsProps, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, SliceCoordinates, SliceOrientation, SourceChunkStats, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportChunkStats, ViewportProps, VolumeLayerProps, VolumeRenderableProps };
|