@kitware/vtk.js 21.1.5 → 21.3.0

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.
Files changed (48) hide show
  1. package/Common/Transform/LandmarkTransform.d.ts +1 -1
  2. package/Filters/General/ImageCropFilter.js +3 -4
  3. package/Filters/Sources/Arrow2DSource.d.ts +14 -13
  4. package/Filters/Sources/ArrowSource.d.ts +9 -8
  5. package/Filters/Sources/CircleSource.d.ts +15 -14
  6. package/Filters/Sources/ConeSource.d.ts +18 -17
  7. package/Filters/Sources/CubeSource.d.ts +19 -19
  8. package/Filters/Sources/Cursor3D.d.ts +19 -16
  9. package/Filters/Sources/CylinderSource.d.ts +15 -14
  10. package/Filters/Sources/LineSource.d.ts +1 -1
  11. package/Filters/Sources/PlaneSource.d.ts +29 -28
  12. package/Filters/Sources/PointSource.d.ts +9 -8
  13. package/Filters/Sources/SphereSource.d.ts +9 -8
  14. package/IO/Geometry/STLReader.js +2 -2
  15. package/Rendering/Core/AbstractMapper.js +1 -0
  16. package/Rendering/Core/Actor2D.js +1 -3
  17. package/Rendering/Core/Light.d.ts +277 -234
  18. package/Rendering/Core/Mapper2D.d.ts +402 -0
  19. package/Rendering/Core/Mapper2D.js +213 -0
  20. package/Rendering/Core/Property.d.ts +43 -43
  21. package/Rendering/Core/Property2D/Constants.js +9 -0
  22. package/Rendering/Core/Property2D.d.ts +21 -5
  23. package/Rendering/Core/Property2D.js +30 -2
  24. package/Rendering/Core/RenderWindowInteractor.js +7 -7
  25. package/Rendering/Core/Volume.d.ts +9 -0
  26. package/Rendering/Core.js +2 -0
  27. package/Rendering/OpenGL/Actor2D.js +74 -30
  28. package/Rendering/OpenGL/ForwardPass.js +11 -0
  29. package/Rendering/OpenGL/ImageMapper.js +1 -1
  30. package/Rendering/OpenGL/PolyDataMapper.js +8 -19
  31. package/Rendering/OpenGL/PolyDataMapper2D.js +667 -0
  32. package/Rendering/OpenGL/Profiles/All.js +1 -0
  33. package/Rendering/OpenGL/Profiles/Geometry.js +1 -0
  34. package/Rendering/OpenGL/RenderWindow.js +190 -106
  35. package/Rendering/OpenGL/ShaderProgram.js +0 -12
  36. package/Rendering/OpenGL/glsl/vtkPolyData2DFS.glsl.js +3 -0
  37. package/Rendering/OpenGL/glsl/vtkPolyData2DVS.glsl.js +3 -0
  38. package/Rendering/OpenGL.js +2 -0
  39. package/Rendering/Profiles/All.js +1 -0
  40. package/Rendering/Profiles/Geometry.js +1 -0
  41. package/_virtual/rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js +17 -0
  42. package/_virtual/rollup-plugin-web-worker-loader__helper__funcToSource.js +18 -0
  43. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +698 -2
  44. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +274 -2
  45. package/interfaces.d.ts +66 -24
  46. package/package.json +1 -1
  47. package/types.d.ts +4 -1
  48. package/_virtual/rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +0 -31
@@ -1,5 +1,5 @@
1
1
  import { vtkObject } from '@kitware/vtk.js/interfaces';
2
- import { Color } from '@kitware/vtk.js/types';
2
+ import { RGBColor } from '@kitware/vtk.js/types';
3
3
 
4
4
  export enum Shading {
5
5
  FLAT,
@@ -19,12 +19,12 @@ export enum Interpolation {
19
19
  PHONG,
20
20
  }
21
21
 
22
- interface IPropertyValues {
23
- color?: Color;
24
- ambientColor?: Color;
25
- diffuseColor?: Color;
26
- specularColor?: Color;
27
- edgeColor?: Color;
22
+ export interface IPropertyInitialValues {
23
+ color?: RGBColor;
24
+ ambientColor?: RGBColor;
25
+ diffuseColor?: RGBColor;
26
+ specularColor?: RGBColor;
27
+ edgeColor?: RGBColor;
28
28
  ambient?: number;
29
29
  diffuse?: number;
30
30
  specular?: number;
@@ -63,14 +63,14 @@ export interface vtkProperty extends vtkObject {
63
63
  * and diffuse colors. From a physical standpoint it really doesn't make too
64
64
  * much sense to have both. For the rendering libraries that don't support
65
65
  * both, the diffuse color is used.
66
- * @return {Color} Array of RGB color.
66
+ * @return {RGBColor} Array of RGB color.
67
67
  */
68
- getAmbientColor(): Color;
68
+ getAmbientColor(): RGBColor;
69
69
 
70
70
  /**
71
- *
71
+ * Get the ambient surface color.
72
72
  */
73
- getAmbientColorByReference(): Color;
73
+ getAmbientColorByReference(): RGBColor;
74
74
 
75
75
  /**
76
76
  *
@@ -80,7 +80,7 @@ export interface vtkProperty extends vtkObject {
80
80
  /**
81
81
  * Get the color of the object.the color of the object
82
82
  */
83
- getColor(): Color;
83
+ getColor(): RGBColor;
84
84
 
85
85
  /**
86
86
  * Get the diffuse lighting coefficient.
@@ -90,23 +90,23 @@ export interface vtkProperty extends vtkObject {
90
90
 
91
91
  /**
92
92
  * Get the diffuse surface color.
93
- * @return {Color} Array of RGB color.
93
+ * @return {RGBColor} Array of RGB color.
94
94
  */
95
- getDiffuseColor(): Color;
95
+ getDiffuseColor(): RGBColor;
96
96
  /**
97
97
  *
98
98
  */
99
- getDiffuseColorByReference(): Color;
99
+ getDiffuseColorByReference(): RGBColor;
100
100
 
101
101
  /**
102
102
  *
103
103
  */
104
- getEdgeColor(): Color;
104
+ getEdgeColor(): RGBColor;
105
105
 
106
106
  /**
107
107
  *
108
108
  */
109
- getEdgeColorByReference(): Color;
109
+ getEdgeColorByReference(): RGBColor;
110
110
 
111
111
  /**
112
112
  *
@@ -180,14 +180,14 @@ export interface vtkProperty extends vtkObject {
180
180
 
181
181
  /**
182
182
  * Get the specular surface color.
183
- * @return {Color} Array of RGB color.
183
+ * @return {RGBColor} Array of RGB color.
184
184
  */
185
- getSpecularColor(): Color;
185
+ getSpecularColor(): RGBColor;
186
186
 
187
187
  /**
188
- *
188
+ * Get the specular surface color.
189
189
  */
190
- getSpecularColorByReference(): Color;
190
+ getSpecularColorByReference(): RGBColor;
191
191
 
192
192
  /**
193
193
  * Get the specular power.
@@ -218,15 +218,15 @@ export interface vtkProperty extends vtkObject {
218
218
  * ambient and diffuse colors. From a physical standpoint it really
219
219
  * doesn't make too much sense to have both. For the rendering
220
220
  * libraries that don’t support both, the diffuse color is used.
221
- * @param {Color} ambientColor An Array of the RGB color.
221
+ * @param {RGBColor} ambientColor An Array of the RGB color.
222
222
  */
223
- setAmbientColor(ambientColor: Color): boolean;
223
+ setAmbientColor(ambientColor: RGBColor): boolean;
224
224
 
225
225
  /**
226
226
  * Set the ambient surface color from an RGB array
227
- * @param {Color} ambientColor An Array of the RGB color.
227
+ * @param {RGBColor} ambientColor An Array of the RGB color.
228
228
  */
229
- setAmbientColorFrom(ambientColor: Color): boolean;
229
+ setAmbientColorFrom(ambientColor: RGBColor): boolean;
230
230
 
231
231
  /**
232
232
  * Turn on/off fast culling of polygons based on orientation of normal
@@ -250,9 +250,9 @@ export interface vtkProperty extends vtkObject {
250
250
  * Set the color of the object. Has the side effect of setting the
251
251
  * ambient diffuse and specular colors as well. This is basically
252
252
  * a quick overall color setting method.
253
- * @param {Color} color An Array of the RGB color.
253
+ * @param {RGBColor} color An Array of the RGB color.
254
254
  */
255
- setColor(color: Color): boolean;
255
+ setColor(color: RGBColor): boolean;
256
256
 
257
257
  /**
258
258
  * Set the diffuse lighting coefficient.
@@ -270,15 +270,15 @@ export interface vtkProperty extends vtkObject {
270
270
 
271
271
  /**
272
272
  * Set the diffuse surface color.
273
- * @param {Color} diffuseColor An Array of the RGB color.
273
+ * @param {RGBColor} diffuseColor An Array of the RGB color.
274
274
  */
275
- setDiffuseColor(diffuseColor: Color): boolean;
275
+ setDiffuseColor(diffuseColor: RGBColor): boolean;
276
276
 
277
277
  /**
278
278
  * Set the diffuse surface color from an RGB array
279
- * @param {Color} diffuseColor An Array of the RGB color.
279
+ * @param {RGBColor} diffuseColor An Array of the RGB color.
280
280
  */
281
- setDiffuseColorFrom(diffuseColor: Color): boolean;
281
+ setDiffuseColorFrom(diffuseColor: RGBColor): boolean;
282
282
 
283
283
  /**
284
284
  * Set the color of primitive edges (if edge visibility is enabled).
@@ -290,15 +290,15 @@ export interface vtkProperty extends vtkObject {
290
290
 
291
291
  /**
292
292
  * Set the color of primitive edges (if edge visibility is enabled).
293
- * @param {Color} edgeColor An Array of the RGB color.
293
+ * @param {RGBColor} edgeColor An Array of the RGB color.
294
294
  */
295
- setEdgeColor(edgeColor: Color): boolean;
295
+ setEdgeColor(edgeColor: RGBColor): boolean;
296
296
 
297
297
  /**
298
298
  * Set the color of primitive edges from an RGB array.
299
- * @param {Color} edgeColor An Array of the RGB color.
299
+ * @param {RGBColor} edgeColor An Array of the RGB color.
300
300
  */
301
- setEdgeColorFrom(edgeColor: Color): boolean;
301
+ setEdgeColorFrom(edgeColor: RGBColor): boolean;
302
302
 
303
303
  /**
304
304
  * Turn on/off the visibility of edges. On some renderers it is
@@ -412,15 +412,15 @@ export interface vtkProperty extends vtkObject {
412
412
 
413
413
  /**
414
414
  * Set the specular surface color from an RGB array
415
- * @param {Color} specularColor An Array of the RGB color.
415
+ * @param {RGBColor} specularColor An Array of the RGB color.
416
416
  */
417
- setSpecularColor(specularColor: Color): boolean;
417
+ setSpecularColor(specularColor: RGBColor): boolean;
418
418
 
419
419
  /**
420
420
  * Set the specular surface color from an RGB array
421
- * @param {Color} specularColor An Array of the RGB color.
421
+ * @param {RGBColor} specularColor An Array of the RGB color.
422
422
  */
423
- setSpecularColorFrom(specularColor: Color): boolean;
423
+ setSpecularColorFrom(specularColor: RGBColor): boolean;
424
424
 
425
425
  /**
426
426
  * Set the specular power.
@@ -434,18 +434,18 @@ export interface vtkProperty extends vtkObject {
434
434
  *
435
435
  * @param publicAPI object on which methods will be bounds (public)
436
436
  * @param model object on which data structure will be bounds (protected)
437
- * @param {IPropertyValues} [initialValues] (default: {})
437
+ * @param {IPropertyInitialValues} [initialValues] (default: {})
438
438
  */
439
- export function extend(publicAPI: object, model: object, initialValues?: IPropertyValues): void;
439
+ export function extend(publicAPI: object, model: object, initialValues?: IPropertyInitialValues): void;
440
440
 
441
441
  /**
442
442
  * Method use to create a new instance of vtkProperty with object color, ambient color, diffuse color,
443
443
  * specular color, and edge color white; ambient coefficient=0; diffuse
444
444
  * coefficient=0; specular coefficient=0; specular power=1; Gouraud shading;
445
445
  * and surface representation. Backface and frontface culling are off.
446
- * @param {IPropertyValues} [initialValues] for pre-setting some of its content
446
+ * @param {IPropertyInitialValues} [initialValues] for pre-setting some of its content
447
447
  */
448
- export function newInstance(initialValues?: IPropertyValues): vtkProperty;
448
+ export function newInstance(initialValues?: IPropertyInitialValues): vtkProperty;
449
449
 
450
450
  /**
451
451
  * vtkProperty is an object that represents lighting and other surface
@@ -0,0 +1,9 @@
1
+ var DisplayLocation = {
2
+ BACKGROUND: 0,
3
+ FOREGROUND: 1
4
+ };
5
+ var Constants = {
6
+ DisplayLocation: DisplayLocation
7
+ };
8
+
9
+ export { DisplayLocation, Constants as default };
@@ -1,8 +1,8 @@
1
1
  import { vtkObject } from '@kitware/vtk.js/interfaces';
2
- import { Color } from '@kitware/vtk.js/types';
2
+ import { RGBColor } from '@kitware/vtk.js/types';
3
3
 
4
4
  interface IProperty2DInitialValues{
5
- color?: number[];
5
+ color?: RGBColor;
6
6
  opacity?: number;
7
7
  pointSize?: number;
8
8
  lineWidth?: number;
@@ -14,12 +14,12 @@ export interface vtkProperty2D extends vtkObject {
14
14
  /**
15
15
  * Get the color of the object.
16
16
  */
17
- getColor(): Color;
17
+ getColor(): RGBColor;
18
18
 
19
19
  /**
20
20
  * Get the color of the object.
21
21
  */
22
- getColorByReference(): Color;
22
+ getColorByReference(): RGBColor;
23
23
 
24
24
  /**
25
25
  * Get the display location of the object.
@@ -54,6 +54,14 @@ export interface vtkProperty2D extends vtkObject {
54
54
  */
55
55
  setColor(r: number, g: number, b: number): boolean;
56
56
 
57
+ /**
58
+ * Set the color of the object. Has the side effect of setting the
59
+ * ambient diffuse and specular colors as well. This is basically
60
+ * a quick overall color setting method.
61
+ * @param {RGBColor} color Defines the RGB color array..
62
+ */
63
+ setColor(color: RGBColor): boolean;
64
+
57
65
  /**
58
66
  * Set the color of the object. Has the side effect of setting the
59
67
  * ambient diffuse and specular colors as well. This is basically
@@ -62,7 +70,15 @@ export interface vtkProperty2D extends vtkObject {
62
70
  * @param {Number} g Defines the green component (between 0 and 1).
63
71
  * @param {Number} b Defines the blue component (between 0 and 1).
64
72
  */
65
- setColorFrom(color: number[]): boolean;
73
+ setColorFrom(r: number, g: number, b: number): boolean;
74
+
75
+ /**
76
+ * Set the color of the object. Has the side effect of setting the
77
+ * ambient diffuse and specular colors as well. This is basically
78
+ * a quick overall color setting method.
79
+ * @param {RGBColor} color Defines the RGB color array..
80
+ */
81
+ setColorFrom(color: RGBColor): boolean;
66
82
 
67
83
  /**
68
84
  * Set the display location of the object.
@@ -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
- displayLocation: 'Foreground'
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);
@@ -325,7 +325,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
325
325
 
326
326
  animationRequesters.add(requestor);
327
327
 
328
- if (animationRequesters.size === 1) {
328
+ if (animationRequesters.size === 1 && !model.xrAnimation) {
329
329
  model.lastFrameTime = 0.1;
330
330
  model.lastFrameStart = Date.now();
331
331
  model.animationRequest = requestAnimationFrame(publicAPI.handleAnimation);
@@ -334,7 +334,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
334
334
  };
335
335
 
336
336
  publicAPI.isAnimating = function () {
337
- return model.vrAnimation || model.animationRequest !== null;
337
+ return model.xrAnimation || model.animationRequest !== null;
338
338
  };
339
339
 
340
340
  publicAPI.cancelAnimation = function (requestor) {
@@ -359,18 +359,18 @@ function vtkRenderWindowInteractor(publicAPI, model) {
359
359
  }
360
360
  };
361
361
 
362
- publicAPI.switchToVRAnimation = function () {
362
+ publicAPI.switchToXRAnimation = function () {
363
363
  // cancel existing animation if any
364
364
  if (model.animationRequest) {
365
365
  cancelAnimationFrame(model.animationRequest);
366
366
  model.animationRequest = null;
367
367
  }
368
368
 
369
- model.vrAnimation = true;
369
+ model.xrAnimation = true;
370
370
  };
371
371
 
372
- publicAPI.returnFromVRAnimation = function () {
373
- model.vrAnimation = false;
372
+ publicAPI.returnFromXRAnimation = function () {
373
+ model.xrAnimation = false;
374
374
 
375
375
  if (animationRequesters.size !== 0) {
376
376
  model.FrameTime = -1;
@@ -723,7 +723,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
723
723
 
724
724
 
725
725
  publicAPI.render = function () {
726
- if (model.animationRequest === null && !model.inRender) {
726
+ if (!publicAPI.isAnimating() && !model.inRender) {
727
727
  forceRender();
728
728
  }
729
729
  }; // create the generic Event methods
@@ -121,6 +121,15 @@ export function newInstance(initialValues?: IVolumeInitialValues): vtkVolume;
121
121
  *
122
122
  * @example
123
123
  * ```js
124
+ * // Load the rendering pieces we want to use (for both WebGL and WebGPU)
125
+ * import 'vtk.js/Sources/Rendering/Profiles/Volume';
126
+ *
127
+ * import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
128
+ * import vtkHttpDataSetReader from '@kitware/vtk.js/IO/Core/HttpDataSetReader';
129
+ *
130
+ * import vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume';
131
+ * import vtkVolumeMapper from '@kitware/vtk.js/Rendering/Core/VolumeMapper';
132
+
124
133
  * const vol = vtkVolume.newInstance();
125
134
  * const mapper = vtkVolumeMapper.newInstance();
126
135
  * mapper.setSampleDistance(2.0);
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.children.forEach(function (child) {
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.children.forEach(function (child) {
51
- if (!child.isA('vtkOpenGLTexture')) {
52
- child.traverse(renderPass);
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
- if (child.getHandle()) {
66
- model.activeTextures.push(child);
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.forEach(function (child) {
80
- child.deactivate();
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
- // deactivate textures
92
- model.activeTextures.forEach(function (child) {
93
- child.deactivate();
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
  }; // ----------------------------------------------------------------------------
@@ -396,7 +396,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
396
396
  }
397
397
 
398
398
  cellBO.getProgram().setUniformi('numClipPlanes', numClipPlanes);
399
- cellBO.getProgram().setUniform4fv('clipPlanes', 6, planeEquations);
399
+ cellBO.getProgram().setUniform4fv('clipPlanes', planeEquations);
400
400
  }
401
401
  };
402
402