@idetik/core 0.46.2 → 0.48.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 CHANGED
@@ -1437,7 +1437,7 @@ type LayerProps = {
1437
1437
  * }
1438
1438
  *
1439
1439
  * public update(): boolean {
1440
- * return true;
1440
+ * return false; // static content, no changes to redraw
1441
1441
  * }
1442
1442
  * }
1443
1443
  *
@@ -1584,6 +1584,12 @@ declare abstract class Layer {
1584
1584
  getUniforms(): Record<string, unknown>;
1585
1585
  }
1586
1586
 
1587
+ type GpuTiming = {
1588
+ supported: boolean;
1589
+ samples: number;
1590
+ totalMs: number;
1591
+ lastSampleAt?: number;
1592
+ };
1587
1593
  declare abstract class Renderer {
1588
1594
  private readonly canvas_;
1589
1595
  private width_;
@@ -1593,7 +1599,10 @@ declare abstract class Renderer {
1593
1599
  protected abstract renderObject(layer: Layer, object: RenderableObject, camera: Camera): void;
1594
1600
  protected abstract clear(): void;
1595
1601
  constructor(canvas: HTMLCanvasElement);
1596
- beginFrame(): void;
1602
+ abstract beginFrame(): void;
1603
+ abstract endFrame(): void;
1604
+ abstract resetGpuTiming(): void;
1605
+ abstract get gpuTiming(): GpuTiming;
1597
1606
  abstract render(viewport: Viewport): void;
1598
1607
  updateSize(): void;
1599
1608
  private updateRendererSize;
@@ -1622,11 +1631,35 @@ type MemoryStats = {
1622
1631
  /** JS heap size limit in bytes, when the browser exposes it. */
1623
1632
  jsHeapLimitBytes?: number;
1624
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
+ };
1625
1657
  /**
1626
1658
  * Statistics available through `idetik.stats`.
1627
1659
  *
1628
1660
  * Getters read the current state. Only `chunks` walks chunk states. Reading
1629
- * memory usage, queue counts, or rendered objects does not scan chunks.
1661
+ * runtime rates, memory usage, queue counts, or rendered objects does not
1662
+ * scan chunks.
1630
1663
  *
1631
1664
  * @group Core
1632
1665
  */
@@ -1634,8 +1667,19 @@ declare class Stats {
1634
1667
  private readonly renderer_;
1635
1668
  private readonly chunkManager_;
1636
1669
  private readonly viewports_;
1670
+ private readonly runtime_;
1671
+ private sampleStartedAt_;
1672
+ private draws_;
1673
+ private gpuSamples_;
1674
+ private gpuMsAtWindowStart_;
1637
1675
  /** @hidden */
1638
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;
1639
1683
  /**
1640
1684
  * CPU chunk memory shared across instances, this renderer's GPU texture
1641
1685
  * memory, and optional JS heap figures. Heap figures are not specific to
@@ -1652,6 +1696,13 @@ declare class Stats {
1652
1696
  get chunks(): ChunkStats;
1653
1697
  /** Objects reported by the renderer for the last viewport render. */
1654
1698
  get renderedObjects(): number;
1699
+ /** @hidden */
1700
+ recordDraw(): void;
1701
+ /** @hidden */
1702
+ private sample;
1703
+ /** @hidden */
1704
+ resetRates(): void;
1705
+ private resetSample;
1655
1706
  }
1656
1707
 
1657
1708
  /**
@@ -1743,7 +1794,7 @@ declare class Idetik {
1743
1794
  readonly canvas: HTMLCanvasElement;
1744
1795
  /** The registered overlays that update once per frame in order. */
1745
1796
  readonly overlays: Overlay[];
1746
- /** Memory, queue, chunk, and rendered-object statistics. */
1797
+ /** Runtime, memory, queue, chunk, and rendered-object statistics. */
1747
1798
  readonly stats: Stats;
1748
1799
  private readonly chunkManager_;
1749
1800
  private readonly context_;
@@ -2664,6 +2715,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2664
2715
  private readonly onPickValue_?;
2665
2716
  private readonly visibleChunks_;
2666
2717
  private orderedChunks_;
2718
+ private lastSliceCoord_?;
2667
2719
  private readonly pool_;
2668
2720
  private readonly initialChannelProps_?;
2669
2721
  private readonly channelChangeCallbacks_;
@@ -2838,6 +2890,7 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2838
2890
  private readonly source_;
2839
2891
  private readonly sliceCoords_;
2840
2892
  private readonly currentVolumes_;
2893
+ private renderedChunks_;
2841
2894
  private readonly volumeToPoolKey_;
2842
2895
  private readonly pool_;
2843
2896
  private readonly initialChannelProps_?;
@@ -2845,9 +2898,8 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2845
2898
  private policy_;
2846
2899
  private chunkStoreView_?;
2847
2900
  private channelProps_?;
2848
- private lastLoadedTime_;
2849
- private lastNumRenderedChannelChunks_;
2850
2901
  private interactiveStepSizeScale_;
2902
+ private previousAppearanceState_;
2851
2903
  private debugShowWireframes_;
2852
2904
  /** Whether chunk bounding wireframes are drawn for debugging. */
2853
2905
  get debugShowWireframes(): boolean;
@@ -2904,6 +2956,7 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2904
2956
  * @param viewport - The viewport being rendered.
2905
2957
  */
2906
2958
  update(viewport?: Viewport): boolean;
2959
+ private updateAppearanceState;
2907
2960
  private rebuildObjects;
2908
2961
  /** @hidden */
2909
2962
  get chunkStoreView(): ChunkStoreView | undefined;
@@ -3075,6 +3128,8 @@ declare class LabelLayer extends Layer {
3075
3128
  private readonly onPickValue_?;
3076
3129
  private readonly outlineSelected_;
3077
3130
  private readonly visibleChunks_;
3131
+ private orderedChunks_;
3132
+ private lastSliceCoord_?;
3078
3133
  private readonly pool_;
3079
3134
  private colorMap_;
3080
3135
  private selectedValue_;
@@ -3626,4 +3681,4 @@ declare class OrbitControls implements CameraControls {
3626
3681
  }
3627
3682
 
3628
3683
  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 };
3629
- 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 };
3684
+ 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 };