@kitware/vtk.js 20.4.0 → 20.4.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/README.md CHANGED
@@ -48,8 +48,8 @@ In general VTK tries to be as portable as possible; the specific configurations
48
48
 
49
49
  vtk.js supports the following development environments:
50
50
 
51
- - Node 12+
52
- - NPM 6+
51
+ - Node 14+
52
+ - NPM 7+
53
53
 
54
54
  and we use [@babel/preset-env](https://www.npmjs.com/package/@babel/preset-env) with the [defaults](https://github.com/Kitware/vtk-js/blob/master/.browserslistrc) set of [browsers target](https://browserl.ist/?q=defaults).
55
55
  But when built from source this could be adjusted to support any browser as long they provide WebGL.
@@ -1,6 +1,6 @@
1
1
  import macro from '../../macros.js';
2
2
 
3
- var DEFAULT_VIEW_API = navigator.gpu ? 'WebGPU' : 'WebGL';
3
+ var DEFAULT_VIEW_API = 'WebGL';
4
4
  var VIEW_CONSTRUCTORS = Object.create(null); // ----------------------------------------------------------------------------
5
5
  // static methods
6
6
  // ----------------------------------------------------------------------------
@@ -109,7 +109,7 @@ function vtkOpenGLActor(publicAPI, model) {
109
109
 
110
110
  publicAPI.opaquePass = function (prepass, renderPass) {
111
111
  if (prepass) {
112
- model.openGLRenderWindow.enableDepthMask();
112
+ model.context.depthMask(true);
113
113
  publicAPI.activateTextures();
114
114
  } else if (model.activeTextures) {
115
115
  for (var index = 0; index < model.activeTextures.length; index++) {
@@ -121,7 +121,7 @@ function vtkOpenGLActor(publicAPI, model) {
121
121
 
122
122
  publicAPI.translucentPass = function (prepass, renderPass) {
123
123
  if (prepass) {
124
- model.openGLRenderWindow.disableDepthMask();
124
+ model.context.depthMask(false);
125
125
  publicAPI.activateTextures();
126
126
  } else if (model.activeTextures) {
127
127
  for (var index = 0; index < model.activeTextures.length; index++) {
@@ -15,7 +15,9 @@ function vtkOpenGLActor2D(publicAPI, model) {
15
15
  return;
16
16
  }
17
17
 
18
+ model.openGLRenderWindow = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow');
18
19
  model.openGLRenderer = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderer');
20
+ model.context = model.openGLRenderWindow.getContext();
19
21
  publicAPI.prepareNodes();
20
22
  publicAPI.addMissingNodes(model.renderable.getTextures());
21
23
  publicAPI.addMissingNode(model.renderable.getMapper());
@@ -70,7 +72,6 @@ function vtkOpenGLActor2D(publicAPI, model) {
70
72
 
71
73
  publicAPI.opaquePass = function (prepass, renderPass) {
72
74
  if (prepass) {
73
- model.context = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow').getContext();
74
75
  model.context.depthMask(true);
75
76
  publicAPI.activateTextures();
76
77
  } else {
@@ -84,7 +85,6 @@ function vtkOpenGLActor2D(publicAPI, model) {
84
85
 
85
86
  publicAPI.translucentPass = function (prepass, renderPass) {
86
87
  if (prepass) {
87
- model.context = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow').getContext();
88
88
  model.context.depthMask(false);
89
89
  publicAPI.activateTextures();
90
90
  } else {
@@ -20,7 +20,9 @@ function vtkOpenGLImageSlice(publicAPI, model) {
20
20
  return;
21
21
  }
22
22
 
23
+ model.openGLRenderWindow = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow');
23
24
  model.openGLRenderer = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderer');
25
+ model.context = model.openGLRenderWindow.getContext();
24
26
  publicAPI.prepareNodes();
25
27
  publicAPI.addMissingNode(model.renderable.getMapper());
26
28
  publicAPI.removeUnusedNodes();
@@ -78,19 +80,13 @@ function vtkOpenGLImageSlice(publicAPI, model) {
78
80
 
79
81
  publicAPI.opaquePass = function (prepass, renderPass) {
80
82
  if (prepass) {
81
- model.context = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow').getContext();
82
83
  model.context.depthMask(true);
83
84
  }
84
85
  }; // Renders myself
85
86
 
86
87
 
87
88
  publicAPI.translucentPass = function (prepass, renderPass) {
88
- if (prepass) {
89
- model.context = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow').getContext();
90
- model.context.depthMask(false);
91
- } else {
92
- model.context.depthMask(true);
93
- }
89
+ model.context.depthMask(!prepass);
94
90
  };
95
91
 
96
92
  publicAPI.getKeyMatrices = function () {
@@ -273,16 +273,6 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
273
273
  */
274
274
  traverseAllPasses(): void;
275
275
 
276
- /**
277
- *
278
- */
279
- disableDepthMask(): void;
280
-
281
- /**
282
- *
283
- */
284
- enableDepthMask(): void;
285
-
286
276
  /**
287
277
  *
288
278
  */
@@ -621,20 +621,6 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
621
621
  }
622
622
  };
623
623
 
624
- publicAPI.disableDepthMask = function () {
625
- if (model.depthMaskEnabled) {
626
- model.context.depthMask(false);
627
- model.depthMaskEnabled = false;
628
- }
629
- };
630
-
631
- publicAPI.enableDepthMask = function () {
632
- if (!model.depthMaskEnabled) {
633
- model.context.depthMask(true);
634
- model.depthMaskEnabled = true;
635
- }
636
- };
637
-
638
624
  publicAPI.disableCullFace = function () {
639
625
  if (model.cullFaceEnabled) {
640
626
  model.context.disable(model.context.CULL_FACE);
@@ -688,7 +674,6 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
688
674
 
689
675
  var DEFAULT_VALUES = {
690
676
  cullFaceEnabled: false,
691
- depthMaskEnabled: true,
692
677
  shaderCache: null,
693
678
  initialized: false,
694
679
  context: null,
@@ -57,7 +57,7 @@ function vtkOpenGLRenderer(publicAPI, model) {
57
57
  if (!model.renderable.getPreserveDepthBuffer()) {
58
58
  gl.clearDepth(1.0);
59
59
  clearMask |= gl.DEPTH_BUFFER_BIT;
60
- gl.depthMask(true);
60
+ model.context.depthMask(true);
61
61
  }
62
62
 
63
63
  var ts = publicAPI.getTiledSizeAndOrigin();
@@ -135,7 +135,7 @@ function vtkOpenGLRenderer(publicAPI, model) {
135
135
  if (!model.renderable.getPreserveDepthBuffer()) {
136
136
  gl.clearDepth(1.0);
137
137
  clearMask |= gl.DEPTH_BUFFER_BIT;
138
- gl.depthMask(true);
138
+ model.context.depthMask(true);
139
139
  }
140
140
 
141
141
  gl.colorMask(true, true, true, true);
@@ -40,7 +40,7 @@ function vtkOpenGLSkybox(publicAPI, model) {
40
40
  publicAPI.opaquePass = function (prepass, renderPass) {
41
41
  if (prepass && !model.openGLRenderer.getSelector()) {
42
42
  publicAPI.updateBufferObjects();
43
- model.openGLRenderWindow.enableDepthMask();
43
+ model.context.depthMask(true);
44
44
  model.openGLRenderWindow.getShaderCache().readyShaderProgram(model.tris.getProgram());
45
45
  model.openGLTexture.render(model.openGLRenderWindow);
46
46
  var texUnit = model.openGLTexture.getTextureUnit();
@@ -16,7 +16,9 @@ function vtkOpenGLVolume(publicAPI, model) {
16
16
  }
17
17
 
18
18
  if (prepass) {
19
+ model.openGLRenderWindow = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow');
19
20
  model.openGLRenderer = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderer');
21
+ model.context = model.openGLRenderWindow.getContext();
20
22
  publicAPI.prepareNodes();
21
23
  publicAPI.addMissingNode(model.renderable.getMapper());
22
24
  publicAPI.removeUnusedNodes();
@@ -49,12 +51,7 @@ function vtkOpenGLVolume(publicAPI, model) {
49
51
  return;
50
52
  }
51
53
 
52
- if (prepass) {
53
- model.context = publicAPI.getFirstAncestorOfType('vtkOpenGLRenderWindow').getContext();
54
- model.context.depthMask(false);
55
- } else {
56
- model.context.depthMask(true);
57
- }
54
+ model.context.depthMask(!prepass);
58
55
  };
59
56
 
60
57
  publicAPI.getKeyMatrices = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "20.4.0",
3
+ "version": "20.4.2",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",