@idetik/core 0.46.1 → 0.47.0
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 +117 -29
- package/dist/index.js +1142 -960
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +41 -41
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/layer.d.ts +36 -17
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/core/renderer.d.ts +10 -1
- package/dist/types/src/core/renderer.d.ts.map +1 -1
- package/dist/types/src/core/stats.d.ts +43 -1
- package/dist/types/src/core/stats.d.ts.map +1 -1
- package/dist/types/src/core/viewport.d.ts +7 -0
- package/dist/types/src/core/viewport.d.ts.map +1 -1
- package/dist/types/src/idetik.d.ts +13 -4
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layers/axes_layer.d.ts +1 -1
- package/dist/types/src/layers/axes_layer.d.ts.map +1 -1
- package/dist/types/src/layers/image_layer.d.ts +1 -1
- package/dist/types/src/layers/image_layer.d.ts.map +1 -1
- package/dist/types/src/layers/label_layer.d.ts +1 -1
- package/dist/types/src/layers/label_layer.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +1 -1
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/points_renderable.d.ts +3 -1
- package/dist/types/src/objects/renderable/points_renderable.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_renderer.d.ts +5 -0
- package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_timer.d.ts +19 -0
- package/dist/types/src/renderers/webgl_timer.d.ts.map +1 -0
- package/dist/types/test/helpers.d.ts +1 -1
- package/dist/types/test/helpers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1316,6 +1316,11 @@ declare class Viewport {
|
|
|
1316
1316
|
/** Input controls driving the camera. */
|
|
1317
1317
|
cameraControls?: CameraControls;
|
|
1318
1318
|
private layers_;
|
|
1319
|
+
private layersChanged_;
|
|
1320
|
+
private lastRenderBox_?;
|
|
1321
|
+
private lastVisibility_?;
|
|
1322
|
+
private readonly lastCameraTransform_;
|
|
1323
|
+
private readonly lastProjection_;
|
|
1319
1324
|
constructor(props: ViewportProps);
|
|
1320
1325
|
/**
|
|
1321
1326
|
* The layers rendered by this viewport in order. Layers with `occludes`
|
|
@@ -1337,6 +1342,8 @@ declare class Viewport {
|
|
|
1337
1342
|
removeLayer(layer: Layer): void;
|
|
1338
1343
|
/** Removes all layers from the viewport. */
|
|
1339
1344
|
removeAllLayers(): void;
|
|
1345
|
+
/** @hidden */
|
|
1346
|
+
renderStateChanged(canvas: HTMLCanvasElement): boolean;
|
|
1340
1347
|
/**
|
|
1341
1348
|
* Syncs the camera's aspect ratio to the host element's size. Called
|
|
1342
1349
|
* automatically when the host element resizes.
|
|
@@ -1429,7 +1436,9 @@ type LayerProps = {
|
|
|
1429
1436
|
* this.setState("ready");
|
|
1430
1437
|
* }
|
|
1431
1438
|
*
|
|
1432
|
-
* public update() {
|
|
1439
|
+
* public update(): boolean {
|
|
1440
|
+
* return true;
|
|
1441
|
+
* }
|
|
1433
1442
|
* }
|
|
1434
1443
|
*
|
|
1435
1444
|
* viewport.addLayer(new Particles(points));
|
|
@@ -1440,28 +1449,16 @@ type LayerProps = {
|
|
|
1440
1449
|
declare abstract class Layer {
|
|
1441
1450
|
/** A string identifying the concrete layer type. */
|
|
1442
1451
|
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
1452
|
/** Set to `true` by subclasses whose shaders read scene depth. */
|
|
1459
1453
|
protected requiresSceneDepth_: boolean;
|
|
1460
1454
|
private readonly coverageGroups_;
|
|
1461
1455
|
private state_;
|
|
1462
1456
|
private attached_;
|
|
1463
1457
|
private readonly callbacks_;
|
|
1458
|
+
private renderStateChanged_;
|
|
1464
1459
|
private opacity_;
|
|
1460
|
+
private blendMode_;
|
|
1461
|
+
private occludes_;
|
|
1465
1462
|
/**
|
|
1466
1463
|
* Creates a layer with the given presentation state.
|
|
1467
1464
|
*
|
|
@@ -1474,6 +1471,23 @@ declare abstract class Layer {
|
|
|
1474
1471
|
* sample. A layer cannot both occlude and read scene depth.
|
|
1475
1472
|
*/
|
|
1476
1473
|
get requiresSceneDepth(): boolean;
|
|
1474
|
+
/**
|
|
1475
|
+
* How the layer's output blends with previously drawn content.
|
|
1476
|
+
*/
|
|
1477
|
+
get blendMode(): BlendMode;
|
|
1478
|
+
/** @param value - The blending mode to use. */
|
|
1479
|
+
set blendMode(value: BlendMode);
|
|
1480
|
+
/**
|
|
1481
|
+
* Whether the layer writes depth and hides content drawn behind it.
|
|
1482
|
+
*
|
|
1483
|
+
* Occluding layers render a depth pass and always draw before
|
|
1484
|
+
* non-occluding layers regardless of their order in the viewport. When
|
|
1485
|
+
* not set explicitly this value is inferred from `blendMode` at
|
|
1486
|
+
* construction only. Reassigning {@link blendMode} later does not update it.
|
|
1487
|
+
*/
|
|
1488
|
+
get occludes(): boolean;
|
|
1489
|
+
/** @param value - Whether the layer writes depth. */
|
|
1490
|
+
set occludes(value: boolean);
|
|
1477
1491
|
/** The layer's opacity in `[0, 1]`. Values outside are clamped. */
|
|
1478
1492
|
get opacity(): number;
|
|
1479
1493
|
/** @param value - The new opacity in `[0, 1]`. */
|
|
@@ -1483,9 +1497,21 @@ declare abstract class Layer {
|
|
|
1483
1497
|
* view. Called automatically once per frame for every layer in a
|
|
1484
1498
|
* viewport.
|
|
1485
1499
|
*
|
|
1500
|
+
* Return `true` if this update changed the rendered output, otherwise
|
|
1501
|
+
* return `false`. Changes marked by {@link invalidate} are tracked
|
|
1502
|
+
* separately, so returning `false` does not discard them.
|
|
1503
|
+
*
|
|
1486
1504
|
* @param viewport - The viewport being rendered.
|
|
1487
1505
|
*/
|
|
1488
|
-
abstract update(viewport?: Viewport):
|
|
1506
|
+
abstract update(viewport?: Viewport): boolean;
|
|
1507
|
+
/**
|
|
1508
|
+
* Marks the layer's rendered output as changed. Call from setters or
|
|
1509
|
+
* asynchronous callbacks when a change happens outside {@link update}.
|
|
1510
|
+
* The runtime checks this flag on its next update.
|
|
1511
|
+
*/
|
|
1512
|
+
protected invalidate(): void;
|
|
1513
|
+
/** @hidden */
|
|
1514
|
+
renderStateChanged(): boolean;
|
|
1489
1515
|
/**
|
|
1490
1516
|
* Handles a pointer or wheel event from the owning viewport. Called
|
|
1491
1517
|
* automatically for each event before the camera controls. The default
|
|
@@ -1558,6 +1584,12 @@ declare abstract class Layer {
|
|
|
1558
1584
|
getUniforms(): Record<string, unknown>;
|
|
1559
1585
|
}
|
|
1560
1586
|
|
|
1587
|
+
type GpuTiming = {
|
|
1588
|
+
supported: boolean;
|
|
1589
|
+
samples: number;
|
|
1590
|
+
totalMs: number;
|
|
1591
|
+
lastSampleAt?: number;
|
|
1592
|
+
};
|
|
1561
1593
|
declare abstract class Renderer {
|
|
1562
1594
|
private readonly canvas_;
|
|
1563
1595
|
private width_;
|
|
@@ -1567,7 +1599,10 @@ declare abstract class Renderer {
|
|
|
1567
1599
|
protected abstract renderObject(layer: Layer, object: RenderableObject, camera: Camera): void;
|
|
1568
1600
|
protected abstract clear(): void;
|
|
1569
1601
|
constructor(canvas: HTMLCanvasElement);
|
|
1570
|
-
beginFrame(): void;
|
|
1602
|
+
abstract beginFrame(): void;
|
|
1603
|
+
abstract endFrame(): void;
|
|
1604
|
+
abstract resetGpuTiming(): void;
|
|
1605
|
+
abstract get gpuTiming(): GpuTiming;
|
|
1571
1606
|
abstract render(viewport: Viewport): void;
|
|
1572
1607
|
updateSize(): void;
|
|
1573
1608
|
private updateRendererSize;
|
|
@@ -1596,11 +1631,35 @@ type MemoryStats = {
|
|
|
1596
1631
|
/** JS heap size limit in bytes, when the browser exposes it. */
|
|
1597
1632
|
jsHeapLimitBytes?: number;
|
|
1598
1633
|
};
|
|
1634
|
+
/**
|
|
1635
|
+
* A snapshot of drawing frequency and GPU draw cost.
|
|
1636
|
+
*
|
|
1637
|
+
* Values are averaged over sampling windows of at least one second. A frame
|
|
1638
|
+
* is one canvas draw pass across all viewports including draws during resize.
|
|
1639
|
+
* GPU timings are collected asynchronously and lag draw submission.
|
|
1640
|
+
*/
|
|
1641
|
+
type RuntimeStats = {
|
|
1642
|
+
/** Whether GPU timer queries are supported by the current renderer context. */
|
|
1643
|
+
gpuTimingSupported: boolean;
|
|
1644
|
+
/**
|
|
1645
|
+
* Canvas draw passes per second in the latest sampling window.
|
|
1646
|
+
* This value diverges from frames per second when on-demand rendering
|
|
1647
|
+
* is enabled.
|
|
1648
|
+
*/
|
|
1649
|
+
renderedFramesPerSecond: number;
|
|
1650
|
+
/**
|
|
1651
|
+
* Mean elapsed GPU timeline time per sampled canvas render pass, in ms.
|
|
1652
|
+
* The interval spans drawing across all viewports, excluding layer updates.
|
|
1653
|
+
* Undefined when no recent valid sample exists.
|
|
1654
|
+
*/
|
|
1655
|
+
gpuMsPerFrame?: number;
|
|
1656
|
+
};
|
|
1599
1657
|
/**
|
|
1600
1658
|
* Statistics available through `idetik.stats`.
|
|
1601
1659
|
*
|
|
1602
1660
|
* Getters read the current state. Only `chunks` walks chunk states. Reading
|
|
1603
|
-
* memory usage, queue counts, or rendered objects does not
|
|
1661
|
+
* runtime rates, memory usage, queue counts, or rendered objects does not
|
|
1662
|
+
* scan chunks.
|
|
1604
1663
|
*
|
|
1605
1664
|
* @group Core
|
|
1606
1665
|
*/
|
|
@@ -1608,8 +1667,19 @@ declare class Stats {
|
|
|
1608
1667
|
private readonly renderer_;
|
|
1609
1668
|
private readonly chunkManager_;
|
|
1610
1669
|
private readonly viewports_;
|
|
1670
|
+
private readonly runtime_;
|
|
1671
|
+
private sampleStartedAt_;
|
|
1672
|
+
private draws_;
|
|
1673
|
+
private gpuSamples_;
|
|
1674
|
+
private gpuMsAtWindowStart_;
|
|
1611
1675
|
/** @hidden */
|
|
1612
1676
|
constructor(renderer: Renderer, chunkManager: ChunkManager, viewports: readonly Viewport[]);
|
|
1677
|
+
/**
|
|
1678
|
+
* Drawing frequency and GPU cost, recalculated on read when at least one
|
|
1679
|
+
* second has passed since the last calculation or reset. Values cover that
|
|
1680
|
+
* entire interval, so less frequent reads produce longer-term averages.
|
|
1681
|
+
*/
|
|
1682
|
+
get runtime(): RuntimeStats;
|
|
1613
1683
|
/**
|
|
1614
1684
|
* CPU chunk memory shared across instances, this renderer's GPU texture
|
|
1615
1685
|
* memory, and optional JS heap figures. Heap figures are not specific to
|
|
@@ -1626,10 +1696,17 @@ declare class Stats {
|
|
|
1626
1696
|
get chunks(): ChunkStats;
|
|
1627
1697
|
/** Objects reported by the renderer for the last viewport render. */
|
|
1628
1698
|
get renderedObjects(): number;
|
|
1699
|
+
/** @hidden */
|
|
1700
|
+
recordDraw(): void;
|
|
1701
|
+
/** @hidden */
|
|
1702
|
+
private sample;
|
|
1703
|
+
/** @hidden */
|
|
1704
|
+
resetRates(): void;
|
|
1705
|
+
private resetSample;
|
|
1629
1706
|
}
|
|
1630
1707
|
|
|
1631
1708
|
/**
|
|
1632
|
-
* An object updated once per frame after
|
|
1709
|
+
* An object updated once per animation frame after any drawing.
|
|
1633
1710
|
*
|
|
1634
1711
|
* Overlays drive HUD elements that live outside the canvas such as scale
|
|
1635
1712
|
* bars, time indicators, or memory readouts.
|
|
@@ -1645,7 +1722,7 @@ declare class Stats {
|
|
|
1645
1722
|
* ```
|
|
1646
1723
|
*/
|
|
1647
1724
|
type Overlay = {
|
|
1648
|
-
/** Called
|
|
1725
|
+
/** Called every animation frame, including when drawing is skipped. */
|
|
1649
1726
|
update: (idetik: Idetik) => void;
|
|
1650
1727
|
};
|
|
1651
1728
|
/**
|
|
@@ -1717,7 +1794,7 @@ declare class Idetik {
|
|
|
1717
1794
|
readonly canvas: HTMLCanvasElement;
|
|
1718
1795
|
/** The registered overlays that update once per frame in order. */
|
|
1719
1796
|
readonly overlays: Overlay[];
|
|
1720
|
-
/**
|
|
1797
|
+
/** Runtime, memory, queue, chunk, and rendered-object statistics. */
|
|
1721
1798
|
readonly stats: Stats;
|
|
1722
1799
|
private readonly chunkManager_;
|
|
1723
1800
|
private readonly context_;
|
|
@@ -1728,6 +1805,8 @@ declare class Idetik {
|
|
|
1728
1805
|
private readonly sizeObserver_;
|
|
1729
1806
|
private lastAnimationId_?;
|
|
1730
1807
|
private lastTimestamp_;
|
|
1808
|
+
private renderRequested_;
|
|
1809
|
+
private renderInvalidated_;
|
|
1731
1810
|
/**
|
|
1732
1811
|
* Creates an Idetik runtime for the given canvas.
|
|
1733
1812
|
*
|
|
@@ -1782,6 +1861,11 @@ declare class Idetik {
|
|
|
1782
1861
|
* @param memoryLimitMB - The new budget in megabytes.
|
|
1783
1862
|
*/
|
|
1784
1863
|
setMemoryLimitMB(memoryLimitMB: number): void;
|
|
1864
|
+
/**
|
|
1865
|
+
* Explicitly requests a draw on the next animation frame while running,
|
|
1866
|
+
* even if no internal state has changed.
|
|
1867
|
+
*/
|
|
1868
|
+
requestRender(): void;
|
|
1785
1869
|
/**
|
|
1786
1870
|
* Starts the render loop and connects input handlers.
|
|
1787
1871
|
*
|
|
@@ -1789,8 +1873,10 @@ declare class Idetik {
|
|
|
1789
1873
|
*/
|
|
1790
1874
|
start(): this;
|
|
1791
1875
|
private detachRemovedLayers;
|
|
1792
|
-
private renderViewport;
|
|
1793
1876
|
private animate;
|
|
1877
|
+
private invalidate;
|
|
1878
|
+
private updateViewport;
|
|
1879
|
+
private draw;
|
|
1794
1880
|
/**
|
|
1795
1881
|
* Stops the render loop and disconnects input handlers.
|
|
1796
1882
|
*/
|
|
@@ -2540,7 +2626,7 @@ declare class AxesLayer extends Layer {
|
|
|
2540
2626
|
*/
|
|
2541
2627
|
constructor(props: AxesLayerProps);
|
|
2542
2628
|
/** Performs no per-frame work. The axes are built at construction. */
|
|
2543
|
-
update():
|
|
2629
|
+
update(): boolean;
|
|
2544
2630
|
}
|
|
2545
2631
|
|
|
2546
2632
|
/**
|
|
@@ -2657,7 +2743,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
|
|
|
2657
2743
|
*
|
|
2658
2744
|
* @param viewport - The viewport being rendered.
|
|
2659
2745
|
*/
|
|
2660
|
-
update(viewport?: Viewport):
|
|
2746
|
+
update(viewport?: Viewport): boolean;
|
|
2661
2747
|
/** The slice plane the layer displays. */
|
|
2662
2748
|
get orientation(): SliceOrientation;
|
|
2663
2749
|
/**
|
|
@@ -2868,7 +2954,7 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
|
|
|
2868
2954
|
*
|
|
2869
2955
|
* @param viewport - The viewport being rendered.
|
|
2870
2956
|
*/
|
|
2871
|
-
update(viewport?: Viewport):
|
|
2957
|
+
update(viewport?: Viewport): boolean;
|
|
2872
2958
|
private rebuildObjects;
|
|
2873
2959
|
/** @hidden */
|
|
2874
2960
|
get chunkStoreView(): ChunkStoreView | undefined;
|
|
@@ -3066,7 +3152,7 @@ declare class LabelLayer extends Layer {
|
|
|
3066
3152
|
*
|
|
3067
3153
|
* @param viewport - The viewport being rendered.
|
|
3068
3154
|
*/
|
|
3069
|
-
update(viewport?: Viewport):
|
|
3155
|
+
update(viewport?: Viewport): boolean;
|
|
3070
3156
|
/** The slice plane the layer displays. */
|
|
3071
3157
|
get orientation(): SliceOrientation;
|
|
3072
3158
|
/**
|
|
@@ -3251,7 +3337,9 @@ type PointProps = {
|
|
|
3251
3337
|
* this.setState("ready");
|
|
3252
3338
|
* }
|
|
3253
3339
|
*
|
|
3254
|
-
* public update() {
|
|
3340
|
+
* public update(): boolean {
|
|
3341
|
+
* return true;
|
|
3342
|
+
* }
|
|
3255
3343
|
* }
|
|
3256
3344
|
* ```
|
|
3257
3345
|
*
|
|
@@ -3589,4 +3677,4 @@ declare class OrbitControls implements CameraControls {
|
|
|
3589
3677
|
}
|
|
3590
3678
|
|
|
3591
3679
|
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 };
|
|
3592
|
-
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 };
|
|
3680
|
+
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, RuntimeStats, SliceCoordinates, SliceOrientation, SourceChunkStats, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportChunkStats, ViewportProps, VolumeLayerProps, VolumeRenderableProps };
|