@idetik/core 0.46.0 → 0.46.2

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
@@ -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): void;
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
@@ -1629,7 +1655,7 @@ declare class Stats {
1629
1655
  }
1630
1656
 
1631
1657
  /**
1632
- * An object updated once per frame after all viewports have rendered.
1658
+ * An object updated once per animation frame after any drawing.
1633
1659
  *
1634
1660
  * Overlays drive HUD elements that live outside the canvas such as scale
1635
1661
  * bars, time indicators, or memory readouts.
@@ -1645,7 +1671,7 @@ declare class Stats {
1645
1671
  * ```
1646
1672
  */
1647
1673
  type Overlay = {
1648
- /** Called once per rendered frame. */
1674
+ /** Called every animation frame, including when drawing is skipped. */
1649
1675
  update: (idetik: Idetik) => void;
1650
1676
  };
1651
1677
  /**
@@ -1728,6 +1754,8 @@ declare class Idetik {
1728
1754
  private readonly sizeObserver_;
1729
1755
  private lastAnimationId_?;
1730
1756
  private lastTimestamp_;
1757
+ private renderRequested_;
1758
+ private renderInvalidated_;
1731
1759
  /**
1732
1760
  * Creates an Idetik runtime for the given canvas.
1733
1761
  *
@@ -1782,6 +1810,11 @@ declare class Idetik {
1782
1810
  * @param memoryLimitMB - The new budget in megabytes.
1783
1811
  */
1784
1812
  setMemoryLimitMB(memoryLimitMB: number): void;
1813
+ /**
1814
+ * Explicitly requests a draw on the next animation frame while running,
1815
+ * even if no internal state has changed.
1816
+ */
1817
+ requestRender(): void;
1785
1818
  /**
1786
1819
  * Starts the render loop and connects input handlers.
1787
1820
  *
@@ -1789,8 +1822,10 @@ declare class Idetik {
1789
1822
  */
1790
1823
  start(): this;
1791
1824
  private detachRemovedLayers;
1792
- private renderViewport;
1793
1825
  private animate;
1826
+ private invalidate;
1827
+ private updateViewport;
1828
+ private draw;
1794
1829
  /**
1795
1830
  * Stops the render loop and disconnects input handlers.
1796
1831
  */
@@ -2540,7 +2575,7 @@ declare class AxesLayer extends Layer {
2540
2575
  */
2541
2576
  constructor(props: AxesLayerProps);
2542
2577
  /** Performs no per-frame work. The axes are built at construction. */
2543
- update(): void;
2578
+ update(): boolean;
2544
2579
  }
2545
2580
 
2546
2581
  /**
@@ -2657,7 +2692,7 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2657
2692
  *
2658
2693
  * @param viewport - The viewport being rendered.
2659
2694
  */
2660
- update(viewport?: Viewport): void;
2695
+ update(viewport?: Viewport): boolean;
2661
2696
  /** The slice plane the layer displays. */
2662
2697
  get orientation(): SliceOrientation;
2663
2698
  /**
@@ -2868,7 +2903,7 @@ declare class VolumeLayer extends Layer implements ChannelsEnabled {
2868
2903
  *
2869
2904
  * @param viewport - The viewport being rendered.
2870
2905
  */
2871
- update(viewport?: Viewport): void;
2906
+ update(viewport?: Viewport): boolean;
2872
2907
  private rebuildObjects;
2873
2908
  /** @hidden */
2874
2909
  get chunkStoreView(): ChunkStoreView | undefined;
@@ -3066,7 +3101,7 @@ declare class LabelLayer extends Layer {
3066
3101
  *
3067
3102
  * @param viewport - The viewport being rendered.
3068
3103
  */
3069
- update(viewport?: Viewport): void;
3104
+ update(viewport?: Viewport): boolean;
3070
3105
  /** The slice plane the layer displays. */
3071
3106
  get orientation(): SliceOrientation;
3072
3107
  /**
@@ -3251,7 +3286,9 @@ type PointProps = {
3251
3286
  * this.setState("ready");
3252
3287
  * }
3253
3288
  *
3254
- * public update() {}
3289
+ * public update(): boolean {
3290
+ * return true;
3291
+ * }
3255
3292
  * }
3256
3293
  * ```
3257
3294
  *