zincjs 1.20.1 → 2.0.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 +292 -2648
- package/build/zinc.js.map +1 -1
- package/package.json +17 -20
- package/src/controls.js +33 -25
- package/src/geometryCSG.js +25 -23
- package/src/glyphsetCSG.js +15 -13
- package/src/loaders/GLTFToZincJSLoader.js +11 -9
- package/src/loaders/JSONLoader.js +14 -14
- package/src/loaders/niftiReader.js +0 -3
- package/src/loaders/primitivesLoader.js +4 -3
- package/src/minimap.js +6 -4
- package/src/primitives/augmentShader.js +3 -1
- package/src/primitives/geometry.js +16 -14
- package/src/primitives/glyph.js +7 -5
- package/src/primitives/glyphset.js +9 -7
- package/src/primitives/label.js +5 -2
- package/src/primitives/lines.js +13 -10
- package/src/primitives/lines2.js +8 -9
- package/src/primitives/lod.js +9 -9
- package/src/primitives/marker.js +22 -16
- package/src/primitives/markerCluster.js +14 -12
- package/src/primitives/pointset.js +8 -8
- package/src/primitives/texturePrimitive.js +7 -6
- package/src/primitives/textureSlides.js +8 -6
- package/src/primitives/textureVolume.js +8 -6
- package/src/primitives/tubeLines.js +14 -13
- package/src/primitives/zincObject.js +13 -9
- package/src/region.js +65 -66
- package/src/renderer.js +8 -5
- package/src/scene.js +26 -16
- package/src/sceneExporter.js +3 -3
- package/src/sceneLoader.js +109 -88
- package/src/shaders/rgbVolumeRender.js +8 -7
- package/src/shaders/textureArray.js +8 -7
- package/src/shaders/textureSlide.js +7 -6
- package/src/shaders/volumeRender.js +8 -7
- package/src/shaders/volumeRender_old.js +8 -7
- package/src/shaders/volumeTexture.js +9 -8
- package/src/texture/texture.js +9 -9
- package/src/texture/textureArray.js +5 -4
- package/src/three/Loader.js +0 -2
- package/src/three/Points.js +2 -2
- package/src/three-js-csg.js +538 -538
- package/src/utilities.js +49 -41
- package/src/videoHandler.js +11 -9
- package/src/workers/geometryCSG.worker.js +68 -67
- package/src/workers/geometryCSGInternal.js +12 -11
- package/src/zinc.js +49 -25
- package/vite.config.js +29 -0
- package/build/zinc.frontend.js +0 -3
package/src/region.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const THREE = require('three');
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Pointset } from './primitives/pointset';
|
|
3
|
+
import { Lines2 } from './primitives/lines2';
|
|
4
|
+
import { Geometry } from './primitives/geometry';
|
|
5
|
+
|
|
7
6
|
let uniqueiId = 0;
|
|
8
7
|
|
|
9
8
|
const getUniqueId = function () {
|
|
@@ -13,27 +12,27 @@ const getUniqueId = function () {
|
|
|
13
12
|
/**
|
|
14
13
|
* Provides a hierachical structure to objects, Each region
|
|
15
14
|
* may contain multiple child regions and {@link ZincObject}.
|
|
16
|
-
*
|
|
15
|
+
*
|
|
17
16
|
* @class
|
|
18
17
|
* @author Alan Wu
|
|
19
18
|
* @return {Region}
|
|
20
19
|
*/
|
|
21
20
|
let Region = function (parentIn, sceneIn) {
|
|
22
21
|
let parent = parentIn;
|
|
23
|
-
let group = new Group();
|
|
22
|
+
let group = new THREE.Group();
|
|
24
23
|
group.matrixAutoUpdate = false;
|
|
25
24
|
group.userData = this;
|
|
26
25
|
let children = [];
|
|
27
26
|
let name = "";
|
|
28
27
|
let zincObjects = [];
|
|
29
28
|
let scene = sceneIn;
|
|
30
|
-
const tMatrix = new Matrix4();
|
|
29
|
+
const tMatrix = new THREE.Matrix4();
|
|
31
30
|
let duration = 3000;
|
|
32
31
|
tMatrix.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
|
33
32
|
this.pickableUpdateRequired = true;
|
|
34
33
|
this.isRegion = true;
|
|
35
34
|
this.uuid = getUniqueId();
|
|
36
|
-
|
|
35
|
+
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
38
|
* Hide all primitives belong to this region.
|
|
@@ -54,7 +53,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
54
53
|
/**
|
|
55
54
|
* Set the visibility and propagate it down the hierarchies
|
|
56
55
|
* depending on the flag.
|
|
57
|
-
*
|
|
56
|
+
*
|
|
58
57
|
* @param {Boolean} flag - A flag indicating either the visibilty to be on/off.
|
|
59
58
|
*/
|
|
60
59
|
this.setVisibility = (flag) => {
|
|
@@ -66,7 +65,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
66
65
|
|
|
67
66
|
/**
|
|
68
67
|
* Get the visibility of the region and its children.
|
|
69
|
-
*
|
|
68
|
+
*
|
|
70
69
|
* @return {Boolean}
|
|
71
70
|
*/
|
|
72
71
|
this.getVisibility = () => {
|
|
@@ -76,7 +75,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
76
75
|
/**
|
|
77
76
|
* Get the {THREE.Group} containing all child regions and their
|
|
78
77
|
* primitives.
|
|
79
|
-
*
|
|
78
|
+
*
|
|
80
79
|
* @return {THREE.Group}
|
|
81
80
|
*/
|
|
82
81
|
this.getGroup = () => {
|
|
@@ -86,7 +85,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
86
85
|
/**
|
|
87
86
|
* Set the transformation with a {THREE.Matrix4} matrix, this will affect
|
|
88
87
|
* all primitives in this and its child regions
|
|
89
|
-
*
|
|
88
|
+
*
|
|
90
89
|
* @param {THREE.Matrix4} transformation - The transformation matrix
|
|
91
90
|
* used for the transformation.
|
|
92
91
|
*/
|
|
@@ -98,7 +97,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
98
97
|
|
|
99
98
|
/**
|
|
100
99
|
* Set the name of this region.
|
|
101
|
-
*
|
|
100
|
+
*
|
|
102
101
|
* @param {String} nameIn - Name to be set for this region. It must be defined
|
|
103
102
|
* and non-empty.
|
|
104
103
|
*/
|
|
@@ -110,7 +109,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
110
109
|
|
|
111
110
|
/**
|
|
112
111
|
* Get the name of this region.
|
|
113
|
-
*
|
|
112
|
+
*
|
|
114
113
|
* @return {String}
|
|
115
114
|
*/
|
|
116
115
|
this.getName = () => {
|
|
@@ -119,7 +118,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
119
118
|
|
|
120
119
|
/**
|
|
121
120
|
* Get the parent region.
|
|
122
|
-
*
|
|
121
|
+
*
|
|
123
122
|
* @return {Region}
|
|
124
123
|
*/
|
|
125
124
|
this.getParent = () => {
|
|
@@ -128,7 +127,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
128
127
|
|
|
129
128
|
/**
|
|
130
129
|
* Get the array of each hierarachy from the root region to this region.
|
|
131
|
-
*
|
|
130
|
+
*
|
|
132
131
|
* @return {Array}
|
|
133
132
|
*/
|
|
134
133
|
this.getFullSeparatedPath = () => {
|
|
@@ -148,7 +147,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
148
147
|
|
|
149
148
|
/**
|
|
150
149
|
* Get the full paths from the root region to this region.
|
|
151
|
-
*
|
|
150
|
+
*
|
|
152
151
|
* @return {String}
|
|
153
152
|
*/
|
|
154
153
|
this.getFullPath = () => {
|
|
@@ -166,7 +165,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
166
165
|
/**
|
|
167
166
|
* Create a new child region with the provided name.
|
|
168
167
|
* @param {String} nameIn - Name to be set for the new child region.
|
|
169
|
-
*
|
|
168
|
+
*
|
|
170
169
|
* @return {Region}
|
|
171
170
|
*/
|
|
172
171
|
this.createChild = (nameIn) => {
|
|
@@ -180,7 +179,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
180
179
|
/**
|
|
181
180
|
* Get the child region with matching childName.
|
|
182
181
|
* @param {String} childName - Name to be matched.
|
|
183
|
-
*
|
|
182
|
+
*
|
|
184
183
|
* @return {Region}
|
|
185
184
|
*/
|
|
186
185
|
this.getChildWithName = childName => {
|
|
@@ -198,7 +197,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
198
197
|
* Find a child region using the path array.
|
|
199
198
|
* @param {Array} pathArray - Array containing regions' name at each
|
|
200
199
|
* hierarchy to match.
|
|
201
|
-
*
|
|
200
|
+
*
|
|
202
201
|
* @return {Region}
|
|
203
202
|
*/
|
|
204
203
|
this.findChildFromSeparatedPath = pathArray => {
|
|
@@ -221,10 +220,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
221
220
|
|
|
222
221
|
/**
|
|
223
222
|
* Find the region using the provided relative path.
|
|
224
|
-
*
|
|
223
|
+
*
|
|
225
224
|
* @param {String} path - Relative paths from this region
|
|
226
225
|
* to the child region.
|
|
227
|
-
*
|
|
226
|
+
*
|
|
228
227
|
* @return {Region}
|
|
229
228
|
*/
|
|
230
229
|
this.findChildFromPath = (path) => {
|
|
@@ -235,10 +234,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
235
234
|
/**
|
|
236
235
|
* Create a new child using the path array. All required new regions
|
|
237
236
|
* down the path will be created.
|
|
238
|
-
*
|
|
237
|
+
*
|
|
239
238
|
* @param {Array} pathArray - Array containing regions' name, new regions
|
|
240
239
|
* will be created along the path if not found.
|
|
241
|
-
*
|
|
240
|
+
*
|
|
242
241
|
* @return {Region}
|
|
243
242
|
*/
|
|
244
243
|
this.createChildFromSeparatedPath = pathArray => {
|
|
@@ -261,10 +260,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
261
260
|
/**
|
|
262
261
|
* Create a new child using the path. All required new regions
|
|
263
262
|
* down the path will be created.
|
|
264
|
-
*
|
|
263
|
+
*
|
|
265
264
|
* @param {String} path - Relative paths from the region
|
|
266
265
|
* to the child region.
|
|
267
|
-
*
|
|
266
|
+
*
|
|
268
267
|
* @return {Region}
|
|
269
268
|
*/
|
|
270
269
|
this.createChildFromPath = (path) => {
|
|
@@ -276,10 +275,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
276
275
|
/**
|
|
277
276
|
* Return existing region if it exists, otherwise, create a new
|
|
278
277
|
* region with the provided path.
|
|
279
|
-
*
|
|
278
|
+
*
|
|
280
279
|
* @param {String} path - Relative paths from the region
|
|
281
280
|
* to the child region.
|
|
282
|
-
*
|
|
281
|
+
*
|
|
283
282
|
* @return {Region}
|
|
284
283
|
*/
|
|
285
284
|
this.findOrCreateChildFromPath = (path) => {
|
|
@@ -293,7 +292,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
293
292
|
/**
|
|
294
293
|
* Add a zinc object into this region, the morph will be added
|
|
295
294
|
* to the group.
|
|
296
|
-
*
|
|
295
|
+
*
|
|
297
296
|
* @param {ZincObject} zincObject - Zinc object to be added into
|
|
298
297
|
* this region.
|
|
299
298
|
*/
|
|
@@ -313,7 +312,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
313
312
|
/**
|
|
314
313
|
* Remove a ZincObject from this region if it presents. This will eventually
|
|
315
314
|
* destroy the object and free up the memory.
|
|
316
|
-
*
|
|
315
|
+
*
|
|
317
316
|
* @param {ZincObject} zincObject - object to be removed from this region.
|
|
318
317
|
*/
|
|
319
318
|
this.removeZincObject = zincObject => {
|
|
@@ -333,10 +332,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
333
332
|
|
|
334
333
|
/**
|
|
335
334
|
* Return true if pickable objects require an update.
|
|
336
|
-
*
|
|
335
|
+
*
|
|
337
336
|
* @param {Boolean} transverse - Check child regions as well
|
|
338
337
|
* if this is set to true.
|
|
339
|
-
*
|
|
338
|
+
*
|
|
340
339
|
* @return {Boolean}
|
|
341
340
|
*/
|
|
342
341
|
this.checkPickableUpdateRequred = (transverse) => {
|
|
@@ -378,7 +377,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
378
377
|
/**
|
|
379
378
|
* Set the default duration value for all zinc objects
|
|
380
379
|
* that are to be loaded into this region.
|
|
381
|
-
*
|
|
380
|
+
*
|
|
382
381
|
* @param {Number} durationIn - duration of the scene.
|
|
383
382
|
*/
|
|
384
383
|
this.setDuration = durationIn => {
|
|
@@ -399,8 +398,8 @@ let Region = function (parentIn, sceneIn) {
|
|
|
399
398
|
* Get the bounding box of all the object in this and child regions only.
|
|
400
399
|
* Do not include the matrix transformation here, it is done at the primitives
|
|
401
400
|
* level.
|
|
402
|
-
*
|
|
403
|
-
* @returns {THREE.Box3}
|
|
401
|
+
*
|
|
402
|
+
* @returns {THREE.Box3}
|
|
404
403
|
*/
|
|
405
404
|
this.getBoundingBox = transverse => {
|
|
406
405
|
let boundingBox1 = undefined, boundingBox2 = undefined;
|
|
@@ -431,7 +430,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
431
430
|
|
|
432
431
|
/**
|
|
433
432
|
* Clear and dispose all objects belong to this region.
|
|
434
|
-
*
|
|
433
|
+
*
|
|
435
434
|
* @param {Boolean} transverse - Clear and dispose child regions as well
|
|
436
435
|
* if this is set to true.
|
|
437
436
|
*/
|
|
@@ -449,10 +448,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
449
448
|
|
|
450
449
|
/**
|
|
451
450
|
* Check if a zincObject is a member of this region.
|
|
452
|
-
*
|
|
451
|
+
*
|
|
453
452
|
* @param {ZincObject} zincObject - The ZincObject to be checked.
|
|
454
453
|
* @param {Boolean} transverse - Also check the child regions.
|
|
455
|
-
*
|
|
454
|
+
*
|
|
456
455
|
* @return {Boolean}
|
|
457
456
|
*/
|
|
458
457
|
this.objectIsInRegion = (zincObject, transverse) => {
|
|
@@ -474,7 +473,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
474
473
|
/**
|
|
475
474
|
* A function which iterates through the list of geometries and call the callback
|
|
476
475
|
* function with the geometries as the argument.
|
|
477
|
-
*
|
|
476
|
+
*
|
|
478
477
|
* @param {Function} callbackFunction - Callback function with the geometry
|
|
479
478
|
* as an argument.
|
|
480
479
|
* @param {Boolean} transverse - Also perform the same callback function for
|
|
@@ -493,7 +492,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
493
492
|
/**
|
|
494
493
|
* A function which iterates through the list of glyphsets and call the callback
|
|
495
494
|
* function with the glyphset as the argument.
|
|
496
|
-
*
|
|
495
|
+
*
|
|
497
496
|
* @param {Function} callbackFunction - Callback function with the glyphset
|
|
498
497
|
* as an argument.
|
|
499
498
|
* @param {Boolean} transverse - Also perform the same callback function for
|
|
@@ -512,7 +511,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
512
511
|
/**
|
|
513
512
|
* A function which iterates through the list of pointsets and call the callback
|
|
514
513
|
* function with the pointset as the argument.
|
|
515
|
-
*
|
|
514
|
+
*
|
|
516
515
|
* @param {Function} callbackFunction - Callback function with the pointset
|
|
517
516
|
* as an argument.
|
|
518
517
|
* @param {Boolean} transverse - Also perform the same callback function for
|
|
@@ -531,7 +530,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
531
530
|
/**
|
|
532
531
|
* A function which iterates through the list of lines and call the callback
|
|
533
532
|
* function with the lines as the argument.
|
|
534
|
-
*
|
|
533
|
+
*
|
|
535
534
|
* @param {Function} callbackFunction - Callback function with the lines
|
|
536
535
|
* as an argument.
|
|
537
536
|
* @param {Boolean} transverse - Also perform the same callback function for
|
|
@@ -563,10 +562,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
563
562
|
return objectsArray;
|
|
564
563
|
}
|
|
565
564
|
|
|
566
|
-
/**
|
|
567
|
-
* Find and return all zinc objects in this and child regions with
|
|
565
|
+
/**
|
|
566
|
+
* Find and return all zinc objects in this and child regions with
|
|
568
567
|
* the matching GroupName.
|
|
569
|
-
*
|
|
568
|
+
*
|
|
570
569
|
* @param {String} groupName - Groupname to match with.
|
|
571
570
|
* @param {Boolean} transverse - Also look for the object with groupName
|
|
572
571
|
* in child regions if set to true.
|
|
@@ -589,10 +588,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
589
588
|
return objectsArray;
|
|
590
589
|
}
|
|
591
590
|
|
|
592
|
-
/**
|
|
593
|
-
* Find and return all geometries in this and child regions with
|
|
591
|
+
/**
|
|
592
|
+
* Find and return all geometries in this and child regions with
|
|
594
593
|
* the matching GroupName.
|
|
595
|
-
*
|
|
594
|
+
*
|
|
596
595
|
* @param {String} groupName - Groupname to match with.
|
|
597
596
|
* @param {Boolean} transverse - Also look for the object with groupName
|
|
598
597
|
* in child regions if set to true.
|
|
@@ -604,10 +603,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
604
603
|
return geometriesArray;
|
|
605
604
|
}
|
|
606
605
|
|
|
607
|
-
/**
|
|
606
|
+
/**
|
|
608
607
|
* Find and return all pointsets in this and child regions with
|
|
609
608
|
* the matching groupName.
|
|
610
|
-
*
|
|
609
|
+
*
|
|
611
610
|
* @param {String} groupName - Groupname to match with.
|
|
612
611
|
* @param {Boolean} transverse - Also look for the object with groupName
|
|
613
612
|
* in child regions if set to true.
|
|
@@ -619,10 +618,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
619
618
|
return pointsetsArray;
|
|
620
619
|
}
|
|
621
620
|
|
|
622
|
-
/**
|
|
621
|
+
/**
|
|
623
622
|
* Find and return all glyphsets in this and child regions with
|
|
624
623
|
* the matching groupName.
|
|
625
|
-
*
|
|
624
|
+
*
|
|
626
625
|
* @param {String} groupName - Groupname to match with.
|
|
627
626
|
* @param {Boolean} transverse - Also look for the object with groupName
|
|
628
627
|
* in child regions if set to true.
|
|
@@ -634,10 +633,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
634
633
|
return glyphsetsArray;
|
|
635
634
|
}
|
|
636
635
|
|
|
637
|
-
/**
|
|
636
|
+
/**
|
|
638
637
|
* Find and return all lines in this and child regions with
|
|
639
638
|
* the matching groupName.
|
|
640
|
-
*
|
|
639
|
+
*
|
|
641
640
|
* @param {String} groupName - Groupname to match with.
|
|
642
641
|
* @param {Boolean} transverse - Also look for the object with groupName
|
|
643
642
|
* in child regions if set to true.
|
|
@@ -649,9 +648,9 @@ let Region = function (parentIn, sceneIn) {
|
|
|
649
648
|
return linesArray;
|
|
650
649
|
}
|
|
651
650
|
|
|
652
|
-
/**
|
|
651
|
+
/**
|
|
653
652
|
* Get all zinc objects in this region.
|
|
654
|
-
*
|
|
653
|
+
*
|
|
655
654
|
* @param {Boolean} transverse - Include zinc objects in child regions if this is
|
|
656
655
|
* set to true.
|
|
657
656
|
* @returns {Array}
|
|
@@ -667,10 +666,10 @@ let Region = function (parentIn, sceneIn) {
|
|
|
667
666
|
return objectsArray;
|
|
668
667
|
}
|
|
669
668
|
|
|
670
|
-
/**
|
|
669
|
+
/**
|
|
671
670
|
* Get all child regions.
|
|
672
|
-
*
|
|
673
|
-
* @param {Boolean} transverse - Include all regions which are descendants of
|
|
671
|
+
*
|
|
672
|
+
* @param {Boolean} transverse - Include all regions which are descendants of
|
|
674
673
|
* this reigon when this is set to true.
|
|
675
674
|
* @returns {Array}
|
|
676
675
|
*/
|
|
@@ -688,7 +687,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
688
687
|
/**
|
|
689
688
|
* Get the current time of the region.
|
|
690
689
|
* Return -1 if no graphics in the region.
|
|
691
|
-
*
|
|
690
|
+
*
|
|
692
691
|
* @return {Number}
|
|
693
692
|
*/
|
|
694
693
|
this.getCurrentTime = () => {
|
|
@@ -706,7 +705,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
706
705
|
|
|
707
706
|
/**
|
|
708
707
|
* Set the current time of all the objects of this region.
|
|
709
|
-
*
|
|
708
|
+
*
|
|
710
709
|
* @param {Number} time - Value to set the time to.
|
|
711
710
|
* @param {Boolean} transverse - Set the time for chidl regions if
|
|
712
711
|
* this is set to true.
|
|
@@ -724,7 +723,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
724
723
|
|
|
725
724
|
/**
|
|
726
725
|
* Check if any object in this region is time varying.
|
|
727
|
-
*
|
|
726
|
+
*
|
|
728
727
|
* @return {Boolean}
|
|
729
728
|
*/
|
|
730
729
|
this.isTimeVarying = () => {
|
|
@@ -756,7 +755,7 @@ let Region = function (parentIn, sceneIn) {
|
|
|
756
755
|
//one entry in markersList is greater than 1, markers have been enabled.
|
|
757
756
|
if (options && (playAnimation === false) &&
|
|
758
757
|
options.markerCluster?.markerUpdateRequired) {
|
|
759
|
-
/**
|
|
758
|
+
/**
|
|
760
759
|
const markerDepths = Object.values(options.markersList)
|
|
761
760
|
.map((marker) => marker.ndc.z);
|
|
762
761
|
if (markerDepths.length > 1) {
|
|
@@ -839,4 +838,4 @@ let Region = function (parentIn, sceneIn) {
|
|
|
839
838
|
}
|
|
840
839
|
}
|
|
841
840
|
|
|
842
|
-
|
|
841
|
+
export { Region };
|
package/src/renderer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { ResizeSensor } from 'css-element-queries';
|
|
3
|
+
import { Scene } from './scene';
|
|
3
4
|
/**
|
|
4
5
|
* Create a Zinc 3D renderer in the container provided.
|
|
5
6
|
* The primary function of a Zinc 3D renderer is to display the current
|
|
@@ -12,7 +13,7 @@ const ResizeSensor = require('css-element-queries/src/ResizeSensor');
|
|
|
12
13
|
* @author Alan Wu
|
|
13
14
|
* @return {Renderer}
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
const Renderer = function (containerIn) {
|
|
16
17
|
|
|
17
18
|
let container = containerIn;
|
|
18
19
|
|
|
@@ -218,9 +219,9 @@ exports.Renderer = function (containerIn) {
|
|
|
218
219
|
} else {
|
|
219
220
|
let new_scene = undefined;
|
|
220
221
|
if (canvas)
|
|
221
|
-
new_scene = new
|
|
222
|
+
new_scene = new Scene(canvas, renderer);
|
|
222
223
|
else
|
|
223
|
-
new_scene = new
|
|
224
|
+
new_scene = new Scene(container, renderer);
|
|
224
225
|
sceneMap[name] = new_scene;
|
|
225
226
|
new_scene.sceneName = name;
|
|
226
227
|
return new_scene;
|
|
@@ -700,3 +701,5 @@ exports.Renderer = function (containerIn) {
|
|
|
700
701
|
return false;
|
|
701
702
|
}
|
|
702
703
|
};
|
|
704
|
+
|
|
705
|
+
export { Renderer };
|
package/src/scene.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { CameraControls, StereoEffect } from './controls';
|
|
3
|
+
import { LineSegments } from './three/line/LineSegments';
|
|
4
|
+
import { MarkerCluster } from './primitives/markerCluster';
|
|
5
|
+
import { Minimap } from './minimap';
|
|
6
|
+
import { Region } from './region';
|
|
7
|
+
import { Points } from './three/Points';
|
|
8
|
+
import { SceneExporter } from './sceneExporter';
|
|
9
|
+
import { SceneLoader } from './sceneLoader';
|
|
10
|
+
import { Viewport } from './controls';
|
|
11
|
+
import {
|
|
12
|
+
createBufferGeometry,
|
|
13
|
+
createNewSpriteText,
|
|
14
|
+
getCircularTexture
|
|
15
|
+
} from './utilities';
|
|
16
|
+
|
|
9
17
|
let uniqueiId = 0;
|
|
10
18
|
|
|
11
19
|
const getUniqueId = function () {
|
|
@@ -33,7 +41,7 @@ const defaultDuration = 6000;
|
|
|
33
41
|
* @author Alan Wu
|
|
34
42
|
* @return {Scene}
|
|
35
43
|
*/
|
|
36
|
-
|
|
44
|
+
const Scene = function (containerIn, rendererIn) {
|
|
37
45
|
const container = containerIn;
|
|
38
46
|
let cameraHelper = undefined;
|
|
39
47
|
let videoHandler = undefined;
|
|
@@ -45,7 +53,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
45
53
|
let zincObjectRemovedCallbacks_id = 0;
|
|
46
54
|
const scene = new THREE.Scene();
|
|
47
55
|
const miniAxesScene = new THREE.Scene();
|
|
48
|
-
const rootRegion = new
|
|
56
|
+
const rootRegion = new Region(undefined, this);
|
|
49
57
|
scene.add(rootRegion.getGroup());
|
|
50
58
|
const tempGroup = new THREE.Group();
|
|
51
59
|
scene.add(tempGroup);
|
|
@@ -151,12 +159,12 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
151
159
|
|
|
152
160
|
this.directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
|
|
153
161
|
scene.add(this.directionalLight);
|
|
154
|
-
zincCameraControls = new
|
|
162
|
+
zincCameraControls = new CameraControls(this.camera, rendererIn.domElement, rendererIn, this);
|
|
155
163
|
|
|
156
164
|
zincCameraControls.setDirectionalLight(this.directionalLight);
|
|
157
165
|
zincCameraControls.resetView();
|
|
158
166
|
|
|
159
|
-
minimap = new
|
|
167
|
+
minimap = new Minimap(this);
|
|
160
168
|
};
|
|
161
169
|
|
|
162
170
|
setupCamera();
|
|
@@ -784,7 +792,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
784
792
|
this.setStereoEffectEnable = stereoFlag => {
|
|
785
793
|
if (stereoFlag == true) {
|
|
786
794
|
if (!stereoEffect) {
|
|
787
|
-
stereoEffect = new
|
|
795
|
+
stereoEffect = new StereoEffect(rendererIn);
|
|
788
796
|
}
|
|
789
797
|
}
|
|
790
798
|
rendererIn.setSize(getDrawingWidth(), getDrawingHeight());
|
|
@@ -859,7 +867,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
859
867
|
}
|
|
860
868
|
|
|
861
869
|
/**
|
|
862
|
-
* Transition the camera into viewing the zinc object
|
|
870
|
+
* Transition the camera into viewing the zinc object with a
|
|
863
871
|
* smooth transition within the providied transitionTime.
|
|
864
872
|
*
|
|
865
873
|
* @param {ZincObject} zincObject - the bounding box to target
|
|
@@ -1232,7 +1240,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1232
1240
|
color: colour, sizeAttenuation: false });
|
|
1233
1241
|
const texture = getCircularTexture();
|
|
1234
1242
|
material.map = texture;
|
|
1235
|
-
let point = new
|
|
1243
|
+
let point = new Points(geometry, material);
|
|
1236
1244
|
tempGroup.add(point);
|
|
1237
1245
|
return point;
|
|
1238
1246
|
}
|
|
@@ -1244,7 +1252,7 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1244
1252
|
this.addTemporaryLines = (coords, colour) => {
|
|
1245
1253
|
const geometry = createBufferGeometry(coords.length, coords);
|
|
1246
1254
|
const material = new THREE.LineBasicMaterial({color:colour});
|
|
1247
|
-
const line = new
|
|
1255
|
+
const line = new LineSegments(geometry, material);
|
|
1248
1256
|
tempGroup.add(line);
|
|
1249
1257
|
return line;
|
|
1250
1258
|
}
|
|
@@ -1481,3 +1489,5 @@ exports.Scene = function (containerIn, rendererIn) {
|
|
|
1481
1489
|
}
|
|
1482
1490
|
}
|
|
1483
1491
|
}
|
|
1492
|
+
|
|
1493
|
+
export { Scene };
|
package/src/sceneExporter.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { GLTFExporter } from './three/GLTFExporter';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Provides an object which uses for exporting the scene
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @class
|
|
7
7
|
* @author Alan Wu
|
|
8
8
|
* @return {SceneExporter}
|
|
@@ -29,4 +29,4 @@ const SceneExporter = function (sceneIn) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
export { SceneExporter };
|