@kitware/vtk.js 25.9.1 → 25.10.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.
@@ -1,3 +1,4 @@
1
+ import vtkDataArray from './../../Common/Core/DataArray';
1
2
  import { vtkObject } from './../../interfaces';
2
3
  import { ColorSpace, Scale } from './ColorTransferFunction/Constants';
3
4
 
@@ -201,6 +202,25 @@ export interface vtkColorTransferFunction extends vtkObject {
201
202
  withAlpha: boolean
202
203
  ): Float32Array;
203
204
 
205
+ /**
206
+ * Construct a color transfer function from a vtkDataArray.
207
+ * The order of values depends on the number of components
208
+ * of the array.
209
+ * 3 -> RGB
210
+ * 4 -> XRGB
211
+ * 5 -> RGBMS
212
+ * 6 -> XRGBMS
213
+ *
214
+ * X represents the input value to a function
215
+ * RGB represents the red, green, and blue value output
216
+ * M represents the midpoint
217
+ * S represents sharpness
218
+ * @param {vtkDataArray} array
219
+ */
220
+ buildFunctionFromArray(
221
+ array: vtkDataArray,
222
+ ): void;
223
+
204
224
  /**
205
225
  * Construct a color transfer function from a table.
206
226
  * @param {Number} xStart The index of the first point.
@@ -849,6 +849,69 @@ function vtkColorTransferFunction(publicAPI, model) {
849
849
 
850
850
  model.buildTime.modified();
851
851
  return model.table;
852
+ };
853
+
854
+ publicAPI.buildFunctionFromArray = function (array) {
855
+ publicAPI.removeAllPoints();
856
+ var numComponents = array.getNumberOfComponents();
857
+
858
+ for (var i = 0; i < array.getNumberOfTuples(); i++) {
859
+ switch (numComponents) {
860
+ case 3:
861
+ {
862
+ model.nodes.push({
863
+ x: i,
864
+ r: array.getComponent(i, 0),
865
+ g: array.getComponent(i, 1),
866
+ b: array.getComponent(i, 2),
867
+ midpoint: 0.5,
868
+ sharpness: 0.0
869
+ });
870
+ break;
871
+ }
872
+
873
+ case 4:
874
+ {
875
+ model.nodes.push({
876
+ x: array.getComponent(i, 0),
877
+ r: array.getComponent(i, 1),
878
+ g: array.getComponent(i, 2),
879
+ b: array.getComponent(i, 3),
880
+ midpoint: 0.5,
881
+ sharpness: 0.0
882
+ });
883
+ break;
884
+ }
885
+
886
+ case 5:
887
+ {
888
+ model.nodes.push({
889
+ x: i,
890
+ r: array.getComponent(i, 0),
891
+ g: array.getComponent(i, 1),
892
+ b: array.getComponent(i, 2),
893
+ midpoint: array.getComponent(i, 4),
894
+ sharpness: array.getComponent(i, 5)
895
+ });
896
+ break;
897
+ }
898
+
899
+ case 6:
900
+ {
901
+ model.nodes.push({
902
+ x: array.getComponent(i, 0),
903
+ r: array.getComponent(i, 1),
904
+ g: array.getComponent(i, 2),
905
+ b: array.getComponent(i, 3),
906
+ midpoint: array.getComponent(i, 4),
907
+ sharpness: array.getComponent(i, 5)
908
+ });
909
+ break;
910
+ }
911
+ }
912
+ }
913
+
914
+ publicAPI.sortAndUpdateRange();
852
915
  }; //----------------------------------------------------------------------------
853
916
 
854
917
 
@@ -1,3 +1,4 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
3
  import { mat3, mat4, vec3 } from 'gl-matrix';
3
4
  import { newInstance as newInstance$1, setGet, obj, vtkErrorMacro as vtkErrorMacro$1 } from '../../macros.js';
@@ -16,6 +17,9 @@ import { registerOverride } from './ViewNodeFactory.js';
16
17
  import { PassTypes } from './HardwareSelector/Constants.js';
17
18
  import vtkDataSet from '../../Common/DataModel/DataSet.js';
18
19
 
20
+ 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; }
21
+
22
+ 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; }
19
23
  var FieldAssociations = vtkDataSet.FieldAssociations;
20
24
  /* eslint-disable no-lonely-if */
21
25
 
@@ -1276,15 +1280,13 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
1276
1280
  } else {
1277
1281
  // if we have edge visibility build the edge VBOs
1278
1282
  if (drawSurfaceWithEdges) {
1279
- model.primitives[i].getCABO().createVBO(primitives[i].cells, primitives[i].inRep, Representation.WIREFRAME, {
1280
- points: points,
1281
- normals: n,
1283
+ options.cellOffset += model.primitives[i].getCABO().createVBO(primitives[i].cells, primitives[i].inRep, Representation.WIREFRAME, _objectSpread(_objectSpread({}, options), {}, {
1282
1284
  tcoords: null,
1283
1285
  colors: null,
1284
- cellOffset: 0,
1285
1286
  haveCellScalars: false,
1286
1287
  haveCellNormals: false
1287
- });
1288
+ }), model.selectionWebGLIdsToVTKIds);
1289
+ options.vertexOffset += model.primitives[i].getCABO().getElementCount();
1288
1290
  } else {
1289
1291
  // otherwise free them
1290
1292
  model.primitives[i].releaseGraphicsResources();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "25.9.1",
3
+ "version": "25.10.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",