@kitware/vtk.js 33.0.0-beta.3 → 33.0.0-beta.5

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 (41) hide show
  1. package/BREAKING_CHANGES.md +2 -0
  2. package/Common/Core/DataArray.d.ts +17 -0
  3. package/Common/Core/DataArray.js +36 -0
  4. package/Rendering/Core/AbstractImageMapper.d.ts +81 -0
  5. package/Rendering/Core/AbstractImageMapper.js +5 -2
  6. package/Rendering/Core/AbstractPicker.d.ts +13 -13
  7. package/Rendering/Core/AbstractPicker.js +1 -1
  8. package/Rendering/Core/Actor2D.d.ts +22 -0
  9. package/Rendering/Core/Actor2D.js +1 -1
  10. package/Rendering/Core/CellPicker.js +4 -1
  11. package/Rendering/Core/ImageCPRMapper.js +5 -4
  12. package/Rendering/Core/ImageProperty.d.ts +20 -1
  13. package/Rendering/Core/ImageProperty.js +7 -5
  14. package/Rendering/Core/ImageResliceMapper.d.ts +1 -2
  15. package/Rendering/Core/ImageResliceMapper.js +5 -4
  16. package/Rendering/Core/Viewport.js +13 -3
  17. package/Rendering/Core/VolumeMapper.d.ts +70 -0
  18. package/Rendering/Core/VolumeMapper.js +10 -5
  19. package/Rendering/Core/VolumeProperty.d.ts +20 -1
  20. package/Rendering/Core/VolumeProperty.js +7 -5
  21. package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +2 -2
  22. package/Rendering/OpenGL/Framebuffer.js +7 -1
  23. package/Rendering/OpenGL/ImageCPRMapper.js +59 -7
  24. package/Rendering/OpenGL/ImageMapper.js +71 -9
  25. package/Rendering/OpenGL/ImageResliceMapper.js +60 -9
  26. package/Rendering/OpenGL/OrderIndependentTranslucentPass.js +20 -3
  27. package/Rendering/OpenGL/PolyDataMapper.js +7 -1
  28. package/Rendering/OpenGL/Renderer.js +1 -1
  29. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +7 -1
  30. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +20 -3
  31. package/Rendering/OpenGL/Texture.d.ts +131 -62
  32. package/Rendering/OpenGL/Texture.js +287 -48
  33. package/Rendering/OpenGL/VolumeMapper.js +70 -10
  34. package/Rendering/SceneGraph/ViewNode.js +12 -2
  35. package/Rendering/WebXR/RenderWindowHelper.js +9 -0
  36. package/Widgets/Core/WidgetManager.d.ts +12 -1
  37. package/Widgets/Representations/WidgetRepresentation.d.ts +1 -7
  38. package/Widgets/Widgets3D/ResliceCursorWidget.d.ts +1 -8
  39. package/macros.js +1 -1
  40. package/macros2.js +7 -2
  41. package/package.json +11 -11
@@ -105,13 +105,23 @@ function vtkViewNode(publicAPI, model) {
105
105
 
106
106
  // add missing nodes/children for the passed in renderables. This should
107
107
  // be called only in between prepareNodes and removeUnusedNodes
108
- publicAPI.addMissingNodes = dataObjs => {
108
+ publicAPI.addMissingNodes = function (dataObjs) {
109
+ let enforceOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
109
110
  if (!dataObjs || !dataObjs.length) {
110
111
  return;
111
112
  }
112
113
  for (let index = 0; index < dataObjs.length; ++index) {
113
114
  const dobj = dataObjs[index];
114
- publicAPI.addMissingNode(dobj);
115
+ const node = publicAPI.addMissingNode(dobj);
116
+ if (enforceOrder && node !== undefined && model.children[index] !== node) {
117
+ for (let i = index + 1; i < model.children.length; ++i) {
118
+ if (model.children[i] === node) {
119
+ model.children.splice(i, 1);
120
+ model.children.splice(index, 0, node);
121
+ break;
122
+ }
123
+ }
124
+ }
115
125
  }
116
126
  };
117
127
 
@@ -140,6 +140,15 @@ function vtkWebXRRenderWindowHelper(publicAPI, model) {
140
140
  model.renderWindow.getRenderable().getInteractor().returnFromXRAnimation();
141
141
  const gl = model.renderWindow.get3DContext();
142
142
  gl.bindFramebuffer(gl.FRAMEBUFFER, null);
143
+
144
+ // Remove controllers ray
145
+ const ren = model.renderWindow.getRenderable().getRenderers()[0];
146
+ model.xrSession.inputSources.forEach(inputSource => {
147
+ if (model.inputSourceToRay[inputSource.handedness]) {
148
+ ren.removeActor(model.inputSourceToRay[inputSource.handedness].actor);
149
+ model.inputSourceToRay[inputSource.handedness].visible = false;
150
+ }
151
+ });
143
152
  await model.xrSession.end().catch(error => {
144
153
  if (!(error instanceof DOMException)) {
145
154
  throw error;
@@ -12,6 +12,14 @@ import { vtkObject } from './../../interfaces';
12
12
  import { CaptureOn, ViewTypes } from './WidgetManager/Constants';
13
13
  import { Nullable } from './../../types';
14
14
 
15
+ export interface IDisplayScaleParams {
16
+ dispHeightFactor: number;
17
+ cameraPosition: number[];
18
+ cameraDir: number[];
19
+ isParallel: boolean;
20
+ rendererPixelDims: number[];
21
+ }
22
+
15
23
  export interface ISelectedData {
16
24
  requestCount: number;
17
25
  propID: number;
@@ -45,7 +53,10 @@ export function extractRenderingComponents(
45
53
  * (vertical) distance that matches a display distance of 30px for a coordinate
46
54
  * `coord`, you would compute `30 * getPixelWorldHeightAtCoord(coord)`.
47
55
  */
48
- export function getPixelWorldHeightAtCoord(coord: []): Number;
56
+ export function getPixelWorldHeightAtCoord(
57
+ coord: [],
58
+ displayScaleParams: IDisplayScaleParams
59
+ ): Number;
49
60
 
50
61
  export interface vtkWidgetManager extends vtkObject {
51
62
  /**
@@ -2,13 +2,7 @@ import vtkDataArray from './../../Common/Core/DataArray';
2
2
  import vtkPolyData from './../../Common/DataModel/PolyData';
3
3
  import { vtkObject } from './../../interfaces';
4
4
  import vtkProp from './../../Rendering/Core/Prop';
5
- export interface IDisplayScaleParams {
6
- dispHeightFactor: number;
7
- cameraPosition: number[];
8
- cameraDir: number[];
9
- isParallel: boolean;
10
- rendererPixelDims: number[];
11
- }
5
+ import { IDisplayScaleParams } from './../Core/WidgetManager';
12
6
 
13
7
  export interface IWidgetRepresentationInitialValues {
14
8
  labels?: Array<any>;
@@ -12,14 +12,7 @@ import vtkRenderer from './../../Rendering/Core/Renderer';
12
12
  import vtkPlaneManipulator from './../Manipulators/PlaneManipulator';
13
13
  import { ViewTypes } from './../Core/WidgetManager/Constants';
14
14
  import { Vector2, Vector3 } from './../../types';
15
-
16
- export interface IDisplayScaleParams {
17
- dispHeightFactor: number;
18
- cameraPosition: Vector3;
19
- cameraDir: Vector3;
20
- isParallel: false;
21
- rendererPixelDims: Vector2;
22
- }
15
+ import { IDisplayScaleParams } from './../Core/WidgetManager';
23
16
 
24
17
  export interface vtkResliceCursorWidget<
25
18
  WidgetInstance extends vtkAbstractWidget = vtkResliceCursorWidgetDefaultInstance
package/macros.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'fast-deep-equal';
2
2
  import './vtk.js';
3
3
  import './Common/Core/ClassHierarchy.js';
4
- export { G as EVENT_ABORT, T as TYPED_ARRAYS, V as VOID, _ as _capitalize, d as algo, q as capitalize, h as chain, I as debounce, m as default, f as event, B as formatBytesToProperUnit, C as formatNumbersWithThousandSeparator, g as get, k as getArray, H as isVtkObject, K as keystore, E as measurePromiseExecution, i as moveToProtected, n as newInstance, a as newTypedArray, b as newTypedArrayFrom, M as normalizeWheel, o as obj, p as proxy, j as proxyPropertyMapping, L as proxyPropertyState, s as set, F as setArray, e as setGet, l as setGetArray, D as setImmediateVTK, u as setLoggerFunction, J as throttle, t as traverseInstanceTree, A as uncapitalize, y as vtkDebugMacro, r as vtkErrorMacro, x as vtkInfoMacro, w as vtkLogMacro, z as vtkOnceErrorMacro, v as vtkWarningMacro } from './macros2.js';
4
+ export { H as EVENT_ABORT, T as TYPED_ARRAYS, V as VOID, _ as _capitalize, d as algo, q as capitalize, h as chain, J as debounce, m as default, f as event, C as formatBytesToProperUnit, D as formatNumbersWithThousandSeparator, g as get, k as getArray, I as isVtkObject, L as keystore, F as measurePromiseExecution, i as moveToProtected, n as newInstance, a as newTypedArray, b as newTypedArrayFrom, N as normalizeWheel, o as obj, p as proxy, j as proxyPropertyMapping, M as proxyPropertyState, u as requiredParam, s as set, G as setArray, e as setGet, l as setGetArray, E as setImmediateVTK, w as setLoggerFunction, K as throttle, t as traverseInstanceTree, B as uncapitalize, z as vtkDebugMacro, r as vtkErrorMacro, y as vtkInfoMacro, x as vtkLogMacro, A as vtkOnceErrorMacro, v as vtkWarningMacro } from './macros2.js';
package/macros2.js CHANGED
@@ -7,6 +7,9 @@ import ClassHierarchy from './Common/Core/ClassHierarchy.js';
7
7
  * The name change is so we do not get eaten by babel-plugin-macros.
8
8
  */
9
9
  let globalMTime = 0;
10
+ const requiredParam = name => {
11
+ throw new Error(`Named parameter '${name}' is missing`);
12
+ };
10
13
  const VOID = Symbol('void');
11
14
  function getCurrentGlobalMTime() {
12
15
  return globalMTime;
@@ -1654,11 +1657,13 @@ var macro = {
1654
1657
  vtkOnceErrorMacro,
1655
1658
  vtkWarningMacro,
1656
1659
  // vtk.js internal use
1657
- objectSetterMap
1660
+ objectSetterMap,
1661
+ requiredParam
1658
1662
  };
1659
1663
 
1660
1664
  var macro$1 = /*#__PURE__*/Object.freeze({
1661
1665
  __proto__: null,
1666
+ requiredParam: requiredParam,
1662
1667
  VOID: VOID,
1663
1668
  setLoggerFunction: setLoggerFunction,
1664
1669
  vtkLogMacro: vtkLogMacro,
@@ -1702,4 +1707,4 @@ var macro$1 = /*#__PURE__*/Object.freeze({
1702
1707
  'default': macro
1703
1708
  });
1704
1709
 
1705
- export { uncapitalize as A, formatBytesToProperUnit as B, formatNumbersWithThousandSeparator as C, setImmediateVTK as D, measurePromiseExecution as E, setArray as F, EVENT_ABORT as G, isVtkObject as H, debounce as I, throttle as J, keystore as K, proxyPropertyState as L, normalizeWheel as M, TYPED_ARRAYS as T, VOID as V, _capitalize as _, newTypedArray as a, newTypedArrayFrom as b, macro$1 as c, algo as d, setGet as e, event as f, get as g, chain as h, moveToProtected as i, proxyPropertyMapping as j, getArray as k, setGetArray as l, macro as m, newInstance as n, obj as o, proxy as p, capitalize as q, vtkErrorMacro as r, set as s, traverseInstanceTree as t, setLoggerFunction as u, vtkWarningMacro as v, vtkLogMacro as w, vtkInfoMacro as x, vtkDebugMacro as y, vtkOnceErrorMacro as z };
1710
+ export { vtkOnceErrorMacro as A, uncapitalize as B, formatBytesToProperUnit as C, formatNumbersWithThousandSeparator as D, setImmediateVTK as E, measurePromiseExecution as F, setArray as G, EVENT_ABORT as H, isVtkObject as I, debounce as J, throttle as K, keystore as L, proxyPropertyState as M, normalizeWheel as N, TYPED_ARRAYS as T, VOID as V, _capitalize as _, newTypedArray as a, newTypedArrayFrom as b, macro$1 as c, algo as d, setGet as e, event as f, get as g, chain as h, moveToProtected as i, proxyPropertyMapping as j, getArray as k, setGetArray as l, macro as m, newInstance as n, obj as o, proxy as p, capitalize as q, vtkErrorMacro as r, set as s, traverseInstanceTree as t, requiredParam as u, vtkWarningMacro as v, setLoggerFunction as w, vtkLogMacro as x, vtkInfoMacro as y, vtkDebugMacro as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "33.0.0-beta.3",
3
+ "version": "33.0.0-beta.5",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",
@@ -141,19 +141,20 @@
141
141
  "reformat-only": "prettier --single-quote --trailing-comma es5 --print-width 80 --arrow-parens always --write",
142
142
  "lint-fix": "eslint --fix Sources Examples",
143
143
  "lint": "eslint Sources Examples",
144
- "doc": "kw-doc -c ./Documentation/config.js",
145
- "doc:www": "npm t -- --single-run && kw-doc -c ./Documentation/config.js -s",
146
- "doc:minified": "kw-doc -c ./Documentation/config.js -m",
147
- "doc:generate-api": "node ./Documentation/generate-api-docs.js",
144
+ "doc": "npm run build:pre && kw-doc -c ./Documentation/config.js",
145
+ "doc:www": "npm t -- --single-run && npm run build:pre && kw-doc -c ./Documentation/config.js -s",
146
+ "doc:minified": "npm run build:pre && kw-doc -c ./Documentation/config.js -m",
147
+ "doc:generate-api": "npm run build:pre && node ./Documentation/generate-api-docs.js",
148
148
  "example": "node ./Utilities/ExampleRunner/example-runner-cli.js -c ./Documentation/config.js",
149
149
  "example:https": "node ./Utilities/ExampleRunner/example-runner-cli.js --server-type https -c ./Documentation/config.js",
150
150
  "example:webgpu": "cross-env WEBGPU=1 NO_WEBGL=1 node ./Utilities/ExampleRunner/example-runner-cli.js --server-type https -c ./Documentation/config.js",
151
+ "build:pre": "patch-package",
151
152
  "dev:esm": "npm run build:esm -- -w",
152
- "dev:umd": "webpack --watch --config webpack.dev.js --progress",
153
+ "dev:umd": "npm run build:pre && webpack --watch --config webpack.dev.js --progress",
153
154
  "build": "npm run build:release",
154
- "build:esm": "rollup -c rollup.config.js",
155
- "build:umd": "webpack --config webpack.prod.js --progress",
156
- "build:release": "npm run lint && concurrently \"cross-env NOLINT=1 npm run build:esm\" \"cross-env NOLINT=1 npm run build:umd\"",
155
+ "build:esm": "npm run build:pre && rollup -c rollup.config.js",
156
+ "build:umd": "npm run build:pre && webpack --config webpack.prod.js --progress",
157
+ "build:release": "npm run lint && npm run build:pre && concurrently \"cross-env NOLINT=1 npm run build:esm\" \"cross-env NOLINT=1 npm run build:umd\"",
157
158
  "release:create-packages": "node ./Utilities/ci/build-npm-package.js",
158
159
  "test": "karma start ./karma.conf.js",
159
160
  "test:headless": "karma start ./karma.conf.js --browsers ChromeHeadlessNoSandbox --single-run",
@@ -163,8 +164,7 @@
163
164
  "test:firefox-debug": "karma start ./karma.conf.js --browsers Firefox --no-single-run",
164
165
  "commit": "git cz",
165
166
  "semantic-release": "semantic-release",
166
- "prepare": "node ./Utilities/prepare.js",
167
- "postinstall": "patch-package"
167
+ "prepare": "node ./Utilities/prepare.js"
168
168
  },
169
169
  "config": {
170
170
  "commitizen": {