@aics/vole-core 3.15.4 → 3.15.5

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/es/Line3d.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Group, Vector3 } from "three";
2
- import { LineMaterial } from "three/addons/lines/LineMaterial";
3
- import { MESH_LAYER, OVERLAY_LAYER } from "./ThreeJsPanel";
4
- import { LineSegments2 } from "three/addons/lines/LineSegments2";
5
- import { LineSegmentsGeometry } from "three/addons/lines/LineSegmentsGeometry";
2
+ import { LineMaterial } from "three/addons/lines/LineMaterial.js";
3
+ import { MESH_LAYER, OVERLAY_LAYER } from "./ThreeJsPanel.js";
4
+ import { LineSegments2 } from "three/addons/lines/LineSegments2.js";
5
+ import { LineSegmentsGeometry } from "three/addons/lines/LineSegmentsGeometry.js";
6
6
  const DEFAULT_VERTEX_BUFFER_SIZE = 1020;
7
7
 
8
8
  /**
@@ -48,6 +48,7 @@ export class ThreeJsPanel {
48
48
  this.timestepIndicatorElement = document.createElement("div");
49
49
  this.showTimestepIndicator = false;
50
50
  this.animateFuncs = [];
51
+ this.postAnimateFuncs = [];
51
52
 
52
53
  // are we in a constant render loop or not?
53
54
  this.inRenderLoop = false;
@@ -572,6 +573,11 @@ export class ThreeJsPanel {
572
573
  this.renderer.render(this.axisHelperScene, this.axisCamera);
573
574
  this.renderer.autoClear = true;
574
575
  }
576
+ for (let i = 0; i < this.postAnimateFuncs.length; i++) {
577
+ if (this.postAnimateFuncs[i]) {
578
+ this.postAnimateFuncs[i](this.renderer, this.camera, this.meshRenderTarget.depthTexture);
579
+ }
580
+ }
575
581
  if (this.dataurlcallback) {
576
582
  this.dataurlcallback(this.canvas.toDataURL());
577
583
  this.dataurlcallback = undefined;
package/es/View3d.js CHANGED
@@ -143,6 +143,7 @@ export class View3d {
143
143
  if (this.image) {
144
144
  this.canvas3d.removeControlHandlers();
145
145
  this.canvas3d.animateFuncs = [];
146
+ this.canvas3d.postAnimateFuncs = [];
146
147
  this.scene.remove(this.image.sceneRoot);
147
148
  }
148
149
  return this.image;
@@ -344,7 +345,11 @@ export class View3d {
344
345
  this.canvas3d.setControlHandlers(this.onStartControls.bind(this), this.onChangeControls.bind(this), this.onEndControls.bind(this));
345
346
  this.canvas3d.animateFuncs.push(this.preRender.bind(this));
346
347
  this.canvas3d.animateFuncs.push(img.onAnimate.bind(img));
347
- this.canvas3d.animateFuncs.push(img.fillPickBuffer.bind(img));
348
+ // NOTE: `fillPickBuffer` MUST run after render occurs. This is because the
349
+ // pick buffer needs to access the `meshRenderTarget`'s depth texture, but
350
+ // during a resize, the texture is disposed of and not recreated until the
351
+ // next render.
352
+ this.canvas3d.postAnimateFuncs.push(img.fillPickBuffer.bind(img));
348
353
  this.updatePerspectiveScaleBar(img.volume);
349
354
  this.updateTimestepIndicator(img.volume);
350
355
 
@@ -1,5 +1,5 @@
1
1
  import { Color, Euler, Group, Vector3 } from "three";
2
- import { IDrawableObject } from "./types";
2
+ import { IDrawableObject } from "./types.js";
3
3
  /**
4
4
  * Simple wrapper for a 3D line segments object, with controls for vertex data,
5
5
  * color, width, and segments visible.
@@ -13,13 +13,15 @@ export type CameraState = {
13
13
  /** The scale value for the orthographic camera controls; undefined for perspective cameras. */
14
14
  orthoScale?: number;
15
15
  };
16
+ type AnimateFunction = (renderer: WebGLRenderer, camera: PerspectiveCamera | OrthographicCamera, depthTexture?: DepthTexture | null) => void;
16
17
  export declare class ThreeJsPanel {
17
18
  containerdiv: HTMLDivElement;
18
19
  private canvas;
19
20
  scene: Scene;
20
21
  private meshRenderTarget;
21
22
  private meshRenderToBuffer;
22
- animateFuncs: ((renderer: WebGLRenderer, camera: PerspectiveCamera | OrthographicCamera, depthTexture?: DepthTexture | null) => void)[];
23
+ animateFuncs: AnimateFunction[];
24
+ postAnimateFuncs: AnimateFunction[];
23
25
  private inRenderLoop;
24
26
  private requestedRender;
25
27
  hasWebGL2: boolean;
@@ -109,3 +111,4 @@ export declare class ThreeJsPanel {
109
111
  setControlHandlers(onstart: EventListener<Event, "start", TrackballControls>, onchange: EventListener<Event, "change", TrackballControls>, onend: EventListener<Event, "end", TrackballControls>): void;
110
112
  hitTest(offsetX: number, offsetY: number, pickBuffer: WebGLRenderTarget | undefined): number;
111
113
  }
114
+ export {};
@@ -1,4 +1,4 @@
1
- import { PrefetchDirection, TCZYX } from "./types";
1
+ import { PrefetchDirection, TCZYX } from "./types.js";
2
2
  type TZYX = [number, number, number, number];
3
3
  type PrefetchDirectionState = {
4
4
  direction: PrefetchDirection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aics/vole-core",
3
- "version": "3.15.4",
3
+ "version": "3.15.5",
4
4
  "description": "volume renderer for 3d, 4d, or 5d imaging data with OME-Zarr support",
5
5
  "main": "es/index.js",
6
6
  "type": "module",