zincjs 1.12.2 → 1.12.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zincjs",
3
- "version": "1.12.2",
3
+ "version": "1.12.4",
4
4
  "description": "ZincJS (Web-based-Zinc-Visualisation)",
5
5
  "main": "build/zinc.js",
6
6
  "directories": {
@@ -19,6 +19,7 @@ const TextureSlides = function (textureIn) {
19
19
  this.morph = new THREE.Group();
20
20
  this.group = this.morph;
21
21
  this.morph.userData = this;
22
+ let edgesLine = undefined;
22
23
  let flipY = true;
23
24
 
24
25
  /**
@@ -59,7 +60,7 @@ const TextureSlides = function (textureIn) {
59
60
  mesh.position.z = 0;
60
61
  switch (settings.direction) {
61
62
  case "x":
62
- const rotation = flipY ? -Math.PI / 2 : Math.PI / 2;
63
+ const rotation = -Math.PI / 2;
63
64
  mesh.rotation.y = rotation;
64
65
  uniforms.direction.value = 1;
65
66
  uniforms.slide.value.set(settings.value, 0, 0);
@@ -225,30 +226,32 @@ const TextureSlides = function (textureIn) {
225
226
 
226
227
  //Expand the boundingbox with slide settings
227
228
  const expandBoxWithSettings = (box, settings, vector) => {
228
- switch (settings.direction.value) {
229
- case 1:
230
- vector.copy(settings.slide.value);
231
- box.expandByPoint(vector);
232
- vector.setY(1.0);
233
- vector.setZ(1.0);
234
- box.expandByPoint(vector);
235
- break;
236
- case 2:
237
- vector.copy(settings.slide.value);
238
- box.expandByPoint(vector);
239
- vector.setX(1.0);
240
- vector.setZ(1.0);
241
- box.expandByPoint(vector);
242
- break;
243
- case 3:
244
- vector.copy(settings.slide.value);
245
- box.expandByPoint(vector);
246
- vector.setX(1.0);
247
- vector.setY(1.0);
248
- box.expandByPoint(vector);
249
- break;
250
- default:
251
- break;
229
+ if (settings) {
230
+ switch (settings.direction.value) {
231
+ case 1:
232
+ vector.copy(settings.slide.value);
233
+ box.expandByPoint(vector);
234
+ vector.setY(1.0);
235
+ vector.setZ(1.0);
236
+ box.expandByPoint(vector);
237
+ break;
238
+ case 2:
239
+ vector.copy(settings.slide.value);
240
+ box.expandByPoint(vector);
241
+ vector.setX(1.0);
242
+ vector.setZ(1.0);
243
+ box.expandByPoint(vector);
244
+ break;
245
+ case 3:
246
+ vector.copy(settings.slide.value);
247
+ box.expandByPoint(vector);
248
+ vector.setX(1.0);
249
+ vector.setY(1.0);
250
+ box.expandByPoint(vector);
251
+ break;
252
+ default:
253
+ break;
254
+ }
252
255
  }
253
256
  }
254
257
 
@@ -303,9 +306,13 @@ const TextureSlides = function (textureIn) {
303
306
  this.boundingBoxUpdateRequired = true;
304
307
  }
305
308
 
309
+ this.setRenderOrder = (order) => {
310
+ //multiilayers
311
+ this.morph.renderOrder = order;
312
+ }
313
+
306
314
  this.initialise = (textureData, finishCallback) => {
307
315
  if (textureData) {
308
-
309
316
  const locations = textureData.locations;
310
317
  if (locations && locations.length > 0) {
311
318
  this.applyTransformation(locations[0].orientation,
@@ -320,6 +327,25 @@ const TextureSlides = function (textureIn) {
320
327
  }
321
328
  }
322
329
  }
330
+
331
+ this.showEdges = (color) => {
332
+ if (!edgesLine) {
333
+ const geometry = new THREE.BoxGeometry( 1, 1, 1 );
334
+ geometry.translate(0.5, 0.5, 0.5);
335
+ const edges = new THREE.EdgesGeometry( geometry );
336
+ edgesLine = new THREE.LineSegments(edges, new THREE.LineBasicMaterial( { color } ) );
337
+ this.group.add( edgesLine );
338
+ } else {
339
+ edgesLine.material.color = color;
340
+ }
341
+ edgesLine.visible = true;
342
+ }
343
+
344
+ this.hideEdges = () => {
345
+ if (edgesLine) {
346
+ edgesLine.visible = false;
347
+ }
348
+ }
323
349
  }
324
350
 
325
351
  TextureSlides.prototype = Object.create((require('./texturePrimitive').TexturePrimitive).prototype);
@@ -9,6 +9,7 @@ precision highp int;
9
9
  precision highp sampler2DArray;
10
10
 
11
11
  uniform sampler2DArray diffuse;
12
+ uniform bool discardAlpha;
12
13
  in vec3 vUw;
13
14
 
14
15
  out vec4 outColor;
@@ -18,7 +19,9 @@ void main() {
18
19
  vec4 color = texture( diffuse, vUw );
19
20
 
20
21
  // lighten a bit
21
- outColor = vec4( color.rgb + .2, 1.0 );
22
+ if (discardAlpha && color.a == 0.0) discard;
23
+
24
+ outColor = vec4( color.rgba );
22
25
 
23
26
  }
24
27
  `;
@@ -58,6 +61,7 @@ const getUniforms = function() {
58
61
  slide: { value: new THREE.Vector3( 0, 0, 1 ) },
59
62
  direction: {value: 1},
60
63
  flipY: { value: true},
64
+ discardAlpha: {value: true},
61
65
  };
62
66
  }
63
67
 
@@ -78,8 +78,9 @@ const TextureArray = function () {
78
78
  if (options) {
79
79
  if (options.vs && options.fs) {
80
80
  let transparent = true;
81
- if (options.transparent)
81
+ if ("transparent" in options) {
82
82
  transparent = options.transparent;
83
+ }
83
84
  let side = THREE.FrontSide;
84
85
  if (options.side)
85
86
  side = options.side;