zincjs 1.16.0 → 1.16.2
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.frontend.js +1 -1
- package/build/zinc.js +47 -39
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/label.js +13 -10
- package/src/primitives/pointset.js +40 -9
- package/src/primitives/texturePrimitive.js +3 -3
- package/src/primitives/textureSlides.js +6 -6
- package/src/primitives/tubeLines.js +1 -1
- package/src/sceneLoader.js +29 -28
package/package.json
CHANGED
package/src/primitives/label.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const SpriteText = require('three-spritetext').default;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Bitmap labels, this is used with {@link Glyph} to
|
|
4
|
+
* Bitmap labels, this is used with {@link Glyph} to
|
|
5
5
|
* provide labels.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* @param {String} textIn - Text to be displayed dwith the label.
|
|
8
8
|
* @param {THREE.Color} colour - Colour to be set for the label.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* @class
|
|
11
11
|
* @author Alan Wu
|
|
12
12
|
* @return {Label}
|
|
@@ -28,7 +28,7 @@ exports.Label = function (textIn, colour) {
|
|
|
28
28
|
/**
|
|
29
29
|
* Get the current position in an array containing the x, y and z
|
|
30
30
|
* coordinates.
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
* @return {Array}
|
|
33
33
|
*/
|
|
34
34
|
this.getPosition = () => {
|
|
@@ -39,7 +39,7 @@ exports.Label = function (textIn, colour) {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Set the position of the label in 3D coordinates.
|
|
42
|
-
*
|
|
42
|
+
*
|
|
43
43
|
* @param {Number} x - x coordinate to be set.
|
|
44
44
|
* @param {Number} y - y coordinate to be set.
|
|
45
45
|
* @param {Number} z - z coordinate to be set.
|
|
@@ -52,16 +52,19 @@ exports.Label = function (textIn, colour) {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Set the colour of the label
|
|
55
|
-
*
|
|
55
|
+
*
|
|
56
56
|
* @param {THREE.Color} colour - colour to be set
|
|
57
57
|
*/
|
|
58
58
|
this.setColour = colour => {
|
|
59
|
-
|
|
59
|
+
console.log(sprite)
|
|
60
|
+
if (colour) {
|
|
61
|
+
sprite.color = colour.getStyle();
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
/**
|
|
63
66
|
* Scale the label.
|
|
64
|
-
*
|
|
67
|
+
*
|
|
65
68
|
* @param {Number} scaling - Scale to be set.
|
|
66
69
|
*/
|
|
67
70
|
this.setScale = scaling => {
|
|
@@ -78,7 +81,7 @@ exports.Label = function (textIn, colour) {
|
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
83
|
* Get the intrnal sprite.
|
|
81
|
-
*
|
|
84
|
+
*
|
|
82
85
|
* @return {THREE.Sprite}
|
|
83
86
|
*/
|
|
84
87
|
this.getSprite = () => {
|
|
@@ -87,7 +90,7 @@ exports.Label = function (textIn, colour) {
|
|
|
87
90
|
|
|
88
91
|
/**
|
|
89
92
|
* Get the text.
|
|
90
|
-
*
|
|
93
|
+
*
|
|
91
94
|
* @return {String}
|
|
92
95
|
*/
|
|
93
96
|
this.getString = () => {
|
|
@@ -8,7 +8,7 @@ const Label = require('./label').Label;
|
|
|
8
8
|
* Provides an object which stores points and provides method which controls its position.
|
|
9
9
|
* This is created when a valid json file containing point is read into a {@link Zinc.Scene}
|
|
10
10
|
* object.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @class
|
|
13
13
|
* @author Alan Wu
|
|
14
14
|
* @return {Pointset}
|
|
@@ -20,7 +20,7 @@ const Pointset = function () {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Create the pointsets using geometry and material.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
* @param {THREE.Geomtry} geometryIn - Geometry of points to be rendered.
|
|
25
25
|
* @param {THREE.Material} materialIn - Material to be set for the lines.
|
|
26
26
|
* @param {Object} options - Provide various options
|
|
@@ -35,7 +35,7 @@ const Pointset = function () {
|
|
|
35
35
|
const texture = getCircularTexture();
|
|
36
36
|
materialIn.map = texture;
|
|
37
37
|
let point = new Points(geometry, materialIn);
|
|
38
|
-
this.setMesh(point, options.localTimeEnabled,
|
|
38
|
+
this.setMesh(point, options.localTimeEnabled,
|
|
39
39
|
options.localMorphColour);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -78,7 +78,7 @@ const Pointset = function () {
|
|
|
78
78
|
}
|
|
79
79
|
let end = current + coords.length;
|
|
80
80
|
let index = 0;
|
|
81
|
-
if ((Array.isArray(labels) && labels.length === coords.length) ||
|
|
81
|
+
if ((Array.isArray(labels) && labels.length === coords.length) ||
|
|
82
82
|
(typeof labels === "string")) {
|
|
83
83
|
for (current; current + index < end;) {
|
|
84
84
|
const labelText = typeof labels === "string" ? labels : labels[index];
|
|
@@ -90,9 +90,40 @@ const Pointset = function () {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Set the colour of the pointset and its label using the hex value
|
|
95
|
+
*
|
|
96
|
+
* @param {Number} hex - hex value of color to be set
|
|
97
|
+
*/
|
|
98
|
+
this.setColourHex = function(hex) {
|
|
99
|
+
this._lod._material.color.setHex(hex);
|
|
100
|
+
if (this._lod._secondaryMaterial) {
|
|
101
|
+
this._lod._secondaryMaterial.color.setHex(hex);
|
|
102
|
+
}
|
|
103
|
+
for (let i = 0; i < labelSets.length; i++) {
|
|
104
|
+
if (labelSets[i]) {
|
|
105
|
+
labelSets[i].setColour(this._lod._material.color);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Set the colour of the pointset and its label
|
|
112
|
+
*
|
|
113
|
+
* @param {THREE.Color} colour - colour to be set
|
|
114
|
+
*/
|
|
115
|
+
this.setColour = (colour) => {
|
|
116
|
+
this._lod.setColour(colour);
|
|
117
|
+
for (let i = 0; i < labelSets.length; i++) {
|
|
118
|
+
if (labelSets[i]) {
|
|
119
|
+
labelSets[i].setColour(this._lod._material.color);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
93
124
|
/**
|
|
94
125
|
* Set the size of the points.
|
|
95
|
-
*
|
|
126
|
+
*
|
|
96
127
|
* @param {Number} size - size to be set.
|
|
97
128
|
*/
|
|
98
129
|
this.setSize = size => {
|
|
@@ -104,7 +135,7 @@ const Pointset = function () {
|
|
|
104
135
|
|
|
105
136
|
/**
|
|
106
137
|
* Turn size attenuation on/off based on the flag.
|
|
107
|
-
*
|
|
138
|
+
*
|
|
108
139
|
* @param {Boolean} flag - Determin either size attenuation
|
|
109
140
|
* should be on or off.
|
|
110
141
|
*/
|
|
@@ -121,7 +152,7 @@ const Pointset = function () {
|
|
|
121
152
|
this.getVerticesByIndex = function(index) {
|
|
122
153
|
if (index >= 0 && this.drawRange > index) {
|
|
123
154
|
const positionAttribute = this.getMorph().geometry.getAttribute( 'position' );
|
|
124
|
-
return [
|
|
155
|
+
return [
|
|
125
156
|
positionAttribute.getX(index),
|
|
126
157
|
positionAttribute.getY(index),
|
|
127
158
|
positionAttribute.getZ(index)
|
|
@@ -148,7 +179,7 @@ const Pointset = function () {
|
|
|
148
179
|
label.setPosition(coord[0], coord[1], coord[2]);
|
|
149
180
|
}
|
|
150
181
|
positionAttribute.setXYZ(index++, coord[0], coord[1], coord[2]);
|
|
151
|
-
|
|
182
|
+
|
|
152
183
|
});
|
|
153
184
|
positionAttribute.needsUpdate = true;
|
|
154
185
|
this.boundingBoxUpdateRequired = true;
|
|
@@ -158,7 +189,7 @@ const Pointset = function () {
|
|
|
158
189
|
|
|
159
190
|
/**
|
|
160
191
|
* Turn size attenuation on/off based on the flag.
|
|
161
|
-
*
|
|
192
|
+
*
|
|
162
193
|
* @param {Boolean} flag - Determin either size attenuation
|
|
163
194
|
* should be on or off.
|
|
164
195
|
*/
|
|
@@ -2,7 +2,7 @@ const THREE = require('three');
|
|
|
2
2
|
const resolveURL = require('../utilities').resolveURL;
|
|
3
3
|
/**
|
|
4
4
|
* Provides a base class object which stores textures and rendering object.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @class
|
|
7
7
|
* @author Alan Wu
|
|
8
8
|
* @return {TexturePrimitive}
|
|
@@ -14,7 +14,7 @@ const TexturePrimitive = function (textureIn) {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Load texture data into this primitves.
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* @param {Object} textureData - contains the informations about the textures.
|
|
19
19
|
* @param {Function} finishCallback - User's function to be called once texture's
|
|
20
20
|
* is loaded.
|
|
@@ -39,7 +39,7 @@ const TexturePrimitive = function (textureIn) {
|
|
|
39
39
|
/**
|
|
40
40
|
* Initialise a texture based on the provided textureData, this should be used
|
|
41
41
|
* internally only.
|
|
42
|
-
*
|
|
42
|
+
*
|
|
43
43
|
* @param {Object} textureData - contains the informations about the textures.
|
|
44
44
|
* @param {Function} finishCallback - User's function to be called once texture's
|
|
45
45
|
* is loaded.
|
|
@@ -3,10 +3,10 @@ const shader = require("../shaders/textureSlide.js");
|
|
|
3
3
|
/**
|
|
4
4
|
* Provides a class which create a texture stacks in a block
|
|
5
5
|
* with shaders allowing slices of texture to be displayed.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* @param {TextureArray} textureIn - An object of texture array
|
|
8
8
|
* holding texture information.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* @class
|
|
11
11
|
* @author Alan Wu
|
|
12
12
|
* @return {TextureSlides}
|
|
@@ -29,13 +29,13 @@ const TextureSlides = function (textureIn) {
|
|
|
29
29
|
direction the slide should be facing.
|
|
30
30
|
@property {Number} value - Normalised value of the location on direction.
|
|
31
31
|
@property {String} id - ID of the mesh, it is only available if the settings
|
|
32
|
-
is returned from {@link TextureSlides.createSlide} or
|
|
32
|
+
is returned from {@link TextureSlides.createSlide} or
|
|
33
33
|
{@link TextureSlides.getTextureSettings}.
|
|
34
34
|
*/
|
|
35
35
|
/**
|
|
36
36
|
* Create the slides required for visualisation based on the slide settings.
|
|
37
37
|
* The slides themselves are {THREE.PlanGeometry} objects.
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* @param {SLIDE_SETTINGS} slideSettings - An array to each slide settings.
|
|
40
40
|
*/
|
|
41
41
|
this.createSlides = slideSettings => {
|
|
@@ -114,7 +114,7 @@ const TextureSlides = function (textureIn) {
|
|
|
114
114
|
uniforms.diffuse.value = this.texture.impl;
|
|
115
115
|
uniforms.depth.value = this.texture.size.depth;
|
|
116
116
|
uniforms.flipY.value = flipY;
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
const options = {
|
|
119
119
|
fs: shader.fs,
|
|
120
120
|
vs: shader.vs,
|
|
@@ -259,7 +259,7 @@ const TextureSlides = function (textureIn) {
|
|
|
259
259
|
* Get the bounding box of this slides.
|
|
260
260
|
* It uses the max and min of the slides position and the
|
|
261
261
|
* transformation to calculate the position of the box.
|
|
262
|
-
*
|
|
262
|
+
*
|
|
263
263
|
* @return {THREE.Box3}.
|
|
264
264
|
*/
|
|
265
265
|
this.getBoundingBox = () => {
|
|
@@ -101,7 +101,7 @@ const TubeLines = function () {
|
|
|
101
101
|
if (smooth) {
|
|
102
102
|
const curve = new THREE.CatmullRomCurve3(vertices);
|
|
103
103
|
finalGeometry = new THREE.TubeGeometry(curve, vertices.length, radius, radialSegments, false);
|
|
104
|
-
} else {
|
|
104
|
+
} else {
|
|
105
105
|
const geometries = [];
|
|
106
106
|
for (let i = 0; i + 1 < vertices.length; i = i + 2) {
|
|
107
107
|
const curve = new THREE.LineCurve3(vertices[i], vertices[i+1]);
|
package/src/sceneLoader.js
CHANGED
|
@@ -10,7 +10,7 @@ const PrimitivesLoader = require('./loaders/primitivesLoader').PrimitivesLoader;
|
|
|
10
10
|
/**
|
|
11
11
|
* A helper class to help with reading / importing primitives and
|
|
12
12
|
* settings into a {@link Scene}.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
14
|
* @class
|
|
15
15
|
* @param {Object} containerIn - Container to create the renderer on.
|
|
16
16
|
* @author Alan Wu
|
|
@@ -27,7 +27,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
27
27
|
* This function returns a three component array, which contains
|
|
28
28
|
* [totalsize, totalLoaded and errorDownload] of all the downloads happening
|
|
29
29
|
* in this scene.
|
|
30
|
-
* @returns {Array}
|
|
30
|
+
* @returns {Array}
|
|
31
31
|
*/
|
|
32
32
|
this.getDownloadProgress = () => {
|
|
33
33
|
let totalSize = 0;
|
|
@@ -134,7 +134,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
134
134
|
/**
|
|
135
135
|
* Load a legacy model(s) format with the provided URLs and parameters. This only loads the geometry
|
|
136
136
|
* without any of the metadata. Therefore, extra parameters should be provided.
|
|
137
|
-
*
|
|
137
|
+
*
|
|
138
138
|
* @deprecated
|
|
139
139
|
*/
|
|
140
140
|
this.loadModelsURL = (region, urls, colours, opacities, timeEnabled, morphColour, finishCallback) => {
|
|
@@ -160,10 +160,10 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
* Load a legacy file format containing the viewport and its meta file from an external
|
|
163
|
+
* Load a legacy file format containing the viewport and its meta file from an external
|
|
164
164
|
* location provided by the url. Use the new metadata format with
|
|
165
165
|
* {@link Zinc.SceneLoader.#loadMetadataURL} instead.
|
|
166
|
-
*
|
|
166
|
+
*
|
|
167
167
|
* @param {String} URL - address to the file containing viewport and model information.
|
|
168
168
|
* @deprecated
|
|
169
169
|
*/
|
|
@@ -223,11 +223,11 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
223
223
|
if (finishCallback != undefined && (typeof finishCallback == 'function'))
|
|
224
224
|
finishCallback(newLines);
|
|
225
225
|
};
|
|
226
|
-
}
|
|
226
|
+
}
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
229
|
* Load lines into this scene object.
|
|
230
|
-
*
|
|
230
|
+
*
|
|
231
231
|
* @param {Boolean} timeEnabled - Indicate if morphing is enabled.
|
|
232
232
|
* @param {Boolean} morphColour - Indicate if color morphing is enabled.
|
|
233
233
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
@@ -251,7 +251,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
251
251
|
(linesloader(region, localTimeEnabled, localMorphColour, groupName, anatomicalId,
|
|
252
252
|
renderOrder, options.lod, tubeLines, finishCallback))( object.geometry, object.materials );
|
|
253
253
|
} else {
|
|
254
|
-
primitivesLoader.load(url, linesloader(region, localTimeEnabled, localMorphColour, groupName,
|
|
254
|
+
primitivesLoader.load(url, linesloader(region, localTimeEnabled, localMorphColour, groupName,
|
|
255
255
|
anatomicalId, renderOrder, options.lod, tubeLines, finishCallback), this.onProgress(url), this.onError(finishCallback),
|
|
256
256
|
options.loaderOptions);
|
|
257
257
|
}
|
|
@@ -326,8 +326,8 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* Read a STL file into this scene, the geometry will be presented as
|
|
329
|
-
* {@link Zinc.Geometry}.
|
|
330
|
-
*
|
|
329
|
+
* {@link Zinc.Geometry}.
|
|
330
|
+
*
|
|
331
331
|
* @param {STRING} url - location to the STL file.
|
|
332
332
|
* @param {STRING} groupName - name to assign the geometry's groupname to.
|
|
333
333
|
* @param {Function} finishCallback - Callback function which will be called
|
|
@@ -345,8 +345,8 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
345
345
|
|
|
346
346
|
/**
|
|
347
347
|
* Read a OBJ file into this scene, the geometry will be presented as
|
|
348
|
-
* {@link Zinc.Geometry}.
|
|
349
|
-
*
|
|
348
|
+
* {@link Zinc.Geometry}.
|
|
349
|
+
*
|
|
350
350
|
* @param {STRING} url - location to the STL file.
|
|
351
351
|
* @param {STRING} groupName - name to assign the geometry's groupname to.
|
|
352
352
|
* @param {Function} finishCallback - Callback function which will be called
|
|
@@ -363,10 +363,10 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
* Load a geometry into this scene, this is a subsequent called from
|
|
366
|
+
* Load a geometry into this scene, this is a subsequent called from
|
|
367
367
|
* {@link Zinc.Scene#loadMetadataURL}, although it can be used to read
|
|
368
368
|
* in geometry into the scene externally.
|
|
369
|
-
*
|
|
369
|
+
*
|
|
370
370
|
* @param {String} url - regular json model file providing geometry.
|
|
371
371
|
* @param {Boolean} timeEnabled - Indicate if geometry morphing is enabled.
|
|
372
372
|
* @param {Boolean} morphColour - Indicate if color morphing is enabled.
|
|
@@ -432,14 +432,14 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
432
432
|
if (zincCameraControls) {
|
|
433
433
|
zincCameraControls.calculateMaxAllowedDistance(scene);
|
|
434
434
|
}
|
|
435
|
-
}
|
|
435
|
+
}
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
438
|
};
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
441
|
* Load a pointset into this scene object.
|
|
442
|
-
*
|
|
442
|
+
*
|
|
443
443
|
* @param {Boolean} timeEnabled - Indicate if morphing is enabled.
|
|
444
444
|
* @param {Boolean} morphColour - Indicate if color morphing is enabled.
|
|
445
445
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
@@ -487,6 +487,8 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
487
487
|
if (newTexture) {
|
|
488
488
|
newTexture.groupName = groupName;
|
|
489
489
|
let myCallback = () => {
|
|
490
|
+
//Add zincObject after it has sort out all the required download
|
|
491
|
+
region.addZincObject(newTexture);
|
|
490
492
|
--this.toBeDownloaded;
|
|
491
493
|
if (finishCallback != undefined && (typeof finishCallback == 'function'))
|
|
492
494
|
finishCallback(newTexture);
|
|
@@ -495,7 +497,6 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
495
497
|
newTexture.load(textureData, myCallback, isInline);
|
|
496
498
|
newTexture.setAnatomicalId(anatomicalId);
|
|
497
499
|
newTexture.setRenderOrder(renderOrder);
|
|
498
|
-
region.addZincObject(newTexture);
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
502
|
};
|
|
@@ -513,7 +514,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
513
514
|
|
|
514
515
|
/**
|
|
515
516
|
* Load a texture into this scene object.
|
|
516
|
-
*
|
|
517
|
+
*
|
|
517
518
|
* @param {STRING} groupName - name to assign the pointset's groupname to.
|
|
518
519
|
* @param {Function} finishCallback - Callback function which will be called
|
|
519
520
|
* once the glyphset is succssfully load in.
|
|
@@ -533,8 +534,8 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
533
534
|
|
|
534
535
|
/**
|
|
535
536
|
* Load a glyphset into this scene object.
|
|
536
|
-
*
|
|
537
|
-
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
537
|
+
*
|
|
538
|
+
* @param {String} metaurl - Provide informations such as transformations, colours
|
|
538
539
|
* and others for each of the glyph in the glyphsset.
|
|
539
540
|
* @param {String} glyphurl - regular json model file providing geometry of the glyph.
|
|
540
541
|
* @param {String} groupName - name to assign the glyphset's groupname to.
|
|
@@ -556,7 +557,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
556
557
|
|
|
557
558
|
/**
|
|
558
559
|
* Add a user provided {THREE.Geometry} into the scene as zinc geometry.
|
|
559
|
-
*
|
|
560
|
+
*
|
|
560
561
|
* @param {Three.Geometry} geometry - The threejs geometry to be added as {@link Zinc.Geometry}.
|
|
561
562
|
* @param {THREE.Color} color - Colour to be assigned to this geometry, overrided if materialIn is provided.
|
|
562
563
|
* @param {Number} opacity - Opacity to be set for this geometry, overrided if materialIn is provided.
|
|
@@ -565,7 +566,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
565
566
|
* @param {Boolean} external - Set this to true if morph geometry is present, overrided if materialIn is provided.
|
|
566
567
|
* @param {Function} finishCallback - Callback once the geometry has been added succssfully.
|
|
567
568
|
* @param {THREE.Material} materialIn - Material to be set for this geometry if it is present.
|
|
568
|
-
*
|
|
569
|
+
*
|
|
569
570
|
* @returns {Zinc.Geometry}
|
|
570
571
|
*/
|
|
571
572
|
const addZincGeometry = (
|
|
@@ -621,7 +622,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
621
622
|
if (materials && materials[0]) {
|
|
622
623
|
material = materials[0];
|
|
623
624
|
}
|
|
624
|
-
const zincGeometry = addZincGeometry(region, geometry, colour, opacity,
|
|
625
|
+
const zincGeometry = addZincGeometry(region, geometry, colour, opacity,
|
|
625
626
|
localTimeEnabled, localMorphColour, undefined, material, groupName, renderOrder, anatomicalId);
|
|
626
627
|
if (options.lod && options.lod.levels) {
|
|
627
628
|
for (const [key, value] of Object.entries(options.lod.levels)) {
|
|
@@ -639,7 +640,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
639
640
|
//Turn ISO 8601 duration string into an array.
|
|
640
641
|
const parseDuration = (durationString) => {
|
|
641
642
|
const regex = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
|
642
|
-
const [, years, months, weeks, days, hours, mins, secs] =
|
|
643
|
+
const [, years, months, weeks, days, hours, mins, secs] =
|
|
643
644
|
durationString.match(regex);
|
|
644
645
|
return {years: years,months: months, weeks: weeks, days: days,
|
|
645
646
|
hours: hours, mins: mins, secs: secs };
|
|
@@ -708,7 +709,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
708
709
|
lod: lod,
|
|
709
710
|
renderOrder: order
|
|
710
711
|
};
|
|
711
|
-
|
|
712
|
+
|
|
712
713
|
switch (item.Type) {
|
|
713
714
|
case "Surfaces":
|
|
714
715
|
loadSurfaceURL(region, newURL, item.MorphVertices, item.MorphColours, groupName, finishCallback, options);
|
|
@@ -776,7 +777,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
776
777
|
|
|
777
778
|
/**
|
|
778
779
|
* Load GLTF into this scene object.
|
|
779
|
-
*
|
|
780
|
+
*
|
|
780
781
|
* @param {String} url - URL to the GLTF file
|
|
781
782
|
* @param {Function} finishCallback - Callback function which will be called
|
|
782
783
|
* once the glyphset is succssfully load in.
|
|
@@ -879,7 +880,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
879
880
|
}
|
|
880
881
|
|
|
881
882
|
let getNumberOfObjectsInRegions = (regionJson) => {
|
|
882
|
-
let counts = regionJson.Primitives ?
|
|
883
|
+
let counts = regionJson.Primitives ?
|
|
883
884
|
getNumberOfDownloadsInArray(regionJson.Primitives, false) : 0;
|
|
884
885
|
if (regionJson.Children) {
|
|
885
886
|
Object.values(regionJson.Children).forEach(childRegion => {
|
|
@@ -936,7 +937,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
936
937
|
/**
|
|
937
938
|
* Load a metadata file from the provided URL into this scene. Once
|
|
938
939
|
* succssful scene proceeds to read each items into scene for visualisations.
|
|
939
|
-
*
|
|
940
|
+
*
|
|
940
941
|
* @param {String} url - Location of the metadata file
|
|
941
942
|
* @param {Function} finishCallback - Callback function which will be called
|
|
942
943
|
* @param {options} Optional settings, it can be used to ignore some regions/groups
|