@kitware/vtk.js 32.9.1 → 32.11.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/DataArray.d.ts +17 -0
- package/Common/Core/DataArray.js +36 -0
- package/Common/DataModel/Line.js +1 -0
- package/Common/DataModel/PolyLine.js +4 -0
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +1 -1
- package/IO/Geometry/STLReader.d.ts +14 -0
- package/IO/Geometry/STLReader.js +57 -1
- package/Rendering/Core/Glyph3DMapper.d.ts +45 -29
- package/Rendering/Core/ImageCPRMapper.js +1 -1
- package/Rendering/Core/PointPicker.js +6 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +1 -1
- package/Rendering/OpenGL/ImageMapper.js +16 -1
- package/Rendering/OpenGL/Texture.d.ts +11 -5
- package/Rendering/OpenGL/Texture.js +6 -2
- package/Rendering/WebXR/RenderWindowHelper.js +9 -0
- package/Widgets/Widgets3D/InteractiveOrientationWidget.js +1 -1
- package/package.json +11 -10
|
@@ -83,6 +83,23 @@ export interface vtkDataArray extends vtkObject {
|
|
|
83
83
|
*/
|
|
84
84
|
setRange(rangeValue: vtkRange, componentIndex: number): Range;
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Returns an array of the ranges for each component of the DataArray.
|
|
88
|
+
* Defaults to computing all the ranges if they aren't already computed.
|
|
89
|
+
*
|
|
90
|
+
* If the number of components is greater than 1, the last element in the
|
|
91
|
+
* ranges array is the min,max magnitude of the dataset. This is the same as
|
|
92
|
+
* calling `getRange(-1)`.
|
|
93
|
+
*
|
|
94
|
+
* Passing `getRanges(false)` will return a clone of the ranges that have
|
|
95
|
+
* already been computed. This is useful when you want to avoid recomputing
|
|
96
|
+
* the ranges, which can be expensive.
|
|
97
|
+
*
|
|
98
|
+
* @param {boolean} [computeRanges] (default: true)
|
|
99
|
+
* @returns {vtkRange[]}
|
|
100
|
+
*/
|
|
101
|
+
getRanges(computeRanges: boolean): vtkRange[];
|
|
102
|
+
|
|
86
103
|
/**
|
|
87
104
|
* Set the given tuple at the given index.
|
|
88
105
|
* @param {Number} idx
|
package/Common/Core/DataArray.js
CHANGED
|
@@ -268,6 +268,35 @@ function vtkDataArray(publicAPI, model) {
|
|
|
268
268
|
model.rangeTuple[1] = range.max;
|
|
269
269
|
return model.rangeTuple;
|
|
270
270
|
};
|
|
271
|
+
publicAPI.getRanges = function () {
|
|
272
|
+
let computeRanges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
273
|
+
if (!computeRanges) {
|
|
274
|
+
return structuredClone(model.ranges);
|
|
275
|
+
}
|
|
276
|
+
/** @type {import('../../../interfaces').vtkRange[]} */
|
|
277
|
+
const ranges = [];
|
|
278
|
+
for (let i = 0; i < model.numberOfComponents; i++) {
|
|
279
|
+
const [min, max] = publicAPI.getRange(i);
|
|
280
|
+
/** @type {import('../../../interfaces').vtkRange} */
|
|
281
|
+
const range = {
|
|
282
|
+
min,
|
|
283
|
+
max
|
|
284
|
+
};
|
|
285
|
+
ranges.push(range);
|
|
286
|
+
}
|
|
287
|
+
// where the number of components is greater than 1, the last element in
|
|
288
|
+
// the range array is the min,max magnitude of the entire dataset.
|
|
289
|
+
if (model.numberOfComponents > 1) {
|
|
290
|
+
const [min, max] = publicAPI.getRange(-1);
|
|
291
|
+
/** @type {import('../../../interfaces').vtkRange} */
|
|
292
|
+
const range = {
|
|
293
|
+
min,
|
|
294
|
+
max
|
|
295
|
+
};
|
|
296
|
+
ranges.push(range);
|
|
297
|
+
}
|
|
298
|
+
return ranges;
|
|
299
|
+
};
|
|
271
300
|
publicAPI.setTuple = (idx, tuple) => {
|
|
272
301
|
const offset = idx * model.numberOfComponents;
|
|
273
302
|
for (let i = 0; i < model.numberOfComponents; i++) {
|
|
@@ -426,12 +455,19 @@ function vtkDataArray(publicAPI, model) {
|
|
|
426
455
|
}
|
|
427
456
|
return sortedObj;
|
|
428
457
|
};
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* @param {import("./index").vtkDataArray} other
|
|
461
|
+
*/
|
|
429
462
|
publicAPI.deepCopy = other => {
|
|
430
463
|
// Retain current dataType and array reference before shallowCopy call.
|
|
431
464
|
const currentType = publicAPI.getDataType();
|
|
432
465
|
const currentArray = model.values;
|
|
433
466
|
publicAPI.shallowCopy(other);
|
|
434
467
|
|
|
468
|
+
// set the ranges
|
|
469
|
+
model.ranges = structuredClone(other.getRanges());
|
|
470
|
+
|
|
435
471
|
// Avoid array reallocation if size already sufficient
|
|
436
472
|
// and dataTypes match.
|
|
437
473
|
if (currentArray?.length >= other.getNumberOfValues() && currentType === other.getDataType()) {
|
package/Common/DataModel/Line.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unzipSync, strFromU8, decompressSync, strToU8 } from 'fflate';
|
|
2
2
|
import { m as macro } from '../../../macros2.js';
|
|
3
3
|
import Endian from '../../../Common/Core/Endian.js';
|
|
4
4
|
import { DataTypeByteSize } from '../../../Common/Core/DataArray/Constants.js';
|
|
@@ -46,6 +46,11 @@ export interface vtkSTLReader extends vtkSTLReaderBase {
|
|
|
46
46
|
*/
|
|
47
47
|
getUrl(): string;
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Get tolerance when removeDuplicateVertices is set
|
|
51
|
+
*/
|
|
52
|
+
getRemoveDuplicateVertices(): number;
|
|
53
|
+
|
|
49
54
|
/**
|
|
50
55
|
* Load the object data.
|
|
51
56
|
* @param {ISTLReaderOptions} [options]
|
|
@@ -94,6 +99,15 @@ export interface vtkSTLReader extends vtkSTLReaderBase {
|
|
|
94
99
|
* @param {ISTLReaderOptions} [option] The STL reader options.
|
|
95
100
|
*/
|
|
96
101
|
setUrl(url: string, option?: ISTLReaderOptions): Promise<string | any>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Turn on/off automatic removeDuplicateVertices
|
|
105
|
+
* After reading the STL file, if `tolerance` is >= 0, then points with the same coordinates at 10 power tolerance are merged.
|
|
106
|
+
* For a smooth rendering, you might want to compute normals with vtkPolyDataNormals.
|
|
107
|
+
*
|
|
108
|
+
* @param {Number} tolerance
|
|
109
|
+
*/
|
|
110
|
+
setRemoveDuplicateVertices(tolerance: number): boolean;
|
|
97
111
|
}
|
|
98
112
|
|
|
99
113
|
/**
|
package/IO/Geometry/STLReader.js
CHANGED
|
@@ -103,6 +103,55 @@ function vtkSTLReader(publicAPI, model) {
|
|
|
103
103
|
progressCallback
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
+
function removeDuplicateVertices(tolerance) {
|
|
107
|
+
const polydata = model.output[0];
|
|
108
|
+
const points = polydata.getPoints().getData();
|
|
109
|
+
const faces = polydata.getPolys().getData();
|
|
110
|
+
if (!points || !faces) {
|
|
111
|
+
console.warn('No valid polydata.');
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const vMap = new Map();
|
|
115
|
+
const vIndexMap = new Map();
|
|
116
|
+
let vInc = 0;
|
|
117
|
+
let pointsChanged = false;
|
|
118
|
+
for (let i = 0; i < points.length; i += 3) {
|
|
119
|
+
const k1 = (points[i] * 10 ** tolerance).toFixed(0);
|
|
120
|
+
const k2 = (points[i + 1] * 10 ** tolerance).toFixed(0);
|
|
121
|
+
const k3 = (points[i + 2] * 10 ** tolerance).toFixed(0);
|
|
122
|
+
const key = `${k1},${k2},${k3}`;
|
|
123
|
+
if (vMap.get(key) !== undefined) {
|
|
124
|
+
vIndexMap.set(i / 3, vMap.get(key));
|
|
125
|
+
pointsChanged = true;
|
|
126
|
+
} else {
|
|
127
|
+
vIndexMap.set(i / 3, vInc);
|
|
128
|
+
vMap.set(key, vInc);
|
|
129
|
+
vInc++;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const outVerts = new Float32Array(vMap.size * 3);
|
|
133
|
+
const keys = Array.from(vMap.keys());
|
|
134
|
+
for (let i = 0; i < keys.length; i++) {
|
|
135
|
+
const k = keys[i];
|
|
136
|
+
const j = vMap.get(k) * 3;
|
|
137
|
+
const coords = k.split(',').map(e => +e * 10 ** -tolerance);
|
|
138
|
+
outVerts[j] = coords[0];
|
|
139
|
+
outVerts[j + 1] = coords[1];
|
|
140
|
+
outVerts[j + 2] = coords[2];
|
|
141
|
+
}
|
|
142
|
+
const outFaces = new Int32Array(faces);
|
|
143
|
+
for (let i = 0; i < faces.length; i += 4) {
|
|
144
|
+
outFaces[i] = 3;
|
|
145
|
+
outFaces[i + 1] = vIndexMap.get(faces[i + 1]);
|
|
146
|
+
outFaces[i + 2] = vIndexMap.get(faces[i + 2]);
|
|
147
|
+
outFaces[i + 3] = vIndexMap.get(faces[i + 3]);
|
|
148
|
+
}
|
|
149
|
+
polydata.getPoints().setData(outVerts);
|
|
150
|
+
polydata.getPolys().setData(outFaces);
|
|
151
|
+
if (pointsChanged) {
|
|
152
|
+
publicAPI.modified();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
106
155
|
|
|
107
156
|
// Set DataSet url
|
|
108
157
|
publicAPI.setUrl = function (url) {
|
|
@@ -251,6 +300,9 @@ function vtkSTLReader(publicAPI, model) {
|
|
|
251
300
|
|
|
252
301
|
// Add new output
|
|
253
302
|
model.output[0] = polydata;
|
|
303
|
+
if (model.removeDuplicateVertices >= 0) {
|
|
304
|
+
removeDuplicateVertices(model.removeDuplicateVertices);
|
|
305
|
+
}
|
|
254
306
|
};
|
|
255
307
|
publicAPI.parseAsText = content => {
|
|
256
308
|
if (!content) {
|
|
@@ -281,6 +333,9 @@ function vtkSTLReader(publicAPI, model) {
|
|
|
281
333
|
|
|
282
334
|
// Add new output
|
|
283
335
|
model.output[0] = polydata;
|
|
336
|
+
if (model.removeDuplicateVertices >= 0) {
|
|
337
|
+
removeDuplicateVertices(model.removeDuplicateVertices);
|
|
338
|
+
}
|
|
284
339
|
};
|
|
285
340
|
publicAPI.requestData = (inData, outData) => {
|
|
286
341
|
publicAPI.parse(model.parseData);
|
|
@@ -295,6 +350,7 @@ const DEFAULT_VALUES = {
|
|
|
295
350
|
// baseURL: null,
|
|
296
351
|
// dataAccessHelper: null,
|
|
297
352
|
// url: null,
|
|
353
|
+
removeDuplicateVertices: -1
|
|
298
354
|
};
|
|
299
355
|
|
|
300
356
|
// ----------------------------------------------------------------------------
|
|
@@ -306,7 +362,7 @@ function extend(publicAPI, model) {
|
|
|
306
362
|
// Build VTK API
|
|
307
363
|
macro.obj(publicAPI, model);
|
|
308
364
|
macro.get(publicAPI, model, ['url', 'baseURL']);
|
|
309
|
-
macro.setGet(publicAPI, model, ['dataAccessHelper']);
|
|
365
|
+
macro.setGet(publicAPI, model, ['dataAccessHelper', 'removeDuplicateVertices']);
|
|
310
366
|
macro.algo(publicAPI, model, 0, 1);
|
|
311
367
|
|
|
312
368
|
// vtkSTLReader methods
|
|
@@ -12,11 +12,11 @@ interface IPrimitiveCount {
|
|
|
12
12
|
export interface IGlyph3DMapperInitialValues extends IMapperInitialValues {
|
|
13
13
|
orient?: boolean;
|
|
14
14
|
orientationMode?: OrientationModes;
|
|
15
|
-
orientationArray?:
|
|
15
|
+
orientationArray?: string;
|
|
16
16
|
scaling?: boolean;
|
|
17
17
|
scaleFactor?: number;
|
|
18
18
|
scaleMode?: ScaleModes;
|
|
19
|
-
scaleArray?:
|
|
19
|
+
scaleArray?: string;
|
|
20
20
|
matrixArray?: number[];
|
|
21
21
|
normalArray?: number[];
|
|
22
22
|
colorArray?: number[];
|
|
@@ -24,29 +24,26 @@ export interface IGlyph3DMapperInitialValues extends IMapperInitialValues {
|
|
|
24
24
|
|
|
25
25
|
export interface vtkGlyph3DMapper extends vtkMapper {
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* This definition is compliant with SetOrientation method on vtkProp3D.
|
|
27
|
+
* Get the bounds for this mapper as [xmin, xmax, ymin, ymax,zmin, zmax].
|
|
28
|
+
* @return {Bounds} The bounds for the mapper.
|
|
29
|
+
*/
|
|
30
|
+
getBounds(): Bounds;
|
|
31
|
+
|
|
32
|
+
/**
|
|
34
33
|
*
|
|
35
|
-
* By using vector or normal there is a degree of freedom or rotation left
|
|
36
|
-
* (underconstrained). With the orientation array, there is no degree of
|
|
37
|
-
* freedom left.
|
|
38
34
|
*/
|
|
39
|
-
|
|
35
|
+
buildArrays(): void;
|
|
40
36
|
|
|
41
37
|
/**
|
|
42
|
-
*
|
|
38
|
+
*
|
|
43
39
|
*/
|
|
44
|
-
|
|
40
|
+
getPrimitiveCount(): IPrimitiveCount;
|
|
45
41
|
|
|
46
42
|
/**
|
|
47
|
-
* Get
|
|
43
|
+
* Get scale mode
|
|
44
|
+
* @default `SCALE_BY_MAGNITUDE`
|
|
48
45
|
*/
|
|
49
|
-
|
|
46
|
+
getScaleMode(): ScaleModes;
|
|
50
47
|
|
|
51
48
|
/**
|
|
52
49
|
* Get scale factor to scale object by.
|
|
@@ -54,15 +51,20 @@ export interface vtkGlyph3DMapper extends vtkMapper {
|
|
|
54
51
|
getScaleFactor(): number;
|
|
55
52
|
|
|
56
53
|
/**
|
|
57
|
-
* Get scale mode
|
|
58
|
-
* @default `SCALE_BY_MAGNITUDE`
|
|
54
|
+
* Get scale mode as string
|
|
59
55
|
*/
|
|
60
|
-
|
|
56
|
+
getScaleModeAsString(): string;
|
|
61
57
|
|
|
62
58
|
/**
|
|
63
|
-
*
|
|
59
|
+
* Sets the name of the array to use as scale values.
|
|
60
|
+
* @param {String} arrayName Name of the array
|
|
64
61
|
*/
|
|
65
|
-
|
|
62
|
+
setScaleArray(arrayName: Nullable<string>): boolean;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Gets the name of the array used as scale values.
|
|
66
|
+
*/
|
|
67
|
+
getScaleArray(): string;
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Get scale mode as array
|
|
@@ -70,20 +72,29 @@ export interface vtkGlyph3DMapper extends vtkMapper {
|
|
|
70
72
|
getScaleArrayData(): number[];
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
+
* An orientation array is a vtkDataArray with 3 components. The first
|
|
76
|
+
* component is the angle of rotation along the X axis. The second component
|
|
77
|
+
* is the angle of rotation along the Y axis. The third component is the
|
|
78
|
+
* angle of rotation along the Z axis. Orientation is specified in X,Y,Z
|
|
79
|
+
* order but the rotations are performed in Z,X an Y.
|
|
80
|
+
*
|
|
81
|
+
* This definition is compliant with SetOrientation method on vtkProp3D.
|
|
82
|
+
*
|
|
83
|
+
* By using vector or normal there is a degree of freedom or rotation left
|
|
84
|
+
* (underconstrained). With the orientation array, there is no degree of
|
|
85
|
+
* freedom left.
|
|
75
86
|
*/
|
|
76
|
-
|
|
87
|
+
getOrientationMode(): OrientationModes;
|
|
77
88
|
|
|
78
89
|
/**
|
|
79
|
-
*
|
|
90
|
+
* Get orientation as string
|
|
80
91
|
*/
|
|
81
|
-
|
|
92
|
+
getOrientationModeAsString(): string;
|
|
82
93
|
|
|
83
94
|
/**
|
|
84
|
-
*
|
|
95
|
+
* Get orientation as array
|
|
85
96
|
*/
|
|
86
|
-
|
|
97
|
+
getOrientationArrayData(): number[];
|
|
87
98
|
|
|
88
99
|
/**
|
|
89
100
|
* Sets the name of the array to use as orientation.
|
|
@@ -91,6 +102,11 @@ export interface vtkGlyph3DMapper extends vtkMapper {
|
|
|
91
102
|
*/
|
|
92
103
|
setOrientationArray(arrayName: Nullable<string>): boolean;
|
|
93
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Gets the name of the array used as orientation values.
|
|
107
|
+
*/
|
|
108
|
+
getOrientationArray(): string;
|
|
109
|
+
|
|
94
110
|
/**
|
|
95
111
|
* Orientation mode indicates if the OrientationArray provides the direction
|
|
96
112
|
* vector for the orientation or the rotations around each axes.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vec3, mat4
|
|
1
|
+
import { quat, vec3, mat4 } from 'gl-matrix';
|
|
2
2
|
import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
|
|
3
3
|
import vtkAbstractImageMapper from './AbstractImageMapper.js';
|
|
4
4
|
import { m as macro } from '../../macros2.js';
|
|
@@ -80,6 +80,9 @@ function vtkPointPicker(publicAPI, model) {
|
|
|
80
80
|
if (maxDist <= tolerance && maxDist < minPtDist) {
|
|
81
81
|
// within tolerance
|
|
82
82
|
minPtId = ptId;
|
|
83
|
+
x[0];
|
|
84
|
+
x[1];
|
|
85
|
+
x[2];
|
|
83
86
|
minPtDist = maxDist;
|
|
84
87
|
tMin = t;
|
|
85
88
|
}
|
|
@@ -108,6 +111,9 @@ function vtkPointPicker(publicAPI, model) {
|
|
|
108
111
|
if (maxDist <= tolerance && maxDist < minPtDist) {
|
|
109
112
|
// within tolerance
|
|
110
113
|
minPtId = ptId;
|
|
114
|
+
x[0];
|
|
115
|
+
x[1];
|
|
116
|
+
x[2];
|
|
111
117
|
minPtDist = maxDist;
|
|
112
118
|
tMin = t;
|
|
113
119
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vtkObject } from './../../../interfaces';
|
|
2
2
|
import { Nullable } from './../../../types';
|
|
3
|
-
import { ISynchronizerContext, IViewState } from '
|
|
3
|
+
import { ISynchronizerContext, IViewState } from '../SynchronizableRenderWindow';
|
|
4
4
|
|
|
5
5
|
export type BuilderFunction = <T extends vtkObject>(
|
|
6
6
|
type: string,
|
|
@@ -863,10 +863,25 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
863
863
|
vtkErrorMacro('Reformat slicing not yet supported.');
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
+
/**
|
|
867
|
+
*
|
|
868
|
+
* Fetch the ranges of the source volume, `imgScalars`, and use them when
|
|
869
|
+
* creating the texture. Whilst the pre-calculated ranges may not be
|
|
870
|
+
* strictly correct for the slice, it is guaranteed to be within the
|
|
871
|
+
* source volume's range.
|
|
872
|
+
*
|
|
873
|
+
* There is a significant performance improvement by pre-setting the range
|
|
874
|
+
* of the scalars array particularly when scrolling through the source
|
|
875
|
+
* volume as there is no need to calculate the range of the slice scalar.
|
|
876
|
+
*
|
|
877
|
+
* @type{ import("../../../interfaces").vtkRange[] }
|
|
878
|
+
*/
|
|
879
|
+
const ranges = imgScalars.getRanges();
|
|
880
|
+
|
|
866
881
|
// Don't share this resource as `scalars` is created in this function
|
|
867
882
|
// so it is impossible to share
|
|
868
883
|
model.openGLTexture.resetFormatAndType();
|
|
869
|
-
model.openGLTexture.create2DFilterableFromRaw(dims[0], dims[1], numComp, imgScalars.getDataType(), scalars, model.renderable.getPreferSizeOverAccuracy?.());
|
|
884
|
+
model.openGLTexture.create2DFilterableFromRaw(dims[0], dims[1], numComp, imgScalars.getDataType(), scalars, model.renderable.getPreferSizeOverAccuracy?.(), ranges);
|
|
870
885
|
model.openGLTexture.activate();
|
|
871
886
|
model.openGLTexture.sendParameters();
|
|
872
887
|
model.openGLTexture.deactivate();
|
|
@@ -3,7 +3,7 @@ import vtkOpenGLRenderWindow from './RenderWindow';
|
|
|
3
3
|
import { Nullable } from './../../types';
|
|
4
4
|
import { VtkDataTypes } from './../../Common/Core/DataArray';
|
|
5
5
|
import { vtkViewNode } from './../SceneGraph/ViewNode';
|
|
6
|
-
import { vtkObject } from './../../interfaces';
|
|
6
|
+
import { vtkObject, vtkRange } from './../../interfaces';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Initial values for creating a new instance of vtkOpenGLTexture.
|
|
@@ -244,7 +244,8 @@ export interface vtkOpenGLTexture extends vtkViewNode {
|
|
|
244
244
|
* @param numComps The number of components in the texture.
|
|
245
245
|
* @param dataType The data type of the texture.
|
|
246
246
|
* @param data The raw data for the texture.
|
|
247
|
-
* @param preferSizeOverAccuracy Whether to prefer texture size over accuracy.
|
|
247
|
+
* @param [preferSizeOverAccuracy=false] Whether to prefer texture size over accuracy. Defaults to false.
|
|
248
|
+
* @param [ranges] The precomputed ranges of the data (optional). Provided to prevent computation of the data ranges.
|
|
248
249
|
* @returns {boolean} True if the texture was successfully created, false otherwise.
|
|
249
250
|
*/
|
|
250
251
|
create2DFilterableFromRaw(
|
|
@@ -253,7 +254,8 @@ export interface vtkOpenGLTexture extends vtkViewNode {
|
|
|
253
254
|
numComps: number,
|
|
254
255
|
dataType: VtkDataTypes,
|
|
255
256
|
data: any,
|
|
256
|
-
preferSizeOverAccuracy
|
|
257
|
+
preferSizeOverAccuracy?: boolean,
|
|
258
|
+
ranges?: vtkRange[]
|
|
257
259
|
): boolean;
|
|
258
260
|
|
|
259
261
|
/**
|
|
@@ -299,7 +301,10 @@ export interface vtkOpenGLTexture extends vtkViewNode {
|
|
|
299
301
|
* @param dataType The data type of the texture.
|
|
300
302
|
* @param values The raw data for the texture.
|
|
301
303
|
* @param preferSizeOverAccuracy Whether to prefer texture size over accuracy.
|
|
302
|
-
* @
|
|
304
|
+
* @param [ranges] The precomputed ranges of the data (optional). Provided to
|
|
305
|
+
* prevent computation of the data ranges.
|
|
306
|
+
* @returns {boolean} True if the texture was successfully created, false
|
|
307
|
+
* otherwise.
|
|
303
308
|
*/
|
|
304
309
|
create3DFilterableFromRaw(
|
|
305
310
|
width: number,
|
|
@@ -308,7 +313,8 @@ export interface vtkOpenGLTexture extends vtkViewNode {
|
|
|
308
313
|
numComps: number,
|
|
309
314
|
dataType: VtkDataTypes,
|
|
310
315
|
values: any,
|
|
311
|
-
preferSizeOverAccuracy: boolean
|
|
316
|
+
preferSizeOverAccuracy: boolean,
|
|
317
|
+
ranges?: vtkRange[]
|
|
312
318
|
): boolean;
|
|
313
319
|
|
|
314
320
|
/**
|
|
@@ -986,10 +986,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
986
986
|
}
|
|
987
987
|
publicAPI.create2DFilterableFromRaw = function (width, height, numberOfComponents, dataType, values) {
|
|
988
988
|
let preferSizeOverAccuracy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
989
|
+
let ranges = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : undefined;
|
|
989
990
|
return publicAPI.create2DFilterableFromDataArray(width, height, vtkDataArray.newInstance({
|
|
990
991
|
numberOfComponents,
|
|
991
992
|
dataType,
|
|
992
|
-
values
|
|
993
|
+
values,
|
|
994
|
+
ranges
|
|
993
995
|
}), preferSizeOverAccuracy);
|
|
994
996
|
};
|
|
995
997
|
publicAPI.create2DFilterableFromDataArray = function (width, height, dataArray) {
|
|
@@ -1129,10 +1131,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1129
1131
|
// Prefer create3DFilterableFromDataArray to enable caching of min and max values
|
|
1130
1132
|
publicAPI.create3DFilterableFromRaw = function (width, height, depth, numberOfComponents, dataType, values) {
|
|
1131
1133
|
let preferSizeOverAccuracy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
1134
|
+
let ranges = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
1132
1135
|
return publicAPI.create3DFilterableFromDataArray(width, height, depth, vtkDataArray.newInstance({
|
|
1133
1136
|
numberOfComponents,
|
|
1134
1137
|
dataType,
|
|
1135
|
-
values
|
|
1138
|
+
values,
|
|
1139
|
+
ranges
|
|
1136
1140
|
}), preferSizeOverAccuracy);
|
|
1137
1141
|
};
|
|
1138
1142
|
|
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import { m as macro } from '../../macros2.js';
|
|
|
2
2
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
3
3
|
import vtkConvexFaceContextRepresentation from '../Representations/ConvexFaceContextRepresentation.js';
|
|
4
4
|
import widgetBehavior from './InteractiveOrientationWidget/behavior.js';
|
|
5
|
-
import {
|
|
5
|
+
import { INITIAL_POINTS, generateState } from './InteractiveOrientationWidget/state.js';
|
|
6
6
|
import { Behavior } from '../Representations/WidgetRepresentation/Constants.js';
|
|
7
7
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.11.0",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@babel/eslint-parser": "7.22.11",
|
|
54
54
|
"@babel/plugin-transform-runtime": "7.22.10",
|
|
55
55
|
"@babel/preset-env": "7.22.10",
|
|
56
|
-
"@commitlint/cli": "
|
|
57
|
-
"@commitlint/config-conventional": "
|
|
56
|
+
"@commitlint/cli": "19.7.1",
|
|
57
|
+
"@commitlint/config-conventional": "19.7.1",
|
|
58
58
|
"@mapbox/node-pre-gyp": "1.0.9",
|
|
59
59
|
"@rollup/plugin-alias": "3.1.9",
|
|
60
60
|
"@rollup/plugin-babel": "5.3.1",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"@rollup/plugin-eslint": "8.0.2",
|
|
63
63
|
"@rollup/plugin-json": "4.1.0",
|
|
64
64
|
"@rollup/plugin-node-resolve": "13.1.3",
|
|
65
|
+
"@types/node": "^22.13.1",
|
|
65
66
|
"autoprefixer": "10.4.7",
|
|
66
67
|
"babel-loader": "8.2.5",
|
|
67
68
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"cross-env": "7.0.3",
|
|
73
74
|
"css-loader": "6.7.1",
|
|
74
75
|
"dotenv": "16.0.1",
|
|
75
|
-
"dox": "0.
|
|
76
|
+
"dox": "1.0.0",
|
|
76
77
|
"eslint": "8.15.0",
|
|
77
78
|
"eslint-config-airbnb": "19.0.4",
|
|
78
79
|
"eslint-config-prettier": "8.5.0",
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"prettier": "2.6.2",
|
|
106
107
|
"process": "0.11.10",
|
|
107
108
|
"regenerator-runtime": "0.13.9",
|
|
108
|
-
"rollup": "2.
|
|
109
|
+
"rollup": "2.79.2",
|
|
109
110
|
"rollup-plugin-auto-external": "2.0.0",
|
|
110
111
|
"rollup-plugin-copy": "3.4.0",
|
|
111
112
|
"rollup-plugin-ignore": "1.0.10",
|
|
@@ -119,14 +120,14 @@
|
|
|
119
120
|
"string-replace-loader": "3.1.0",
|
|
120
121
|
"style-loader": "3.3.1",
|
|
121
122
|
"tape": "5.5.3",
|
|
122
|
-
"webpack": "5.
|
|
123
|
+
"webpack": "5.97.1",
|
|
123
124
|
"webpack-bundle-analyzer": "4.5.0",
|
|
124
125
|
"webpack-cli": "4.9.2",
|
|
125
126
|
"webpack-dashboard": "3.3.7",
|
|
126
127
|
"webpack-dev-server": "4.9.0",
|
|
127
128
|
"webpack-merge": "5.8.0",
|
|
128
129
|
"webpack-notifier": "1.15.0",
|
|
129
|
-
"wslink": "1.
|
|
130
|
+
"wslink": "1.12.4",
|
|
130
131
|
"xml2js": "0.5.0"
|
|
131
132
|
},
|
|
132
133
|
"peerDependencies": {
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
"lint": "eslint Sources Examples",
|
|
143
144
|
"doc": "kw-doc -c ./Documentation/config.js",
|
|
144
145
|
"doc:www": "npm t -- --single-run && kw-doc -c ./Documentation/config.js -s",
|
|
145
|
-
"doc:
|
|
146
|
+
"doc:minified": "kw-doc -c ./Documentation/config.js -m",
|
|
146
147
|
"doc:generate-api": "node ./Documentation/generate-api-docs.js",
|
|
147
148
|
"example": "node ./Utilities/ExampleRunner/example-runner-cli.js -c ./Documentation/config.js",
|
|
148
149
|
"example:https": "node ./Utilities/ExampleRunner/example-runner-cli.js --server-type https -c ./Documentation/config.js",
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
"dev:esm": "npm run build:esm -- -w",
|
|
151
152
|
"dev:umd": "webpack --watch --config webpack.dev.js --progress",
|
|
152
153
|
"build": "npm run build:release",
|
|
153
|
-
"build:esm": "
|
|
154
|
+
"build:esm": "rollup -c rollup.config.js",
|
|
154
155
|
"build:umd": "webpack --config webpack.prod.js --progress",
|
|
155
156
|
"build:release": "npm run lint && concurrently \"cross-env NOLINT=1 npm run build:esm\" \"cross-env NOLINT=1 npm run build:umd\"",
|
|
156
157
|
"release:create-packages": "node ./Utilities/ci/build-npm-package.js",
|
|
@@ -163,7 +164,7 @@
|
|
|
163
164
|
"commit": "git cz",
|
|
164
165
|
"semantic-release": "semantic-release",
|
|
165
166
|
"prepare": "node ./Utilities/prepare.js",
|
|
166
|
-
"
|
|
167
|
+
"postinstall": "patch-package"
|
|
167
168
|
},
|
|
168
169
|
"config": {
|
|
169
170
|
"commitizen": {
|