@idetik/core 0.1.0 → 0.1.1

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
@@ -243,6 +243,31 @@ declare class Color {
243
243
  private toHexComponent;
244
244
  }
245
245
 
246
+ declare class Box2 {
247
+ min: vec2;
248
+ max: vec2;
249
+ /**
250
+ * Initializes as an empty box if no values are provided using the
251
+ * "empty-by-sentinel" pattern: min = +Infinity, max = -Infinity.
252
+ * This allows expansion functions to work without special-casing
253
+ * the first element, and avoids biasing toward (0,0).
254
+ */
255
+ constructor(min?: vec2, max?: vec2);
256
+ clone(): Box2;
257
+ isEmpty(): boolean;
258
+ static intersects(a: Box2, b: Box2): boolean;
259
+ static equals(a: Box2, b: Box2): boolean;
260
+ floor(): Box2;
261
+ toRect(): {
262
+ x: number;
263
+ y: number;
264
+ width: number;
265
+ height: number;
266
+ };
267
+ }
268
+
269
+ type CullingMode = "none" | "front" | "back" | "both";
270
+
246
271
  declare abstract class RenderableObject extends Node {
247
272
  wireframeEnabled: boolean;
248
273
  wireframeColor: Color;
@@ -252,6 +277,7 @@ declare abstract class RenderableObject extends Node {
252
277
  private geometry_;
253
278
  private wireframeGeometry_;
254
279
  private programName_;
280
+ private cullFaceMode_;
255
281
  setTexture(index: number, texture: Texture): void;
256
282
  popStaleTextures(): Texture[];
257
283
  get geometry(): Geometry;
@@ -262,6 +288,8 @@ declare abstract class RenderableObject extends Node {
262
288
  get programName(): Shader;
263
289
  get boundingBox(): Box3;
264
290
  protected set programName(programName: Shader);
291
+ get cullFaceMode(): CullingMode;
292
+ set cullFaceMode(mode: CullingMode);
265
293
  /**
266
294
  * Get uniforms for shader program. Override in derived classes that need custom uniforms.
267
295
  * @returns Object containing uniform name-value pairs
@@ -296,29 +324,6 @@ declare abstract class Camera extends RenderableObject {
296
324
  clipToWorld(position: vec3): vec3;
297
325
  }
298
326
 
299
- declare class Box2 {
300
- min: vec2;
301
- max: vec2;
302
- /**
303
- * Initializes as an empty box if no values are provided using the
304
- * "empty-by-sentinel" pattern: min = +Infinity, max = -Infinity.
305
- * This allows expansion functions to work without special-casing
306
- * the first element, and avoids biasing toward (0,0).
307
- */
308
- constructor(min?: vec2, max?: vec2);
309
- clone(): Box2;
310
- isEmpty(): boolean;
311
- static intersects(a: Box2, b: Box2): boolean;
312
- static equals(a: Box2, b: Box2): boolean;
313
- floor(): Box2;
314
- toRect(): {
315
- x: number;
316
- y: number;
317
- width: number;
318
- height: number;
319
- };
320
- }
321
-
322
327
  declare class OrthographicCamera extends Camera {
323
328
  private width_;
324
329
  private height_;
@@ -1570,28 +1575,17 @@ type OmeroChannel = OmeroMetadata["channels"][number];
1570
1575
  declare function loadOmeroChannels(source: OmeZarrImageSource): Promise<OmeroChannel[]>;
1571
1576
  declare function loadOmeroDefaults(source: OmeZarrImageSource): Promise<OmeroMetadata["rdefs"]>;
1572
1577
 
1573
- /** Options for customizing fetch requests, such as adding authentication headers for private S3 data */
1574
- type FetchOptions = {
1575
- /** RequestInit overrides to customize fetch behavior (e.g., custom headers for S3 authentication) */
1576
- overrides?: RequestInit;
1577
- /** Whether to use suffix requests for range queries */
1578
- useSuffixRequest?: boolean;
1579
- };
1580
1578
  /** Opens an OME-Zarr multiscale image Zarr group from either a URL or local directory. */
1581
1579
  declare class OmeZarrImageSource {
1582
1580
  readonly location: Location<Readable>;
1583
1581
  readonly version?: Version;
1584
- readonly fetchOptions?: FetchOptions;
1585
1582
  /**
1586
1583
  * @param url URL of Zarr root
1587
- * @param version OME-Zarr version
1588
- * @param fetchOptions Optional fetch configuration (e.g., authentication headers for private S3 data)
1589
1584
  */
1590
- constructor(url: string, version?: Version, fetchOptions?: FetchOptions);
1585
+ constructor(url: string, version?: Version);
1591
1586
  /**
1592
1587
  * @param directory return value of `window.showDirectoryPicker()` which gives the browser
1593
1588
  * permission to access a directory (only works in Chrome/Edge)
1594
- * @param version OME-Zarr version
1595
1589
  * @param path path to image, beginning with "/". This argument allows the application to only
1596
1590
  * ask the user once for permission to the root directory
1597
1591
  */
@@ -1862,4 +1856,4 @@ declare class Texture3D extends Texture {
1862
1856
  static createWithChunk(chunk: Chunk): Texture3D;
1863
1857
  }
1864
1858
 
1865
- export { AxesLayer, Box2, Box3, type CameraControls, type ChannelProps, type ChannelsEnabled, type Chunk, type ChunkLoader, ChunkedImageLayer, Color, type ColorLike, EventContext, type FetchOptions, Frustum, Idetik, ImageLayer, ImageSeriesLayer, type ImageSourcePolicy, type ImageSourcePolicyConfig, LabelImageLayer, Layer, LayerManager, type LayerState, Image as OmeZarrImage, OmeZarrImageSource, type OmeroChannel, type OmeroMetadata, OrthographicCamera, PanZoomControls, PerspectiveCamera, Plane, type PointPickingResult, Points, type PriorityCategory, ProjectedLineLayer, type Region, type SliceCoordinates, Spherical, Texture2DArray, Texture3D, TracksLayer, Viewport, type ViewportConfig, VolumeLayer, WebGLRenderer, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults, parseViewportConfigs };
1859
+ export { AxesLayer, Box2, Box3, type CameraControls, type ChannelProps, type ChannelsEnabled, type Chunk, type ChunkLoader, ChunkedImageLayer, Color, type ColorLike, EventContext, Frustum, Idetik, ImageLayer, ImageSeriesLayer, type ImageSourcePolicy, type ImageSourcePolicyConfig, LabelImageLayer, Layer, LayerManager, type LayerState, Image as OmeZarrImage, OmeZarrImageSource, type OmeroChannel, type OmeroMetadata, OrthographicCamera, PanZoomControls, PerspectiveCamera, Plane, type PointPickingResult, Points, type PriorityCategory, ProjectedLineLayer, type Region, type SliceCoordinates, Spherical, Texture2DArray, Texture3D, TracksLayer, Viewport, type ViewportConfig, VolumeLayer, WebGLRenderer, createExplorationPolicy, createImageSourcePolicy, createNoPrefetchPolicy, createPlaybackPolicy, loadOmeZarrPlate, loadOmeZarrWell, loadOmeroChannels, loadOmeroDefaults, parseViewportConfigs };
package/dist/index.js CHANGED
@@ -1706,6 +1706,7 @@ class lQ {
1706
1706
  currentBlendingMode_ = null;
1707
1707
  currentViewport_ = null;
1708
1708
  currentScissor_ = null;
1709
+ currentCullingMode_ = null;
1709
1710
  constructor(A) {
1710
1711
  this.gl_ = A;
1711
1712
  }
@@ -1767,6 +1768,28 @@ class lQ {
1767
1768
  const { x: B, y: Q, width: C, height: E } = I.toRect();
1768
1769
  this.gl_.scissor(B, Q, C, E), this.currentScissor_ = I;
1769
1770
  }
1771
+ setCullFace(A) {
1772
+ A ? this.enable(this.gl_.CULL_FACE) : this.disable(this.gl_.CULL_FACE);
1773
+ }
1774
+ setCullFaceMode(A) {
1775
+ if (this.currentCullingMode_ !== A) {
1776
+ if (A === "none")
1777
+ this.setCullFace(!1);
1778
+ else
1779
+ switch (this.setCullFace(!0), A) {
1780
+ case "front":
1781
+ this.gl_.cullFace(this.gl_.FRONT);
1782
+ break;
1783
+ case "back":
1784
+ this.gl_.cullFace(this.gl_.BACK);
1785
+ break;
1786
+ case "both":
1787
+ this.gl_.cullFace(this.gl_.FRONT_AND_BACK);
1788
+ break;
1789
+ }
1790
+ this.currentCullingMode_ = A;
1791
+ }
1792
+ }
1770
1793
  }
1771
1794
  const fQ = oQ(AA(), [1, -1, 1]);
1772
1795
  class pQ extends ZB {
@@ -1824,7 +1847,7 @@ class pQ extends ZB {
1824
1847
  }
1825
1848
  renderObject(A, I, B) {
1826
1849
  const Q = A.objects[I];
1827
- this.bindings_.bindGeometry(Q.geometry), Q.popStaleTextures().forEach((E) => {
1850
+ this.state_.setCullFaceMode(Q.cullFaceMode), this.bindings_.bindGeometry(Q.geometry), Q.popStaleTextures().forEach((E) => {
1828
1851
  this.textures_.disposeTexture(E);
1829
1852
  }), Q.textures.forEach((E, i) => {
1830
1853
  this.textures_.bindTexture(E, i);
@@ -2885,6 +2908,7 @@ class mA extends Eg {
2885
2908
  geometry_ = new pA();
2886
2909
  wireframeGeometry_ = null;
2887
2910
  programName_ = null;
2911
+ cullFaceMode_ = "none";
2888
2912
  setTexture(A, I) {
2889
2913
  const B = this.textures_[A];
2890
2914
  B !== void 0 && this.staleTextures_.push(B), this.textures_[A] = I;
@@ -2920,6 +2944,12 @@ class mA extends Eg {
2920
2944
  set programName(A) {
2921
2945
  this.programName_ = A;
2922
2946
  }
2947
+ get cullFaceMode() {
2948
+ return this.cullFaceMode_;
2949
+ }
2950
+ set cullFaceMode(A) {
2951
+ this.cullFaceMode_ = A;
2952
+ }
2923
2953
  /**
2924
2954
  * Get uniforms for shader program. Override in derived classes that need custom uniforms.
2925
2955
  * @returns Object containing uniform name-value pairs
@@ -4105,7 +4135,7 @@ class tC extends pA {
4105
4135
  }
4106
4136
  class GC extends mA {
4107
4137
  constructor(A, I, B, Q) {
4108
- super(), this.geometry = new tC(A, I, B, 1, 1, 1), this.setTexture(0, Q), this.programName = wC(Q.dataType);
4138
+ super(), this.geometry = new tC(A, I, B, 1, 1, 1), this.cullFaceMode = "back", this.setTexture(0, Q), this.programName = wC(Q.dataType);
4109
4139
  }
4110
4140
  get type() {
4111
4141
  return "VolumeRenderable";
@@ -5922,14 +5952,13 @@ async function SE(g) {
5922
5952
  const I = g.arrayPath ? A.resolve(g.arrayPath) : A;
5923
5953
  return rE(I, g.zarrVersion);
5924
5954
  }
5925
- function RE(g, A, I, B) {
5955
+ function RE(g, A, I) {
5926
5956
  if (g.store instanceof sI)
5927
5957
  return {
5928
5958
  type: "fetch",
5929
5959
  arrayPath: A,
5930
5960
  zarrVersion: I,
5931
- url: g.store.url.toString(),
5932
- fetchOptions: B
5961
+ url: g.store.url.toString()
5933
5962
  };
5934
5963
  if (g.store instanceof cg)
5935
5964
  return {
@@ -13366,18 +13395,8 @@ ${JSON.stringify(g)}`);
13366
13395
  class No {
13367
13396
  location;
13368
13397
  version;
13369
- fetchOptions;
13370
- // Implementation signature that handles both overloads above.
13371
- // For URLs: 2nd param can be version or fetchOptions, 3rd param is fetchOptions
13372
- // For FileSystemDirectoryHandle: 2nd param is version, 3rd param is path
13373
13398
  constructor(A, I, B) {
13374
- if (typeof A == "string") {
13375
- const Q = typeof I == "string" ? I : void 0, C = typeof I == "object" ? I : B;
13376
- this.location = new _(new sI(A, C)), this.version = Q, this.fetchOptions = C;
13377
- } else {
13378
- const Q = typeof I == "string" ? I : void 0, C = typeof B == "string" ? B : void 0;
13379
- this.location = new _(new cg(A), C), this.version = Q, this.fetchOptions = void 0;
13380
- }
13399
+ this.location = typeof A == "string" ? new _(new sI(A)) : new _(new cg(A), B), this.version = I;
13381
13400
  }
13382
13401
  async open() {
13383
13402
  let A = fA(this.version);
@@ -13391,7 +13410,7 @@ class No {
13391
13410
  throw new Error("No datasets found in the multiscale image.");
13392
13411
  A || (A = fA(B.originalVersion));
13393
13412
  const E = C.datasets.map(
13394
- (D) => RE(this.location, D.path, A, this.fetchOptions)
13413
+ (D) => RE(this.location, D.path, A)
13395
13414
  ), i = await Promise.all(
13396
13415
  E.map((D) => SE(D))
13397
13416
  ), o = i[0].shape, a = C.axes;