zincjs 3.0.0 → 3.0.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.
Files changed (60) hide show
  1. package/README.md +27 -22
  2. package/build/zinc.js +2 -2
  3. package/build/zinc.js.map +1 -1
  4. package/package.json +4 -1
  5. package/src/controls.js +1332 -1241
  6. package/src/geometryCSG.js +111 -115
  7. package/src/glyphsetCSG.js +51 -55
  8. package/src/loaders/GLTFToZincJSLoader.js +31 -33
  9. package/src/loaders/JSONLoader.js +339 -449
  10. package/src/loaders/OBJLoader.js +654 -851
  11. package/src/loaders/STLLoader.js +271 -329
  12. package/src/loaders/niftiReader.js +90 -59
  13. package/src/loaders/primitivesLoader.js +55 -52
  14. package/src/minimap.js +63 -43
  15. package/src/primitives/geometry.js +40 -44
  16. package/src/primitives/glyph.js +16 -19
  17. package/src/primitives/glyphset.js +229 -185
  18. package/src/primitives/label.js +29 -31
  19. package/src/primitives/lines.js +20 -20
  20. package/src/primitives/lines2.js +33 -39
  21. package/src/primitives/lod.js +43 -43
  22. package/src/primitives/marker.js +31 -32
  23. package/src/primitives/markerCluster.js +32 -35
  24. package/src/primitives/pointset.js +86 -83
  25. package/src/primitives/texturePrimitive.js +9 -10
  26. package/src/primitives/textureSlides.js +84 -97
  27. package/src/primitives/textureVolume.js +46 -49
  28. package/src/primitives/tubeLines.js +108 -108
  29. package/src/primitives/zincObject.js +176 -184
  30. package/src/region.js +145 -155
  31. package/src/renderRequests.js +3 -3
  32. package/src/renderer.js +635 -620
  33. package/src/scene.js +479 -419
  34. package/src/sceneExporter.js +22 -17
  35. package/src/sceneLoader.js +542 -296
  36. package/src/shaders/rgbVolumeRender.js +11 -18
  37. package/src/shaders/textureArray.js +5 -12
  38. package/src/shaders/textureSlide.js +10 -17
  39. package/src/shaders/volumeRender.js +11 -18
  40. package/src/shaders/volumeRender_old.js +11 -18
  41. package/src/shaders/volumeTexture.js +7 -14
  42. package/src/textSprite.js +23 -19
  43. package/src/texture/texture.js +14 -15
  44. package/src/texture/textureArray.js +14 -16
  45. package/src/three/InstancedPoints.js +2 -9
  46. package/src/three/Loader.js +334 -315
  47. package/src/three/line/Line.js +165 -215
  48. package/src/three/line/LineSegments.js +40 -55
  49. package/src/three/line/LineSegments2.js +322 -366
  50. package/src/three/line/LineSegmentsGeometry.js +239 -280
  51. package/src/three-js-csg.js +260 -252
  52. package/src/tsl/glyphRenderMaterial.js +12 -3
  53. package/src/tsl/glyphTransform.js +51 -29
  54. package/src/tsl/textureSlides.js +23 -24
  55. package/src/utilities.js +309 -371
  56. package/src/videoHandler.js +76 -83
  57. package/src/workers/geometryCSG.worker.js +33 -36
  58. package/src/workers/geometryCSGInternal.js +39 -44
  59. package/src/zinc.js +4 -7
  60. package/vite.config.js +7 -7
@@ -1,8 +1,7 @@
1
1
  import * as THREE from 'three/webgpu';
2
2
  const glslVersion = null;
3
3
 
4
- const fs =
5
- `
4
+ const fs = `
6
5
  uniform sampler3D texture0;
7
6
  uniform sampler3D texture1;
8
7
  uniform vec4 lookup_offsets, lookup_scales;
@@ -75,8 +74,7 @@ void main()
75
74
  }
76
75
  `;
77
76
 
78
- const vs =
79
- `
77
+ const vs = `
80
78
  varying vec4 diffuse, ambientGlobal, ambient;
81
79
  uniform vec4 texture_scaling;
82
80
 
@@ -100,20 +98,15 @@ void main()
100
98
  }
101
99
  `;
102
100
 
103
- const getUniforms = function() {
101
+ const getUniforms = function () {
104
102
  return {
105
- u_size: { value: new THREE.Vector3( 1, 1, 1 ) },
106
- u_renderstyle: { value: 0 },
107
- u_renderthreshold: { value: 0.5 },
108
- u_clim: { value: new THREE.Vector2( 1, 1 ) },
109
- u_data: { value: null },
110
- u_cmdata: { value: null },
111
- }
103
+ u_size: { value: new THREE.Vector3(1, 1, 1) },
104
+ u_renderstyle: { value: 0 },
105
+ u_renderthreshold: { value: 0.5 },
106
+ u_clim: { value: new THREE.Vector2(1, 1) },
107
+ u_data: { value: null },
108
+ u_cmdata: { value: null },
109
+ };
112
110
  };
113
111
 
114
- export {
115
- fs,
116
- vs,
117
- glslVersion,
118
- getUniforms
119
- }
112
+ export { fs, vs, glslVersion, getUniforms };
@@ -2,8 +2,7 @@ import * as THREE from 'three';
2
2
 
3
3
  const glslVersion = THREE.GLSL3;
4
4
 
5
- const fs =
6
- `
5
+ const fs = `
7
6
  precision highp float;
8
7
  precision highp int;
9
8
  precision highp sampler2DArray;
@@ -23,8 +22,7 @@ void main() {
23
22
  }
24
23
  `;
25
24
 
26
- const vs =
27
- `
25
+ const vs = `
28
26
  out vec3 vUw;
29
27
  uniform float depth;
30
28
 
@@ -37,16 +35,11 @@ void main() {
37
35
  }
38
36
  `;
39
37
 
40
- const getUniforms = function() {
38
+ const getUniforms = function () {
41
39
  return {
42
40
  diffuse: { value: undefined },
43
41
  depth: { value: 1 },
44
42
  };
45
- }
43
+ };
46
44
 
47
- export {
48
- fs,
49
- vs,
50
- glslVersion,
51
- getUniforms
52
- }
45
+ export { fs, vs, glslVersion, getUniforms };
@@ -1,8 +1,7 @@
1
1
  import * as THREE from 'three/webgpu';
2
2
  const glslVersion = THREE.GLSL3;
3
3
 
4
- const fs =
5
- `
4
+ const fs = `
6
5
  precision highp float;
7
6
  precision highp int;
8
7
  precision highp sampler2DArray;
@@ -41,8 +40,7 @@ void main() {
41
40
  }
42
41
  `;
43
42
 
44
- const vs =
45
- `
43
+ const vs = `
46
44
  out vec3 vUw;
47
45
  uniform float depth;
48
46
  uniform vec3 slide;
@@ -72,12 +70,12 @@ void main() {
72
70
  }
73
71
  `;
74
72
 
75
- const getUniforms = function() {
73
+ const getUniforms = function () {
76
74
  return {
77
- brightness: { value: 0},
78
- contrast: { value: 1},
75
+ brightness: { value: 0 },
76
+ contrast: { value: 1 },
79
77
  depth: { value: 1 },
80
- discardAlpha: {value: true},
78
+ discardAlpha: { value: true },
81
79
  diffuse0: { value: undefined },
82
80
  diffuse1: { value: undefined },
83
81
  direction: { value: 1 },
@@ -86,14 +84,9 @@ const getUniforms = function() {
86
84
  nChannels: { value: 1 },
87
85
  mask: { value: undefined },
88
86
  maskEnabled: { value: false },
89
- slide: { value: new THREE.Vector3( 0, 0, 1 ) },
90
- time: { value: 0 }
87
+ slide: { value: new THREE.Vector3(0, 0, 1) },
88
+ time: { value: 0 },
91
89
  };
92
- }
90
+ };
93
91
 
94
- export {
95
- fs,
96
- vs,
97
- glslVersion,
98
- getUniforms
99
- }
92
+ export { fs, vs, glslVersion, getUniforms };
@@ -1,8 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  const glslVersion = null;
3
3
 
4
- const fs =
5
- `
4
+ const fs = `
6
5
  precision highp float;
7
6
  precision highp sampler2DArray;
8
7
  precision highp sampler2D;
@@ -236,8 +235,7 @@ const fs =
236
235
  }
237
236
  `;
238
237
 
239
- const vs =
240
- `
238
+ const vs = `
241
239
  varying vec4 v_nearpos;
242
240
  varying vec4 v_farpos;
243
241
  varying vec3 v_position;
@@ -269,20 +267,15 @@ const vs =
269
267
  }
270
268
  `;
271
269
 
272
- const getUniforms = function() {
270
+ const getUniforms = function () {
273
271
  return {
274
- u_size: { value: new THREE.Vector3( 1, 1, 1 ) },
275
- u_renderstyle: { value: 0 },
276
- u_renderthreshold: { value: 0.5 },
277
- u_clim: { value: new THREE.Vector2( 1, 1 ) },
278
- u_data: { value: null },
279
- u_cmdata: { value: null },
280
- }
272
+ u_size: { value: new THREE.Vector3(1, 1, 1) },
273
+ u_renderstyle: { value: 0 },
274
+ u_renderthreshold: { value: 0.5 },
275
+ u_clim: { value: new THREE.Vector2(1, 1) },
276
+ u_data: { value: null },
277
+ u_cmdata: { value: null },
278
+ };
281
279
  };
282
280
 
283
- export {
284
- fs,
285
- vs,
286
- glslVersion,
287
- getUniforms
288
- }
281
+ export { fs, vs, glslVersion, getUniforms };
@@ -1,8 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  const glslVersion = null;
3
3
 
4
- const fs =
5
- `
4
+ const fs = `
6
5
  precision highp float;
7
6
  precision highp sampler2DArray;
8
7
  precision highp sampler2D;
@@ -236,8 +235,7 @@ const fs =
236
235
  }
237
236
  `;
238
237
 
239
- const vs =
240
- `
238
+ const vs = `
241
239
  varying vec4 v_nearpos;
242
240
  varying vec4 v_farpos;
243
241
  varying vec3 v_position;
@@ -269,20 +267,15 @@ const vs =
269
267
  }
270
268
  `;
271
269
 
272
- const getUniforms = function() {
270
+ const getUniforms = function () {
273
271
  return {
274
- u_size: { value: new THREE.Vector3( 1, 1, 1 ) },
275
- u_renderstyle: { value: 0 },
276
- u_renderthreshold: { value: 0.5 },
277
- u_clim: { value: new THREE.Vector2( 1, 1 ) },
278
- u_data: { value: null },
279
- u_cmdata: { value: null },
280
- }
272
+ u_size: { value: new THREE.Vector3(1, 1, 1) },
273
+ u_renderstyle: { value: 0 },
274
+ u_renderthreshold: { value: 0.5 },
275
+ u_clim: { value: new THREE.Vector2(1, 1) },
276
+ u_data: { value: null },
277
+ u_cmdata: { value: null },
278
+ };
281
279
  };
282
280
 
283
- export {
284
- fs,
285
- vs,
286
- glslVersion,
287
- getUniforms
288
- }
281
+ export { fs, vs, glslVersion, getUniforms };
@@ -1,8 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  const glslVersion = THREE.GLSL3;
3
3
 
4
- const fs =
5
- `
4
+ const fs = `
6
5
  precision highp int;
7
6
  precision highp float;
8
7
 
@@ -72,8 +71,7 @@ void main(void) {
72
71
  }
73
72
  `;
74
73
 
75
- const vs =
76
- `
74
+ const vs = `
77
75
  uniform vec3 volume_scale;
78
76
 
79
77
  out vec3 vray_dir;
@@ -91,18 +89,13 @@ void main(void) {
91
89
  }
92
90
  `;
93
91
 
94
- const getUniforms = function() {
92
+ const getUniforms = function () {
95
93
  return {
96
- volume_scale: { value: new THREE.Vector3( 1, 1, 1 ) },
94
+ volume_scale: { value: new THREE.Vector3(1, 1, 1) },
97
95
  diffuse: { value: undefined },
98
- volume_dims: { value: [ 1, 1, 1 ] },
96
+ volume_dims: { value: [1, 1, 1] },
99
97
  depth: { value: 1 },
100
- }
98
+ };
101
99
  };
102
100
 
103
- export {
104
- fs,
105
- vs,
106
- glslVersion,
107
- getUniforms
108
- }
101
+ export { fs, vs, glslVersion, getUniforms };
package/src/textSprite.js CHANGED
@@ -23,7 +23,7 @@ const RESCALE_THRESHOLD = 0.1;
23
23
  * is viewportHeight * pixelRatio / (2 * tan(fov / 2)). Default to a 1000
24
24
  * pixels viewport with the 40 degrees field of view used by the scenes.
25
25
  */
26
- let pixelsPerUnit = 1000 / (2 * Math.tan(20 * Math.PI / 180));
26
+ let pixelsPerUnit = 1000 / (2 * Math.tan((20 * Math.PI) / 180));
27
27
 
28
28
  //Weak references to every live text sprite, so they can be redrawn
29
29
  const sprites = new Set();
@@ -32,7 +32,7 @@ let fontListenerAdded = false;
32
32
  const fontSizeForHeight = (textHeight) => {
33
33
  const size = Math.round(textHeight * pixelsPerUnit * OVERSAMPLE);
34
34
  return Math.min(Math.max(size, MIN_FONT_SIZE), MAX_FONT_SIZE);
35
- }
35
+ };
36
36
 
37
37
  /*
38
38
  * The canvas matches the on screen size so mipmaps are not required,
@@ -46,7 +46,7 @@ const applyTextureSettings = (sprite) => {
46
46
  texture.magFilter = THREE.LinearFilter;
47
47
  texture.anisotropy = 1;
48
48
  }
49
- }
49
+ };
50
50
 
51
51
  /*
52
52
  * SpriteText redraws its canvas and creates a new texture in every setter,
@@ -63,7 +63,7 @@ const setFont = (sprite, fontFace, fontSize, fontWeight) => {
63
63
  sprite.fontSize = fontSize;
64
64
  sprite.fontWeight = fontWeight;
65
65
  }
66
- }
66
+ };
67
67
 
68
68
  /*
69
69
  * Redraw the sprite at the resolution required for its current height.
@@ -74,7 +74,7 @@ const refreshTextSprite = (sprite, force = false) => {
74
74
  setFont(sprite, sprite.fontFace, fontSize, sprite.fontWeight);
75
75
  applyTextureSettings(sprite);
76
76
  }
77
- }
77
+ };
78
78
 
79
79
  const forEachSprite = (callback) => {
80
80
  sprites.forEach((ref) => {
@@ -85,12 +85,12 @@ const forEachSprite = (callback) => {
85
85
  sprites.delete(ref);
86
86
  }
87
87
  });
88
- }
88
+ };
89
89
 
90
90
  const redrawAll = () => {
91
91
  forEachSprite((sprite) => refreshTextSprite(sprite, true));
92
92
  requestRenderAll();
93
- }
93
+ };
94
94
 
95
95
  /*
96
96
  * The canvas is drawn with a fallback font if a web font has not been
@@ -108,19 +108,22 @@ const waitForFont = (sprite) => {
108
108
  const font = `${sprite.fontWeight} ${sprite.fontSize}px ${sprite.fontFace}`;
109
109
  try {
110
110
  if (!document.fonts.check(font)) {
111
- document.fonts.load(font).then(() => {
112
- refreshTextSprite(sprite, true);
113
- requestRenderAll();
114
- }).catch(() => {});
111
+ document.fonts
112
+ .load(font)
113
+ .then(() => {
114
+ refreshTextSprite(sprite, true);
115
+ requestRenderAll();
116
+ })
117
+ .catch(() => {});
115
118
  }
116
119
  } catch {
117
120
  //Invalid font string, keep the fallback font
118
121
  }
119
- }
122
+ };
120
123
 
121
124
  const registerTextSprite = (sprite) => {
122
125
  sprites.add(new WeakRef(sprite));
123
- }
126
+ };
124
127
 
125
128
  /**
126
129
  * Stop tracking a text sprite, call this when it is disposed.
@@ -132,7 +135,7 @@ const releaseTextSprite = (sprite) => {
132
135
  sprites.delete(ref);
133
136
  }
134
137
  });
135
- }
138
+ };
136
139
 
137
140
  /**
138
141
  * Create a text sprite rendered with a node material, the canvas resolution
@@ -146,8 +149,9 @@ const releaseTextSprite = (sprite) => {
146
149
  * @return {SpriteText}
147
150
  */
148
151
  const createTextSprite = (text, textHeight, colour, fontFace, fontWeight) => {
149
- const sprite = colour ? new SpriteText(text, textHeight, colour) :
150
- new SpriteText(text, textHeight);
152
+ const sprite = colour
153
+ ? new SpriteText(text, textHeight, colour)
154
+ : new SpriteText(text, textHeight);
151
155
  setFont(sprite, fontFace, fontSizeForHeight(textHeight), fontWeight);
152
156
  //Replace the SpriteMaterial created by SpriteText with a node material
153
157
  //using the same canvas texture.
@@ -162,7 +166,7 @@ const createTextSprite = (text, textHeight, colour, fontFace, fontWeight) => {
162
166
  registerTextSprite(sprite);
163
167
  waitForFont(sprite);
164
168
  return sprite;
165
- }
169
+ };
166
170
 
167
171
  /**
168
172
  * Set the height of a text sprite and redraw it once at the matching
@@ -176,7 +180,7 @@ const setTextSpriteHeight = (sprite, textHeight) => {
176
180
  sprite.textHeight = textHeight;
177
181
  refreshTextSprite(sprite);
178
182
  }
179
- }
183
+ };
180
184
 
181
185
  /**
182
186
  * Update the number of screen pixels per unit of text height, e.g. when the
@@ -194,7 +198,7 @@ const setTextPixelsPerUnit = (value) => {
194
198
  forEachSprite((sprite) => refreshTextSprite(sprite));
195
199
  requestRenderAll();
196
200
  }
197
- }
201
+ };
198
202
 
199
203
  const getTextPixelsPerUnit = () => pixelsPerUnit;
200
204
 
@@ -15,9 +15,9 @@ const Texture = function () {
15
15
  this.size = {
16
16
  width: 1,
17
17
  height: 1,
18
- depth: 0
18
+ depth: 0,
19
19
  };
20
- }
20
+ };
21
21
 
22
22
  /**
23
23
  * Read an image from src.
@@ -33,8 +33,8 @@ Texture.prototype.loadImage = function (img, src) {
33
33
  img.onload = () => resolve(img);
34
34
  img.onerror = reject;
35
35
  img.src = src;
36
- })
37
- }
36
+ });
37
+ };
38
38
 
39
39
  /**
40
40
  @typedef IMAGE_UINT8_RETURN
@@ -57,18 +57,18 @@ Texture.prototype.imageToUint8Array = async function (instance, img, src, canvas
57
57
  await instance.loadImage(img, src);
58
58
  canvas.width = img.width;
59
59
  canvas.height = img.height;
60
- const ctx = canvas.getContext("2d");
60
+ const ctx = canvas.getContext('2d');
61
61
  ctx.drawImage(img, 0, 0);
62
62
  return {
63
63
  array: new Uint8Array(ctx.getImageData(0, 0, canvas.width, canvas.height).data.buffer),
64
64
  width: canvas.width,
65
- height: canvas.height
65
+ height: canvas.height,
66
66
  };
67
- }
67
+ };
68
68
 
69
69
  Texture.prototype.loadFromImages = async function (srcArrays) {
70
- return
71
- }
70
+ return;
71
+ };
72
72
 
73
73
  /**
74
74
  * Free the memory allocated for this texture.
@@ -78,7 +78,7 @@ Texture.prototype.dispose = function () {
78
78
  this.impl.dispose();
79
79
  this.impl = undefined;
80
80
  }
81
- }
81
+ };
82
82
 
83
83
  /**
84
84
  * Return true if the texture is ready for consumption.
@@ -86,10 +86,9 @@ Texture.prototype.dispose = function () {
86
86
  * @return {Boolean}
87
87
  */
88
88
  Texture.prototype.isReady = function () {
89
- if (this.impl && !this.isLoading)
90
- return true;
89
+ if (this.impl && !this.isLoading) return true;
91
90
  return false;
92
- }
91
+ };
93
92
 
94
93
  /**
95
94
  * Return true if the texture is ready for consumption, otherwise false.
@@ -103,9 +102,9 @@ Texture.prototype.getMaterial = function () {
103
102
  transparent: false,
104
103
  opacity: 1.0,
105
104
  map: this.impl,
106
- side: THREE.DoubleSide
105
+ side: THREE.DoubleSide,
107
106
  });
108
107
  }
109
- }
108
+ };
110
109
 
111
110
  export { Texture };
@@ -14,12 +14,11 @@ const TextureArray = function () {
14
14
  this.isTextureArray = true;
15
15
  this.imageData = undefined;
16
16
 
17
-
18
17
  this.setDataTexture = (dataTexture) => {
19
18
  this.impl = dataTexture;
20
- console.log("setDataTexture", dataTexture);
19
+ console.log('setDataTexture', dataTexture);
21
20
  this.imageData = dataTexture.image.data;
22
- }
21
+ };
23
22
 
24
23
  /**
25
24
  * Read images from an array containg src locations.
@@ -34,8 +33,8 @@ const TextureArray = function () {
34
33
  if (srcArrays && srcArrays.length) {
35
34
  this.isLoading = true;
36
35
  const image = new Image();
37
- image.crossOrigin = "Anonymous";
38
- const canvas = document.createElement("canvas");
36
+ image.crossOrigin = 'Anonymous';
37
+ const canvas = document.createElement('canvas');
39
38
  let length = 0;
40
39
  const dataStacks = new Array(srcArrays.length);
41
40
  for (let i = 0; i < srcArrays.length; i++) {
@@ -50,7 +49,7 @@ const TextureArray = function () {
50
49
  }
51
50
  const fullArray = new Uint8Array(length);
52
51
  length = 0;
53
- dataStacks.forEach(data => {
52
+ dataStacks.forEach((data) => {
54
53
  fullArray.set(data, length);
55
54
  length += data.length;
56
55
  });
@@ -59,12 +58,12 @@ const TextureArray = function () {
59
58
  this.size = {
60
59
  width: w,
61
60
  height: h,
62
- depth: d
61
+ depth: d,
63
62
  };
64
63
  this.isLoading = false;
65
64
  this.impl.needsUpdate = true;
66
65
  }
67
- }
66
+ };
68
67
 
69
68
  /**
70
69
  * Get and create the material containing shaders and the textures.
@@ -86,18 +85,17 @@ const TextureArray = function () {
86
85
  if (options) {
87
86
  if (options.vs && options.fs) {
88
87
  let transparent = true;
89
- if ("transparent" in options) {
88
+ if ('transparent' in options) {
90
89
  transparent = options.transparent;
91
90
  }
92
91
  let side = THREE.FrontSide;
93
- if (options.side)
94
- side = options.side;
92
+ if (options.side) side = options.side;
95
93
  material = new THREE.ShaderMaterial({
96
94
  transparent,
97
95
  uniforms: options.uniforms,
98
96
  vertexShader: options.vs,
99
97
  fragmentShader: options.fs,
100
- side
98
+ side,
101
99
  });
102
100
  if (options.glslVersion) {
103
101
  material.glslVersion = options.glslVersion;
@@ -109,7 +107,7 @@ const TextureArray = function () {
109
107
  transparent: false,
110
108
  opacity: 1.0,
111
109
  map: this.impl,
112
- side: THREE.DoubleSide
110
+ side: THREE.DoubleSide,
113
111
  });
114
112
  }
115
113
  if (material) {
@@ -117,8 +115,8 @@ const TextureArray = function () {
117
115
  return material;
118
116
  }
119
117
  }
120
- }
121
- }
118
+ };
119
+ };
122
120
 
123
121
  TextureArray.prototype = Object.create(Texture.prototype);
124
122
 
@@ -128,6 +126,6 @@ TextureArray.prototype = Object.create(Texture.prototype);
128
126
  TextureArray.prototype.dispose = function () {
129
127
  Texture.prototype.dispose.call(this);
130
128
  this.imageData = undefined;
131
- }
129
+ };
132
130
 
133
131
  export { TextureArray };
@@ -1,9 +1,4 @@
1
- import {
2
- InstancedMesh,
3
- Matrix4,
4
- Ray,
5
- Vector3,
6
- } from 'three/webgpu';
1
+ import { InstancedMesh, Matrix4, Ray, Vector3 } from 'three/webgpu';
7
2
 
8
3
  const _inverseMatrix = /*@__PURE__*/ new Matrix4();
9
4
  const _ray = /*@__PURE__*/ new Ray();
@@ -19,7 +14,6 @@ const _position = /*@__PURE__*/ new Vector3();
19
14
  * the distance-to-point approach the legacy `THREE.Points` override used.
20
15
  */
21
16
  class InstancedPoints extends InstancedMesh {
22
-
23
17
  constructor(geometry, material, count) {
24
18
  super(geometry, material, count);
25
19
  this.type = 'InstancedPoints';
@@ -44,7 +38,7 @@ class InstancedPoints extends InstancedMesh {
44
38
  _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
45
39
 
46
40
  const averageScale = (this.scale.x + this.scale.y + this.scale.z) / 3;
47
- const localThreshold = threshold / averageScale * this.pointSize * this.sizePerPixel;
41
+ const localThreshold = (threshold / averageScale) * this.pointSize * this.sizePerPixel;
48
42
  const localThresholdSq = localThreshold * localThreshold;
49
43
 
50
44
  for (let i = 0; i < count; i++) {
@@ -67,7 +61,6 @@ class InstancedPoints extends InstancedMesh {
67
61
  }
68
62
  }
69
63
  }
70
-
71
64
  }
72
65
 
73
66
  export { InstancedPoints };