@kitware/vtk.js 24.13.1 → 24.14.2

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.
@@ -25,10 +25,19 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
25
25
  var resizeObserver = new ResizeObserver(function (entries) {
26
26
  publicAPI.updateViewport();
27
27
  });
28
+ var onCameraChangedSub = null;
29
+ var onCameraModifiedSub = null;
28
30
  var onAnimationSub = null;
29
31
  var onEndAnimationSub = null;
30
32
  var selfSubscription = null;
31
33
 
34
+ function onCameraModified() {
35
+ // If animating, marker will be updated on Animation event
36
+ if (!model._interactor.isAnimating()) {
37
+ publicAPI.updateMarkerOrientation();
38
+ }
39
+ }
40
+
32
41
  publicAPI.computeViewport = function () {
33
42
  var parentRen = model.parentRenderer || model._interactor.getCurrentRenderer();
34
43
 
@@ -147,6 +156,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
147
156
  selfRenderer.setInteractive(false);
148
157
  selfRenderer.addViewProp(model.actor);
149
158
  model.actor.setVisibility(true);
159
+ onCameraChangedSub = ren.onEvent(function (event) {
160
+ if (event.type === 'ActiveCameraEvent') {
161
+ if (onCameraModifiedSub) {
162
+ onCameraModifiedSub.unsubscribe();
163
+ }
164
+
165
+ onCameraModifiedSub = event.camera.onModified(onCameraModified);
166
+ }
167
+ });
168
+ onCameraModifiedSub = ren.getActiveCamera().onModified(onCameraModified);
150
169
  onAnimationSub = model._interactor.onAnimation(publicAPI.updateMarkerOrientation);
151
170
  onEndAnimationSub = model._interactor.onEndAnimation(publicAPI.updateMarkerOrientation);
152
171
  resizeObserver.observe(model._interactor.getView().getCanvas());
@@ -160,6 +179,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
160
179
 
161
180
  model.enabled = false;
162
181
  resizeObserver.disconnect();
182
+ onCameraChangedSub.unsubscribe();
183
+ onCameraChangedSub = null;
184
+ onCameraModifiedSub.unsubscribe();
185
+ onCameraModifiedSub = null;
163
186
  onAnimationSub.unsubscribe();
164
187
  onAnimationSub = null;
165
188
  onEndAnimationSub.unsubscribe();
@@ -234,6 +257,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
234
257
  selfSubscription = null;
235
258
  }
236
259
 
260
+ if (onCameraChangedSub) {
261
+ onCameraChangedSub.unsubscribe();
262
+ onCameraChangedSub = null;
263
+ }
264
+
265
+ if (onCameraModifiedSub) {
266
+ onCameraModifiedSub.unsubscribe();
267
+ onCameraModifiedSub = null;
268
+ }
269
+
237
270
  if (onAnimationSub) {
238
271
  onAnimationSub.unsubscribe();
239
272
  onAnimationSub = null;
@@ -165,6 +165,12 @@ function vtkActor(publicAPI, model) {
165
165
  publicAPI.getSupportsSelection = function () {
166
166
  return model.mapper ? model.mapper.getSupportsSelection() : false;
167
167
  };
168
+
169
+ publicAPI.processSelectorPixelBuffers = function (selector, pixelOffsets) {
170
+ if (model.mapper && model.mapper.processSelectorPixelBuffers) {
171
+ model.mapper.processSelectorPixelBuffers(selector, pixelOffsets);
172
+ }
173
+ };
168
174
  } // ----------------------------------------------------------------------------
169
175
  // Object factory
170
176
  // ----------------------------------------------------------------------------
@@ -8,10 +8,13 @@ import { N as createUninitializedBounds, i as isNan } from '../../Common/Core/Ma
8
8
  import vtkScalarsToColors from '../../Common/Core/ScalarsToColors/Constants.js';
9
9
  import CoincidentTopologyHelper from './Mapper/CoincidentTopologyHelper.js';
10
10
  import Constants from './Mapper/Constants.js';
11
+ import vtkDataSet from '../../Common/DataModel/DataSet.js';
12
+ import { PassTypes } from '../OpenGL/HardwareSelector/Constants.js';
11
13
 
12
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
15
 
14
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
+ var FieldAssociations = vtkDataSet.FieldAssociations;
15
18
  var staticOffsetAPI = CoincidentTopologyHelper.staticOffsetAPI,
16
19
  otherStaticMethods = CoincidentTopologyHelper.otherStaticMethods;
17
20
  var ColorMode = Constants.ColorMode,
@@ -455,6 +458,64 @@ function vtkMapper(publicAPI, model) {
455
458
  publicAPI.colorToValue = notImplemented('ColorToValue');
456
459
  publicAPI.useInvertibleColorFor = notImplemented('UseInvertibleColorFor');
457
460
  publicAPI.clearInvertibleColor = notImplemented('ClearInvertibleColor');
461
+
462
+ publicAPI.processSelectorPixelBuffers = function (selector, pixelOffsets) {
463
+ /* eslint-disable no-bitwise */
464
+ if (!selector || !model.selectionWebGLIdsToVTKIds || !model.populateSelectionSettings) {
465
+ return;
466
+ }
467
+
468
+ var rawLowData = selector.getRawPixelBuffer(PassTypes.ID_LOW24);
469
+ var rawHighData = selector.getRawPixelBuffer(PassTypes.ID_HIGH24);
470
+ var currentPass = selector.getCurrentPass();
471
+ var fieldAssociation = selector.getFieldAssociation();
472
+ var idMap = null;
473
+
474
+ if (fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
475
+ idMap = model.selectionWebGLIdsToVTKIds.points;
476
+ } else if (fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_CELLS) {
477
+ idMap = model.selectionWebGLIdsToVTKIds.cells;
478
+ }
479
+
480
+ if (!idMap) {
481
+ return;
482
+ }
483
+
484
+ pixelOffsets.forEach(function (pos) {
485
+ if (currentPass === PassTypes.ID_LOW24) {
486
+ var inValue = 0;
487
+
488
+ if (rawHighData) {
489
+ inValue += rawHighData[pos];
490
+ inValue *= 256;
491
+ }
492
+
493
+ inValue += rawLowData[pos + 2];
494
+ inValue *= 256;
495
+ inValue += rawLowData[pos + 1];
496
+ inValue *= 256;
497
+ inValue += rawLowData[pos];
498
+ var outValue = idMap[inValue];
499
+ var lowData = selector.getPixelBuffer(PassTypes.ID_LOW24);
500
+ lowData[pos] = outValue & 0xff;
501
+ lowData[pos + 1] = (outValue & 0xff00) >> 8;
502
+ lowData[pos + 2] = (outValue & 0xff0000) >> 16;
503
+ } else if (currentPass === PassTypes.ID_HIGH24 && rawHighData) {
504
+ var _inValue = 0;
505
+ _inValue += rawHighData[pos];
506
+ _inValue *= 256;
507
+ _inValue += rawLowData[pos];
508
+ _inValue *= 256;
509
+ _inValue += rawLowData[pos + 1];
510
+ _inValue *= 256;
511
+ _inValue += rawLowData[pos + 2];
512
+ var _outValue = idMap[_inValue];
513
+ var highData = selector.getPixelBuffer(PassTypes.ID_HIGH24);
514
+ highData[pos] = (_outValue & 0xff000000) >> 24;
515
+ }
516
+ });
517
+ /* eslint-enable no-bitwise */
518
+ };
458
519
  } // ----------------------------------------------------------------------------
459
520
  // Object factory
460
521
  // ----------------------------------------------------------------------------
@@ -475,6 +536,8 @@ var DEFAULT_VALUES = {
475
536
  renderTime: 0,
476
537
  colorByArrayName: null,
477
538
  fieldDataTupleId: -1,
539
+ populateSelectionSettings: true,
540
+ selectionWebGLIdsToVTKIds: null,
478
541
  interpolateScalarsBeforeMapping: false,
479
542
  colorCoordinates: null,
480
543
  colorTextureMap: null,
@@ -491,7 +554,7 @@ function extend(publicAPI, model) {
491
554
 
492
555
  vtkAbstractMapper3D.extend(publicAPI, model, initialValues);
493
556
  macro.get(publicAPI, model, ['colorCoordinates', 'colorMapColors', 'colorTextureMap']);
494
- macro.setGet(publicAPI, model, ['colorByArrayName', 'arrayAccessMode', 'colorMode', 'fieldDataTupleId', 'interpolateScalarsBeforeMapping', 'lookupTable', 'renderTime', 'scalarMode', 'scalarVisibility', 'static', 'useLookupTableScalarRange', 'viewSpecificProperties', 'customShaderAttributes' // point data array names that will be transferred to the VBO
557
+ macro.setGet(publicAPI, model, ['colorByArrayName', 'arrayAccessMode', 'colorMode', 'fieldDataTupleId', 'interpolateScalarsBeforeMapping', 'lookupTable', 'populateSelectionSettings', 'renderTime', 'scalarMode', 'scalarVisibility', 'selectionWebGLIdsToVTKIds', 'static', 'useLookupTableScalarRange', 'viewSpecificProperties', 'customShaderAttributes' // point data array names that will be transferred to the VBO
495
558
  ]);
496
559
  macro.setGetArray(publicAPI, model, ['scalarRange'], 2);
497
560
 
@@ -27,6 +27,8 @@ function vtkProp(publicAPI, model) {
27
27
  return m1;
28
28
  };
29
29
 
30
+ publicAPI.processSelectorPixelBuffers = function (selector, pixeloffsets) {};
31
+
30
32
  publicAPI.getNestedProps = function () {
31
33
  return null;
32
34
  };
@@ -198,7 +198,7 @@ function vtkScalarBarActorHelper(publicAPI, model) {
198
198
  model.camera = camera;
199
199
  model.renderWindow = renderWindow; // did something significant change? If so rebuild a lot of things
200
200
 
201
- if (model.forceUpdate || Math.max(scalarsToColors.getMTime(), publicAPI.getMTime()) > model.lastRebuildTime.getMTime()) {
201
+ if (model.forceUpdate || Math.max(scalarsToColors.getMTime(), publicAPI.getMTime(), model.renderable.getMTime()) > model.lastRebuildTime.getMTime()) {
202
202
  var range = scalarsToColors.getMappingRange();
203
203
  model.lastTickBounds = _toConsumableArray(range); // compute tick marks for axes (update for log scale)
204
204
 
@@ -33,6 +33,8 @@ function vtkOpenGLCellArrayBufferObject(publicAPI, model) {
33
33
  publicAPI.setType(ObjectType.ARRAY_BUFFER);
34
34
 
35
35
  publicAPI.createVBO = function (cellArray, inRep, outRep, options) {
36
+ var selectionMaps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
37
+
36
38
  if (!cellArray.getData() || !cellArray.getData().length) {
37
39
  model.elementCount = 0;
38
40
  return 0;
@@ -263,10 +265,34 @@ function vtkOpenGLCellArrayBufferObject(publicAPI, model) {
263
265
  } else if (model.coordShiftAndScaleEnabled === true) {
264
266
  // Make sure to reset
265
267
  publicAPI.setCoordShiftAndScale(null, null);
268
+ } // Initialize the structures used to keep track of point ids and cell ids for selectors
269
+
270
+
271
+ if (selectionMaps) {
272
+ if (!selectionMaps.points && !selectionMaps.cells) {
273
+ selectionMaps.points = new Int32Array(caboCount);
274
+ selectionMaps.cells = new Int32Array(caboCount);
275
+ } else {
276
+ var newPoints = new Int32Array(caboCount + selectionMaps.points.length);
277
+ newPoints.set(selectionMaps.points);
278
+ selectionMaps.points = newPoints;
279
+ var newCells = new Int32Array(caboCount + selectionMaps.points.length);
280
+ newCells.set(selectionMaps.cells);
281
+ selectionMaps.cells = newCells;
282
+ }
266
283
  }
267
284
 
285
+ var pointCount = options.vertexOffset;
286
+
268
287
  addAPoint = function addAPointFunc(i) {
269
- // Vertices
288
+ // Keep track of original point and cell ids, for selection
289
+ if (selectionMaps) {
290
+ selectionMaps.points[pointCount] = i;
291
+ selectionMaps.cells[pointCount] = cellCount;
292
+ }
293
+
294
+ ++pointCount; // Vertices
295
+
270
296
  pointIdx = i * 3;
271
297
 
272
298
  if (!model.coordShiftAndScaleEnabled) {
@@ -3,7 +3,8 @@ var PassTypes = {
3
3
  ACTOR_PASS: 0,
4
4
  COMPOSITE_INDEX_PASS: 1,
5
5
  ID_LOW24: 2,
6
- MAX_KNOWN_PASS: 2
6
+ ID_HIGH24: 3,
7
+ MAX_KNOWN_PASS: 3
7
8
  };
8
9
  var Constants = {
9
10
  PassTypes: PassTypes
@@ -23,6 +23,15 @@ function getInfoHash(info) {
23
23
  return "".concat(info.propID, " ").concat(info.compositeID);
24
24
  }
25
25
 
26
+ function getAlpha(xx, yy, pb, area) {
27
+ if (!pb) {
28
+ return 0;
29
+ }
30
+
31
+ var offset = (yy * (area[2] - area[0] + 1) + xx) * 4;
32
+ return pb[offset + 3];
33
+ }
34
+
26
35
  function convert(xx, yy, pb, area) {
27
36
  if (!pb) {
28
37
  return 0;
@@ -41,6 +50,15 @@ function convert(xx, yy, pb, area) {
41
50
  return val;
42
51
  }
43
52
 
53
+ function getID(low24, high8) {
54
+ /* eslint-disable no-bitwise */
55
+ var val = high8;
56
+ val <<= 24;
57
+ val |= low24;
58
+ return val;
59
+ /* eslint-enable no-bitwise */
60
+ }
61
+
44
62
  function getPixelInformationWithData(buffdata, inDisplayPosition, maxDistance, outSelectedPosition) {
45
63
  // Base case
46
64
  var maxDist = maxDistance < 0 ? 0 : maxDistance;
@@ -80,6 +98,15 @@ function getPixelInformationWithData(buffdata, inDisplayPosition, maxDistance, o
80
98
  _info.displayPosition = inDisplayPosition;
81
99
  }
82
100
 
101
+ if (buffdata.pixBuffer[PassTypes.ID_LOW24]) {
102
+ if (getAlpha(displayPosition[0], displayPosition[1], buffdata.pixBuffer[PassTypes.ID_LOW24], buffdata.area) === 0.0) {
103
+ return _info;
104
+ }
105
+ }
106
+
107
+ var low24 = convert(displayPosition[0], displayPosition[1], buffdata.pixBuffer[PassTypes.ID_LOW24], buffdata.area);
108
+ var high24 = convert(displayPosition[0], displayPosition[1], buffdata.pixBuffer[PassTypes.ID_HIGH24], buffdata.area);
109
+ _info.attributeID = getID(low24, high24);
83
110
  return _info;
84
111
  } // Iterate over successively growing boxes.
85
112
  // They recursively call the base case to handle single pixels.
@@ -167,6 +194,7 @@ function convertSelection(fieldassociation, dataMap, captureZValues, renderer, o
167
194
  child.getProperties().propID = value.info.propID;
168
195
  child.getProperties().prop = value.info.prop;
169
196
  child.getProperties().compositeID = value.info.compositeID;
197
+ child.getProperties().attributeID = value.info.attributeID;
170
198
  child.getProperties().pixelCount = value.pixelCount;
171
199
 
172
200
  if (captureZValues) {
@@ -233,6 +261,7 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
233
261
  model.classHierarchy.push('vtkOpenGLHardwareSelector'); //----------------------------------------------------------------------------
234
262
 
235
263
  publicAPI.releasePixBuffers = function () {
264
+ model.rawPixBuffer = [];
236
265
  model.pixBuffer = [];
237
266
  model.zBuffer = null;
238
267
  }; //----------------------------------------------------------------------------
@@ -270,8 +299,24 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
270
299
  model._openGLRenderer.setSelector(publicAPI);
271
300
 
272
301
  model.hitProps = {};
302
+ model.propPixels = {};
273
303
  model.props = [];
274
304
  publicAPI.releasePixBuffers();
305
+
306
+ if (model.fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
307
+ var gl = model._openGLRenderWindow.getContext();
308
+
309
+ var originalBlending = gl.isEnabled(gl.BLEND);
310
+ gl.disable(gl.BLEND);
311
+
312
+ model._openGLRenderWindow.traverseAllPasses();
313
+
314
+ model._renderer.setPreserveDepthBuffer(true);
315
+
316
+ if (originalBlending) {
317
+ gl.enable(gl.BLEND);
318
+ }
319
+ }
275
320
  }; //----------------------------------------------------------------------------
276
321
 
277
322
 
@@ -281,11 +326,26 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
281
326
  model._openGLRenderer.setSelector(null);
282
327
 
283
328
  model.framebuffer.restorePreviousBindingsAndBuffers();
329
+
330
+ model._renderer.setPreserveDepthBuffer(false);
331
+ };
332
+
333
+ publicAPI.preCapturePass = function () {
334
+ var gl = model._openGLRenderWindow.getContext(); // Disable blending
335
+
336
+
337
+ model.originalBlending = gl.isEnabled(gl.BLEND);
338
+ gl.disable(gl.BLEND);
284
339
  };
285
340
 
286
- publicAPI.preCapturePass = function () {};
341
+ publicAPI.postCapturePass = function () {
342
+ var gl = model._openGLRenderWindow.getContext(); // Restore blending if it was enabled prior to the capture
343
+
287
344
 
288
- publicAPI.postCapturePass = function () {}; //----------------------------------------------------------------------------
345
+ if (model.originalBlending) {
346
+ gl.enable(gl.BLEND);
347
+ }
348
+ }; //----------------------------------------------------------------------------
289
349
 
290
350
 
291
351
  publicAPI.select = function () {
@@ -385,13 +445,13 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
385
445
 
386
446
  model.originalBackground = model._renderer.getBackgroundByReference();
387
447
 
388
- model._renderer.setBackground(0.0, 0.0, 0.0);
448
+ model._renderer.setBackground(0.0, 0.0, 0.0, 0.0);
389
449
 
390
450
  var rpasses = model._openGLRenderWindow.getRenderPasses();
391
451
 
392
452
  publicAPI.beginSelection();
393
453
 
394
- for (model.currentPass = PassTypes.MIN_KNOWN_PASS; model.currentPass <= PassTypes.COMPOSITE_INDEX_PASS; model.currentPass++) {
454
+ for (model.currentPass = PassTypes.MIN_KNOWN_PASS; model.currentPass <= PassTypes.MAX_KNOWN_PASS; model.currentPass++) {
395
455
  if (publicAPI.passRequired(model.currentPass)) {
396
456
  publicAPI.preCapturePass(model.currentPass);
397
457
 
@@ -405,6 +465,7 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
405
465
 
406
466
  publicAPI.postCapturePass(model.currentPass);
407
467
  publicAPI.savePixelBuffer(model.currentPass);
468
+ publicAPI.processPixelBuffers();
408
469
  }
409
470
  }
410
471
 
@@ -418,10 +479,28 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
418
479
  // model._openGLRenderWindow.traverseAllPasses();
419
480
 
420
481
  return true;
482
+ };
483
+
484
+ publicAPI.processPixelBuffers = function () {
485
+ model.props.forEach(function (prop, index) {
486
+ if (publicAPI.isPropHit(index)) {
487
+ prop.processSelectorPixelBuffers(publicAPI, model.propPixels[index]);
488
+ }
489
+ });
421
490
  }; //----------------------------------------------------------------------------
422
491
 
423
492
 
424
493
  publicAPI.passRequired = function (pass) {
494
+ if (pass === PassTypes.ID_HIGH24) {
495
+ if (model.fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
496
+ return model.maximumPointId > 0x00ffffff;
497
+ }
498
+
499
+ if (model.fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_CELLS) {
500
+ return model.maximumCellId > 0x00ffffff;
501
+ }
502
+ }
503
+
425
504
  return true;
426
505
  }; //----------------------------------------------------------------------------
427
506
 
@@ -429,6 +508,12 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
429
508
  publicAPI.savePixelBuffer = function (passNo) {
430
509
  model.pixBuffer[passNo] = model._openGLRenderWindow.getPixelData(model.area[0], model.area[1], model.area[2], model.area[3]);
431
510
 
511
+ if (!model.rawPixBuffer[passNo]) {
512
+ var size = (model.area[2] - model.area[0] + 1) * (model.area[3] - model.area[1] + 1) * 4;
513
+ model.rawPixBuffer[passNo] = new Uint8Array(size);
514
+ model.rawPixBuffer[passNo].set(model.pixBuffer[passNo]);
515
+ }
516
+
432
517
  if (passNo === PassTypes.ACTOR_PASS) {
433
518
  if (model.captureZValues) {
434
519
  var rpasses = model._openGLRenderWindow.getRenderPasses();
@@ -442,12 +527,14 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
442
527
  }
443
528
  }
444
529
 
445
- publicAPI.buildPropHitList(model.pixBuffer[passNo]);
530
+ publicAPI.buildPropHitList(model.rawPixBuffer[passNo]);
446
531
  }
447
532
  }; //----------------------------------------------------------------------------
448
533
 
449
534
 
450
535
  publicAPI.buildPropHitList = function (pixelbuffer) {
536
+ var offset = 0;
537
+
451
538
  for (var yy = 0; yy <= model.area[3] - model.area[1]; yy++) {
452
539
  for (var xx = 0; xx <= model.area[2] - model.area[0]; xx++) {
453
540
  var val = convert(xx, yy, pixelbuffer, model.area);
@@ -457,8 +544,13 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
457
544
 
458
545
  if (!(val in model.hitProps)) {
459
546
  model.hitProps[val] = true;
547
+ model.propPixels[val] = [];
460
548
  }
549
+
550
+ model.propPixels[val].push(offset * 4);
461
551
  }
552
+
553
+ ++offset;
462
554
  }
463
555
  }
464
556
  }; //----------------------------------------------------------------------------
@@ -552,8 +644,18 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
552
644
  var offset = (displayPosition[1] * (model.area[2] - model.area[0] + 1) + displayPosition[0]) * 4;
553
645
  _info2.zValue = (256 * model.zBuffer[offset] + model.zBuffer[offset + 1]) / 65535.0;
554
646
  _info2.displayPosition = inDisplayPosition;
647
+ } // Skip attribute ids if alpha is zero (missed)
648
+
649
+
650
+ if (model.pixBuffer[PassTypes.ID_LOW24]) {
651
+ if (getAlpha(displayPosition[0], displayPosition[1], model.pixBuffer[PassTypes.ID_LOW24], model.area) === 0.0) {
652
+ return _info2;
653
+ }
555
654
  }
556
655
 
656
+ var low24 = convert(displayPosition[0], displayPosition[1], model.pixBuffer[PassTypes.ID_LOW24], model.area);
657
+ var high24 = convert(displayPosition[0], displayPosition[1], model.pixBuffer[PassTypes.ID_HIGH24], model.area);
658
+ _info2.attributeID = getID(low24, high24);
557
659
  return _info2;
558
660
  } // Iterate over successively growing boxes.
559
661
  // They recursively call the base case to handle single pixels.
@@ -659,6 +761,14 @@ function vtkOpenGLHardwareSelector(publicAPI, model) {
659
761
  }
660
762
 
661
763
  return convertSelection(model.fieldAssociation, dataMap, model.captureZValues, model._renderer, model._openGLRenderWindow);
764
+ };
765
+
766
+ publicAPI.getRawPixelBuffer = function (passNo) {
767
+ return model.rawPixBuffer[passNo];
768
+ };
769
+
770
+ publicAPI.getPixelBuffer = function (passNo) {
771
+ return model.pixBuffer[passNo];
662
772
  }; //----------------------------------------------------------------------------
663
773
 
664
774
 
@@ -694,6 +804,8 @@ var DEFAULT_VALUES = {
694
804
  currentPass: -1,
695
805
  propColorValue: null,
696
806
  props: null,
807
+ maximumPointId: 0,
808
+ maximumCellId: 0,
697
809
  idOffset: 1
698
810
  }; // ----------------------------------------------------------------------------
699
811
 
@@ -710,7 +822,7 @@ function extend(publicAPI, model) {
710
822
  }
711
823
 
712
824
  macro.setGetArray(publicAPI, model, ['area'], 4);
713
- macro.setGet(publicAPI, model, ['_renderer', 'currentPass', '_openGLRenderWindow']);
825
+ macro.setGet(publicAPI, model, ['_renderer', 'currentPass', '_openGLRenderWindow', 'maximumPointId', 'maximumCellId']);
714
826
  macro.setGetArray(publicAPI, model, ['propColorValue'], 3);
715
827
  macro.moveToProtected(publicAPI, model, ['renderer', 'openGLRenderWindow']);
716
828
  macro.event(publicAPI, model, 'event'); // Object methods
@@ -41,6 +41,12 @@ function vtkOpenGLHelper(publicAPI, model) {
41
41
  var mode = publicAPI.getOpenGLMode(rep);
42
42
  var wideLines = publicAPI.haveWideLines(ren, actor);
43
43
  var gl = model.context;
44
+ var depthMask = gl.getParameter(gl.DEPTH_WRITEMASK);
45
+
46
+ if (model.pointPicking) {
47
+ gl.depthMask(false);
48
+ }
49
+
44
50
  var drawingLines = mode === gl.LINES;
45
51
 
46
52
  if (drawingLines && wideLines) {
@@ -55,6 +61,11 @@ function vtkOpenGLHelper(publicAPI, model) {
55
61
  }
56
62
 
57
63
  var stride = (mode === gl.POINTS ? 1 : 0) || (mode === gl.LINES ? 2 : 3);
64
+
65
+ if (model.pointPicking) {
66
+ gl.depthMask(depthMask);
67
+ }
68
+
58
69
  return model.CABO.getElementCount() / stride;
59
70
  }
60
71
 
@@ -62,6 +73,10 @@ function vtkOpenGLHelper(publicAPI, model) {
62
73
  };
63
74
 
64
75
  publicAPI.getOpenGLMode = function (rep) {
76
+ if (model.pointPicking) {
77
+ return model.context.POINTS;
78
+ }
79
+
65
80
  var type = model.primitiveType;
66
81
 
67
82
  if (rep === Representation.POINTS || type === primTypes.Points) {
@@ -144,22 +159,38 @@ function vtkOpenGLHelper(publicAPI, model) {
144
159
  publicAPI.getProgram().setUniformf('lineWidthStepSize', lineWidth / Math.ceil(lineWidth));
145
160
  publicAPI.getProgram().setUniformf('halfLineWidth', halfLineWidth);
146
161
  }
162
+
163
+ if (model.primitiveType === primTypes.Points || actor.getProperty().getRepresentation() === Representation.POINTS) {
164
+ publicAPI.getProgram().setUniformf('pointSize', actor.getProperty().getPointSize());
165
+ } else if (model.pointPicking) {
166
+ publicAPI.getProgram().setUniformf('pointSize', publicAPI.getPointPickingPrimitiveSize());
167
+ }
147
168
  };
148
169
 
149
170
  publicAPI.replaceShaderPositionVC = function (shaders, ren, actor) {
150
- var VSSource = shaders.Vertex; // for lines, make sure we add the width code
171
+ var VSSource = shaders.Vertex; // Always set point size in case we need picking
172
+
173
+ VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::PositionVC::Dec', ['//VTK::PositionVC::Dec', 'uniform float pointSize;']).result;
174
+ VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::PositionVC::Impl', ['//VTK::PositionVC::Impl', ' gl_PointSize = pointSize;'], false).result; // for lines, make sure we add the width code
151
175
 
152
176
  if (publicAPI.getOpenGLMode(actor.getProperty().getRepresentation()) === model.context.LINES && publicAPI.haveWideLines(ren, actor)) {
153
177
  VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::PositionVC::Dec', ['//VTK::PositionVC::Dec', 'uniform vec2 viewportSize;', 'uniform float lineWidthStepSize;', 'uniform float halfLineWidth;']).result;
154
178
  VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::PositionVC::Impl', ['//VTK::PositionVC::Impl', ' if (halfLineWidth > 0.0)', ' {', ' float offset = float(gl_InstanceID / 2) * lineWidthStepSize - halfLineWidth;', ' vec4 tmpPos = gl_Position;', ' vec3 tmpPos2 = tmpPos.xyz / tmpPos.w;', ' tmpPos2.x = tmpPos2.x + 2.0 * mod(float(gl_InstanceID), 2.0) * offset / viewportSize[0];', ' tmpPos2.y = tmpPos2.y + 2.0 * mod(float(gl_InstanceID + 1), 2.0) * offset / viewportSize[1];', ' gl_Position = vec4(tmpPos2.xyz * tmpPos.w, tmpPos.w);', ' }']).result;
155
- } // for points make sure to add in the point size
179
+ }
156
180
 
181
+ shaders.Vertex = VSSource;
182
+ };
157
183
 
158
- if (actor.getProperty().getRepresentation() === Representation.POINTS || model.primitiveType === primTypes.Points) {
159
- VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::PositionVC::Impl', ['//VTK::PositionVC::Impl', " gl_PointSize = ".concat(actor.getProperty().getPointSize(), ".0;")], false).result;
184
+ publicAPI.getPointPickingPrimitiveSize = function () {
185
+ if (model.primitiveType === primTypes.Points) {
186
+ return 2;
160
187
  }
161
188
 
162
- shaders.Vertex = VSSource;
189
+ if (model.primitiveType === primTypes.Lines) {
190
+ return 4;
191
+ }
192
+
193
+ return 6;
163
194
  };
164
195
  } // ----------------------------------------------------------------------------
165
196
  // Object factory
@@ -173,7 +204,8 @@ var DEFAULT_VALUES = {
173
204
  VAO: null,
174
205
  attributeUpdateTime: null,
175
206
  CABO: null,
176
- primitiveType: 0
207
+ primitiveType: 0,
208
+ pointPicking: false
177
209
  }; // ----------------------------------------------------------------------------
178
210
 
179
211
  function extend(publicAPI, model) {
@@ -185,7 +217,7 @@ function extend(publicAPI, model) {
185
217
  macro.obj(model.shaderSourceTime);
186
218
  model.attributeUpdateTime = {};
187
219
  macro.obj(model.attributeUpdateTime);
188
- macro.setGet(publicAPI, model, ['program', 'shaderSourceTime', 'VAO', 'attributeUpdateTime', 'CABO', 'primitiveType']);
220
+ macro.setGet(publicAPI, model, ['program', 'shaderSourceTime', 'VAO', 'attributeUpdateTime', 'CABO', 'primitiveType', 'pointPicking']);
189
221
  model.program = vtkShaderProgram.newInstance();
190
222
  model.VAO = vtkVertexArrayObject.newInstance();
191
223
  model.CABO = vtkCellArrayBufferObject.newInstance(); // Object methods
@@ -12,7 +12,10 @@ import { v as vtkPolyDataVS } from './glsl/vtkPolyDataVS.glsl.js';
12
12
  import { v as vtkPolyDataFS } from './glsl/vtkPolyDataFS.glsl.js';
13
13
  import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
14
14
  import { registerOverride } from './ViewNodeFactory.js';
15
+ import { PassTypes } from './HardwareSelector/Constants.js';
16
+ import vtkDataSet from '../../Common/DataModel/DataSet.js';
15
17
 
18
+ var FieldAssociations = vtkDataSet.FieldAssociations;
16
19
  /* eslint-disable no-lonely-if */
17
20
 
18
21
  var primTypes = vtkHelper.primTypes;
@@ -31,6 +34,16 @@ var EndEvent = {
31
34
  // vtkOpenGLPolyDataMapper methods
32
35
  // ----------------------------------------------------------------------------
33
36
 
37
+ function getPickState(renderer) {
38
+ var selector = renderer.getSelector();
39
+
40
+ if (selector) {
41
+ return selector.getCurrentPass();
42
+ }
43
+
44
+ return PassTypes.MIN_KNOWN_PASS - 1;
45
+ }
46
+
34
47
  function vtkOpenGLPolyDataMapper(publicAPI, model) {
35
48
  // Set our className
36
49
  model.classHierarchy.push('vtkOpenGLPolyDataMapper');
@@ -475,7 +488,10 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
475
488
  publicAPI.getCoincidentParameters = function (ren, actor) {
476
489
  // 1. ResolveCoincidentTopology is On and non zero for this primitive
477
490
  // type
478
- var cp = null;
491
+ var cp = {
492
+ factor: 0.0,
493
+ offset: 0.0
494
+ };
479
495
  var prop = actor.getProperty();
480
496
 
481
497
  if (model.renderable.getResolveCoincidentTopology() || prop.getEdgeVisibility() && prop.getRepresentation() === Representation.SURFACE) {
@@ -496,23 +512,49 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
496
512
  }
497
513
  } // hardware picking always offset due to saved zbuffer
498
514
  // This gets you above the saved surface depth buffer.
499
- // vtkHardwareSelector* selector = ren->GetSelector();
500
- // if (selector &&
501
- // selector->GetFieldAssociation() == vtkDataObject::FIELD_ASSOCIATION_POINTS)
502
- // {
503
- // offset -= 2.0;
504
- // return;
505
- // }
506
515
 
507
516
 
517
+ var selector = model.openGLRenderer.getSelector();
518
+
519
+ if (selector && selector.getFieldAssociation() === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
520
+ cp.offset -= 2.0;
521
+ }
522
+
508
523
  return cp;
509
524
  };
510
525
 
511
526
  publicAPI.replaceShaderPicking = function (shaders, ren, actor) {
512
527
  var FSSource = shaders.Fragment;
513
- FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Dec', ['uniform vec3 mapperIndex;', 'uniform int picking;']).result;
514
- FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Impl', ' gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];').result;
528
+ var VSSource = shaders.Vertex;
529
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Dec', ['uniform int picking;', '//VTK::Picking::Dec']).result;
530
+
531
+ if (!model.openGLRenderer.getSelector()) {
532
+ return;
533
+ }
534
+
535
+ if (model.lastSelectionState === PassTypes.ID_LOW24 || model.lastSelectionState === PassTypes.ID_HIGH24) {
536
+ VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::Picking::Dec', ['flat out int vertexIDVSOutput;\n', 'uniform int VertexIDOffset;\n']).result;
537
+ VSSource = vtkShaderProgram.substitute(VSSource, '//VTK::Picking::Impl', ' vertexIDVSOutput = gl_VertexID + VertexIDOffset;\n').result;
538
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Dec', 'flat in int vertexIDVSOutput;\n').result;
539
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Impl', [' int idx = vertexIDVSOutput;', '//VTK::Picking::Impl']).result;
540
+ }
541
+
542
+ switch (model.lastSelectionState) {
543
+ case PassTypes.ID_LOW24:
544
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Impl', ' gl_FragData[0] = vec4(float(idx%256)/255.0, float((idx/256)%256)/255.0, float((idx/65536)%256)/255.0, 1.0);').result;
545
+ break;
546
+
547
+ case PassTypes.ID_HIGH24:
548
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Impl', ' gl_FragData[0] = vec4(float(idx)/255.0, 0.0, 0.0, 1.0);').result;
549
+ break;
550
+
551
+ default:
552
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Dec', 'uniform vec3 mapperIndex;').result;
553
+ FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::Picking::Impl', ' gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];').result;
554
+ }
555
+
515
556
  shaders.Fragment = FSSource;
557
+ shaders.Vertex = VSSource;
516
558
  };
517
559
 
518
560
  publicAPI.replaceShaderValues = function (shaders, ren, actor) {
@@ -616,7 +658,7 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
616
658
  // light complexity changed
617
659
 
618
660
 
619
- if (model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest || cellBO.getShaderSourceTime().getMTime() < model.renderable.getMTime() || cellBO.getShaderSourceTime().getMTime() < model.currentInput.getMTime() || needRebuild) {
661
+ if (model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest || cellBO.getShaderSourceTime().getMTime() < model.renderable.getMTime() || cellBO.getShaderSourceTime().getMTime() < model.currentInput.getMTime() || cellBO.getShaderSourceTime().getMTime() < model.selectionStateChanged.getMTime() || needRebuild) {
620
662
  model.lastHaveSeenDepthRequest = model.haveSeenDepthRequest;
621
663
  return true;
622
664
  }
@@ -640,6 +682,10 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
640
682
  cellBO.getProgram().setUniformi('PrimitiveIDOffset', model.primitiveIDOffset);
641
683
  }
642
684
 
685
+ if (cellBO.getProgram().isUniformUsed('VertexIDOffset')) {
686
+ cellBO.getProgram().setUniformi('VertexIDOffset', model.vertexIDOffset);
687
+ }
688
+
643
689
  if (cellBO.getCABO().getElementCount() && (model.VBOBuildTime.getMTime() > cellBO.getAttributeUpdateTime().getMTime() || cellBO.getShaderSourceTime().getMTime() > cellBO.getAttributeUpdateTime().getMTime())) {
644
690
  var lastLightComplexity = model.lastBoundBO.getReferenceByName('lastLightComplexity');
645
691
 
@@ -934,11 +980,44 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
934
980
  }
935
981
  };
936
982
 
983
+ publicAPI.updateMaximumPointCellIds = function (ren, actor) {
984
+ var _model$selectionWebGL, _model$selectionWebGL2, _model$selectionWebGL3, _model$selectionWebGL4;
985
+
986
+ var selector = model.openGLRenderer.getSelector();
987
+
988
+ if (!selector) {
989
+ return;
990
+ }
991
+
992
+ if ((_model$selectionWebGL = model.selectionWebGLIdsToVTKIds) !== null && _model$selectionWebGL !== void 0 && (_model$selectionWebGL2 = _model$selectionWebGL.points) !== null && _model$selectionWebGL2 !== void 0 && _model$selectionWebGL2.length) {
993
+ var length = model.selectionWebGLIdsToVTKIds.points.length;
994
+ selector.setMaximumPointId(length - 1);
995
+ }
996
+
997
+ if ((_model$selectionWebGL3 = model.selectionWebGLIdsToVTKIds) !== null && _model$selectionWebGL3 !== void 0 && (_model$selectionWebGL4 = _model$selectionWebGL3.cells) !== null && _model$selectionWebGL4 !== void 0 && _model$selectionWebGL4.length) {
998
+ var _length = model.selectionWebGLIdsToVTKIds.cells.length;
999
+ selector.setMaximumCellId(_length - 1);
1000
+ }
1001
+
1002
+ var fieldAssociation = selector.getFieldAssociation();
1003
+
1004
+ if (fieldAssociation === FieldAssociations.FIELD_ASSOCIATION_POINTS) {
1005
+ model.pointPicking = true;
1006
+ }
1007
+ };
1008
+
937
1009
  publicAPI.renderPieceStart = function (ren, actor) {
938
1010
  model.primitiveIDOffset = 0;
1011
+ model.vertexIDOffset = 0;
1012
+ var picking = getPickState(model.openGLRenderer);
1013
+
1014
+ if (model.lastSelectionState !== picking) {
1015
+ model.selectionStateChanged.modified();
1016
+ model.lastSelectionState = picking;
1017
+ }
939
1018
 
940
1019
  if (model.openGLRenderer.getSelector()) {
941
- switch (model.openGLRenderer.getSelector().getCurrentPass()) {
1020
+ switch (picking) {
942
1021
  default:
943
1022
  model.openGLRenderer.getSelector().renderProp(actor);
944
1023
  }
@@ -958,10 +1037,13 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
958
1037
 
959
1038
  publicAPI.renderPieceDraw = function (ren, actor) {
960
1039
  var representation = actor.getProperty().getRepresentation();
961
- var drawSurfaceWithEdges = actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE; // for every primitive type
1040
+ var drawSurfaceWithEdges = actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE;
1041
+ var selector = model.openGLRenderer.getSelector(); // If we are picking points, we need to tell it to the helper
1042
+
1043
+ var pointPicking = selector && selector.getFieldAssociation() === FieldAssociations.FIELD_ASSOCIATION_POINTS && (model.lastSelectionState === PassTypes.ID_LOW24 || model.lastSelectionState === PassTypes.ID_HIGH24); // for every primitive type
962
1044
 
963
1045
  for (var i = primTypes.Start; i < primTypes.End; i++) {
964
- // if there are entries
1046
+ model.primitives[i].setPointPicking(pointPicking);
965
1047
  var cabo = model.primitives[i].getCABO();
966
1048
 
967
1049
  if (cabo.getElementCount()) {
@@ -971,6 +1053,7 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
971
1053
  if (!model.drawingEdges || !model.renderDepth) {
972
1054
  model.lastBoundBO = model.primitives[i];
973
1055
  model.primitiveIDOffset += model.primitives[i].drawArrays(ren, actor, representation, publicAPI);
1056
+ model.vertexIDOffset += model.primitives[i].getCABO().getElementCount();
974
1057
  }
975
1058
  }
976
1059
  }
@@ -1134,41 +1217,70 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
1134
1217
  tcoords: tcoords,
1135
1218
  colors: c,
1136
1219
  cellOffset: 0,
1220
+ vertexOffset: 0,
1221
+ // Used to keep track of vertex ids across primitives for selection
1137
1222
  haveCellScalars: model.haveCellScalars,
1138
1223
  haveCellNormals: model.haveCellNormals,
1139
1224
  customAttributes: model.renderable.getCustomShaderAttributes().map(function (arrayName) {
1140
1225
  return poly.getPointData().getArrayByName(arrayName);
1141
1226
  })
1142
1227
  };
1143
- options.cellOffset += model.primitives[primTypes.Points].getCABO().createVBO(poly.getVerts(), 'verts', representation, options);
1144
- options.cellOffset += model.primitives[primTypes.Lines].getCABO().createVBO(poly.getLines(), 'lines', representation, options);
1145
- options.cellOffset += model.primitives[primTypes.Tris].getCABO().createVBO(poly.getPolys(), 'polys', representation, options);
1146
- options.cellOffset += model.primitives[primTypes.TriStrips].getCABO().createVBO(poly.getStrips(), 'strips', representation, options);
1147
- var drawSurfaceWithEdges = actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE; // if we have edge visibility build the edge VBOs
1148
-
1149
- if (drawSurfaceWithEdges) {
1150
- model.primitives[primTypes.TrisEdges].getCABO().createVBO(poly.getPolys(), 'polys', Representation.WIREFRAME, {
1151
- points: points,
1152
- normals: n,
1153
- tcoords: null,
1154
- colors: null,
1155
- cellOffset: 0,
1156
- haveCellScalars: false,
1157
- haveCellNormals: false
1158
- });
1159
- model.primitives[primTypes.TriStripsEdges].getCABO().createVBO(poly.getStrips(), 'strips', Representation.WIREFRAME, {
1160
- points: points,
1161
- normals: n,
1162
- tcoords: null,
1163
- colors: null,
1164
- cellOffset: 0,
1165
- haveCellScalars: false,
1166
- haveCellNormals: false
1167
- });
1168
- } else {
1169
- // otherwise free them
1170
- model.primitives[primTypes.TrisEdges].releaseGraphicsResources(model._openGLRenderWindow);
1171
- model.primitives[primTypes.TriStripsEdges].releaseGraphicsResources(model._openGLRenderWindow);
1228
+
1229
+ if (model.renderable.getPopulateSelectionSettings()) {
1230
+ model.selectionWebGLIdsToVTKIds = {
1231
+ points: null,
1232
+ cells: null
1233
+ };
1234
+ }
1235
+
1236
+ var primitives = [{
1237
+ inRep: 'verts',
1238
+ cells: poly.getVerts()
1239
+ }, {
1240
+ inRep: 'lines',
1241
+ cells: poly.getLines()
1242
+ }, {
1243
+ inRep: 'polys',
1244
+ cells: poly.getPolys()
1245
+ }, {
1246
+ inRep: 'strips',
1247
+ cells: poly.getStrips()
1248
+ }, {
1249
+ inRep: 'polys',
1250
+ cells: poly.getPolys()
1251
+ }, {
1252
+ inRep: 'strips',
1253
+ cells: poly.getStrips()
1254
+ }];
1255
+ var drawSurfaceWithEdges = // TODO: false if picking
1256
+ actor.getProperty().getEdgeVisibility() && representation === Representation.SURFACE;
1257
+
1258
+ for (var i = primTypes.Start; i < primTypes.End; i++) {
1259
+ if (i !== primTypes.TrisEdges && i !== primTypes.TriStripsEdges) {
1260
+ options.cellOffset += model.primitives[i].getCABO().createVBO(primitives[i].cells, primitives[i].inRep, representation, options, model.selectionWebGLIdsToVTKIds);
1261
+ options.vertexOffset += model.primitives[i].getCABO().getElementCount();
1262
+ } else {
1263
+ // if we have edge visibility build the edge VBOs
1264
+ if (drawSurfaceWithEdges) {
1265
+ model.primitives[i].getCABO().createVBO(primitives[i].cells, primitives[i].inRep, Representation.WIREFRAME, {
1266
+ points: points,
1267
+ normals: n,
1268
+ tcoords: null,
1269
+ colors: null,
1270
+ cellOffset: 0,
1271
+ haveCellScalars: false,
1272
+ haveCellNormals: false
1273
+ });
1274
+ } else {
1275
+ // otherwise free them
1276
+ model.primitives[i].releaseGraphicsResources();
1277
+ }
1278
+ }
1279
+ }
1280
+
1281
+ if (model.renderable.getPopulateSelectionSettings()) {
1282
+ model.renderable.setSelectionWebGLIdsToVTKIds(model.selectionWebGLIdsToVTKIds);
1283
+ publicAPI.updateMaximumPointCellIds();
1172
1284
  }
1173
1285
 
1174
1286
  model.VBOBuildTime.modified();
@@ -1201,7 +1313,11 @@ var DEFAULT_VALUES = {
1201
1313
  lightDirection: [],
1202
1314
  // used internally
1203
1315
  lastHaveSeenDepthRequest: false,
1204
- haveSeenDepthRequest: false
1316
+ haveSeenDepthRequest: false,
1317
+ lastSelectionState: PassTypes.MIN_KNOWN_PASS - 1,
1318
+ selectionStateChanged: null,
1319
+ selectionWebGLIdsToVTKIds: null,
1320
+ pointPicking: false
1205
1321
  }; // ----------------------------------------------------------------------------
1206
1322
 
1207
1323
  function extend(publicAPI, model) {
@@ -1230,6 +1346,10 @@ function extend(publicAPI, model) {
1230
1346
  model.VBOBuildTime = {};
1231
1347
  obj(model.VBOBuildTime, {
1232
1348
  mtime: 0
1349
+ });
1350
+ model.selectionStateChanged = {};
1351
+ obj(model.selectionStateChanged, {
1352
+ mtime: 0
1233
1353
  }); // Object methods
1234
1354
 
1235
1355
  vtkOpenGLPolyDataMapper(publicAPI, model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.13.1",
3
+ "version": "24.14.2",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",