zincjs 2.4.0 → 2.4.1-beta.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.
- package/build/zinc.js +3 -486
- package/build/zinc.js.map +1 -1
- package/package.json +3 -4
- package/src/controls.js +1 -1
- package/src/geometryCSG.js +1 -1
- package/src/glyphsetCSG.js +1 -1
- package/src/loaders/GLTFToZincJSLoader.js +1 -1
- package/src/loaders/JSONLoader.js +204 -377
- package/src/loaders/OBJLoader.js +1 -1
- package/src/loaders/STLLoader.js +1 -1
- package/src/loaders/niftiReader.js +6 -4
- package/src/loaders/primitivesLoader.js +7 -9
- package/src/minimap.js +1 -1
- package/src/primitives/geometry.js +11 -29
- package/src/primitives/glyph.js +1 -1
- package/src/primitives/glyphset.js +2 -4
- package/src/primitives/label.js +1 -1
- package/src/primitives/lines.js +12 -5
- package/src/primitives/lines2.js +4 -8
- package/src/primitives/lod.js +9 -3
- package/src/primitives/marker.js +1 -1
- package/src/primitives/markerCluster.js +1 -1
- package/src/primitives/pointset.js +368 -52
- package/src/primitives/textureSlides.js +59 -16
- package/src/primitives/textureVolume.js +1 -1
- package/src/primitives/tubeLines.js +20 -3
- package/src/primitives/zincObject.js +13 -1
- package/src/region.js +1 -1
- package/src/renderer.js +17 -13
- package/src/scene.js +20 -8
- package/src/sceneLoader.js +1 -1
- package/src/shaders/rgbVolumeRender.js +1 -1
- package/src/shaders/textureSlide.js +1 -1
- package/src/texture/texture.js +1 -1
- package/src/texture/textureArray.js +9 -2
- package/src/three/GLTFExporter.js +55 -2
- package/src/three/InstancedPoints.js +73 -0
- package/src/three/Loader.js +1 -1
- package/src/three/line/Line.js +1 -1
- package/src/three/line/LineSegments.js +1 -1
- package/src/three/line/LineSegments2.js +24 -39
- package/src/three/line/LineSegmentsGeometry.js +1 -1
- package/src/tls/morphColorMaterial.js +65 -0
- package/src/tls/pointsMaterial.js +79 -0
- package/src/tls/textureSlides.js +126 -0
- package/src/utilities.js +47 -70
- package/src/videoHandler.js +1 -2
- package/src/workers/geometryCSG.worker.js +1 -1
- package/src/workers/geometryCSGInternal.js +1 -1
- package/src/zinc.js +1 -1
- package/vite.config.js +3 -1
- package/src/primitives/augmentShader.js +0 -45
- package/src/three/Geometry.js +0 -2176
- package/src/three/Points.js +0 -224
- package/src/three/line/LineMaterial.js +0 -726
package/src/three/Points.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BufferGeometry,
|
|
3
|
-
Matrix4,
|
|
4
|
-
Object3D,
|
|
5
|
-
PointsMaterial,
|
|
6
|
-
Ray,
|
|
7
|
-
Sphere,
|
|
8
|
-
Vector3
|
|
9
|
-
} from 'three';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const _inverseMatrix = /*@__PURE__*/ new Matrix4();
|
|
13
|
-
const _ray = /*@__PURE__*/ new Ray();
|
|
14
|
-
const _sphere = /*@__PURE__*/ new Sphere();
|
|
15
|
-
const _position = /*@__PURE__*/ new Vector3();
|
|
16
|
-
const _morphA = /*@__PURE__*/ new Vector3();
|
|
17
|
-
const _tempA = /*@__PURE__*/ new Vector3();
|
|
18
|
-
|
|
19
|
-
class Points extends Object3D {
|
|
20
|
-
|
|
21
|
-
constructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {
|
|
22
|
-
|
|
23
|
-
super();
|
|
24
|
-
|
|
25
|
-
this.type = 'Points';
|
|
26
|
-
|
|
27
|
-
this.geometry = geometry;
|
|
28
|
-
this.material = material;
|
|
29
|
-
this.sizePerPixel = 1;
|
|
30
|
-
|
|
31
|
-
this.updateMorphTargets();
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
copy( source ) {
|
|
36
|
-
|
|
37
|
-
super.copy( source );
|
|
38
|
-
|
|
39
|
-
this.material = source.material;
|
|
40
|
-
this.geometry = source.geometry;
|
|
41
|
-
|
|
42
|
-
return this;
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
raycast( raycaster, intersects ) {
|
|
47
|
-
|
|
48
|
-
const geometry = this.geometry;
|
|
49
|
-
const matrixWorld = this.matrixWorld;
|
|
50
|
-
const threshold = raycaster.params.Points.threshold;
|
|
51
|
-
const drawRange = geometry.drawRange;
|
|
52
|
-
|
|
53
|
-
// Checking boundingSphere distance to ray
|
|
54
|
-
|
|
55
|
-
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
56
|
-
|
|
57
|
-
_sphere.copy( geometry.boundingSphere );
|
|
58
|
-
_sphere.applyMatrix4( matrixWorld );
|
|
59
|
-
_sphere.radius += threshold;
|
|
60
|
-
|
|
61
|
-
if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;
|
|
62
|
-
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
_inverseMatrix.copy( matrixWorld ).invert();
|
|
66
|
-
_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );
|
|
67
|
-
|
|
68
|
-
const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ) * this.material.size * this.sizePerPixel;
|
|
69
|
-
const localThresholdSq = localThreshold * localThreshold;
|
|
70
|
-
|
|
71
|
-
if ( geometry.isBufferGeometry ) {
|
|
72
|
-
|
|
73
|
-
const index = geometry.index;
|
|
74
|
-
const attributes = geometry.attributes;
|
|
75
|
-
const positionAttribute = attributes.position;
|
|
76
|
-
const morphPosition = geometry.morphAttributes.position;
|
|
77
|
-
|
|
78
|
-
if ( index !== null ) {
|
|
79
|
-
|
|
80
|
-
const start = Math.max( 0, drawRange.start );
|
|
81
|
-
const end = Math.min( index.count, ( drawRange.start + drawRange.count ) );
|
|
82
|
-
|
|
83
|
-
for ( let i = start, il = end; i < il; i ++ ) {
|
|
84
|
-
|
|
85
|
-
const a = index.getX( i );
|
|
86
|
-
|
|
87
|
-
calculatePosition( this, positionAttribute, morphPosition, a );
|
|
88
|
-
|
|
89
|
-
testPoint( _position, a, localThresholdSq, matrixWorld, raycaster, intersects, this );
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
} else {
|
|
94
|
-
|
|
95
|
-
const start = Math.max( 0, drawRange.start );
|
|
96
|
-
const end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );
|
|
97
|
-
|
|
98
|
-
for ( let i = start, l = end; i < l; i ++ ) {
|
|
99
|
-
|
|
100
|
-
calculatePosition( this, positionAttribute, morphPosition, i );
|
|
101
|
-
|
|
102
|
-
testPoint( _position, i, localThresholdSq, matrixWorld, raycaster, intersects, this );
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
} else {
|
|
109
|
-
|
|
110
|
-
console.error( 'THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
updateMorphTargets() {
|
|
117
|
-
|
|
118
|
-
const geometry = this.geometry;
|
|
119
|
-
|
|
120
|
-
if ( geometry.isBufferGeometry ) {
|
|
121
|
-
|
|
122
|
-
const morphAttributes = geometry.morphAttributes;
|
|
123
|
-
const keys = Object.keys( morphAttributes );
|
|
124
|
-
|
|
125
|
-
if ( keys.length > 0 ) {
|
|
126
|
-
|
|
127
|
-
const morphAttribute = morphAttributes[ keys[ 0 ] ];
|
|
128
|
-
|
|
129
|
-
if ( morphAttribute !== undefined ) {
|
|
130
|
-
|
|
131
|
-
this.morphTargetInfluences = [];
|
|
132
|
-
this.morphTargetDictionary = {};
|
|
133
|
-
|
|
134
|
-
for ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
|
|
135
|
-
|
|
136
|
-
const name = morphAttribute[ m ].name || String( m );
|
|
137
|
-
|
|
138
|
-
this.morphTargetInfluences.push( 0 );
|
|
139
|
-
this.morphTargetDictionary[ name ] = m;
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
} else {
|
|
148
|
-
|
|
149
|
-
const morphTargets = geometry.morphTargets;
|
|
150
|
-
|
|
151
|
-
if ( morphTargets !== undefined && morphTargets.length > 0 ) {
|
|
152
|
-
|
|
153
|
-
console.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
Points.prototype.isPoints = true;
|
|
164
|
-
|
|
165
|
-
function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {
|
|
166
|
-
|
|
167
|
-
const rayPointDistanceSq = _ray.distanceSqToPoint( point );
|
|
168
|
-
|
|
169
|
-
if ( rayPointDistanceSq < localThresholdSq ) {
|
|
170
|
-
|
|
171
|
-
const intersectPoint = new Vector3();
|
|
172
|
-
|
|
173
|
-
_ray.closestPointToPoint( point, intersectPoint );
|
|
174
|
-
intersectPoint.applyMatrix4( matrixWorld );
|
|
175
|
-
|
|
176
|
-
const distance = raycaster.ray.origin.distanceTo( intersectPoint );
|
|
177
|
-
|
|
178
|
-
if ( distance < raycaster.near || distance > raycaster.far ) return;
|
|
179
|
-
|
|
180
|
-
intersects.push( {
|
|
181
|
-
|
|
182
|
-
distance: distance,
|
|
183
|
-
distanceToRay: Math.sqrt( rayPointDistanceSq ),
|
|
184
|
-
point: intersectPoint,
|
|
185
|
-
index: index,
|
|
186
|
-
face: null,
|
|
187
|
-
object: object
|
|
188
|
-
|
|
189
|
-
} );
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function calculatePosition( object, position, morphPosition, a ) {
|
|
196
|
-
|
|
197
|
-
_position.fromBufferAttribute( position, a );
|
|
198
|
-
|
|
199
|
-
const morphInfluences = object.morphTargetInfluences;
|
|
200
|
-
|
|
201
|
-
if ( object.material.morphTargets && morphPosition && morphInfluences ) {
|
|
202
|
-
|
|
203
|
-
_morphA.set( 0, 0, 0 );
|
|
204
|
-
|
|
205
|
-
for ( var i = 0, il = morphPosition.length; i < il; i ++ ) {
|
|
206
|
-
|
|
207
|
-
const influence = morphInfluences[ i ];
|
|
208
|
-
const morphAttribute = morphPosition[ i ];
|
|
209
|
-
|
|
210
|
-
if ( influence === 0 ) continue;
|
|
211
|
-
|
|
212
|
-
_tempA.fromBufferAttribute( morphAttribute, a );
|
|
213
|
-
|
|
214
|
-
_morphA.addScaledVector( _tempA.sub( _position ), influence );
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
_position.add( _morphA );
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export { Points };
|