@kitware/vtk.js 21.2.0 → 21.3.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/Filters/General/ImageCropFilter.js +3 -4
- package/IO/Geometry/STLReader.js +2 -2
- package/Rendering/Core/Actor2D.js +1 -3
- package/Rendering/Core/Mapper2D.d.ts +402 -0
- package/Rendering/Core/Mapper2D.js +213 -0
- package/Rendering/Core/Property2D/Constants.js +9 -0
- package/Rendering/Core/Property2D.js +30 -2
- package/Rendering/Core.js +2 -0
- package/Rendering/OpenGL/Actor2D.js +74 -30
- package/Rendering/OpenGL/ForwardPass.js +11 -0
- package/Rendering/OpenGL/PolyDataMapper.js +3 -2
- package/Rendering/OpenGL/PolyDataMapper2D.js +667 -0
- package/Rendering/OpenGL/Profiles/All.js +1 -0
- package/Rendering/OpenGL/Profiles/Geometry.js +1 -0
- package/Rendering/OpenGL/glsl/vtkPolyData2DFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkPolyData2DVS.glsl.js +3 -0
- package/Rendering/OpenGL.js +2 -0
- package/Rendering/Profiles/All.js +1 -0
- package/Rendering/Profiles/Geometry.js +1 -0
- package/_virtual/rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js +17 -0
- package/_virtual/rollup-plugin-web-worker-loader__helper__funcToSource.js +18 -0
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +698 -2
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +274 -2
- package/macros.js +6 -2
- package/package.json +1 -1
- package/_virtual/rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +0 -31
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
|
+
import Constants from './Property2D/Constants.js';
|
|
3
|
+
import { Representation } from './Property/Constants.js';
|
|
2
4
|
|
|
5
|
+
var DisplayLocation = Constants.DisplayLocation; // ----------------------------------------------------------------------------
|
|
3
6
|
// vtkProperty2D methods
|
|
4
7
|
// ----------------------------------------------------------------------------
|
|
5
8
|
|
|
6
9
|
function vtkProperty2D(publicAPI, model) {
|
|
7
10
|
// Set our className
|
|
8
11
|
model.classHierarchy.push('vtkProperty2D');
|
|
12
|
+
|
|
13
|
+
publicAPI.setDisplayLocationToBackground = function () {
|
|
14
|
+
return publicAPI.setDisplayLocation(DisplayLocation.BACKGROUND);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
publicAPI.setDisplayLocationToForeground = function () {
|
|
18
|
+
return publicAPI.setDisplayLocation(DisplayLocation.FOREGROUND);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
publicAPI.setRepresentationToWireframe = function () {
|
|
22
|
+
return publicAPI.setRepresentation(Representation.WIREFRAME);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
publicAPI.setRepresentationToSurface = function () {
|
|
26
|
+
return publicAPI.setRepresentation(Representation.SURFACE);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
publicAPI.setRepresentationToPoints = function () {
|
|
30
|
+
return publicAPI.setRepresentation(Representation.POINTS);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
publicAPI.getRepresentationAsString = function () {
|
|
34
|
+
return macro.enumToString(Representation, model.representation);
|
|
35
|
+
};
|
|
9
36
|
} // ----------------------------------------------------------------------------
|
|
10
37
|
// Object factory
|
|
11
38
|
// ----------------------------------------------------------------------------
|
|
@@ -16,7 +43,8 @@ var DEFAULT_VALUES = {
|
|
|
16
43
|
opacity: 1,
|
|
17
44
|
pointSize: 1,
|
|
18
45
|
lineWidth: 1,
|
|
19
|
-
|
|
46
|
+
representation: Representation.SURFACE,
|
|
47
|
+
displayLocation: DisplayLocation.FOREGROUND
|
|
20
48
|
}; // ----------------------------------------------------------------------------
|
|
21
49
|
|
|
22
50
|
function extend(publicAPI, model) {
|
|
@@ -24,7 +52,7 @@ function extend(publicAPI, model) {
|
|
|
24
52
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
25
53
|
|
|
26
54
|
macro.obj(publicAPI, model);
|
|
27
|
-
macro.setGet(publicAPI, model, ['opacity', 'lineWidth', 'pointSize', 'displayLocation']);
|
|
55
|
+
macro.setGet(publicAPI, model, ['opacity', 'lineWidth', 'pointSize', 'displayLocation', 'representation']);
|
|
28
56
|
macro.setGetArray(publicAPI, model, ['color'], 3); // Object methods
|
|
29
57
|
|
|
30
58
|
vtkProperty2D(publicAPI, model);
|
package/Rendering/Core.js
CHANGED
|
@@ -22,6 +22,7 @@ import vtkInteractorObserver from './Core/InteractorObserver.js';
|
|
|
22
22
|
import vtkInteractorStyle from './Core/InteractorStyle.js';
|
|
23
23
|
import vtkLight from './Core/Light.js';
|
|
24
24
|
import vtkMapper from './Core/Mapper.js';
|
|
25
|
+
import vtkMapper2D from './Core/Mapper2D.js';
|
|
25
26
|
import vtkPicker from './Core/Picker.js';
|
|
26
27
|
import vtkPixelSpaceCallbackMapper from './Core/PixelSpaceCallbackMapper.js';
|
|
27
28
|
import vtkPointPicker from './Core/PointPicker.js';
|
|
@@ -70,6 +71,7 @@ var Core = {
|
|
|
70
71
|
vtkInteractorStyle: vtkInteractorStyle,
|
|
71
72
|
vtkLight: vtkLight,
|
|
72
73
|
vtkMapper: vtkMapper,
|
|
74
|
+
vtkMapper2D: vtkMapper2D,
|
|
73
75
|
vtkPicker: vtkPicker,
|
|
74
76
|
vtkPixelSpaceCallbackMapper: vtkPixelSpaceCallbackMapper,
|
|
75
77
|
vtkPointPicker: vtkPointPicker,
|
|
@@ -21,52 +21,85 @@ function vtkOpenGLActor2D(publicAPI, model) {
|
|
|
21
21
|
publicAPI.prepareNodes();
|
|
22
22
|
publicAPI.addMissingNodes(model.renderable.getTextures());
|
|
23
23
|
publicAPI.addMissingNode(model.renderable.getMapper());
|
|
24
|
-
publicAPI.removeUnusedNodes();
|
|
24
|
+
publicAPI.removeUnusedNodes(); // we store textures and mapper
|
|
25
|
+
|
|
26
|
+
model.ogltextures = null;
|
|
27
|
+
model.activeTextures = null;
|
|
28
|
+
|
|
29
|
+
for (var index = 0; index < model.children.length; index++) {
|
|
30
|
+
var child = model.children[index];
|
|
31
|
+
|
|
32
|
+
if (child.isA('vtkOpenGLTexture')) {
|
|
33
|
+
if (!model.ogltextures) {
|
|
34
|
+
model.ogltextures = [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
model.ogltextures.push(child);
|
|
38
|
+
} else {
|
|
39
|
+
model.oglmapper = child;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
publicAPI.queryPass = function (prepass, renderPass) {
|
|
46
|
+
if (prepass) {
|
|
47
|
+
if (!model.renderable || !model.renderable.getVisibility()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
renderPass.incrementOverlayActorCount();
|
|
25
52
|
}
|
|
26
53
|
}; // we draw textures, then mapper, then post pass textures
|
|
27
54
|
|
|
28
55
|
|
|
29
56
|
publicAPI.traverseOpaquePass = function (renderPass) {
|
|
30
|
-
if (!model.renderable || !model.renderable.getNestedVisibility() || !model.renderable.getIsOpaque() || model.openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
57
|
+
if (!model.oglmapper || !model.renderable || !model.renderable.getNestedVisibility() || !model.renderable.getIsOpaque() || model.openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
31
58
|
return;
|
|
32
59
|
}
|
|
33
60
|
|
|
34
61
|
publicAPI.apply(renderPass, true);
|
|
35
|
-
model.
|
|
36
|
-
if (!child.isA('vtkOpenGLTexture')) {
|
|
37
|
-
child.traverse(renderPass);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
62
|
+
model.oglmapper.traverse(renderPass);
|
|
40
63
|
publicAPI.apply(renderPass, false);
|
|
41
64
|
}; // we draw textures, then mapper, then post pass textures
|
|
42
65
|
|
|
43
66
|
|
|
44
67
|
publicAPI.traverseTranslucentPass = function (renderPass) {
|
|
45
|
-
if (!model.renderable || !model.renderable.getNestedVisibility() || model.renderable.getIsOpaque() || model.openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
68
|
+
if (!model.oglmapper || !model.renderable || !model.renderable.getNestedVisibility() || model.renderable.getIsOpaque() || model.openGLRenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
46
69
|
return;
|
|
47
70
|
}
|
|
48
71
|
|
|
49
72
|
publicAPI.apply(renderPass, true);
|
|
50
|
-
model.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
model.oglmapper.traverse(renderPass);
|
|
74
|
+
publicAPI.apply(renderPass, false);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
publicAPI.traverseOverlayPass = function (renderPass) {
|
|
78
|
+
if (!model.oglmapper || !model.renderable || !model.renderable.getNestedVisibility() || model.openGLRenderer.getSelector() && !model.renderable.getNestedPickable) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
publicAPI.apply(renderPass, true);
|
|
83
|
+
model.oglmapper.traverse(renderPass);
|
|
55
84
|
publicAPI.apply(renderPass, false);
|
|
56
85
|
};
|
|
57
86
|
|
|
58
87
|
publicAPI.activateTextures = function () {
|
|
59
88
|
// always traverse textures first, then mapper
|
|
89
|
+
if (!model.ogltextures) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
60
93
|
model.activeTextures = [];
|
|
61
|
-
model.children.forEach(function (child) {
|
|
62
|
-
if (child.isA('vtkOpenGLTexture')) {
|
|
63
|
-
child.render();
|
|
64
94
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
for (var index = 0; index < model.ogltextures.length; index++) {
|
|
96
|
+
var child = model.ogltextures[index];
|
|
97
|
+
child.render();
|
|
98
|
+
|
|
99
|
+
if (child.getHandle()) {
|
|
100
|
+
model.activeTextures.push(child);
|
|
68
101
|
}
|
|
69
|
-
}
|
|
102
|
+
}
|
|
70
103
|
}; // Renders myself
|
|
71
104
|
|
|
72
105
|
|
|
@@ -74,11 +107,11 @@ function vtkOpenGLActor2D(publicAPI, model) {
|
|
|
74
107
|
if (prepass) {
|
|
75
108
|
model.context.depthMask(true);
|
|
76
109
|
publicAPI.activateTextures();
|
|
77
|
-
} else {
|
|
110
|
+
} else if (model.activeTextures) {
|
|
78
111
|
// deactivate textures
|
|
79
|
-
model.activeTextures.
|
|
80
|
-
|
|
81
|
-
}
|
|
112
|
+
for (var index = 0; index < model.activeTextures.length; index++) {
|
|
113
|
+
model.activeTextures[index].deactivate();
|
|
114
|
+
}
|
|
82
115
|
}
|
|
83
116
|
}; // Renders myself
|
|
84
117
|
|
|
@@ -87,12 +120,23 @@ function vtkOpenGLActor2D(publicAPI, model) {
|
|
|
87
120
|
if (prepass) {
|
|
88
121
|
model.context.depthMask(false);
|
|
89
122
|
publicAPI.activateTextures();
|
|
90
|
-
} else {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
} else if (model.activeTextures) {
|
|
124
|
+
for (var index = 0; index < model.activeTextures.length; index++) {
|
|
125
|
+
model.activeTextures[index].deactivate();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}; // Renders myself
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
publicAPI.overlayPass = function (prepass, renderPass) {
|
|
132
|
+
if (prepass) {
|
|
95
133
|
model.context.depthMask(true);
|
|
134
|
+
publicAPI.activateTextures();
|
|
135
|
+
} else if (model.activeTextures) {
|
|
136
|
+
// deactivate textures
|
|
137
|
+
for (var index = 0; index < model.activeTextures.length; index++) {
|
|
138
|
+
model.activeTextures[index].deactivate();
|
|
139
|
+
}
|
|
96
140
|
}
|
|
97
141
|
};
|
|
98
142
|
} // ----------------------------------------------------------------------------
|
|
@@ -102,7 +146,7 @@ function vtkOpenGLActor2D(publicAPI, model) {
|
|
|
102
146
|
|
|
103
147
|
var DEFAULT_VALUES = {
|
|
104
148
|
context: null,
|
|
105
|
-
activeTextures:
|
|
149
|
+
activeTextures: null
|
|
106
150
|
}; // ----------------------------------------------------------------------------
|
|
107
151
|
|
|
108
152
|
function extend(publicAPI, model) {
|
|
@@ -35,6 +35,7 @@ function vtkForwardPass(publicAPI, model) {
|
|
|
35
35
|
model.opaqueActorCount = 0;
|
|
36
36
|
model.translucentActorCount = 0;
|
|
37
37
|
model.volumeCount = 0;
|
|
38
|
+
model.overlayActorCount = 0;
|
|
38
39
|
publicAPI.setCurrentOperation('queryPass');
|
|
39
40
|
renNode.traverse(publicAPI); // do we need to capture a zbuffer?
|
|
40
41
|
|
|
@@ -79,6 +80,11 @@ function vtkForwardPass(publicAPI, model) {
|
|
|
79
80
|
publicAPI.setCurrentOperation('volumePass');
|
|
80
81
|
renNode.traverse(publicAPI);
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
if (model.overlayActorCount > 0) {
|
|
85
|
+
publicAPI.setCurrentOperation('overlayPass');
|
|
86
|
+
renNode.traverse(publicAPI);
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
@@ -107,6 +113,10 @@ function vtkForwardPass(publicAPI, model) {
|
|
|
107
113
|
publicAPI.incrementVolumeCount = function () {
|
|
108
114
|
return model.volumeCount++;
|
|
109
115
|
};
|
|
116
|
+
|
|
117
|
+
publicAPI.incrementOverlayActorCount = function () {
|
|
118
|
+
return model.overlayActorCount++;
|
|
119
|
+
};
|
|
110
120
|
} // ----------------------------------------------------------------------------
|
|
111
121
|
// Object factory
|
|
112
122
|
// ----------------------------------------------------------------------------
|
|
@@ -116,6 +126,7 @@ var DEFAULT_VALUES = {
|
|
|
116
126
|
opaqueActorCount: 0,
|
|
117
127
|
translucentActorCount: 0,
|
|
118
128
|
volumeCount: 0,
|
|
129
|
+
overlayActorCount: 0,
|
|
119
130
|
framebuffer: null,
|
|
120
131
|
depthRequested: false
|
|
121
132
|
}; // ----------------------------------------------------------------------------
|
|
@@ -1269,9 +1269,10 @@ var newInstance = newInstance$1(extend, 'vtkOpenGLPolyDataMapper'); // ---------
|
|
|
1269
1269
|
|
|
1270
1270
|
var vtkOpenGLPolyDataMapper$1 = {
|
|
1271
1271
|
newInstance: newInstance,
|
|
1272
|
-
extend: extend
|
|
1272
|
+
extend: extend,
|
|
1273
|
+
primTypes: primTypes
|
|
1273
1274
|
}; // Register ourself to OpenGL backend if imported
|
|
1274
1275
|
|
|
1275
1276
|
registerOverride('vtkMapper', newInstance);
|
|
1276
1277
|
|
|
1277
|
-
export { vtkOpenGLPolyDataMapper$1 as default, extend, newInstance };
|
|
1278
|
+
export { vtkOpenGLPolyDataMapper$1 as default, extend, newInstance, primTypes };
|