@kitware/vtk.js 21.4.0 → 21.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/CONTRIBUTING.md +2 -2
- package/Common/DataModel/ITKHelper.js +34 -8
- package/Rendering/Core/ColorTransferFunction.d.ts +312 -259
- package/Rendering/Core/ColorTransferFunction.js +11 -2
- package/Rendering/Misc/SynchronizableRenderWindow/vtkObjectManager.js +56 -8
- package/Rendering/OpenGL/RenderWindow.js +86 -21
- package/Rendering/WebGPU/RenderWindow.js +3 -2
- package/macros.js +1 -1
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -62,7 +62,7 @@ Please follow the coding style:
|
|
|
62
62
|
If committing changes to `vtk.js@next` or `vtk.js@next-major`, then set your base branch to be `next`
|
|
63
63
|
or `next-major`, respectively. For more info see the section on release channels below.
|
|
64
64
|
|
|
65
|
-
8. vtk.js uses GitHub for code review and
|
|
65
|
+
8. vtk.js uses GitHub for code review and Github Actions to validate proposed patches before they are merged.
|
|
66
66
|
|
|
67
67
|
## Release Channels
|
|
68
68
|
|
|
@@ -110,7 +110,7 @@ you are satisfied with the staging branch changes, you can then merge into eithe
|
|
|
110
110
|
|
|
111
111
|
To create and debug a test:
|
|
112
112
|
- Create a testFuncNameToTest.js in a "test" folder of the class to test.
|
|
113
|
-
-
|
|
113
|
+
- If you want to run just your test, use `test.only(...)` instead of `test(...)`.
|
|
114
114
|
- Run `npm run test:debug`
|
|
115
115
|
- In the opened window, click the Debug button and place breakpoints in browser debugger.
|
|
116
116
|
|
|
@@ -2,9 +2,9 @@ import macro from '../../macros.js';
|
|
|
2
2
|
import vtkImageData from './ImageData.js';
|
|
3
3
|
import vtkDataArray from '../Core/DataArray.js';
|
|
4
4
|
|
|
5
|
-
var vtkErrorMacro = macro.vtkErrorMacro; // see itk.js
|
|
5
|
+
var vtkErrorMacro = macro.vtkErrorMacro; // see itk.js PixelTypes.js
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var ITKJSPixelTypes = {
|
|
8
8
|
Unknown: 0,
|
|
9
9
|
Scalar: 1,
|
|
10
10
|
RGB: 2,
|
|
@@ -21,6 +21,25 @@ var ITKPixelTypes = {
|
|
|
21
21
|
Matrix: 13,
|
|
22
22
|
VariableLengthVector: 14,
|
|
23
23
|
VariableSizeMatrix: 15
|
|
24
|
+
}; // itk-wasm pixel types from https://github.com/InsightSoftwareConsortium/itk-wasm/blob/master/src/core/PixelTypes.ts
|
|
25
|
+
|
|
26
|
+
var ITKWASMPixelTypes = {
|
|
27
|
+
Unknown: 'Unknown',
|
|
28
|
+
Scalar: 'Scalar',
|
|
29
|
+
RGB: 'RGB',
|
|
30
|
+
RGBA: 'RGBA',
|
|
31
|
+
Offset: 'Offset',
|
|
32
|
+
Vector: 'Vector',
|
|
33
|
+
Point: 'Point',
|
|
34
|
+
CovariantVector: 'CovariantVector',
|
|
35
|
+
SymmetricSecondRankTensor: 'SymmetricSecondRankTensor',
|
|
36
|
+
DiffusionTensor3D: 'DiffusionTensor3D',
|
|
37
|
+
Complex: 'Complex',
|
|
38
|
+
FixedArray: 'FixedArray',
|
|
39
|
+
Array: 'Array',
|
|
40
|
+
Matrix: 'Matrix',
|
|
41
|
+
VariableLengthVector: 'VariableLengthVector',
|
|
42
|
+
VariableSizeMatrix: 'VariableSizeMatrix'
|
|
24
43
|
};
|
|
25
44
|
/**
|
|
26
45
|
* Converts an itk.js image to a vtk.js image.
|
|
@@ -35,7 +54,10 @@ function convertItkToVtkImage(itkImage) {
|
|
|
35
54
|
spacing: [1, 1, 1]
|
|
36
55
|
};
|
|
37
56
|
var dimensions = [1, 1, 1];
|
|
38
|
-
var direction = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
57
|
+
var direction = [1, 0, 0, 0, 1, 0, 0, 0, 1]; // Check whether itkImage is an itk.js Image or an itk-wasm Image?
|
|
58
|
+
|
|
59
|
+
var isITKWasm = itkImage.direction.data === undefined;
|
|
60
|
+
var ITKPixelTypes = isITKWasm ? ITKWASMPixelTypes : ITKJSPixelTypes;
|
|
39
61
|
|
|
40
62
|
for (var idx = 0; idx < itkImage.imageType.dimension; ++idx) {
|
|
41
63
|
vtkImage.origin[idx] = itkImage.origin[idx];
|
|
@@ -47,7 +69,11 @@ function convertItkToVtkImage(itkImage) {
|
|
|
47
69
|
// matrix on the vtkImageData is a webGL matrix, which uses a
|
|
48
70
|
// column-major data layout. Transpose the direction matrix from
|
|
49
71
|
// itkImage when instantiating that vtkImageData direction matrix.
|
|
50
|
-
|
|
72
|
+
if (isITKWasm) {
|
|
73
|
+
direction[col + idx * 3] = itkImage.direction[idx + col * itkImage.imageType.dimension];
|
|
74
|
+
} else {
|
|
75
|
+
direction[col + idx * 3] = itkImage.direction.data[idx + col * itkImage.imageType.dimension];
|
|
76
|
+
}
|
|
51
77
|
}
|
|
52
78
|
} // Create VTK Image Data
|
|
53
79
|
|
|
@@ -66,7 +92,7 @@ function convertItkToVtkImage(itkImage) {
|
|
|
66
92
|
imageData.getPointData().setScalars(pointData); // Associate the point data that are 3D vectors / tensors
|
|
67
93
|
// Refer to itk-js/src/PixelTypes.js for numerical values
|
|
68
94
|
|
|
69
|
-
switch (itkImage.imageType.pixelType) {
|
|
95
|
+
switch (ITKPixelTypes[itkImage.imageType.pixelType]) {
|
|
70
96
|
case ITKPixelTypes.Scalar:
|
|
71
97
|
break;
|
|
72
98
|
|
|
@@ -148,7 +174,7 @@ function convertVtkToItkImage(vtkImage) {
|
|
|
148
174
|
var itkImage = {
|
|
149
175
|
imageType: {
|
|
150
176
|
dimension: 3,
|
|
151
|
-
pixelType:
|
|
177
|
+
pixelType: ITKJSPixelTypes.Scalar,
|
|
152
178
|
componentType: '',
|
|
153
179
|
components: 1
|
|
154
180
|
},
|
|
@@ -176,10 +202,10 @@ function convertVtkToItkImage(vtkImage) {
|
|
|
176
202
|
var vtkArray;
|
|
177
203
|
|
|
178
204
|
if (pointData.getTensors() !== null) {
|
|
179
|
-
itkImage.imageType.pixelType =
|
|
205
|
+
itkImage.imageType.pixelType = ITKJSPixelTypes.DiffusionTensor3D;
|
|
180
206
|
vtkArray = pointData.getTensors();
|
|
181
207
|
} else if (pointData.getVectors() != null) {
|
|
182
|
-
itkImage.imageType.pixelType =
|
|
208
|
+
itkImage.imageType.pixelType = ITKJSPixelTypes.Vector;
|
|
183
209
|
vtkArray = pointData.getVectors();
|
|
184
210
|
} else {
|
|
185
211
|
vtkArray = pointData.getScalars();
|
|
@@ -1,269 +1,318 @@
|
|
|
1
1
|
import { vtkObject } from '@kitware/vtk.js/interfaces';
|
|
2
2
|
|
|
3
3
|
export enum ColorSpace {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
RGB,
|
|
5
|
+
HSV,
|
|
6
|
+
LAB,
|
|
7
|
+
DIVERGING,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export enum Scale {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
LINEAR,
|
|
12
|
+
LOG10,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/* TODO: use VtkScalarsToColors instead of VtkObject */
|
|
16
16
|
export interface vtkColorTransferFunction extends vtkObject {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Add a point defined in RGB
|
|
19
|
+
* @param {Number} x The index of the point.
|
|
20
|
+
* @param {Number} r Defines the red component (between 0 and 1).
|
|
21
|
+
* @param {Number} g Defines the green component (between 0 and 1).
|
|
22
|
+
* @param {Number} b Defines the blue component (between 0 and 1).
|
|
23
|
+
*/
|
|
24
|
+
addRGBPoint(x: number, r: number, g: number, b: number): number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Add a point defined in RGB
|
|
28
|
+
* @param {Number} x The index of the point.
|
|
29
|
+
* @param {Number} r Defines the red component (between 0 and 1).
|
|
30
|
+
* @param {Number} g Defines the green component (between 0 and 1).
|
|
31
|
+
* @param {Number} b Defines the blue component (between 0 and 1).
|
|
32
|
+
* @param {Number} [midpoint]
|
|
33
|
+
* @param {Number} [sharpness]
|
|
34
|
+
*/
|
|
35
|
+
addRGBPointLong(
|
|
36
|
+
x: number,
|
|
37
|
+
r: number,
|
|
38
|
+
g: number,
|
|
39
|
+
b: number,
|
|
40
|
+
midpoint?: number,
|
|
41
|
+
sharpness?: number
|
|
42
|
+
): number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Add a point defined in HSV
|
|
46
|
+
* @param {Number} x The index of the point.
|
|
47
|
+
* @param {Number} h Defines the hue of the color (between 0 and 1).
|
|
48
|
+
* @param {Number} s Defines the saturation of the color (between 0 and 1).
|
|
49
|
+
* @param {Number} v Defines the value of the color (between 0 and 1).
|
|
50
|
+
*/
|
|
51
|
+
addHSVPoint(x: number, h: number, s: number, v: number): number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Add a line defined in RGB
|
|
55
|
+
* @param {Number} x1 The index of the first point.
|
|
56
|
+
* @param {Number} r1 Defines the red component of the first point(between 0 and 1).
|
|
57
|
+
* @param {Number} g1 Defines the green component of the first point(between 0 and 1).
|
|
58
|
+
* @param {Number} b1 Defines the red component of the first point (between 0 and 1).
|
|
59
|
+
* @param {Number} x2 The index of the second point.
|
|
60
|
+
* @param {Number} r2 Defines the red component of the second point (between 0 and 1).
|
|
61
|
+
* @param {Number} g2 Defines the green component of the second point (between 0 and 1).
|
|
62
|
+
* @param {Number} b2 Defines the blue component of the second point (between 0 and 1).
|
|
63
|
+
*/
|
|
64
|
+
addRGBSegment(
|
|
65
|
+
x1: number,
|
|
66
|
+
r1: number,
|
|
67
|
+
g1: number,
|
|
68
|
+
b1: number,
|
|
69
|
+
x2: number,
|
|
70
|
+
r2: number,
|
|
71
|
+
g2: number,
|
|
72
|
+
b2: number
|
|
73
|
+
): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Add a line defined in HSV
|
|
77
|
+
* @param {Number} x1 The index of the first point.
|
|
78
|
+
* @param {Number} h1 Defines the hue of the color of the first point (between 0 and 1).
|
|
79
|
+
* @param {Number} s1 Defines the saturation of the color of the first point (between 0 and 1).
|
|
80
|
+
* @param {Number} v1 Defines the value of the color of the first point (between 0 and 1).
|
|
81
|
+
* @param {Number} x2 The index of the second point.
|
|
82
|
+
* @param {Number} h2 Defines the hue of the colorof the second point (between 0 and 1).
|
|
83
|
+
* @param {Number} s2 Defines the saturation of the color of the second point (between 0 and 1).
|
|
84
|
+
* @param {Number} v2 Defines the value of the color of the second point (between 0 and 1).
|
|
85
|
+
*/
|
|
86
|
+
addHSVSegment(
|
|
87
|
+
x1: number,
|
|
88
|
+
h1: number,
|
|
89
|
+
s1: number,
|
|
90
|
+
v1: number,
|
|
91
|
+
x2: number,
|
|
92
|
+
h2: number,
|
|
93
|
+
s2: number,
|
|
94
|
+
v2: number
|
|
95
|
+
): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Add a point defined in HSV
|
|
99
|
+
* @param {Number} x The index of the point.
|
|
100
|
+
* @param {Number} h Defines the hue of the color (between 0 and 1).
|
|
101
|
+
* @param {Number} s Defines the saturation of the color (between 0 and 1).
|
|
102
|
+
* @param {Number} v Defines the value of the color (between 0 and 1).
|
|
103
|
+
* @param {Number} [midpoint]
|
|
104
|
+
* @param {Number} [sharpness]
|
|
105
|
+
*/
|
|
106
|
+
addHSVPointLong(
|
|
107
|
+
x: number,
|
|
108
|
+
h: number,
|
|
109
|
+
s: number,
|
|
110
|
+
v: number,
|
|
111
|
+
midpoint?: number,
|
|
112
|
+
sharpness?: number
|
|
113
|
+
): number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the number of points which specify this function
|
|
117
|
+
*/
|
|
118
|
+
getSize(): number;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Set nodes directly
|
|
122
|
+
* @param nodes
|
|
123
|
+
*
|
|
124
|
+
* @returns true if a change happen
|
|
125
|
+
*/
|
|
126
|
+
setNodes(nodes: any): boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sort the vector in increasing order, then fill in
|
|
130
|
+
* the Range
|
|
131
|
+
*
|
|
132
|
+
* @returns true if a change happen
|
|
133
|
+
*/
|
|
134
|
+
sortAndUpdateRange(): boolean;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @returns true if a change happen
|
|
138
|
+
*/
|
|
139
|
+
updateRange(): boolean;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Remove a point
|
|
143
|
+
* @param {Number} x The index of the point.
|
|
144
|
+
*/
|
|
145
|
+
removePoint(x: number): number;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Moves point from oldX to newX.
|
|
149
|
+
*
|
|
150
|
+
* It removed the point from oldX. If any point existed at newX, it will also be removed.
|
|
151
|
+
* @param {Number} oldX The old index of the point.
|
|
152
|
+
* @param {Number} newX The new index of the point.
|
|
153
|
+
*/
|
|
154
|
+
movePoint(oldX: number, newX: number): void;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Remove all points
|
|
158
|
+
*/
|
|
159
|
+
removeAllPoints(): void;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get the RGBA color evaluated at the specified location
|
|
163
|
+
* @param {Number} x The index of the point.
|
|
164
|
+
*/
|
|
165
|
+
mapValue(x: number): any;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get the RGB color evaluated at the specified location
|
|
169
|
+
* @param {Number} x The index of the point.
|
|
170
|
+
* @param {Number[]} rgb The Array of the RGB color to fill.
|
|
171
|
+
*/
|
|
172
|
+
getColor(x: number, rgb: number[]): void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get the red color evaluated at the specified location
|
|
176
|
+
* @param {Number} x The index of the point.
|
|
177
|
+
*/
|
|
178
|
+
getRedValue(x: number): number;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Get the green color evaluated at the specified location
|
|
182
|
+
* @param {Number} x The index of the point.
|
|
183
|
+
*/
|
|
184
|
+
getGreenValue(x: number): number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get the blue color evaluated at the specified location
|
|
188
|
+
* @param {Number} x The index of the point.
|
|
189
|
+
*/
|
|
190
|
+
getBlueValue(x: number): number;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get a table of RGB colors at regular intervals along the function
|
|
194
|
+
* @param {Number} xStart The index of the first point.
|
|
195
|
+
* @param {Number} xEnd The index of the second point.
|
|
196
|
+
* @param {Number} size
|
|
197
|
+
* @param {Number[]} table
|
|
198
|
+
*/
|
|
199
|
+
getTable(xStart: number, xEnd: number, size: number, table: number[]): void;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {Number} xStart The index of the first point.
|
|
203
|
+
* @param {Number} xEnd The index of the first point.
|
|
204
|
+
* @param {Number} size
|
|
205
|
+
* @param {Boolean} withAlpha
|
|
206
|
+
*/
|
|
207
|
+
getUint8Table(
|
|
208
|
+
xStart: number,
|
|
209
|
+
xEnd: number,
|
|
210
|
+
size: number,
|
|
211
|
+
withAlpha: boolean
|
|
212
|
+
): Float32Array;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Construct a color transfer function from a table.
|
|
216
|
+
* @param {Number} xStart The index of the first point.
|
|
217
|
+
* @param {Number} xEnd The index of the first point.
|
|
218
|
+
* @param {Number} size
|
|
219
|
+
* @param {Number[]} table
|
|
220
|
+
*/
|
|
221
|
+
buildFunctionFromTable(
|
|
222
|
+
xStart: number,
|
|
223
|
+
xEnd: number,
|
|
224
|
+
size: number,
|
|
225
|
+
table: number[]
|
|
226
|
+
): void;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* For the node specified by index, set/get the location (X), R, G, and B
|
|
230
|
+
* values, midpoint, and sharpness values at the node.
|
|
231
|
+
* @param {Number} index
|
|
232
|
+
* @param {Number[]} val
|
|
233
|
+
*/
|
|
234
|
+
getNodeValue(index: number, val: number[]): number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* For a specified index value, set the node parameters
|
|
238
|
+
* @param {Number} index
|
|
239
|
+
* @param {Number[]} val
|
|
240
|
+
*/
|
|
241
|
+
setNodeValue(index: number, val: number[]): number;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get the number of available colors for mapping to.
|
|
245
|
+
*/
|
|
246
|
+
getNumberOfAvailableColors(): number;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Get the color given an integer index.
|
|
250
|
+
* @param {Number} idx The index of the point.
|
|
251
|
+
* @param {Number[]} rgba An Array of the RGBA color.
|
|
252
|
+
*/
|
|
253
|
+
getIndexedColor(idx: number, rgba: number[]): void;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Defines the nodes from an array ptr with the layout [X1, R1, G1, B1, X2,
|
|
257
|
+
* R2, G2, B2, ..., Xn, Rn, Gn, Bn] where n is the number of nodes.
|
|
258
|
+
* @param {Number} nb
|
|
259
|
+
* @param ptr
|
|
260
|
+
*/
|
|
261
|
+
fillFromDataPointer(nb: number, ptr: any): void;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Set the range of scalars being mapped.
|
|
265
|
+
* @param {Number} min
|
|
266
|
+
* @param {Number} max
|
|
267
|
+
*/
|
|
268
|
+
setMappingRange(min: number, max: number): void;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Remove all points out of the new range, and make sure there is a point at
|
|
272
|
+
* each end of that range.
|
|
273
|
+
* @param {Number[]} range
|
|
274
|
+
*/
|
|
275
|
+
adjustRange(range: number[]): number;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Estimates the minimum size of a table such that it would correctly sample this function.
|
|
279
|
+
* @param {Number} x1
|
|
280
|
+
* @param {Number} x2
|
|
281
|
+
*/
|
|
282
|
+
estimateMinNumberOfSamples(x1: number, x2: number): number;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Traverses the nodes to find the minimum distance.
|
|
286
|
+
*/
|
|
287
|
+
findMinimumXDistance(): number;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* @param input
|
|
292
|
+
* @param output
|
|
293
|
+
* @param outFormat
|
|
294
|
+
* @param inputOffset
|
|
295
|
+
*/
|
|
296
|
+
mapScalarsThroughTable(
|
|
297
|
+
input: any,
|
|
298
|
+
output: any,
|
|
299
|
+
outFormat: any,
|
|
300
|
+
inputOffset: any
|
|
301
|
+
): void;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Map a set of scalars through the lookup table.
|
|
305
|
+
* @param input
|
|
306
|
+
* @param output
|
|
307
|
+
* @param outFormat
|
|
308
|
+
* @param inputOffset
|
|
309
|
+
*/
|
|
310
|
+
mapData(input: any, output: any, outFormat: any, inputOffset: any): void;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @param colorMap
|
|
314
|
+
*/
|
|
315
|
+
applyColorMap(colorMap: any): void;
|
|
267
316
|
}
|
|
268
317
|
|
|
269
318
|
/**
|
|
@@ -273,7 +322,11 @@ export interface vtkColorTransferFunction extends vtkObject {
|
|
|
273
322
|
* @param model object on which data structure will be bounds (protected)
|
|
274
323
|
* @param {object} [initialValues] (default: {})
|
|
275
324
|
*/
|
|
276
|
-
export function extend(
|
|
325
|
+
export function extend(
|
|
326
|
+
publicAPI: object,
|
|
327
|
+
model: object,
|
|
328
|
+
initialValues?: object
|
|
329
|
+
): void;
|
|
277
330
|
|
|
278
331
|
/**
|
|
279
332
|
* Method use to create a new instance of vtkColorTransferFunction
|
|
@@ -303,7 +356,7 @@ export function newInstance(initialValues?: object): vtkColorTransferFunction;
|
|
|
303
356
|
*/
|
|
304
357
|
|
|
305
358
|
export declare const vtkColorTransferFunction: {
|
|
306
|
-
|
|
307
|
-
|
|
359
|
+
newInstance: typeof newInstance;
|
|
360
|
+
extend: typeof extend;
|
|
308
361
|
};
|
|
309
362
|
export default vtkColorTransferFunction;
|
|
@@ -221,23 +221,32 @@ function vtkColorTransferFunction(publicAPI, model) {
|
|
|
221
221
|
|
|
222
222
|
publicAPI.setNodes = function (nodes) {
|
|
223
223
|
if (model.nodes !== nodes) {
|
|
224
|
+
var before = JSON.stringify(model.nodes);
|
|
224
225
|
model.nodes = nodes;
|
|
225
|
-
|
|
226
|
+
var after = JSON.stringify(model.nodes);
|
|
227
|
+
return publicAPI.sortAndUpdateRange() || before !== after;
|
|
226
228
|
}
|
|
229
|
+
|
|
230
|
+
return false;
|
|
227
231
|
}; //----------------------------------------------------------------------------
|
|
228
232
|
// Sort the vector in increasing order, then fill in
|
|
229
233
|
// the Range
|
|
230
234
|
|
|
231
235
|
|
|
232
236
|
publicAPI.sortAndUpdateRange = function () {
|
|
237
|
+
var before = JSON.stringify(model.nodes);
|
|
233
238
|
model.nodes.sort(function (a, b) {
|
|
234
239
|
return a.x - b.x;
|
|
235
240
|
});
|
|
241
|
+
var after = JSON.stringify(model.nodes);
|
|
236
242
|
var modifiedInvoked = publicAPI.updateRange(); // If range is updated, Modified() has been called, don't call it again.
|
|
237
243
|
|
|
238
|
-
if (!modifiedInvoked) {
|
|
244
|
+
if (!modifiedInvoked && before !== after) {
|
|
239
245
|
publicAPI.modified();
|
|
246
|
+
return true;
|
|
240
247
|
}
|
|
248
|
+
|
|
249
|
+
return modifiedInvoked;
|
|
241
250
|
}; //----------------------------------------------------------------------------
|
|
242
251
|
|
|
243
252
|
|
|
@@ -102,12 +102,29 @@ function bindArrays(arraysToBind) {
|
|
|
102
102
|
|
|
103
103
|
function createNewArrayHandler(instance, arrayMetadata, arraysToBind) {
|
|
104
104
|
return function (values) {
|
|
105
|
+
var regMethod = arrayMetadata.registration ? arrayMetadata.registration : 'addArray';
|
|
106
|
+
var location = arrayMetadata.location ? instance.getReferenceByName(arrayMetadata.location) : instance; // Try to prevent unncessary modified
|
|
107
|
+
|
|
108
|
+
var previousArray = null;
|
|
109
|
+
|
|
110
|
+
if (arrayMetadata.location) {
|
|
111
|
+
previousArray = instance.getReferenceByName(arrayMetadata.location).getArray(arrayMetadata.name);
|
|
112
|
+
} else {
|
|
113
|
+
previousArray = instance["get".concat(regMethod.substring(3))]();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (previousArray) {
|
|
117
|
+
if (previousArray.getData() !== values) {
|
|
118
|
+
arraysToBind.push([previousArray.setData, [values, arrayMetadata.numberOfComponents]]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return previousArray;
|
|
122
|
+
}
|
|
123
|
+
|
|
105
124
|
var vtkClass = arrayMetadata.vtkClass ? arrayMetadata.vtkClass : 'vtkDataArray';
|
|
106
125
|
var array = DATA_ARRAY_MAPPER[vtkClass].newInstance(_objectSpread(_objectSpread({}, arrayMetadata), {}, {
|
|
107
126
|
values: values
|
|
108
127
|
}));
|
|
109
|
-
var regMethod = arrayMetadata.registration ? arrayMetadata.registration : 'addArray';
|
|
110
|
-
var location = arrayMetadata.location ? instance.getReferenceByName(arrayMetadata.location) : instance;
|
|
111
128
|
arraysToBind.push([location[regMethod], [array]]);
|
|
112
129
|
return array;
|
|
113
130
|
};
|
|
@@ -273,6 +290,11 @@ function genericUpdater(instance, state, context) {
|
|
|
273
290
|
context.start(); // -> start(arraysToBind)
|
|
274
291
|
|
|
275
292
|
dependencies.push(Promise.all(promises).then(function () {
|
|
293
|
+
// Since some arrays are getting updated, we should modify our dataset
|
|
294
|
+
if (arraysToBind.length) {
|
|
295
|
+
instance.modified();
|
|
296
|
+
}
|
|
297
|
+
|
|
276
298
|
bindArrays(arraysToBind);
|
|
277
299
|
return true;
|
|
278
300
|
}).catch(function (error) {
|
|
@@ -429,8 +451,6 @@ function colorTransferFunctionUpdater(instance, state, context) {
|
|
|
429
451
|
instance.set(_objectSpread(_objectSpread({}, state.properties), {}, {
|
|
430
452
|
nodes: nodes
|
|
431
453
|
}), true);
|
|
432
|
-
instance.sortAndUpdateRange();
|
|
433
|
-
instance.modified();
|
|
434
454
|
context.end(); // -> end(colorTransferFunctionUpdater)
|
|
435
455
|
}
|
|
436
456
|
|
|
@@ -454,12 +474,30 @@ function piecewiseFunctionUpdater(instance, state, context) {
|
|
|
454
474
|
instance.set(_objectSpread(_objectSpread({}, state.properties), {}, {
|
|
455
475
|
nodes: nodes
|
|
456
476
|
}), true);
|
|
457
|
-
instance.sortAndUpdateRange();
|
|
458
|
-
|
|
477
|
+
instance.sortAndUpdateRange(); // instance.modified();
|
|
478
|
+
|
|
459
479
|
context.end(); // -> end(piecewiseFunctionUpdater)
|
|
460
480
|
} // ----------------------------------------------------------------------------
|
|
461
481
|
|
|
462
482
|
|
|
483
|
+
function removeUnavailableArrays(fields, availableNames) {
|
|
484
|
+
var namesToDelete = [];
|
|
485
|
+
var size = fields.getNumberOfArrays();
|
|
486
|
+
|
|
487
|
+
for (var i = 0; i < size; i++) {
|
|
488
|
+
var array = fields.getArray(i);
|
|
489
|
+
var name = array.getName();
|
|
490
|
+
|
|
491
|
+
if (!availableNames.has(name)) {
|
|
492
|
+
namesToDelete.push(name);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
for (var _i = 0; _i < namesToDelete.length; _i++) {
|
|
497
|
+
fields.removeArray(namesToDelete[_i]);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
463
501
|
function createDataSetUpdate() {
|
|
464
502
|
var piecesToFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
465
503
|
return function (instance, state, context) {
|
|
@@ -489,8 +527,18 @@ function createDataSetUpdate() {
|
|
|
489
527
|
|
|
490
528
|
delete state.properties.fields; // Reset any pre-existing fields array
|
|
491
529
|
|
|
492
|
-
|
|
493
|
-
|
|
530
|
+
var arrayToKeep = {
|
|
531
|
+
pointData: new Set(),
|
|
532
|
+
cellData: new Set(),
|
|
533
|
+
fieldData: new Set()
|
|
534
|
+
};
|
|
535
|
+
fieldsArrays.forEach(function (_ref5) {
|
|
536
|
+
var location = _ref5.location,
|
|
537
|
+
name = _ref5.name;
|
|
538
|
+
arrayToKeep[location].add(name);
|
|
539
|
+
});
|
|
540
|
+
removeUnavailableArrays(instance.getPointData(), arrayToKeep.pointData);
|
|
541
|
+
removeUnavailableArrays(instance.getCellData(), arrayToKeep.cellData); // Generic handling
|
|
494
542
|
|
|
495
543
|
var res = genericUpdater(instance, state, context); // Finish what we started
|
|
496
544
|
|
|
@@ -22,6 +22,19 @@ var SCREENSHOT_PLACEHOLDER = {
|
|
|
22
22
|
width: '100%',
|
|
23
23
|
height: '100%'
|
|
24
24
|
};
|
|
25
|
+
var DEFAULT_RESET_FACTORS = {
|
|
26
|
+
vr: {
|
|
27
|
+
rescaleFactor: 1.0,
|
|
28
|
+
translateZ: -0.7 // 0.7 m forward from the camera
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
ar: {
|
|
32
|
+
rescaleFactor: 0.25,
|
|
33
|
+
// scale down AR for viewing comfort by default
|
|
34
|
+
translateZ: -0.5 // 0.5 m forward from the camera
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
};
|
|
25
38
|
|
|
26
39
|
function checkRenderTargetSupport(gl, format, type) {
|
|
27
40
|
// create temporary frame buffer and texture
|
|
@@ -245,21 +258,28 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
245
258
|
// typically in response to a user request such as a button press
|
|
246
259
|
|
|
247
260
|
|
|
248
|
-
publicAPI.startXR = function () {
|
|
261
|
+
publicAPI.startXR = function (isAR) {
|
|
249
262
|
if (navigator.xr === undefined) {
|
|
250
263
|
throw new Error('WebXR is not available');
|
|
251
264
|
}
|
|
252
265
|
|
|
253
|
-
|
|
254
|
-
|
|
266
|
+
model.xrSessionIsAR = isAR;
|
|
267
|
+
var sessionType = isAR ? 'immersive-ar' : 'immersive-vr';
|
|
268
|
+
|
|
269
|
+
if (!navigator.xr.isSessionSupported(sessionType)) {
|
|
270
|
+
if (isAR) {
|
|
271
|
+
throw new Error('Device does not support AR session');
|
|
272
|
+
} else {
|
|
273
|
+
throw new Error('VR display is not available');
|
|
274
|
+
}
|
|
255
275
|
}
|
|
256
276
|
|
|
257
277
|
if (model.xrSession === null) {
|
|
258
|
-
navigator.xr.requestSession(
|
|
259
|
-
throw new Error('Failed to create
|
|
278
|
+
navigator.xr.requestSession(sessionType).then(publicAPI.enterXR, function () {
|
|
279
|
+
throw new Error('Failed to create XR session!');
|
|
260
280
|
});
|
|
261
281
|
} else {
|
|
262
|
-
throw new Error('
|
|
282
|
+
throw new Error('XR Session already exists!');
|
|
263
283
|
}
|
|
264
284
|
}; // When an XR session is available, set up the XRWebGLLayer
|
|
265
285
|
// and request the first animation frame for the device
|
|
@@ -276,7 +296,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
276
296
|
model.oldCanvasSize = model.size.slice();
|
|
277
297
|
|
|
278
298
|
if (!(model.xrSession !== null)) {
|
|
279
|
-
_context.next =
|
|
299
|
+
_context.next = 15;
|
|
280
300
|
break;
|
|
281
301
|
}
|
|
282
302
|
|
|
@@ -293,15 +313,16 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
293
313
|
model.xrSession.requestReferenceSpace('local').then(function (refSpace) {
|
|
294
314
|
model.xrReferenceSpace = refSpace;
|
|
295
315
|
});
|
|
316
|
+
publicAPI.resetXRScene();
|
|
296
317
|
model.renderable.getInteractor().switchToXRAnimation();
|
|
297
318
|
model.xrSceneFrame = model.xrSession.requestAnimationFrame(publicAPI.xrRender);
|
|
298
|
-
_context.next =
|
|
319
|
+
_context.next = 16;
|
|
299
320
|
break;
|
|
300
321
|
|
|
301
|
-
case
|
|
322
|
+
case 15:
|
|
302
323
|
throw new Error('Failed to enter VR with a null xrSession.');
|
|
303
324
|
|
|
304
|
-
case
|
|
325
|
+
case 16:
|
|
305
326
|
case "end":
|
|
306
327
|
return _context.stop();
|
|
307
328
|
}
|
|
@@ -314,6 +335,36 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
314
335
|
};
|
|
315
336
|
}();
|
|
316
337
|
|
|
338
|
+
publicAPI.resetXRScene = function () {
|
|
339
|
+
var inputRescaleFactor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_RESET_FACTORS.vr.rescaleFactor;
|
|
340
|
+
var inputTranslateZ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_RESET_FACTORS.vr.translateZ;
|
|
341
|
+
// Adjust world-to-physical parameters for different modalities
|
|
342
|
+
// Default parameter values are for VR (model.xrSessionIsAR == false)
|
|
343
|
+
var rescaleFactor = inputRescaleFactor;
|
|
344
|
+
var translateZ = inputTranslateZ;
|
|
345
|
+
|
|
346
|
+
if (model.xrSessionIsAR && rescaleFactor === DEFAULT_RESET_FACTORS.vr.rescaleFactor) {
|
|
347
|
+
// Scale down by default in AR
|
|
348
|
+
rescaleFactor = DEFAULT_RESET_FACTORS.ar.rescaleFactor;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (model.xrSessionIsAR && translateZ === DEFAULT_RESET_FACTORS.vr.translateZ) {
|
|
352
|
+
// Default closer to the camera in AR
|
|
353
|
+
translateZ = DEFAULT_RESET_FACTORS.ar.translateZ;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var ren = model.renderable.getRenderers()[0];
|
|
357
|
+
ren.resetCamera();
|
|
358
|
+
var camera = ren.getActiveCamera();
|
|
359
|
+
var physicalScale = camera.getPhysicalScale();
|
|
360
|
+
var physicalTranslation = camera.getPhysicalTranslation();
|
|
361
|
+
physicalScale /= rescaleFactor;
|
|
362
|
+
translateZ *= physicalScale;
|
|
363
|
+
physicalTranslation[2] += translateZ;
|
|
364
|
+
camera.setPhysicalScale(physicalScale);
|
|
365
|
+
camera.setPhysicalTranslation(physicalTranslation);
|
|
366
|
+
};
|
|
367
|
+
|
|
317
368
|
publicAPI.stopXR = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
318
369
|
var gl, ren;
|
|
319
370
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -348,7 +399,10 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
348
399
|
model.xrSession = null;
|
|
349
400
|
|
|
350
401
|
case 10:
|
|
351
|
-
|
|
402
|
+
if (model.oldCanvasSize !== undefined) {
|
|
403
|
+
publicAPI.setSize.apply(publicAPI, _toConsumableArray(model.oldCanvasSize));
|
|
404
|
+
} // Reset to default canvas
|
|
405
|
+
|
|
352
406
|
|
|
353
407
|
ren = model.renderable.getRenderers()[0];
|
|
354
408
|
ren.getActiveCamera().setProjectionMatrix(null);
|
|
@@ -378,6 +432,12 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
378
432
|
|
|
379
433
|
if (xrPose) {
|
|
380
434
|
gl = publicAPI.get3DContext();
|
|
435
|
+
|
|
436
|
+
if (model.xrSessionIsAR && model.oldCanvasSize !== undefined) {
|
|
437
|
+
gl.canvas.width = model.oldCanvasSize[0];
|
|
438
|
+
gl.canvas.height = model.oldCanvasSize[1];
|
|
439
|
+
}
|
|
440
|
+
|
|
381
441
|
glLayer = xrSession.renderState.baseLayer;
|
|
382
442
|
gl.bindFramebuffer(gl.FRAMEBUFFER, glLayer.framebuffer);
|
|
383
443
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
@@ -387,15 +447,18 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
387
447
|
|
|
388
448
|
xrPose.views.forEach(function (view) {
|
|
389
449
|
var viewport = glLayer.getViewport(view);
|
|
390
|
-
gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
450
|
+
gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); // TODO: Appropriate handling for AR passthrough on HMDs
|
|
451
|
+
// with two eyes will require further investigation.
|
|
452
|
+
|
|
453
|
+
if (!model.xrSessionIsAR) {
|
|
454
|
+
if (view.eye === 'left') {
|
|
455
|
+
ren.setViewport(0, 0, 0.5, 1.0);
|
|
456
|
+
} else if (view.eye === 'right') {
|
|
457
|
+
ren.setViewport(0.5, 0, 1.0, 1.0);
|
|
458
|
+
} else {
|
|
459
|
+
// No handling for non-eye viewport
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
399
462
|
}
|
|
400
463
|
|
|
401
464
|
ren.getActiveCamera().computeViewParametersFromPhysicalMatrix(view.transform.inverse.matrix);
|
|
@@ -777,7 +840,9 @@ var DEFAULT_VALUES = {
|
|
|
777
840
|
// attempt webgl2 on by default
|
|
778
841
|
activeFramebuffer: null,
|
|
779
842
|
xrSession: null,
|
|
843
|
+
xrSessionIsAR: false,
|
|
780
844
|
xrReferenceSpace: null,
|
|
845
|
+
xrSupported: true,
|
|
781
846
|
imageFormat: 'image/png',
|
|
782
847
|
useOffScreen: false,
|
|
783
848
|
useBackgroundImage: false
|
|
@@ -820,7 +885,7 @@ function extend(publicAPI, model) {
|
|
|
820
885
|
macro.event(publicAPI, model, 'imageReady');
|
|
821
886
|
macro.event(publicAPI, model, 'haveVRDisplay'); // Build VTK API
|
|
822
887
|
|
|
823
|
-
macro.get(publicAPI, model, ['shaderCache', 'textureUnitManager', 'webgl2', 'vrDisplay', 'useBackgroundImage']);
|
|
888
|
+
macro.get(publicAPI, model, ['shaderCache', 'textureUnitManager', 'webgl2', 'vrDisplay', 'useBackgroundImage', 'xrSupported']);
|
|
824
889
|
macro.setGet(publicAPI, model, ['initialized', 'context', 'canvas', 'renderPasses', 'notifyStartCaptureImage', 'defaultToWebgl2', 'cursor', 'useOffScreen', // might want to make this not call modified as
|
|
825
890
|
// we change the active framebuffer a lot. Or maybe
|
|
826
891
|
// only mark modified if the size or depth
|
|
@@ -616,7 +616,8 @@ var DEFAULT_VALUES = {
|
|
|
616
616
|
imageFormat: 'image/png',
|
|
617
617
|
useOffScreen: false,
|
|
618
618
|
useBackgroundImage: false,
|
|
619
|
-
nextPropID: 1
|
|
619
|
+
nextPropID: 1,
|
|
620
|
+
xrSupported: false
|
|
620
621
|
}; // ----------------------------------------------------------------------------
|
|
621
622
|
|
|
622
623
|
function extend(publicAPI, model) {
|
|
@@ -652,7 +653,7 @@ function extend(publicAPI, model) {
|
|
|
652
653
|
macro.event(publicAPI, model, 'imageReady');
|
|
653
654
|
macro.event(publicAPI, model, 'initialized'); // Build VTK API
|
|
654
655
|
|
|
655
|
-
macro.get(publicAPI, model, ['commandEncoder', 'device', 'useBackgroundImage']);
|
|
656
|
+
macro.get(publicAPI, model, ['commandEncoder', 'device', 'useBackgroundImage', 'xrSupported']);
|
|
656
657
|
macro.setGet(publicAPI, model, ['initialized', 'context', 'canvas', 'device', 'renderPasses', 'notifyStartCaptureImage', 'cursor', 'useOffScreen']);
|
|
657
658
|
macro.setGetArray(publicAPI, model, ['size'], 2); // Object methods
|
|
658
659
|
|
package/macros.js
CHANGED