@kitware/vtk.js 21.1.5 → 21.2.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/Transform/LandmarkTransform.d.ts +1 -1
- package/Filters/Sources/Arrow2DSource.d.ts +14 -13
- package/Filters/Sources/ArrowSource.d.ts +9 -8
- package/Filters/Sources/CircleSource.d.ts +15 -14
- package/Filters/Sources/ConeSource.d.ts +18 -17
- package/Filters/Sources/CubeSource.d.ts +19 -19
- package/Filters/Sources/Cursor3D.d.ts +19 -16
- package/Filters/Sources/CylinderSource.d.ts +15 -14
- package/Filters/Sources/LineSource.d.ts +1 -1
- package/Filters/Sources/PlaneSource.d.ts +29 -28
- package/Filters/Sources/PointSource.d.ts +9 -8
- package/Filters/Sources/SphereSource.d.ts +9 -8
- package/Rendering/Core/AbstractMapper.js +1 -0
- package/Rendering/Core/Light.d.ts +277 -234
- package/Rendering/Core/Property.d.ts +43 -43
- package/Rendering/Core/Property2D.d.ts +21 -5
- package/Rendering/Core/RenderWindowInteractor.js +7 -7
- package/Rendering/Core/Volume.d.ts +9 -0
- package/Rendering/OpenGL/ImageMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper.js +5 -17
- package/Rendering/OpenGL/RenderWindow.js +190 -106
- package/Rendering/OpenGL/ShaderProgram.js +0 -12
- package/interfaces.d.ts +66 -24
- package/package.json +1 -1
- package/types.d.ts +4 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
4
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
5
|
+
import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
|
|
3
6
|
import macro from '../../macros.js';
|
|
4
7
|
import { registerViewConstructor } from '../Core/RenderWindow.js';
|
|
5
8
|
import vtkForwardPass from './ForwardPass.js';
|
|
9
|
+
import vtkHardwareSelector from './HardwareSelector.js';
|
|
10
|
+
import vtkShaderCache from './ShaderCache.js';
|
|
11
|
+
import vtkTextureUnitManager from './TextureUnitManager.js';
|
|
6
12
|
import vtkViewNodeFactory from './ViewNodeFactory.js';
|
|
7
13
|
import vtkRenderPass from '../SceneGraph/RenderPass.js';
|
|
8
|
-
import vtkShaderCache from './ShaderCache.js';
|
|
9
14
|
import vtkRenderWindowViewNode from '../SceneGraph/RenderWindowViewNode.js';
|
|
10
|
-
import vtkTextureUnitManager from './TextureUnitManager.js';
|
|
11
|
-
import vtkHardwareSelector from './HardwareSelector.js';
|
|
12
|
-
import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
|
|
13
15
|
|
|
14
16
|
var vtkDebugMacro = macro.vtkDebugMacro,
|
|
15
17
|
vtkErrorMacro = macro.vtkErrorMacro;
|
|
16
|
-
var IS_CHROME = navigator.userAgent.indexOf('Chrome') !== -1;
|
|
17
18
|
var SCREENSHOT_PLACEHOLDER = {
|
|
18
19
|
position: 'absolute',
|
|
19
20
|
top: 0,
|
|
@@ -211,7 +212,12 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
211
212
|
depth: true,
|
|
212
213
|
alpha: true
|
|
213
214
|
};
|
|
214
|
-
var result = null;
|
|
215
|
+
var result = null; // Do we have webxr support
|
|
216
|
+
|
|
217
|
+
if (navigator.xr !== undefined && navigator.xr.isSessionSupported('immersive-vr')) {
|
|
218
|
+
publicAPI.invokeHaveVRDisplay();
|
|
219
|
+
}
|
|
220
|
+
|
|
215
221
|
var webgl2Supported = typeof WebGL2RenderingContext !== 'undefined';
|
|
216
222
|
model.webgl2 = false;
|
|
217
223
|
|
|
@@ -227,22 +233,6 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
227
233
|
if (!result) {
|
|
228
234
|
vtkDebugMacro('using webgl1');
|
|
229
235
|
result = model.canvas.getContext('webgl', options) || model.canvas.getContext('experimental-webgl', options);
|
|
230
|
-
} // Do we have webvr support
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (navigator.getVRDisplays) {
|
|
234
|
-
navigator.getVRDisplays().then(function (displays) {
|
|
235
|
-
if (displays.length > 0) {
|
|
236
|
-
// take the first display for now
|
|
237
|
-
model.vrDisplay = displays[0]; // set the clipping ranges
|
|
238
|
-
|
|
239
|
-
model.vrDisplay.depthNear = 0.01; // meters
|
|
240
|
-
|
|
241
|
-
model.vrDisplay.depthFar = 100.0; // meters
|
|
242
|
-
|
|
243
|
-
publicAPI.invokeHaveVRDisplay();
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
236
|
} // prevent default context lost handler
|
|
247
237
|
|
|
248
238
|
|
|
@@ -251,84 +241,180 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
251
241
|
}, false);
|
|
252
242
|
model.canvas.addEventListener('webglcontextrestored', publicAPI.restoreContext, false);
|
|
253
243
|
return result;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
publicAPI.startVR = function () {
|
|
257
|
-
model.oldCanvasSize = model.size.slice();
|
|
244
|
+
}; // Request an XR session on the user device with WebXR,
|
|
245
|
+
// typically in response to a user request such as a button press
|
|
258
246
|
|
|
259
|
-
if (model.vrDisplay.capabilities.canPresent) {
|
|
260
|
-
model.vrDisplay.requestPresent([{
|
|
261
|
-
source: model.canvas
|
|
262
|
-
}]).then(function () {
|
|
263
|
-
if (model.el && model.vrDisplay.capabilities.hasExternalDisplay && model.hideCanvasInVR) {
|
|
264
|
-
model.el.style.display = 'none';
|
|
265
|
-
}
|
|
266
247
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
var height = Math.floor(Math.max(leftEye.renderHeight, rightEye.renderHeight));
|
|
272
|
-
publicAPI.setSize(width, height);
|
|
273
|
-
} else {
|
|
274
|
-
publicAPI.setSize(model.vrResolution);
|
|
275
|
-
}
|
|
248
|
+
publicAPI.startXR = function () {
|
|
249
|
+
if (navigator.xr === undefined) {
|
|
250
|
+
throw new Error('WebXR is not available');
|
|
251
|
+
}
|
|
276
252
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
model.renderable.getInteractor().switchToVRAnimation();
|
|
281
|
-
model.vrSceneFrame = model.vrDisplay.requestAnimationFrame(publicAPI.vrRender); // If Broswer is chrome we need to request animation again to canvas update
|
|
253
|
+
if (!navigator.xr.isSessionSupported('immersive-vr')) {
|
|
254
|
+
throw new Error('VR display is not available');
|
|
255
|
+
}
|
|
282
256
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}).catch(function () {
|
|
287
|
-
console.error('failed to requestPresent');
|
|
257
|
+
if (model.xrSession === null) {
|
|
258
|
+
navigator.xr.requestSession('immersive-vr').then(publicAPI.enterXR, function () {
|
|
259
|
+
throw new Error('Failed to create VR session!');
|
|
288
260
|
});
|
|
289
261
|
} else {
|
|
290
|
-
|
|
262
|
+
throw new Error('VR Session already exists!');
|
|
291
263
|
}
|
|
292
|
-
};
|
|
264
|
+
}; // When an XR session is available, set up the XRWebGLLayer
|
|
265
|
+
// and request the first animation frame for the device
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
publicAPI.enterXR = /*#__PURE__*/function () {
|
|
269
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(xrSession) {
|
|
270
|
+
var gl, glLayer;
|
|
271
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
272
|
+
while (1) {
|
|
273
|
+
switch (_context.prev = _context.next) {
|
|
274
|
+
case 0:
|
|
275
|
+
model.xrSession = xrSession;
|
|
276
|
+
model.oldCanvasSize = model.size.slice();
|
|
277
|
+
|
|
278
|
+
if (!(model.xrSession !== null)) {
|
|
279
|
+
_context.next = 14;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
gl = publicAPI.get3DContext();
|
|
284
|
+
_context.next = 6;
|
|
285
|
+
return gl.makeXRCompatible();
|
|
286
|
+
|
|
287
|
+
case 6:
|
|
288
|
+
glLayer = new global.XRWebGLLayer(model.xrSession, gl);
|
|
289
|
+
publicAPI.setSize(glLayer.framebufferWidth, glLayer.framebufferHeight);
|
|
290
|
+
model.xrSession.updateRenderState({
|
|
291
|
+
baseLayer: glLayer
|
|
292
|
+
});
|
|
293
|
+
model.xrSession.requestReferenceSpace('local').then(function (refSpace) {
|
|
294
|
+
model.xrReferenceSpace = refSpace;
|
|
295
|
+
});
|
|
296
|
+
model.renderable.getInteractor().switchToXRAnimation();
|
|
297
|
+
model.xrSceneFrame = model.xrSession.requestAnimationFrame(publicAPI.xrRender);
|
|
298
|
+
_context.next = 15;
|
|
299
|
+
break;
|
|
293
300
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
model.vrDisplay.exitPresent();
|
|
297
|
-
model.vrDisplay.cancelAnimationFrame(model.vrSceneFrame);
|
|
298
|
-
publicAPI.setSize.apply(publicAPI, _toConsumableArray(model.oldCanvasSize));
|
|
301
|
+
case 14:
|
|
302
|
+
throw new Error('Failed to enter VR with a null xrSession.');
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
304
|
+
case 15:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context.stop();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}, _callee);
|
|
310
|
+
}));
|
|
303
311
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
return function (_x) {
|
|
313
|
+
return _ref.apply(this, arguments);
|
|
314
|
+
};
|
|
315
|
+
}();
|
|
316
|
+
|
|
317
|
+
publicAPI.stopXR = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
318
|
+
var gl, ren;
|
|
319
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
320
|
+
while (1) {
|
|
321
|
+
switch (_context2.prev = _context2.next) {
|
|
322
|
+
case 0:
|
|
323
|
+
if (!(navigator.xr === undefined)) {
|
|
324
|
+
_context2.next = 2;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return _context2.abrupt("return");
|
|
329
|
+
|
|
330
|
+
case 2:
|
|
331
|
+
if (!(model.xrSession !== null)) {
|
|
332
|
+
_context2.next = 10;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
model.xrSession.cancelAnimationFrame(model.xrSceneFrame);
|
|
337
|
+
model.renderable.getInteractor().returnFromXRAnimation();
|
|
338
|
+
gl = publicAPI.get3DContext();
|
|
339
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
340
|
+
_context2.next = 9;
|
|
341
|
+
return model.xrSession.end().catch(function (error) {
|
|
342
|
+
if (!(error instanceof DOMException)) {
|
|
343
|
+
throw error;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
309
346
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (!model.vrDisplay.isPresenting) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
347
|
+
case 9:
|
|
348
|
+
model.xrSession = null;
|
|
315
349
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
};
|
|
350
|
+
case 10:
|
|
351
|
+
publicAPI.setSize.apply(publicAPI, _toConsumableArray(model.oldCanvasSize)); // Reset to default canvas
|
|
352
|
+
|
|
353
|
+
ren = model.renderable.getRenderers()[0];
|
|
354
|
+
ren.getActiveCamera().setProjectionMatrix(null);
|
|
355
|
+
ren.resetCamera();
|
|
356
|
+
ren.setViewport(0.0, 0, 1.0, 1.0);
|
|
357
|
+
publicAPI.traverseAllPasses();
|
|
358
|
+
|
|
359
|
+
case 16:
|
|
360
|
+
case "end":
|
|
361
|
+
return _context2.stop();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}, _callee2);
|
|
365
|
+
}));
|
|
366
|
+
|
|
367
|
+
publicAPI.xrRender = /*#__PURE__*/function () {
|
|
368
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(t, frame) {
|
|
369
|
+
var xrSession, xrPose, gl, glLayer, ren;
|
|
370
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
371
|
+
while (1) {
|
|
372
|
+
switch (_context3.prev = _context3.next) {
|
|
373
|
+
case 0:
|
|
374
|
+
xrSession = frame.session;
|
|
375
|
+
model.xrSceneFrame = model.xrSession.requestAnimationFrame(publicAPI.xrRender);
|
|
376
|
+
xrPose = frame.getViewerPose(model.xrReferenceSpace);
|
|
377
|
+
|
|
378
|
+
if (xrPose) {
|
|
379
|
+
gl = publicAPI.get3DContext();
|
|
380
|
+
glLayer = xrSession.renderState.baseLayer;
|
|
381
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, glLayer.framebuffer);
|
|
382
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
383
|
+
gl.clear(gl.DEPTH_BUFFER_BIT); // get the first renderer
|
|
384
|
+
|
|
385
|
+
ren = model.renderable.getRenderers()[0]; // Do a render pass for each eye
|
|
386
|
+
|
|
387
|
+
xrPose.views.forEach(function (view) {
|
|
388
|
+
var viewport = glLayer.getViewport(view);
|
|
389
|
+
gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
|
|
390
|
+
|
|
391
|
+
if (view.eye === 'left') {
|
|
392
|
+
ren.setViewport(0, 0, 0.5, 1.0);
|
|
393
|
+
} else if (view.eye === 'right') {
|
|
394
|
+
ren.setViewport(0.5, 0, 1.0, 1.0);
|
|
395
|
+
} else {
|
|
396
|
+
// No handling for non-eye viewport
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
ren.getActiveCamera().computeViewParametersFromPhysicalMatrix(view.transform.inverse.matrix);
|
|
401
|
+
ren.getActiveCamera().setProjectionMatrix(view.projectionMatrix);
|
|
402
|
+
publicAPI.traverseAllPasses();
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
case 4:
|
|
407
|
+
case "end":
|
|
408
|
+
return _context3.stop();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}, _callee3);
|
|
412
|
+
}));
|
|
413
|
+
|
|
414
|
+
return function (_x2, _x3) {
|
|
415
|
+
return _ref3.apply(this, arguments);
|
|
416
|
+
};
|
|
417
|
+
}();
|
|
332
418
|
|
|
333
419
|
publicAPI.restoreContext = function () {
|
|
334
420
|
var rp = vtkRenderPass.newInstance();
|
|
@@ -486,13 +572,13 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
486
572
|
publicAPI.captureNextImage = function () {
|
|
487
573
|
var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'image/png';
|
|
488
574
|
|
|
489
|
-
var
|
|
490
|
-
|
|
491
|
-
resetCamera =
|
|
492
|
-
|
|
493
|
-
size =
|
|
494
|
-
|
|
495
|
-
scale =
|
|
575
|
+
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
576
|
+
_ref4$resetCamera = _ref4.resetCamera,
|
|
577
|
+
resetCamera = _ref4$resetCamera === void 0 ? false : _ref4$resetCamera,
|
|
578
|
+
_ref4$size = _ref4.size,
|
|
579
|
+
size = _ref4$size === void 0 ? null : _ref4$size,
|
|
580
|
+
_ref4$scale = _ref4.scale,
|
|
581
|
+
scale = _ref4$scale === void 0 ? 1 : _ref4$scale;
|
|
496
582
|
|
|
497
583
|
if (model.deleted) {
|
|
498
584
|
return null;
|
|
@@ -519,9 +605,9 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
519
605
|
publicAPI.modified(); // restore the saved camera parameters, if applicable
|
|
520
606
|
|
|
521
607
|
if (model._screenshot.cameras) {
|
|
522
|
-
model._screenshot.cameras.forEach(function (
|
|
523
|
-
var restoreParamsFn =
|
|
524
|
-
arg =
|
|
608
|
+
model._screenshot.cameras.forEach(function (_ref5) {
|
|
609
|
+
var restoreParamsFn = _ref5.restoreParamsFn,
|
|
610
|
+
arg = _ref5.arg;
|
|
525
611
|
return restoreParamsFn(arg);
|
|
526
612
|
});
|
|
527
613
|
} // Trigger a render at the original size
|
|
@@ -568,8 +654,8 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
568
654
|
// the params from all active cameras, in case there happen to be
|
|
569
655
|
// linked cameras among the renderers.
|
|
570
656
|
|
|
571
|
-
model._screenshot.cameras.forEach(function (
|
|
572
|
-
var resetCameraFn =
|
|
657
|
+
model._screenshot.cameras.forEach(function (_ref6) {
|
|
658
|
+
var resetCameraFn = _ref6.resetCameraFn;
|
|
573
659
|
return resetCameraFn();
|
|
574
660
|
});
|
|
575
661
|
} // Trigger a render at the custom size
|
|
@@ -688,11 +774,9 @@ var DEFAULT_VALUES = {
|
|
|
688
774
|
webgl2: false,
|
|
689
775
|
defaultToWebgl2: true,
|
|
690
776
|
// attempt webgl2 on by default
|
|
691
|
-
vrResolution: [2160, 1200],
|
|
692
|
-
queryVRSize: false,
|
|
693
|
-
hideCanvasInVR: true,
|
|
694
777
|
activeFramebuffer: null,
|
|
695
|
-
|
|
778
|
+
xrSession: null,
|
|
779
|
+
xrReferenceSpace: null,
|
|
696
780
|
imageFormat: 'image/png',
|
|
697
781
|
useOffScreen: false,
|
|
698
782
|
useBackgroundImage: false
|
|
@@ -736,12 +820,12 @@ function extend(publicAPI, model) {
|
|
|
736
820
|
macro.event(publicAPI, model, 'haveVRDisplay'); // Build VTK API
|
|
737
821
|
|
|
738
822
|
macro.get(publicAPI, model, ['shaderCache', 'textureUnitManager', 'webgl2', 'vrDisplay', 'useBackgroundImage']);
|
|
739
|
-
macro.setGet(publicAPI, model, ['initialized', 'context', 'canvas', 'renderPasses', 'notifyStartCaptureImage', 'defaultToWebgl2', 'cursor', '
|
|
823
|
+
macro.setGet(publicAPI, model, ['initialized', 'context', 'canvas', 'renderPasses', 'notifyStartCaptureImage', 'defaultToWebgl2', 'cursor', 'useOffScreen', // might want to make this not call modified as
|
|
740
824
|
// we change the active framebuffer a lot. Or maybe
|
|
741
825
|
// only mark modified if the size or depth
|
|
742
826
|
// of the buffer has changed
|
|
743
827
|
'activeFramebuffer']);
|
|
744
|
-
macro.setGetArray(publicAPI, model, ['size'
|
|
828
|
+
macro.setGetArray(publicAPI, model, ['size'], 2); // Object methods
|
|
745
829
|
|
|
746
830
|
vtkOpenGLRenderWindow(publicAPI, model);
|
|
747
831
|
} // ----------------------------------------------------------------------------
|
|
@@ -421,18 +421,6 @@ function vtkShaderProgram(publicAPI, model) {
|
|
|
421
421
|
return true;
|
|
422
422
|
};
|
|
423
423
|
|
|
424
|
-
publicAPI.setUniform4fv = function (name, count, v) {
|
|
425
|
-
var location = publicAPI.findUniform(name);
|
|
426
|
-
|
|
427
|
-
if (location === -1) {
|
|
428
|
-
model.error = "Could not set uniform ".concat(name, " . No such uniform.");
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
model.context.uniform4fv(location, v);
|
|
433
|
-
return true;
|
|
434
|
-
};
|
|
435
|
-
|
|
436
424
|
publicAPI.findUniform = function (name) {
|
|
437
425
|
if (!name || !model.linked) {
|
|
438
426
|
return -1;
|
package/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
|
|
2
|
+
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
|
|
3
|
+
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
|
|
2
4
|
import { vtkPipelineConnection } from '@kitware/vtk.js/types';
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -32,48 +34,88 @@ export interface vtkOutputPort {
|
|
|
32
34
|
* vtkAlgorithm API
|
|
33
35
|
*/
|
|
34
36
|
export interface vtkAlgorithm {
|
|
37
|
+
|
|
35
38
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param
|
|
39
|
+
* Assign a data object as input.
|
|
40
|
+
* @param {vtkPolyData} dataset
|
|
41
|
+
* @param {Number} [port] The port number (default 0).
|
|
38
42
|
*/
|
|
39
|
-
setInputData(dataset:
|
|
43
|
+
setInputData(dataset: vtkPolyData, port?: number): void;
|
|
44
|
+
|
|
40
45
|
/**
|
|
41
|
-
* @param port (default 0)
|
|
46
|
+
* @param {Number} [port] The port number (default 0).
|
|
42
47
|
*/
|
|
43
48
|
getInputData(port?: number): any;
|
|
49
|
+
|
|
44
50
|
/**
|
|
45
51
|
* @param outputPort
|
|
46
|
-
* @param port (default 0)
|
|
52
|
+
* @param {Number} [port] The port number (default 0).
|
|
47
53
|
*/
|
|
48
54
|
setInputConnection(outputPort: vtkPipelineConnection, port?: number): void;
|
|
55
|
+
|
|
49
56
|
/**
|
|
50
|
-
* @param port (default 0)
|
|
57
|
+
* @param {Number} [port] The port number (default 0).
|
|
51
58
|
*/
|
|
52
59
|
getInputConnection(port?: number): vtkPipelineConnection;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Add a connection to the given input port index.
|
|
63
|
+
* @param {vtkPipelineConnection} outputPort
|
|
64
|
+
*/
|
|
53
65
|
addInputConnection(outputPort: vtkPipelineConnection): void;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param dataset
|
|
70
|
+
*/
|
|
54
71
|
addInputData(dataset: any): void;
|
|
72
|
+
|
|
55
73
|
/**
|
|
56
|
-
*
|
|
74
|
+
* Get the data object that will contain the algorithm output for the given
|
|
75
|
+
* port.
|
|
76
|
+
* @param {Number} [port] The port number (default 0).
|
|
77
|
+
*/
|
|
78
|
+
getOutputData(port?: number): vtkImageData | vtkPolyData;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
57
82
|
*/
|
|
58
|
-
getOutputData(port?: number): any;
|
|
59
83
|
shouldUpdate(): boolean;
|
|
84
|
+
|
|
60
85
|
/**
|
|
61
|
-
*
|
|
86
|
+
* Get a proxy object corresponding to the given output port of this
|
|
87
|
+
* algorithm.
|
|
88
|
+
* @param {Number} [port] The port number (default 0).
|
|
62
89
|
*/
|
|
63
90
|
getOutputPort(port?: number): vtkPipelineConnection;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Bring this algorithm's outputs up-to-date.
|
|
94
|
+
*/
|
|
64
95
|
update(): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get the number of input ports used by the algorithm.
|
|
99
|
+
*/
|
|
65
100
|
getNumberOfInputPorts(): number;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get the number of output ports provided by the algorithm.
|
|
104
|
+
*/
|
|
66
105
|
getNumberOfOutputPorts(): number;
|
|
106
|
+
|
|
67
107
|
/**
|
|
68
|
-
*
|
|
108
|
+
* Get the actual data array for the input array sepcified by idx.
|
|
109
|
+
* @param {Number} port (default 0)
|
|
69
110
|
*/
|
|
70
111
|
getInputArrayToProcess(inputPort?: number): vtkDataArray;
|
|
112
|
+
|
|
71
113
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @param inputPort
|
|
74
|
-
* @param arrayName
|
|
75
|
-
* @param fieldAssociation
|
|
76
|
-
* @param attributeType (default 'Scalars')
|
|
114
|
+
* Set the input data arrays that this algorithm will process.
|
|
115
|
+
* @param {Number} inputPort The port number.
|
|
116
|
+
* @param {String} arrayName The name of the array.
|
|
117
|
+
* @param {String} fieldAssociation The name of the association field.
|
|
118
|
+
* @param {String} attributeType (default 'Scalars')
|
|
77
119
|
*/
|
|
78
120
|
setInputArrayToProcess(
|
|
79
121
|
inputPort: number,
|
|
@@ -87,9 +129,9 @@ export interface vtkAlgorithm {
|
|
|
87
129
|
* Base vtkClass which provides MTime tracking and class infrastructure
|
|
88
130
|
*/
|
|
89
131
|
export interface vtkObject {
|
|
132
|
+
|
|
90
133
|
/**
|
|
91
134
|
* Allow to check if that object was deleted (.delete() was called before).
|
|
92
|
-
*
|
|
93
135
|
* @returns true if delete() was previously called
|
|
94
136
|
*/
|
|
95
137
|
isDeleted(): boolean;
|
|
@@ -137,14 +179,14 @@ export interface vtkObject {
|
|
|
137
179
|
* Generic method to set many fields at one.
|
|
138
180
|
*
|
|
139
181
|
* For example calling the following function
|
|
140
|
-
* ```
|
|
182
|
+
* ```js
|
|
141
183
|
* changeDetected = sphereSourceInstance.set({
|
|
142
184
|
* phiResolution: 10,
|
|
143
185
|
* thetaResolution: 20,
|
|
144
186
|
* });
|
|
145
187
|
* ```
|
|
146
188
|
* will be equivalent of calling
|
|
147
|
-
* ```
|
|
189
|
+
* ```js
|
|
148
190
|
* changeDetected += sphereSourceInstance.setPhiResolution(10);
|
|
149
191
|
* changeDetected += sphereSourceInstance.setThetaResolution(20);
|
|
150
192
|
* changeDetected = !!changeDetected;
|
|
@@ -157,9 +199,9 @@ export interface vtkObject {
|
|
|
157
199
|
* If `noFunction` is set to true, the field will be set directly on the model
|
|
158
200
|
* without calling the `set${FieldName}()` method.
|
|
159
201
|
*
|
|
160
|
-
* @param map (default: {}) Object capturing the set of fieldNames and associated values to set.
|
|
161
|
-
* @param noWarning (default: false) Boolean to disable any warning.
|
|
162
|
-
* @param noFunctions (default: false) Boolean to skip any function execution and rely on only setting the fields on the model.
|
|
202
|
+
* @param [map] (default: {}) Object capturing the set of fieldNames and associated values to set.
|
|
203
|
+
* @param [noWarning] (default: false) Boolean to disable any warning.
|
|
204
|
+
* @param [noFunctions] (default: false) Boolean to skip any function execution and rely on only setting the fields on the model.
|
|
163
205
|
* @return true if a change was actually performed. False otherwise when the value provided were equal to the ones already set inside the instance.
|
|
164
206
|
*/
|
|
165
207
|
set(map?: object, noWarning?: boolean, noFunction?: boolean): boolean;
|
|
@@ -215,15 +257,15 @@ export interface vtkObject {
|
|
|
215
257
|
/**
|
|
216
258
|
* Try to copy the state of the other to ourselves by just using references.
|
|
217
259
|
*
|
|
218
|
-
* @param other instance to copy the reference from
|
|
219
|
-
* @param debug (default: false) if true feedback will be provided when mismatch happen
|
|
260
|
+
* @param {vtkObject} other instance to copy the reference from
|
|
261
|
+
* @param {Boolean} [debug] (default: false) if true feedback will be provided when mismatch happen
|
|
220
262
|
*/
|
|
221
263
|
shallowCopy(other: vtkObject, debug?: boolean): void;
|
|
222
264
|
}
|
|
223
265
|
|
|
224
266
|
export interface vtkProperty {
|
|
225
267
|
name: string;
|
|
226
|
-
children?:
|
|
268
|
+
children?: vtkProperty[];
|
|
227
269
|
}
|
|
228
270
|
|
|
229
271
|
export interface vtkPropertyDomain {}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -17,9 +17,12 @@ declare type Extent = [number, number, number, number, number, number];
|
|
|
17
17
|
declare type Placement = 'top' | 'left' | 'right' | 'bottom';
|
|
18
18
|
declare type Size = [number, number];
|
|
19
19
|
declare type Range = [number, number];
|
|
20
|
-
declare type Point = [number, number, number];
|
|
21
20
|
declare type Vector2 = [number, number];
|
|
22
21
|
declare type Vector3 = [number, number, number];
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated The `Point` type is depracted, please use `Vector3` instead.
|
|
24
|
+
*/
|
|
25
|
+
declare type Point = Vector3;
|
|
23
26
|
declare type HSLColor = [number, number, number];
|
|
24
27
|
declare type HSVColor = [number, number, number];
|
|
25
28
|
declare type RGBColor = [number, number, number];
|