@kitware/vtk.js 24.5.4 → 24.6.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.
- package/Common/Core/CellArray.js +14 -3
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/Triangle.js +1 -1
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Filters/Core/PolyDataNormals.js +1 -1
- package/Filters/General/OBBTree.js +1 -1
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/PointSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/Mapper.js +2 -2
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +1 -1
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +5 -3
- package/Rendering/OpenGL/Texture.js +1 -1
- package/Rendering/WebGPU/BindGroup.js +1 -1
- package/Rendering/WebGPU/BufferManager/Constants.js +1 -1
- package/Rendering/WebGPU/BufferManager.js +149 -263
- package/Rendering/WebGPU/CellArrayMapper.js +46 -73
- package/Rendering/WebGPU/Device.js +97 -57
- package/Rendering/WebGPU/Glyph3DMapper.js +2 -0
- package/Rendering/WebGPU/ImageMapper.js +1 -5
- package/Rendering/WebGPU/IndexBuffer.js +397 -0
- package/Rendering/WebGPU/RenderEncoder.js +1 -1
- package/Rendering/WebGPU/SimpleMapper.js +7 -1
- package/Rendering/WebGPU/SphereMapper.js +29 -31
- package/Rendering/WebGPU/StickMapper.js +38 -42
- package/Rendering/WebGPU/StorageBuffer.js +0 -1
- package/Rendering/WebGPU/Texture.js +0 -2
- package/Rendering/WebGPU/TextureManager.js +37 -7
- package/Rendering/WebGPU/UniformBuffer.js +0 -1
- package/Rendering/WebGPU/VertexInput.js +7 -2
- package/Rendering/WebGPU/VolumePass.js +16 -8
- package/Rendering/WebGPU/VolumePassFSQ.js +1 -5
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/PolyLineRepresentation.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -95,7 +95,6 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
95
95
|
|
|
96
96
|
if (req.dataArray) {
|
|
97
97
|
buffRequest.dataArray = req.dataArray;
|
|
98
|
-
buffRequest.time = req.dataArray.getMTime();
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
buffRequest.nativeArray = req.nativeArray; // bytesPerRow must be a multiple of 256 so we might need to rebuild
|
|
@@ -144,7 +143,6 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
144
143
|
|
|
145
144
|
var _buffRequest = {
|
|
146
145
|
nativeArray: imageData.data,
|
|
147
|
-
time: 0,
|
|
148
146
|
|
|
149
147
|
/* eslint-disable no-undef */
|
|
150
148
|
usage: BufferUsage.Texture,
|
|
@@ -119,17 +119,47 @@ function vtkWebGPUTextureManager(publicAPI, model) {
|
|
|
119
119
|
|
|
120
120
|
publicAPI.getTexture = function (req) {
|
|
121
121
|
// if we have a source the get/create/cache the texture
|
|
122
|
-
if (req.
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var hash = req.time + req.format;
|
|
128
|
-
return model.device.getCachedObject(req.owner, hash, _createTexture, req);
|
|
122
|
+
if (req.hash) {
|
|
123
|
+
// if a matching texture already exists then return it
|
|
124
|
+
return model.device.getCachedObject(req.hash, _createTexture, req);
|
|
129
125
|
}
|
|
130
126
|
|
|
131
127
|
return _createTexture(req);
|
|
132
128
|
};
|
|
129
|
+
|
|
130
|
+
publicAPI.getTextureForImageData = function (imgData) {
|
|
131
|
+
var treq = {
|
|
132
|
+
time: imgData.getMTime()
|
|
133
|
+
};
|
|
134
|
+
treq.imageData = imgData; // fill out the req time and format based on imageData/image
|
|
135
|
+
|
|
136
|
+
_fillRequest(treq);
|
|
137
|
+
|
|
138
|
+
treq.hash = treq.time + treq.format;
|
|
139
|
+
return model.device.getTextureManager().getTexture(treq);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
publicAPI.getTextureForVTKTexture = function (srcTexture) {
|
|
143
|
+
var treq = {
|
|
144
|
+
time: srcTexture.getMTime()
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
if (srcTexture.getInputData()) {
|
|
148
|
+
treq.imageData = srcTexture.getInputData();
|
|
149
|
+
} else if (srcTexture.getImage()) {
|
|
150
|
+
treq.image = srcTexture.getImage();
|
|
151
|
+
} else if (srcTexture.getJsImageData()) {
|
|
152
|
+
treq.jsImageData = srcTexture.getJsImageData();
|
|
153
|
+
} else if (srcTexture.getCanvas()) {
|
|
154
|
+
treq.canvas = srcTexture.getCanvas();
|
|
155
|
+
} // fill out the req time and format based on imageData/image
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
_fillRequest(treq);
|
|
159
|
+
|
|
160
|
+
treq.hash = treq.time + treq.format;
|
|
161
|
+
return model.device.getTextureManager().getTexture(treq);
|
|
162
|
+
};
|
|
133
163
|
} // ----------------------------------------------------------------------------
|
|
134
164
|
// Object factory
|
|
135
165
|
// ----------------------------------------------------------------------------
|
|
@@ -158,6 +158,10 @@ function vtkWebGPUVertexInput(publicAPI, model) {
|
|
|
158
158
|
for (var i = 0; i < model.inputs.length; i++) {
|
|
159
159
|
renderEncoder.setVertexBuffer(i, model.inputs[i].buffer.getHandle());
|
|
160
160
|
}
|
|
161
|
+
|
|
162
|
+
if (model.indexBuffer) {
|
|
163
|
+
renderEncoder.setIndexBuffer(model.indexBuffer.getHandle(), model.indexBuffer.getArrayInformation()[0].format);
|
|
164
|
+
}
|
|
161
165
|
};
|
|
162
166
|
|
|
163
167
|
publicAPI.getReady = function () {};
|
|
@@ -177,7 +181,8 @@ function vtkWebGPUVertexInput(publicAPI, model) {
|
|
|
177
181
|
var DEFAULT_VALUES = {
|
|
178
182
|
inputs: null,
|
|
179
183
|
bindingDescriptions: false,
|
|
180
|
-
attributeDescriptions: null
|
|
184
|
+
attributeDescriptions: null,
|
|
185
|
+
indexBuffer: null
|
|
181
186
|
}; // ----------------------------------------------------------------------------
|
|
182
187
|
|
|
183
188
|
function extend(publicAPI, model) {
|
|
@@ -188,7 +193,7 @@ function extend(publicAPI, model) {
|
|
|
188
193
|
model.bindingDescriptions = [];
|
|
189
194
|
model.attributeDescriptions = [];
|
|
190
195
|
model.inputs = [];
|
|
191
|
-
setGet(publicAPI, model, ['created', 'device', 'handle']); // For more macro methods, see "Sources/macros.js"
|
|
196
|
+
setGet(publicAPI, model, ['created', 'device', 'handle', 'indexBuffer']); // For more macro methods, see "Sources/macros.js"
|
|
192
197
|
// Object specific methods
|
|
193
198
|
|
|
194
199
|
vtkWebGPUVertexInput(publicAPI, model);
|
|
@@ -256,19 +256,27 @@ function vtkWebGPUVolumePass(publicAPI, model) {
|
|
|
256
256
|
publicAPI.renderDepthBounds = function (renNode, viewNode) {
|
|
257
257
|
publicAPI.updateDepthPolyData(renNode);
|
|
258
258
|
var pd = model._boundsPoly;
|
|
259
|
-
var cells = pd.getPolys(); // points
|
|
260
|
-
|
|
261
259
|
var points = pd.getPoints();
|
|
260
|
+
var cells = pd.getPolys();
|
|
262
261
|
var buffRequest = {
|
|
263
|
-
|
|
262
|
+
hash: "vp".concat(cells.getMTime()),
|
|
263
|
+
usage: BufferUsage.Index,
|
|
264
|
+
cells: cells,
|
|
265
|
+
numberOfPoints: points.getNumberOfPoints(),
|
|
266
|
+
primitiveType: PrimitiveTypes.Triangles,
|
|
267
|
+
representation: Representation.SURFACE
|
|
268
|
+
};
|
|
269
|
+
var indexBuffer = viewNode.getDevice().getBufferManager().getBuffer(buffRequest);
|
|
270
|
+
|
|
271
|
+
model._mapper.getVertexInput().setIndexBuffer(indexBuffer); // points
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
buffRequest = {
|
|
264
275
|
usage: BufferUsage.PointArray,
|
|
265
276
|
format: 'float32x4',
|
|
266
|
-
|
|
267
|
-
hash: 'vp',
|
|
277
|
+
hash: "vp".concat(points.getMTime()).concat(cells.getMTime()),
|
|
268
278
|
dataArray: points,
|
|
269
|
-
|
|
270
|
-
primitiveType: PrimitiveTypes.Triangles,
|
|
271
|
-
representation: Representation.SURFACE,
|
|
279
|
+
indexBuffer: indexBuffer,
|
|
272
280
|
packExtra: true
|
|
273
281
|
};
|
|
274
282
|
var buff = viewNode.getDevice().getBufferManager().getBuffer(buffRequest);
|
|
@@ -455,11 +455,7 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
455
455
|
|
|
456
456
|
var image = _volMapr4.getInputData();
|
|
457
457
|
|
|
458
|
-
var
|
|
459
|
-
imageData: image,
|
|
460
|
-
owner: image.getPointData().getScalars()
|
|
461
|
-
};
|
|
462
|
-
var newTex = model.device.getTextureManager().getTexture(treq);
|
|
458
|
+
var newTex = model.device.getTextureManager().getTextureForImageData(image);
|
|
463
459
|
|
|
464
460
|
if (!model.textureViews[vidx + 4] || model.textureViews[vidx + 4].getTexture() !== newTex) {
|
|
465
461
|
var tview = newTex.createView("volTexture".concat(vidx));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
|
-
import { g as subtract, j as cross, d as dot,
|
|
2
|
+
import { g as subtract, j as cross, d as dot, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
|
|
3
3
|
|
|
4
4
|
function projectDisplayToLine(x, y, lineOrigin, lineDirection, renderer, glRenderWindow) {
|
|
5
5
|
var near = glRenderWindow.displayToWorld(x, y, 0, renderer);
|
|
@@ -2,7 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
4
4
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
5
|
-
import {
|
|
5
|
+
import { B as areEquals, f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
6
6
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
7
7
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
8
8
|
import vtkTubeFilter from '../../Filters/General/TubeFilter.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
|
-
import { g as subtract,
|
|
4
|
+
import { g as subtract, m as multiplyAccumulate, l as normalize, j as cross } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
6
6
|
import vtkCylinderSource from '../../Filters/Sources/CylinderSource.js';
|
|
7
7
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
@@ -3,7 +3,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
|
3
3
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
4
4
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
5
5
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
6
|
-
import { g as subtract,
|
|
6
|
+
import { g as subtract, R as angleBetweenVectors } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import widgetBehavior from './AngleWidget/behavior.js';
|
|
8
8
|
import generateState from './AngleWidget/state.js';
|
|
9
9
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as subtract,
|
|
1
|
+
import { g as subtract, x as multiplyScalar, k as add, B as areEquals } from '../../../Common/Core/Math/index.js';
|
|
2
2
|
|
|
3
3
|
function calculateTextPosition(model) {
|
|
4
4
|
var vector = [0, 0, 0];
|
|
@@ -3,7 +3,7 @@ import macro from '../../../macros.js';
|
|
|
3
3
|
import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
|
|
4
4
|
import vtkLine from '../../../Common/DataModel/Line.js';
|
|
5
5
|
import vtkPlanePointManipulator from '../../Manipulators/PlaneManipulator.js';
|
|
6
|
-
import {
|
|
6
|
+
import { x as multiplyScalar, g as subtract, l as normalize, d as dot, j as cross, m as multiplyAccumulate, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
7
|
import { updateState, getAssociatedLinesName, boundPointOnPlane, rotateVector } from './helpers.js';
|
|
8
8
|
import { InteractionMethodsName, ScrollingMethods } from './Constants.js';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import vtkBoundingBox, { STATIC } from '../../../Common/DataModel/BoundingBox.js
|
|
|
3
3
|
import vtkCubeSource from '../../../Filters/Sources/CubeSource.js';
|
|
4
4
|
import vtkCutter from '../../../Filters/Core/Cutter.js';
|
|
5
5
|
import vtkPlane from '../../../Common/DataModel/Plane.js';
|
|
6
|
-
import { g as subtract, l as normalize, j as cross,
|
|
6
|
+
import { g as subtract, l as normalize, j as cross, x as multiplyScalar, m as multiplyAccumulate, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
7
|
import vtkMatrixBuilder from '../../../Common/Core/MatrixBuilder.js';
|
|
8
8
|
import { ViewTypes } from '../../Core/WidgetManager/Constants.js';
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
|
4
4
|
import vtkPlane from '../../Common/DataModel/Plane.js';
|
|
5
5
|
import vtkPlaneSource from '../../Filters/Sources/PlaneSource.js';
|
|
6
6
|
import vtkResliceCursorContextRepresentation from '../Representations/ResliceCursorContextRepresentation.js';
|
|
7
|
-
import { f as distance2BetweenPoints,
|
|
7
|
+
import { f as distance2BetweenPoints, m as multiplyAccumulate, g as subtract, l as normalize, x as multiplyScalar, k as add } from '../../Common/Core/Math/index.js';
|
|
8
8
|
import widgetBehavior from './ResliceCursorWidget/behavior.js';
|
|
9
9
|
import generateState from './ResliceCursorWidget/state.js';
|
|
10
10
|
import { updateState, transformPlane, boundPlane } from './ResliceCursorWidget/helpers.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import macro from '../../../macros.js';
|
|
4
|
-
import {
|
|
4
|
+
import { t as vtkMath } from '../../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
|
|
6
6
|
import vtkPlane from '../../../Common/DataModel/Plane.js';
|
|
7
7
|
import { ShapeBehavior, BehaviorCategory, TextPosition } from './Constants.js';
|
package/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
/// <reference path="./Common/DataModel/Sphere.d.ts" />
|
|
38
38
|
/// <reference path="./Common/DataModel/Spline1D.d.ts" />
|
|
39
39
|
/// <reference path="./Common/DataModel/Spline3D.d.ts" />
|
|
40
|
+
/// <reference path="./Common/DataModel/Triangle.d.ts" />
|
|
40
41
|
/// <reference path="./Common/Transform/LandmarkTransform.d.ts" />
|
|
41
42
|
/// <reference path="./Filters/General/AppendPolyData.d.ts" />
|
|
42
43
|
/// <reference path="./Filters/General/ImageCropFilter.d.ts" />
|
|
@@ -61,8 +62,8 @@
|
|
|
61
62
|
/// <reference path="./Filters/Texture/TextureMapToPlane.d.ts" />
|
|
62
63
|
/// <reference path="./Filters/Texture/TextureMapToSphere.d.ts" />
|
|
63
64
|
/// <reference path="./Interaction/Widgets/OrientationMarkerWidget.d.ts" />
|
|
64
|
-
/// <reference path="./IO/Core/DataAccessHelper/HttpDataAccessHelper.d.ts" />
|
|
65
65
|
/// <reference path="./IO/Core/DataAccessHelper/HtmlDataAccessHelper.d.ts" />
|
|
66
|
+
/// <reference path="./IO/Core/DataAccessHelper/HttpDataAccessHelper.d.ts" />
|
|
66
67
|
/// <reference path="./IO/Core/DataAccessHelper.d.ts" />
|
|
67
68
|
/// <reference path="./IO/Core/DataAccessHelper/JSZipDataAccessHelper.d.ts" />
|
|
68
69
|
/// <reference path="./IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.d.ts" />
|
|
@@ -143,5 +144,4 @@
|
|
|
143
144
|
/// <reference path="./Widgets/Representations/ResliceCursorContextRepresentation.d.ts" />
|
|
144
145
|
/// <reference path="./Widgets/Representations/WidgetRepresentation.d.ts" />
|
|
145
146
|
/// <reference path="./Widgets/Widgets3D/SphereWidget.d.ts" />
|
|
146
|
-
/// <reference path="./Common/DataModel/Triangle.d.ts" />
|
|
147
147
|
/// <reference path="./Common/Core/Math.d.ts" />
|