zincjs 1.13.2 → 1.14.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.
- package/build/zinc.frontend.js +1 -1
- package/build/zinc.js +17 -8
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/zincObject.js +40 -0
- package/src/sceneLoader.js +10 -8
package/package.json
CHANGED
|
@@ -61,6 +61,9 @@ const ZincObject = function() {
|
|
|
61
61
|
//Draw range is only used by primitives added
|
|
62
62
|
//programatically with addVertices function
|
|
63
63
|
this.drawRange = -1;
|
|
64
|
+
//Default value of colour
|
|
65
|
+
this.origColour = undefined;
|
|
66
|
+
this.origVertexColors = false;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
/**
|
|
@@ -195,6 +198,16 @@ ZincObject.prototype.setMesh = function(mesh, localTimeEnabled, localMorphColour
|
|
|
195
198
|
this.boundingBoxUpdateRequired = true;
|
|
196
199
|
}
|
|
197
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Set the name for this ZincObject.
|
|
203
|
+
*
|
|
204
|
+
* @param {String} anatomicalId - Id to be set.
|
|
205
|
+
*/
|
|
206
|
+
ZincObject.prototype.setAnatomicalId = function(anatomicalId) {
|
|
207
|
+
this.anatomicalId = anatomicalId;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
198
211
|
/**
|
|
199
212
|
* Set the name for this ZincObject.
|
|
200
213
|
*
|
|
@@ -352,6 +365,33 @@ ZincObject.prototype.setColour = function(colour) {
|
|
|
352
365
|
this._lod.setColour(colour);
|
|
353
366
|
}
|
|
354
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Set the colour of the mesh.
|
|
370
|
+
*
|
|
371
|
+
* @param {THREE.Color} colour - Colour to be set for this geometry.
|
|
372
|
+
*/
|
|
373
|
+
ZincObject.prototype.setGreyScale = function(flag) {
|
|
374
|
+
if (flag) {
|
|
375
|
+
if (!this.origColour) {
|
|
376
|
+
if (this._lod._material) {
|
|
377
|
+
this.origColour = this._lod._material.color;
|
|
378
|
+
this.origVertexColors = this._lod._material.vertexColors;
|
|
379
|
+
this._lod.setVertexColors(false);
|
|
380
|
+
this._lod.setColour(new THREE.Color().setHex( 0xBBBBBB ));
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
} else {
|
|
385
|
+
if (this.origColour) {
|
|
386
|
+
this._lod.setColour(this.origColour);
|
|
387
|
+
this._lod.setVertexColors(this.origVertexColors);
|
|
388
|
+
this.origColour = undefined;
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
|
|
355
395
|
/**
|
|
356
396
|
* Get the colour of the mesh in hex string form.
|
|
357
397
|
*
|
package/src/sceneLoader.js
CHANGED
|
@@ -208,7 +208,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
208
208
|
if (newLines) {
|
|
209
209
|
newLines.createLineSegment(geometry, material, options);
|
|
210
210
|
newLines.setName(groupName);
|
|
211
|
-
newLines.anatomicalId
|
|
211
|
+
newLines.setAnatomicalId(anatomicalId);
|
|
212
212
|
newLines.setRenderOrder(renderOrder);
|
|
213
213
|
region.addZincObject(newLines);
|
|
214
214
|
newLines.setDuration(scene.getDuration());
|
|
@@ -276,7 +276,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
276
276
|
else {
|
|
277
277
|
newGlyphset.load(glyphsetData, resolveURL(glyphurl), myCallback, isInline, displayLabels);
|
|
278
278
|
}
|
|
279
|
-
newGlyphset.anatomicalId
|
|
279
|
+
newGlyphset.setAnatomicalId(anatomicalId);
|
|
280
280
|
newGlyphset.setRenderOrder(renderOrder);
|
|
281
281
|
region.addZincObject(newGlyphset);
|
|
282
282
|
};
|
|
@@ -311,7 +311,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
311
311
|
if (newPointset) {
|
|
312
312
|
newPointset.createMesh(geometry, material, options);
|
|
313
313
|
newPointset.setName(groupName);
|
|
314
|
-
newPointset.anatomicalId
|
|
314
|
+
newPointset.setAnatomicalId(anatomicalId);
|
|
315
315
|
region.addZincObject(newPointset);
|
|
316
316
|
newPointset.setDuration(scene.getDuration());
|
|
317
317
|
newPointset.setRenderOrder(renderOrder);
|
|
@@ -492,7 +492,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
492
492
|
}
|
|
493
493
|
++this.toBeDownloaded;
|
|
494
494
|
newTexture.load(textureData, myCallback, isInline);
|
|
495
|
-
newTexture.anatomicalId
|
|
495
|
+
newTexture.setAnatomicalId(anatomicalId);
|
|
496
496
|
newTexture.setRenderOrder(renderOrder);
|
|
497
497
|
region.addZincObject(newTexture);
|
|
498
498
|
}
|
|
@@ -576,7 +576,9 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
576
576
|
localMorphColour,
|
|
577
577
|
finishCallback,
|
|
578
578
|
materialIn,
|
|
579
|
-
groupName
|
|
579
|
+
groupName,
|
|
580
|
+
renderOrder,
|
|
581
|
+
anatomicalId
|
|
580
582
|
) => {
|
|
581
583
|
let options = {};
|
|
582
584
|
options.colour = colour;
|
|
@@ -587,6 +589,8 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
587
589
|
newGeometry.createMesh(geometryIn, materialIn, options);
|
|
588
590
|
if (newGeometry.getMorph()) {
|
|
589
591
|
newGeometry.setName(groupName);
|
|
592
|
+
newGeometry.setRenderOrder(renderOrder);
|
|
593
|
+
newGeometry.setAnatomicalId(anatomicalId);
|
|
590
594
|
if (region) region.addZincObject(newGeometry);
|
|
591
595
|
newGeometry.setDuration(scene.getDuration());
|
|
592
596
|
if (finishCallback != undefined && (typeof finishCallback == 'function'))
|
|
@@ -617,9 +621,7 @@ exports.SceneLoader = function (sceneIn) {
|
|
|
617
621
|
material = materials[0];
|
|
618
622
|
}
|
|
619
623
|
const zincGeometry = addZincGeometry(region, geometry, colour, opacity,
|
|
620
|
-
localTimeEnabled, localMorphColour, undefined, material, groupName, renderOrder);
|
|
621
|
-
zincGeometry.anatomicalId = anatomicalId;
|
|
622
|
-
zincGeometry.setRenderOrder(renderOrder);
|
|
624
|
+
localTimeEnabled, localMorphColour, undefined, material, groupName, renderOrder, anatomicalId);
|
|
623
625
|
if (options.lod && options.lod.levels) {
|
|
624
626
|
for (const [key, value] of Object.entries(options.lod.levels)) {
|
|
625
627
|
zincGeometry.addLOD(primitivesLoader, key, value.URL, value.Index, options.lod.preload);
|