@idetik/core 0.48.4 → 0.49.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.
Files changed (31) hide show
  1. package/dist/assets/worker_kernel-CBlE4MBI.js.map +1 -1
  2. package/dist/index.d.ts +175 -4
  3. package/dist/index.js +1232 -1057
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.cjs +272 -232
  6. package/dist/index.umd.cjs.map +1 -1
  7. package/dist/types/src/core/geometry.d.ts +1 -1
  8. package/dist/types/src/core/geometry.d.ts.map +1 -1
  9. package/dist/types/src/core/renderable_object.d.ts +8 -0
  10. package/dist/types/src/core/renderable_object.d.ts.map +1 -1
  11. package/dist/types/src/core/renderer.d.ts +2 -0
  12. package/dist/types/src/core/renderer.d.ts.map +1 -1
  13. package/dist/types/src/data/mesh/mesh_loader.d.ts +3 -0
  14. package/dist/types/src/data/mesh/mesh_loader.d.ts.map +1 -0
  15. package/dist/types/src/data/mesh/mesh_source.d.ts +50 -0
  16. package/dist/types/src/data/mesh/mesh_source.d.ts.map +1 -0
  17. package/dist/types/src/idetik.d.ts +2 -0
  18. package/dist/types/src/idetik.d.ts.map +1 -1
  19. package/dist/types/src/index.d.ts +6 -0
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/layers/mesh_layer.d.ts +66 -0
  22. package/dist/types/src/layers/mesh_layer.d.ts.map +1 -0
  23. package/dist/types/src/objects/renderable/mesh_renderable.d.ts +55 -0
  24. package/dist/types/src/objects/renderable/mesh_renderable.d.ts.map +1 -0
  25. package/dist/types/src/renderers/shaders/index.d.ts +1 -1
  26. package/dist/types/src/renderers/shaders/index.d.ts.map +1 -1
  27. package/dist/types/src/renderers/webgl_renderer.d.ts +2 -0
  28. package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
  29. package/dist/types/src/utilities/logger.d.ts +1 -1
  30. package/dist/types/src/utilities/logger.d.ts.map +1 -1
  31. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -731,7 +731,7 @@ declare class Geometry extends Node {
731
731
  protected attributes_: GeometryAttribute[];
732
732
  protected vertexData_: Float32Array;
733
733
  protected indexData_: Uint32Array;
734
- constructor(vertexData?: number[], indexData?: number[], primitive?: Primitive);
734
+ constructor(vertexData?: number[] | Float32Array, indexData?: number[] | Uint32Array, primitive?: Primitive);
735
735
  addAttribute(attr: GeometryAttribute): void;
736
736
  get vertexCount(): number;
737
737
  get stride(): number;
@@ -749,7 +749,7 @@ declare class WireframeGeometry extends Geometry {
749
749
  constructor(geometry: Geometry);
750
750
  }
751
751
 
752
- type Shader = "floatScalarImage" | "floatVolume" | "intLabelImage" | "intScalarImage" | "intVolume" | "labelImage" | "points" | "projectedLine" | "uintScalarImage" | "uintVolume" | "wireframe" | "meshDepth" | "pointsDepth" | "projectedLineDepth";
752
+ type Shader = "floatScalarImage" | "floatVolume" | "intLabelImage" | "intScalarImage" | "intVolume" | "labelImage" | "mesh" | "points" | "projectedLine" | "uintScalarImage" | "uintVolume" | "wireframe" | "meshDepth" | "pointsDepth" | "projectedLineDepth";
753
753
 
754
754
  /**
755
755
  * A value convertible to {@link Color}.
@@ -919,6 +919,14 @@ declare abstract class RenderableObject extends Node {
919
919
  * changes.
920
920
  */
921
921
  get wireframeGeometry(): WireframeGeometry;
922
+ /**
923
+ * Releases GPU buffers for {@link geometry} and any cached
924
+ * {@link wireframeGeometry}. Layers call this when discarding a
925
+ * renderable. CPU geometry data remains available for reuse.
926
+ *
927
+ * @param dispose - The runtime callback that releases a geometry's GPU buffers.
928
+ */
929
+ disposeGeometry(dispose: (geometry: Geometry) => void): void;
922
930
  /** The assigned textures indexed by texture unit. */
923
931
  get textures(): Texture[];
924
932
  /**
@@ -1614,6 +1622,7 @@ declare abstract class Renderer {
1614
1622
  abstract get gpuTextureCount(): number;
1615
1623
  abstract uploadTexture(texture: Texture): void;
1616
1624
  abstract disposeTexture(texture: Texture): void;
1625
+ abstract disposeGeometry(geometry: Geometry): void;
1617
1626
  }
1618
1627
 
1619
1628
  /** A snapshot of memory used by chunks, renderer textures, and the JS heap. */
@@ -1746,6 +1755,7 @@ type IdetikProps = {
1746
1755
  };
1747
1756
  type IdetikContext = {
1748
1757
  chunkManager: ChunkManager;
1758
+ disposeGeometry: (geometry: Geometry) => void;
1749
1759
  };
1750
1760
  /**
1751
1761
  * The entry point of an Idetik application.
@@ -1883,6 +1893,55 @@ declare class Idetik {
1883
1893
  stop(): void;
1884
1894
  }
1885
1895
 
1896
+ /**
1897
+ * Initialization properties for constructing a mesh source.
1898
+ */
1899
+ type MeshSourceProps = {
1900
+ /** The source URL passed to the mesh loader. */
1901
+ url: string;
1902
+ };
1903
+ /**
1904
+ * A source of static mesh geometry shared by one or more mesh layers.
1905
+ *
1906
+ * Geometry is loaded on the first call to {@link load} and retained by the
1907
+ * source. Each layer's renderable references the same CPU arrays and uses
1908
+ * separate GPU buffers. The loader currently returns placeholder box
1909
+ * geometry without fetching the URL.
1910
+ *
1911
+ * ```ts
1912
+ * const source = new MeshSource({
1913
+ * url: "https://example.com/mesh.glb",
1914
+ * });
1915
+ *
1916
+ * const layer = new MeshLayer({
1917
+ * source,
1918
+ * color: Color.RED,
1919
+ * });
1920
+ * ```
1921
+ *
1922
+ * @group Data Loading
1923
+ */
1924
+ declare class MeshSource {
1925
+ /** The source URL passed to the mesh loader. */
1926
+ readonly url: string;
1927
+ private geometryPromise_?;
1928
+ /**
1929
+ * Creates a mesh source without loading its geometry.
1930
+ *
1931
+ * @param props - Initialization properties.
1932
+ */
1933
+ constructor({ url }: MeshSourceProps);
1934
+ /**
1935
+ * Returns the source's CPU geometry, loading it on the first call.
1936
+ *
1937
+ * Concurrent and subsequent calls share the same promise and geometry.
1938
+ * A failed load clears the cached promise so a later call can retry.
1939
+ *
1940
+ * @returns A promise resolving to the geometry owned by this source.
1941
+ */
1942
+ load(): Promise<Geometry>;
1943
+ }
1944
+
1886
1945
  /**The zarr.json attributes key*/
1887
1946
  declare const Image: z.ZodObject<{
1888
1947
  /**The versioned OME-Zarr Metadata namespace*/
@@ -2831,6 +2890,68 @@ declare class ImageLayer extends Layer implements ChannelsEnabled {
2831
2890
  private releaseAndRemoveChunks;
2832
2891
  }
2833
2892
 
2893
+ /**
2894
+ * Initialization properties for constructing a mesh layer.
2895
+ */
2896
+ type MeshLayerProps = {
2897
+ /** The mesh source to load geometry from. */
2898
+ source: MeshSource;
2899
+ /** The mesh color. Alpha is ignored. Defaults to `Color.WHITE`. */
2900
+ color?: ColorLike;
2901
+ /** Ambient lighting contribution. Defaults to `0.25`. */
2902
+ ambientStrength?: number;
2903
+ /** Diffuse lighting contribution. Defaults to `0.75`. */
2904
+ diffuseStrength?: number;
2905
+ };
2906
+ /**
2907
+ * A layer that renders a static mesh with an opaque color and overhead lighting.
2908
+ *
2909
+ * Mesh layer loads its {@link MeshSource} when attached to a viewport and
2910
+ * creates one {@link MeshRenderable}. The mesh writes scene depth so
2911
+ * {@link VolumeLayer} can composite volume samples in front of its surface.
2912
+ * Detaching the layer releases the renderable's GPU buffers while the
2913
+ * source retains its CPU geometry for reuse.
2914
+ *
2915
+ * ```ts
2916
+ * const source = new MeshSource({ url: "https://example.com/mesh.glb" });
2917
+ *
2918
+ * const layer = new MeshLayer({
2919
+ * source,
2920
+ * color: Color.RED,
2921
+ * ambientStrength: 0.25,
2922
+ * diffuseStrength: 0.75,
2923
+ * });
2924
+ *
2925
+ * viewport.addLayer(layer);
2926
+ * ```
2927
+ *
2928
+ * @see {@link MeshSource} for geometry loading and caching.
2929
+ *
2930
+ * @group Layers
2931
+ */
2932
+ declare class MeshLayer extends Layer {
2933
+ /** Identifies the layer type as `MeshLayer`. */
2934
+ readonly type = "MeshLayer";
2935
+ private readonly source_;
2936
+ private readonly renderableProps_;
2937
+ private version_;
2938
+ /**
2939
+ * Creates a mesh layer for the given source and appearance settings.
2940
+ *
2941
+ * @param props - Initialization properties.
2942
+ */
2943
+ constructor({ source, ...renderableProps }: MeshLayerProps);
2944
+ /** @hidden */
2945
+ protected attach(): void;
2946
+ /** @hidden */
2947
+ protected detach(context: IdetikContext): void;
2948
+ /**
2949
+ * Returns `false` because the mesh is static. Loading and readiness
2950
+ * changes are handled when the layer is attached.
2951
+ */
2952
+ update(): boolean;
2953
+ }
2954
+
2834
2955
  /**
2835
2956
  * Initialization properties for constructing a volume layer.
2836
2957
  */
@@ -3230,6 +3351,56 @@ declare class LabelLayer extends Layer {
3230
3351
  private releaseAndRemoveChunks;
3231
3352
  }
3232
3353
 
3354
+ /**
3355
+ * Initialization properties for constructing a mesh renderable.
3356
+ */
3357
+ type MeshRenderableProps = {
3358
+ /** The mesh geometry with position and normal attributes. */
3359
+ geometry: Geometry;
3360
+ /** The mesh color. Alpha is ignored. Defaults to `Color.WHITE`. */
3361
+ color?: ColorLike;
3362
+ /** Ambient lighting contribution. Defaults to `0.25`. */
3363
+ ambientStrength?: number;
3364
+ /** Diffuse lighting contribution. Defaults to `0.75`. */
3365
+ diffuseStrength?: number;
3366
+ };
3367
+ type UniformValues$1 = {
3368
+ u_color: vec3;
3369
+ u_ambientStrength: number;
3370
+ u_diffuseStrength: number;
3371
+ };
3372
+ /**
3373
+ * An opaque mesh shaded with ambient light and a fixed overhead light.
3374
+ *
3375
+ * Normals are transformed to world space for diffuse shading. The mesh
3376
+ * also writes depth so it can occlude other layers. {@link MeshLayer}
3377
+ * creates one instance after its source has loaded.
3378
+ *
3379
+ * Vertex and index arrays are kept by reference in a separate geometry
3380
+ * object, allowing each renderable to use its own GPU buffers without
3381
+ * copying the source's CPU data.
3382
+ *
3383
+ * @group Renderables
3384
+ */
3385
+ declare class MeshRenderable extends RenderableObject {
3386
+ /** The mesh color. Alpha is ignored. Defaults to `Color.WHITE`. */
3387
+ color: Color;
3388
+ /** Ambient lighting contribution. Defaults to `0.25`. */
3389
+ ambientStrength: number;
3390
+ /** Diffuse lighting contribution. Defaults to `0.75`. */
3391
+ diffuseStrength: number;
3392
+ /**
3393
+ * Creates a mesh renderable for the given geometry and appearance settings.
3394
+ *
3395
+ * @param props - Initialization properties.
3396
+ */
3397
+ constructor({ geometry, color, ambientStrength, diffuseStrength, }: MeshRenderableProps);
3398
+ /** Identifies the renderable type as `MeshRenderable`. */
3399
+ get type(): string;
3400
+ /** Returns the color and lighting strength uniforms for the mesh shader. */
3401
+ getUniforms(): UniformValues$1;
3402
+ }
3403
+
3233
3404
  /**
3234
3405
  * Initialization properties for constructing an image renderable.
3235
3406
  */
@@ -3680,5 +3851,5 @@ declare class OrbitControls implements CameraControls {
3680
3851
  private cutoffLowVelocity;
3681
3852
  }
3682
3853
 
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 };
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 };
3854
+ export { AxesLayer, Box2, Box3, Camera, Color, Frustum, Idetik, ImageLayer, ImageRenderable, LabelImageRenderable, LabelLayer, Layer, MeshLayer, MeshRenderable, MeshSource, OmeZarrImageSource, OrbitControls, OrthographicCamera, PanZoomControls, PerspectiveCamera, PointsRenderable, ProjectedLineRenderable, RenderableObject, Stats, TrsTransform, Viewport, VolumeLayer, VolumeRenderable, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults };
3855
+ export type { AxesLayerProps, BlendMode, CameraControls, CameraType, ChannelProps, ChunkStats, ColorLike, FileSystemOmeZarrImageSourceProps, HttpOmeZarrImageSourceProps, IdetikProps, ImageLayerProps, ImageRenderableProps, ImageSourcePolicy, ImageSourcePolicyProps, LabelColorMap, LabelColorMapProps, LabelImageRenderableProps, LabelLayerProps, LayerProps, LayerState, MemoryStats, MeshLayerProps, MeshRenderableProps, MeshSourceProps, OrbitControlsProps, OrthographicCameraFrame, OrthographicCameraProps, Overlay, PanZoomControlsProps, PerspectiveCameraProps, PointPickingResult, PointProps, PriorityCategory, ProjectedLineRenderableProps, QueueStats, RuntimeStats, SliceCoordinates, SliceOrientation, SourceChunkStats, SourceDimension, SourceDimensionLod, SourceDimensionMap, StateChangeCallback, ViewportChunkStats, ViewportProps, VolumeLayerProps, VolumeRenderableProps };