@kitware/vtk.js 25.13.5 → 25.14.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,3 @@
1
- var svgLogo = "<svg viewBox=\"0 0 196 196\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M67.77 157.024a86.095 86.095 0 01-2.3 9.306c-.977 3.206-2.44 6.116-4.392 8.73-1.952 2.614-4.531 4.758-7.738 6.43-3.206 1.674-7.284 2.51-12.233 2.51-6.343 0-11.501-1.55-15.474-4.653-3.974-3.102-6.518-7.301-7.633-12.599l16.102-5.228c.279 1.882 1.01 3.485 2.196 4.81 1.185 1.324 2.753 1.986 4.705 1.986 3.067 0 5.262-1.08 6.587-3.24 1.324-2.162 2.265-4.88 2.823-8.156l8.574-48.933h17.565l-8.783 49.037zm58.029-31.053c-1.394-1.883-3.137-3.311-5.228-4.287-2.091-.976-4.426-1.464-7.005-1.464-1.185 0-2.44.157-3.764.47a10.815 10.815 0 00-3.608 1.569 9.806 9.806 0 00-2.718 2.77c-.732 1.116-1.098 2.475-1.098 4.078 0 2.091.819 3.747 2.457 4.967 1.638 1.22 3.921 2.352 6.849 3.398 3.206 1.115 6.064 2.352 8.573 3.712 2.51 1.359 4.636 2.91 6.378 4.652 1.743 1.743 3.067 3.712 3.974 5.908.906 2.196 1.359 4.688 1.359 7.476 0 4.461-.924 8.26-2.77 11.397-1.848 3.136-4.236 5.698-7.163 7.685-2.928 1.986-6.204 3.433-9.829 4.339-3.624.906-7.214 1.359-10.769 1.359-2.649 0-5.298-.244-7.946-.732a42.608 42.608 0 01-7.633-2.143 31.681 31.681 0 01-6.796-3.608c-2.092-1.463-3.869-3.136-5.333-5.018l12.86-10.456c1.465 2.23 3.625 4.043 6.483 5.437 2.858 1.394 5.751 2.091 8.679 2.091 1.533 0 3.014-.157 4.443-.47 1.43-.314 2.701-.837 3.817-1.569a8.267 8.267 0 002.666-2.823c.662-1.15.993-2.527.993-4.13 0-2.579-1.045-4.618-3.136-6.117-2.092-1.498-4.88-2.84-8.365-4.025a58.492 58.492 0 01-6.849-2.823c-2.126-1.046-3.973-2.335-5.541-3.869-1.569-1.533-2.823-3.363-3.764-5.489-.941-2.126-1.412-4.688-1.412-7.685 0-3.764.784-7.162 2.353-10.194a23.324 23.324 0 016.43-7.738c2.719-2.126 5.89-3.764 9.515-4.914 3.624-1.15 7.493-1.725 11.606-1.725 2.16 0 4.356.21 6.587.627a35.853 35.853 0 016.43 1.83 28.502 28.502 0 015.699 2.98c1.742 1.185 3.206 2.544 4.39 4.078L125.8 125.97z\" fill=\"#8A8B8A\"/><rect fill=\"#1C4678\" transform=\"rotate(45 169.749 159.749)\" x=\"152.249\" y=\"142.249\" width=\"35\" height=\"35\" rx=\"17.5\"/><path fill=\"#1C4678\" d=\"M7.775 11l20.483 86.069h22.53l34.24-71.408H63.841L42.91 70.03 28.259 11zM88.663 25.344h50.476l-8.093 16.562-17.246-.049-9.652 54.62H85.609l9.572-54.535H80.99zM141.366 25.344l16.072.066-4.414 24.987h2.388l16.856-25.053h20.975l-22.442 33.403 13.203 54.063h-20.94l-10.652-44.43h-2.296l-5.125 28.135h-21.024l9.763-55.043z\"/><path fill=\"#8A8B8A\" d=\"M3 11h3.182l20.864 85.944h-3.187zM58.102 25.344h2.788L43.747 61.155l-.955-3.866zM88.608 44.469h2.883l-9.157 52.096H79.4zM126.785 44.469h2.924l-9.186 52.046H117.6zM166.38 25.344h3.594l-12.582 18.854 1.316-7.545zM150.902 74.75l8.917 37.613h-3.311l-7.075-29.073z\"/></g></svg>";
1
+ var svgLogo = "<svg viewBox=\"0 0 196 196\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M67.77 157.024a86.095 86.095 0 0 1-2.3 9.306c-.977 3.206-2.44 6.116-4.392 8.73-1.952 2.614-4.531 4.758-7.738 6.43-3.206 1.674-7.284 2.51-12.233 2.51-6.343 0-11.501-1.55-15.474-4.653-3.974-3.102-6.518-7.301-7.633-12.599l16.102-5.228c.279 1.882 1.01 3.485 2.196 4.81 1.185 1.324 2.753 1.986 4.705 1.986 3.067 0 5.262-1.08 6.587-3.24 1.324-2.162 2.265-4.88 2.823-8.156l8.574-48.933h17.565l-8.783 49.037Zm58.029-31.053c-1.394-1.883-3.137-3.311-5.228-4.287-2.091-.976-4.426-1.464-7.005-1.464-1.185 0-2.44.157-3.764.47a10.815 10.815 0 0 0-3.608 1.569 9.806 9.806 0 0 0-2.718 2.77c-.732 1.116-1.098 2.475-1.098 4.078 0 2.091.819 3.747 2.457 4.967 1.638 1.22 3.921 2.352 6.849 3.398 3.206 1.115 6.064 2.352 8.573 3.712 2.51 1.359 4.636 2.91 6.378 4.652 1.743 1.743 3.067 3.712 3.974 5.908.906 2.196 1.359 4.688 1.359 7.476 0 4.461-.924 8.26-2.77 11.397-1.848 3.136-4.236 5.698-7.163 7.685-2.928 1.986-6.204 3.433-9.829 4.339-3.624.906-7.214 1.359-10.769 1.359-2.649 0-5.298-.244-7.946-.732a42.608 42.608 0 0 1-7.633-2.143 31.681 31.681 0 0 1-6.796-3.608c-2.092-1.463-3.869-3.136-5.333-5.018l12.86-10.456c1.465 2.23 3.625 4.043 6.483 5.437 2.858 1.394 5.751 2.091 8.679 2.091 1.533 0 3.014-.157 4.443-.47 1.43-.314 2.701-.837 3.817-1.569a8.267 8.267 0 0 0 2.666-2.823c.662-1.15.993-2.527.993-4.13 0-2.579-1.045-4.618-3.136-6.117-2.092-1.498-4.88-2.84-8.365-4.025a58.492 58.492 0 0 1-6.849-2.823c-2.126-1.046-3.973-2.335-5.541-3.869-1.569-1.533-2.823-3.363-3.764-5.489-.941-2.126-1.412-4.688-1.412-7.685 0-3.764.784-7.162 2.353-10.194a23.324 23.324 0 0 1 6.43-7.738c2.719-2.126 5.89-3.764 9.515-4.914 3.624-1.15 7.493-1.725 11.606-1.725 2.16 0 4.356.21 6.587.627a35.853 35.853 0 0 1 6.43 1.83 28.502 28.502 0 0 1 5.699 2.98c1.742 1.185 3.206 2.544 4.39 4.078L125.8 125.97Z\" fill=\"#8A8B8A\"/><rect fill=\"#1C4678\" transform=\"rotate(45 169.749 159.749)\" x=\"152.249\" y=\"142.249\" width=\"35\" height=\"35\" rx=\"17.5\"/><path fill=\"#1C4678\" d=\"m7.775 11 20.483 86.069h22.53l34.24-71.408H63.841L42.91 70.03 28.259 11zM88.663 25.344h50.476l-8.093 16.562-17.246-.049-9.652 54.62H85.609l9.572-54.535H80.99zM141.366 25.344l16.072.066-4.414 24.987h2.388l16.856-25.053h20.975l-22.442 33.403 13.203 54.063h-20.94l-10.652-44.43h-2.296l-5.125 28.135h-21.024l9.763-55.043z\"/><path fill=\"#8A8B8A\" d=\"M3 11h3.182l20.864 85.944h-3.187zM58.102 25.344h2.788L43.747 61.155l-.955-3.866zM88.608 44.469h2.883l-9.157 52.096H79.4zM126.785 44.469h2.924l-9.186 52.046H117.6zM166.38 25.344h3.594l-12.582 18.854 1.316-7.545zM150.902 74.75l8.917 37.613h-3.311l-7.075-29.073z\"/></g></svg>";
2
2
 
3
3
  export { svgLogo as s };
@@ -1,3 +1,3 @@
1
- var Tint = "<svg viewBox=\"0 0 180 180\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M90 24c20 29.485 45 58.5 45 86s-17.5 46.485-45 46.485S45 137.5 45 110s25-56.515 45-86z\" stroke=\"#000\" stroke-width=\"10\" fill=\"#000\" fill-rule=\"evenodd\"/></svg>";
1
+ var Tint = "<svg viewBox=\"0 0 180 180\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M90 24c20 29.485 45 58.5 45 86s-17.5 46.485-45 46.485S45 137.5 45 110s25-56.515 45-86Z\" stroke=\"#000\" stroke-width=\"10\" fill=\"#000\" fill-rule=\"evenodd\"/></svg>";
2
2
 
3
3
  export { Tint as T };
@@ -16,6 +16,11 @@ export interface vtkSphereMapper extends vtkMapper {
16
16
  */
17
17
  getScaleArray(): any;
18
18
 
19
+ /**
20
+ *
21
+ */
22
+ getScaleFactor(): number;
23
+
19
24
  /**
20
25
  *
21
26
  * @param {Number} radius
@@ -27,6 +32,13 @@ export interface vtkSphereMapper extends vtkMapper {
27
32
  * @param scaleArray
28
33
  */
29
34
  setScaleArray(scaleArray: any): boolean;
35
+
36
+ /**
37
+ * Factor multiplied with scale array elements. Radius is used when no scale array is given.
38
+ * @param scaleFactor number to multiply with when a scale array is provided. 1 by default.
39
+ * @see getScaleFactor(), setScaleArray(), setRadius()
40
+ */
41
+ setScaleFactor(scaleFactor: number): boolean;
30
42
  }
31
43
 
32
44
  /**
@@ -14,7 +14,8 @@ function vtkSphereMapper(publicAPI, model) {
14
14
 
15
15
  var DEFAULT_VALUES = {
16
16
  scaleArray: null,
17
- radius: 0.05
17
+ radius: 0.05,
18
+ scaleFactor: 1.0
18
19
  }; // ----------------------------------------------------------------------------
19
20
 
20
21
  function extend(publicAPI, model) {
@@ -22,7 +23,7 @@ function extend(publicAPI, model) {
22
23
  Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
23
24
 
24
25
  vtkMapper.extend(publicAPI, model, initialValues);
25
- macro.setGet(publicAPI, model, ['radius', 'scaleArray']); // Object methods
26
+ macro.setGet(publicAPI, model, ['radius', 'scaleArray', 'scaleFactor']); // Object methods
26
27
 
27
28
  vtkSphereMapper(publicAPI, model);
28
29
  } // ----------------------------------------------------------------------------
@@ -88,6 +88,18 @@ function vtkOpenGLSphereMapper(publicAPI, model) {
88
88
  cellBO.getProgram().setUniformf('invertedDepth', model.invert ? -1.0 : 1.0);
89
89
  }
90
90
 
91
+ if (cellBO.getProgram().isUniformUsed('scaleFactor')) {
92
+ // apply scaling factor only if a scale array has been provided.
93
+ var poly = model.currentInput;
94
+ var pointData = poly.getPointData();
95
+
96
+ if (model.renderable.getScaleArray() != null && pointData.hasArray(model.renderable.getScaleArray())) {
97
+ cellBO.getProgram().setUniformf('scaleFactor', model.renderable.getScaleFactor());
98
+ } else {
99
+ cellBO.getProgram().setUniformf('scaleFactor', 1.0);
100
+ }
101
+ }
102
+
91
103
  superClass.setMapperShaderParameters(cellBO, ren, actor);
92
104
  };
93
105
 
@@ -1,3 +1,3 @@
1
- var vtkSphereMapperVS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + offsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n";
1
+ var vtkSphereMapperVS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n";
2
2
 
3
3
  export { vtkSphereMapperVS as v };
@@ -134,7 +134,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
134
134
  var radius = model.renderable.getRadius();
135
135
 
136
136
  if (scales) {
137
- radius = scales[_id];
137
+ radius = scales[_id] * model.renderable.getScaleFactor();
138
138
  }
139
139
 
140
140
  _tmpVBO[_vboIdx++] = -2.0 * radius * cos30;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "25.13.5",
3
+ "version": "25.14.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",
@@ -64,7 +64,7 @@
64
64
  "babel-loader": "8.2.5",
65
65
  "babel-plugin-istanbul": "6.1.1",
66
66
  "buffer": "6.0.3",
67
- "commitizen": "4.2.4",
67
+ "commitizen": "4.2.5",
68
68
  "concurrently": "7.1.0",
69
69
  "copy-webpack-plugin": "10.2.4",
70
70
  "cross-env": "7.0.3",
@@ -110,7 +110,7 @@
110
110
  "rollup-plugin-polyfill-node": "0.9.0",
111
111
  "rollup-plugin-postcss": "4.0.2",
112
112
  "rollup-plugin-string": "3.0.0",
113
- "rollup-plugin-svgo": "1.1.0",
113
+ "rollup-plugin-svgo": "2.0.0",
114
114
  "rollup-plugin-web-worker-loader": "1.6.1",
115
115
  "semantic-release": "19.0.3",
116
116
  "string-replace-loader": "3.1.0",