@kitware/vtk.js 20.1.2 → 20.2.1

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.
Files changed (309) hide show
  1. package/Common/Core/Base64.d.ts +14 -2
  2. package/Common/Core/Base64.js +31 -2
  3. package/Common/Core/Math/index.js +3 -3
  4. package/Common/Core/Math.d.ts +128 -128
  5. package/Common/Core/Math.js +1 -1
  6. package/Common/Core/MatrixBuilder.js +39 -41
  7. package/Common/DataModel/ImageData.js +12 -14
  8. package/Common/Transform/LandmarkTransform.js +6 -7
  9. package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
  10. package/Filters/General/PaintFilter.js +11 -11
  11. package/Filters/Sources/PlaneSource.js +12 -13
  12. package/IO/Core/BinaryHelper.js +2 -4
  13. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
  14. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
  15. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
  16. package/IO/Core/ZipMultiDataSetReader.js +1 -1
  17. package/IO/Core/ZipMultiDataSetWriter.js +1 -1
  18. package/IO/Geometry/STLWriter.js +4 -4
  19. package/IO/Misc/SkyboxReader.js +1 -1
  20. package/IO/XML/XMLReader.js +3 -4
  21. package/IO/XML/XMLWriter.js +5 -6
  22. package/Imaging/Core/ImageReslice.js +18 -19
  23. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
  24. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
  25. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
  26. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
  27. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
  28. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  29. package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
  30. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
  31. package/Rendering/Core/Actor.js +3 -4
  32. package/Rendering/Core/Camera.js +81 -84
  33. package/Rendering/Core/CellPicker.js +2 -2
  34. package/Rendering/Core/CubeAxesActor.js +32 -33
  35. package/Rendering/Core/Follower.js +20 -21
  36. package/Rendering/Core/Glyph3DMapper.js +30 -32
  37. package/Rendering/Core/ImageMapper.js +2 -2
  38. package/Rendering/Core/ImageSlice.js +5 -6
  39. package/Rendering/Core/Picker.js +5 -6
  40. package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
  41. package/Rendering/Core/Prop3D.js +24 -25
  42. package/Rendering/Core/Renderer.js +11 -12
  43. package/Rendering/Core/ScalarBarActor.js +32 -33
  44. package/Rendering/Core/Volume.js +3 -4
  45. package/Rendering/OpenGL/Actor.js +9 -10
  46. package/Rendering/OpenGL/Camera.js +8 -9
  47. package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
  48. package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
  49. package/Rendering/OpenGL/ImageMapper.js +7 -7
  50. package/Rendering/OpenGL/ImageSlice.js +4 -4
  51. package/Rendering/OpenGL/PolyDataMapper.js +11 -13
  52. package/Rendering/OpenGL/RenderWindow.d.ts +37 -1
  53. package/Rendering/OpenGL/ShaderCache.js +1 -1
  54. package/Rendering/OpenGL/Skybox.js +4 -5
  55. package/Rendering/OpenGL/SphereMapper.js +2 -2
  56. package/Rendering/OpenGL/StickMapper.js +3 -4
  57. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
  58. package/Rendering/OpenGL/Volume.js +6 -7
  59. package/Rendering/OpenGL/VolumeMapper.js +47 -49
  60. package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
  61. package/Rendering/WebGPU/Actor.js +8 -8
  62. package/Rendering/WebGPU/Camera.js +8 -8
  63. package/Rendering/WebGPU/ImageMapper.js +18 -19
  64. package/Rendering/WebGPU/ImageSlice.js +9 -9
  65. package/Rendering/WebGPU/PolyDataMapper.js +3 -4
  66. package/Rendering/WebGPU/Renderer.js +6 -7
  67. package/Rendering/WebGPU/Texture.js +10 -9
  68. package/Rendering/WebGPU/Volume.js +3 -3
  69. package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
  70. package/ThirdParty/index.js +2 -2
  71. package/Widgets/Manipulators/TrackballManipulator.js +5 -6
  72. package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
  73. package/Widgets/Representations/CircleContextRepresentation.js +4 -5
  74. package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
  75. package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
  76. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
  77. package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
  78. package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
  79. package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
  80. package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
  81. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
  82. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  83. package/package.json +2 -2
  84. package/vtk.js +2 -2
  85. package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
  86. package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
  87. package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
  88. package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
  89. package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
  90. package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
  91. package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
  92. package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
  93. package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
  94. package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
  95. package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
  96. package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
  97. package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
  98. package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
  99. package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
  100. package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
  101. package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
  102. package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
  103. package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
  104. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
  105. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
  106. package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
  107. package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
  108. package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
  109. package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
  110. package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
  111. package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
  112. package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
  113. package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
  114. package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
  115. package/_virtual/commonjsHelpers.js +0 -22
  116. package/_virtual/polyfill-node.buffer.js +0 -1971
  117. package/_virtual/polyfill-node.global.js +0 -5
  118. package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
  119. package/vendor/base64-js/index.js +0 -72
  120. package/vendor/blueimp-md5/js/md5.js +0 -402
  121. package/vendor/d3-array/src/array.js +0 -1
  122. package/vendor/d3-array/src/ascending.js +0 -5
  123. package/vendor/d3-array/src/bin.js +0 -1
  124. package/vendor/d3-array/src/bisect.js +0 -10
  125. package/vendor/d3-array/src/bisector.js +0 -46
  126. package/vendor/d3-array/src/constant.js +0 -1
  127. package/vendor/d3-array/src/count.js +0 -1
  128. package/vendor/d3-array/src/cross.js +0 -1
  129. package/vendor/d3-array/src/cumsum.js +0 -1
  130. package/vendor/d3-array/src/descending.js +0 -1
  131. package/vendor/d3-array/src/deviation.js +0 -1
  132. package/vendor/d3-array/src/difference.js +0 -1
  133. package/vendor/d3-array/src/disjoint.js +0 -1
  134. package/vendor/d3-array/src/every.js +0 -1
  135. package/vendor/d3-array/src/extent.js +0 -1
  136. package/vendor/d3-array/src/filter.js +0 -1
  137. package/vendor/d3-array/src/fsum.js +0 -1
  138. package/vendor/d3-array/src/greatest.js +0 -1
  139. package/vendor/d3-array/src/greatestIndex.js +0 -1
  140. package/vendor/d3-array/src/group.js +0 -1
  141. package/vendor/d3-array/src/groupSort.js +0 -1
  142. package/vendor/d3-array/src/identity.js +0 -1
  143. package/vendor/d3-array/src/index.js +0 -1
  144. package/vendor/d3-array/src/intersection.js +0 -1
  145. package/vendor/d3-array/src/least.js +0 -1
  146. package/vendor/d3-array/src/leastIndex.js +0 -1
  147. package/vendor/d3-array/src/map.js +0 -1
  148. package/vendor/d3-array/src/max.js +0 -1
  149. package/vendor/d3-array/src/maxIndex.js +0 -1
  150. package/vendor/d3-array/src/mean.js +0 -1
  151. package/vendor/d3-array/src/median.js +0 -1
  152. package/vendor/d3-array/src/merge.js +0 -1
  153. package/vendor/d3-array/src/min.js +0 -1
  154. package/vendor/d3-array/src/minIndex.js +0 -1
  155. package/vendor/d3-array/src/mode.js +0 -1
  156. package/vendor/d3-array/src/nice.js +0 -1
  157. package/vendor/d3-array/src/number.js +0 -5
  158. package/vendor/d3-array/src/pairs.js +0 -1
  159. package/vendor/d3-array/src/permute.js +0 -1
  160. package/vendor/d3-array/src/quantile.js +0 -1
  161. package/vendor/d3-array/src/quickselect.js +0 -1
  162. package/vendor/d3-array/src/range.js +0 -1
  163. package/vendor/d3-array/src/reduce.js +0 -1
  164. package/vendor/d3-array/src/reverse.js +0 -1
  165. package/vendor/d3-array/src/scan.js +0 -1
  166. package/vendor/d3-array/src/set.js +0 -1
  167. package/vendor/d3-array/src/shuffle.js +0 -1
  168. package/vendor/d3-array/src/some.js +0 -1
  169. package/vendor/d3-array/src/sort.js +0 -1
  170. package/vendor/d3-array/src/subset.js +0 -1
  171. package/vendor/d3-array/src/sum.js +0 -1
  172. package/vendor/d3-array/src/superset.js +0 -1
  173. package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
  174. package/vendor/d3-array/src/threshold/scott.js +0 -1
  175. package/vendor/d3-array/src/threshold/sturges.js +0 -1
  176. package/vendor/d3-array/src/ticks.js +0 -56
  177. package/vendor/d3-array/src/transpose.js +0 -1
  178. package/vendor/d3-array/src/union.js +0 -1
  179. package/vendor/d3-array/src/variance.js +0 -1
  180. package/vendor/d3-array/src/zip.js +0 -1
  181. package/vendor/d3-color/src/color.js +0 -373
  182. package/vendor/d3-color/src/cubehelix.js +0 -1
  183. package/vendor/d3-color/src/define.js +0 -12
  184. package/vendor/d3-color/src/index.js +0 -1
  185. package/vendor/d3-color/src/lab.js +0 -1
  186. package/vendor/d3-color/src/math.js +0 -1
  187. package/vendor/d3-format/src/defaultLocale.js +0 -20
  188. package/vendor/d3-format/src/exponent.js +0 -7
  189. package/vendor/d3-format/src/formatDecimal.js +0 -22
  190. package/vendor/d3-format/src/formatGroup.js +0 -20
  191. package/vendor/d3-format/src/formatNumerals.js +0 -9
  192. package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
  193. package/vendor/d3-format/src/formatRounded.js +0 -13
  194. package/vendor/d3-format/src/formatSpecifier.js +0 -49
  195. package/vendor/d3-format/src/formatTrim.js +0 -13
  196. package/vendor/d3-format/src/formatTypes.js +0 -21
  197. package/vendor/d3-format/src/identity.js +0 -5
  198. package/vendor/d3-format/src/index.js +0 -1
  199. package/vendor/d3-format/src/locale.js +0 -150
  200. package/vendor/d3-format/src/precisionFixed.js +0 -7
  201. package/vendor/d3-format/src/precisionPrefix.js +0 -7
  202. package/vendor/d3-format/src/precisionRound.js +0 -8
  203. package/vendor/d3-interpolate/src/array.js +0 -19
  204. package/vendor/d3-interpolate/src/basis.js +0 -1
  205. package/vendor/d3-interpolate/src/basisClosed.js +0 -1
  206. package/vendor/d3-interpolate/src/color.js +0 -26
  207. package/vendor/d3-interpolate/src/constant.js +0 -3
  208. package/vendor/d3-interpolate/src/cubehelix.js +0 -1
  209. package/vendor/d3-interpolate/src/date.js +0 -8
  210. package/vendor/d3-interpolate/src/discrete.js +0 -1
  211. package/vendor/d3-interpolate/src/hcl.js +0 -1
  212. package/vendor/d3-interpolate/src/hsl.js +0 -1
  213. package/vendor/d3-interpolate/src/hue.js +0 -1
  214. package/vendor/d3-interpolate/src/index.js +0 -1
  215. package/vendor/d3-interpolate/src/lab.js +0 -1
  216. package/vendor/d3-interpolate/src/number.js +0 -7
  217. package/vendor/d3-interpolate/src/numberArray.js +0 -16
  218. package/vendor/d3-interpolate/src/object.js +0 -25
  219. package/vendor/d3-interpolate/src/piecewise.js +0 -1
  220. package/vendor/d3-interpolate/src/quantize.js +0 -1
  221. package/vendor/d3-interpolate/src/rgb.js +0 -26
  222. package/vendor/d3-interpolate/src/round.js +0 -7
  223. package/vendor/d3-interpolate/src/string.js +0 -66
  224. package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
  225. package/vendor/d3-interpolate/src/transform/index.js +0 -1
  226. package/vendor/d3-interpolate/src/transform/parse.js +0 -1
  227. package/vendor/d3-interpolate/src/value.js +0 -24
  228. package/vendor/d3-interpolate/src/zoom.js +0 -1
  229. package/vendor/d3-scale/src/band.js +0 -1
  230. package/vendor/d3-scale/src/constant.js +0 -7
  231. package/vendor/d3-scale/src/continuous.js +0 -129
  232. package/vendor/d3-scale/src/diverging.js +0 -1
  233. package/vendor/d3-scale/src/identity.js +0 -1
  234. package/vendor/d3-scale/src/index.js +0 -1
  235. package/vendor/d3-scale/src/init.js +0 -10
  236. package/vendor/d3-scale/src/linear.js +0 -72
  237. package/vendor/d3-scale/src/log.js +0 -1
  238. package/vendor/d3-scale/src/nice.js +0 -1
  239. package/vendor/d3-scale/src/number.js +0 -5
  240. package/vendor/d3-scale/src/ordinal.js +0 -1
  241. package/vendor/d3-scale/src/pow.js +0 -1
  242. package/vendor/d3-scale/src/quantile.js +0 -1
  243. package/vendor/d3-scale/src/quantize.js +0 -1
  244. package/vendor/d3-scale/src/radial.js +0 -1
  245. package/vendor/d3-scale/src/sequential.js +0 -1
  246. package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
  247. package/vendor/d3-scale/src/symlog.js +0 -1
  248. package/vendor/d3-scale/src/threshold.js +0 -1
  249. package/vendor/d3-scale/src/tickFormat.js +0 -35
  250. package/vendor/d3-scale/src/time.js +0 -1
  251. package/vendor/d3-scale/src/utcTime.js +0 -1
  252. package/vendor/d3-time/src/day.js +0 -1
  253. package/vendor/d3-time/src/duration.js +0 -1
  254. package/vendor/d3-time/src/hour.js +0 -1
  255. package/vendor/d3-time/src/index.js +0 -1
  256. package/vendor/d3-time/src/interval.js +0 -1
  257. package/vendor/d3-time/src/millisecond.js +0 -1
  258. package/vendor/d3-time/src/minute.js +0 -1
  259. package/vendor/d3-time/src/month.js +0 -1
  260. package/vendor/d3-time/src/second.js +0 -1
  261. package/vendor/d3-time/src/ticks.js +0 -1
  262. package/vendor/d3-time/src/utcDay.js +0 -1
  263. package/vendor/d3-time/src/utcHour.js +0 -1
  264. package/vendor/d3-time/src/utcMinute.js +0 -1
  265. package/vendor/d3-time/src/utcMonth.js +0 -1
  266. package/vendor/d3-time/src/utcWeek.js +0 -1
  267. package/vendor/d3-time/src/utcYear.js +0 -1
  268. package/vendor/d3-time/src/week.js +0 -1
  269. package/vendor/d3-time/src/year.js +0 -1
  270. package/vendor/d3-time-format/src/defaultLocale.js +0 -1
  271. package/vendor/d3-time-format/src/index.js +0 -1
  272. package/vendor/d3-time-format/src/isoFormat.js +0 -1
  273. package/vendor/d3-time-format/src/isoParse.js +0 -1
  274. package/vendor/d3-time-format/src/locale.js +0 -1
  275. package/vendor/define-properties/index.js +0 -60
  276. package/vendor/gl-matrix/esm/common.js +0 -30
  277. package/vendor/gl-matrix/esm/index.js +0 -1
  278. package/vendor/gl-matrix/esm/mat2.js +0 -1
  279. package/vendor/gl-matrix/esm/mat2d.js +0 -1
  280. package/vendor/gl-matrix/esm/mat3.js +0 -817
  281. package/vendor/gl-matrix/esm/mat4.js +0 -1868
  282. package/vendor/gl-matrix/esm/quat.js +0 -330
  283. package/vendor/gl-matrix/esm/quat2.js +0 -1
  284. package/vendor/gl-matrix/esm/vec2.js +0 -1
  285. package/vendor/gl-matrix/esm/vec3.js +0 -842
  286. package/vendor/gl-matrix/esm/vec4.js +0 -153
  287. package/vendor/globalthis/implementation.browser.js +0 -11
  288. package/vendor/globalthis/index.js +0 -25
  289. package/vendor/globalthis/polyfill.js +0 -14
  290. package/vendor/globalthis/shim.js +0 -25
  291. package/vendor/internmap/src/index.js +0 -1
  292. package/vendor/jszip/dist/jszip.min.js +0 -11
  293. package/vendor/object-keys/implementation.js +0 -124
  294. package/vendor/object-keys/index.js +0 -35
  295. package/vendor/object-keys/isArguments.js +0 -17
  296. package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
  297. package/vendor/seedrandom/index.js +0 -77
  298. package/vendor/seedrandom/lib/alea.js +0 -117
  299. package/vendor/seedrandom/lib/tychei.js +0 -105
  300. package/vendor/seedrandom/lib/xor128.js +0 -84
  301. package/vendor/seedrandom/lib/xor4096.js +0 -150
  302. package/vendor/seedrandom/lib/xorshift7.js +0 -101
  303. package/vendor/seedrandom/lib/xorwow.js +0 -89
  304. package/vendor/seedrandom/seedrandom.js +0 -256
  305. package/vendor/webworker-promise/lib/register.js +0 -158
  306. package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
  307. package/vendor/webworker-promise/src/index.js +0 -110
  308. package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
  309. package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +0 -13
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import { newInstance as newInstance$1, obj, setGet, vtkWarningMacro as vtkWarningMacro$1, vtkErrorMacro as vtkErrorMacro$1 } from '../../macros.js';
3
+ import { mat4, mat3, vec3 } from 'gl-matrix';
3
4
  import vtkDataArray from '../../Common/Core/DataArray.js';
4
5
  import { VtkDataTypes } from '../../Common/Core/DataArray/Constants.js';
5
6
  import vtkHelper from './Helper.js';
@@ -16,9 +17,6 @@ import { BlendMode } from '../Core/VolumeMapper/Constants.js';
16
17
  import { v as vtkVolumeVS } from './glsl/vtkVolumeVS.glsl.js';
17
18
  import { v as vtkVolumeFS } from './glsl/vtkVolumeFS.glsl.js';
18
19
  import { registerOverride } from './ViewNodeFactory.js';
19
- import { i as identity, m as multiply, g as invert } from '../../vendor/gl-matrix/esm/mat4.js';
20
- import { i as identity$1, m as multiply$1 } from '../../vendor/gl-matrix/esm/mat3.js';
21
- import { s as set, l as length, t as transformMat4, n as normalize, b as scale, o as divide, p as transformMat3, d as dot } from '../../vendor/gl-matrix/esm/vec3.js';
22
20
 
23
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
24
22
 
@@ -139,8 +137,8 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
139
137
  var ext = model.currentInput.getExtent();
140
138
  var spc = model.currentInput.getSpacing();
141
139
  var vsize = new Float64Array(3);
142
- set(vsize, (ext[1] - ext[0]) * spc[0], (ext[3] - ext[2]) * spc[1], (ext[5] - ext[4]) * spc[2]);
143
- var maxSamples = length(vsize) / model.renderable.getSampleDistance();
140
+ vec3.set(vsize, (ext[1] - ext[0]) * spc[0], (ext[3] - ext[2]) * spc[1], (ext[5] - ext[4]) * spc[2]);
141
+ var maxSamples = vec3.length(vsize) / model.renderable.getSampleDistance();
144
142
  FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::MaximumSamplesValue', "".concat(Math.ceil(maxSamples))).result; // set light complexity
145
143
 
146
144
  FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::LightComplexity', "#define vtkLightComplexity ".concat(model.lastLightComplexity)).result; // if using gradient opacity define that
@@ -278,8 +276,8 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
278
276
  var ext = model.currentInput.getExtent();
279
277
  var spc = model.currentInput.getSpacing();
280
278
  var vsize = new Float64Array(3);
281
- set(vsize, (ext[1] - ext[0]) * spc[0], (ext[3] - ext[2]) * spc[1], (ext[5] - ext[4]) * spc[2]);
282
- var maxSamples = length(vsize) / model.renderable.getSampleDistance();
279
+ vec3.set(vsize, (ext[1] - ext[0]) * spc[0], (ext[3] - ext[2]) * spc[1], (ext[5] - ext[4]) * spc[2]);
280
+ var maxSamples = vec3.length(vsize) / model.renderable.getSampleDistance();
283
281
  var state = {
284
282
  interpolationType: actor.getProperty().getInterpolationType(),
285
283
  useLabelOutline: actor.getProperty().getUseLabelOutline(),
@@ -384,7 +382,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
384
382
  // // E.g., WCPC == world to projection coordinate transformation
385
383
  var keyMats = model.openGLCamera.getKeyMatrices(ren);
386
384
  var actMats = model.openGLVolume.getKeyMatrices();
387
- multiply(model.modelToView, keyMats.wcvc, actMats.mcwc);
385
+ mat4.multiply(model.modelToView, keyMats.wcvc, actMats.mcwc);
388
386
  var program = cellBO.getProgram();
389
387
  var cam = model.openGLCamera.getRenderable();
390
388
  var crange = cam.getClippingRange();
@@ -403,22 +401,22 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
403
401
  var dcymax = -1.0;
404
402
 
405
403
  for (var i = 0; i < 8; ++i) {
406
- set(pos, bounds[i % 2], bounds[2 + Math.floor(i / 2) % 2], bounds[4 + Math.floor(i / 4)]);
407
- transformMat4(pos, pos, model.modelToView);
404
+ vec3.set(pos, bounds[i % 2], bounds[2 + Math.floor(i / 2) % 2], bounds[4 + Math.floor(i / 4)]);
405
+ vec3.transformMat4(pos, pos, model.modelToView);
408
406
 
409
407
  if (!cam.getParallelProjection()) {
410
- normalize(dir, pos); // now find the projection of this point onto a
408
+ vec3.normalize(dir, pos); // now find the projection of this point onto a
411
409
  // nearZ distance plane. Since the camera is at 0,0,0
412
410
  // in VC the ray is just t*pos and
413
411
  // t is -nearZ/dir.z
414
412
  // intersection becomes pos.x/pos.z
415
413
 
416
414
  var t = -crange[0] / pos[2];
417
- scale(pos, dir, t);
415
+ vec3.scale(pos, dir, t);
418
416
  } // now convert to DC
419
417
 
420
418
 
421
- transformMat4(pos, pos, keyMats.vcpc);
419
+ vec3.transformMat4(pos, pos, keyMats.vcpc);
422
420
  dcxmin = Math.min(pos[0], dcxmin);
423
421
  dcxmax = Math.max(pos[0], dcxmax);
424
422
  dcymin = Math.min(pos[1], dcymin);
@@ -437,26 +435,26 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
437
435
  var ext = model.currentInput.getExtent();
438
436
  var spc = model.currentInput.getSpacing();
439
437
  var vsize = new Float64Array(3);
440
- set(vsize, (ext[1] - ext[0] + 1) * spc[0], (ext[3] - ext[2] + 1) * spc[1], (ext[5] - ext[4] + 1) * spc[2]);
438
+ vec3.set(vsize, (ext[1] - ext[0] + 1) * spc[0], (ext[3] - ext[2] + 1) * spc[1], (ext[5] - ext[4] + 1) * spc[2]);
441
439
  program.setUniform3f('vSpacing', spc[0], spc[1], spc[2]);
442
- set(pos, ext[0], ext[2], ext[4]);
440
+ vec3.set(pos, ext[0], ext[2], ext[4]);
443
441
  model.currentInput.indexToWorldVec3(pos, pos);
444
- transformMat4(pos, pos, model.modelToView);
442
+ vec3.transformMat4(pos, pos, model.modelToView);
445
443
  program.setUniform3f('vOriginVC', pos[0], pos[1], pos[2]); // apply the image directions
446
444
 
447
445
  var i2wmat4 = model.currentInput.getIndexToWorld();
448
- multiply(model.idxToView, model.modelToView, i2wmat4);
449
- multiply$1(model.idxNormalMatrix, keyMats.normalMatrix, actMats.normalMatrix);
450
- multiply$1(model.idxNormalMatrix, model.idxNormalMatrix, model.currentInput.getDirection());
451
- var maxSamples = length(vsize) / model.renderable.getSampleDistance();
446
+ mat4.multiply(model.idxToView, model.modelToView, i2wmat4);
447
+ mat3.multiply(model.idxNormalMatrix, keyMats.normalMatrix, actMats.normalMatrix);
448
+ mat3.multiply(model.idxNormalMatrix, model.idxNormalMatrix, model.currentInput.getDirection());
449
+ var maxSamples = vec3.length(vsize) / model.renderable.getSampleDistance();
452
450
 
453
451
  if (maxSamples > model.renderable.getMaximumSamplesPerRay()) {
454
452
  vtkWarningMacro("The number of steps required ".concat(Math.ceil(maxSamples), " is larger than the\n specified maximum number of steps ").concat(model.renderable.getMaximumSamplesPerRay(), ".\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples."));
455
453
  }
456
454
 
457
455
  var vctoijk = new Float64Array(3);
458
- set(vctoijk, 1.0, 1.0, 1.0);
459
- divide(vctoijk, vctoijk, vsize);
456
+ vec3.set(vctoijk, 1.0, 1.0, 1.0);
457
+ vec3.divide(vctoijk, vctoijk, vsize);
460
458
  program.setUniform3f('vVCToIJK', vctoijk[0], vctoijk[1], vctoijk[2]);
461
459
  program.setUniform3i('volumeDimensions', dims[0], dims[1], dims[2]);
462
460
 
@@ -478,39 +476,39 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
478
476
  switch (_i) {
479
477
  default:
480
478
  case 0:
481
- set(normal, 1.0, 0.0, 0.0);
482
- set(pos2, ext[1], ext[3], ext[5]);
479
+ vec3.set(normal, 1.0, 0.0, 0.0);
480
+ vec3.set(pos2, ext[1], ext[3], ext[5]);
483
481
  break;
484
482
 
485
483
  case 1:
486
- set(normal, -1.0, 0.0, 0.0);
487
- set(pos2, ext[0], ext[2], ext[4]);
484
+ vec3.set(normal, -1.0, 0.0, 0.0);
485
+ vec3.set(pos2, ext[0], ext[2], ext[4]);
488
486
  break;
489
487
 
490
488
  case 2:
491
- set(normal, 0.0, 1.0, 0.0);
492
- set(pos2, ext[1], ext[3], ext[5]);
489
+ vec3.set(normal, 0.0, 1.0, 0.0);
490
+ vec3.set(pos2, ext[1], ext[3], ext[5]);
493
491
  break;
494
492
 
495
493
  case 3:
496
- set(normal, 0.0, -1.0, 0.0);
497
- set(pos2, ext[0], ext[2], ext[4]);
494
+ vec3.set(normal, 0.0, -1.0, 0.0);
495
+ vec3.set(pos2, ext[0], ext[2], ext[4]);
498
496
  break;
499
497
 
500
498
  case 4:
501
- set(normal, 0.0, 0.0, 1.0);
502
- set(pos2, ext[1], ext[3], ext[5]);
499
+ vec3.set(normal, 0.0, 0.0, 1.0);
500
+ vec3.set(pos2, ext[1], ext[3], ext[5]);
503
501
  break;
504
502
 
505
503
  case 5:
506
- set(normal, 0.0, 0.0, -1.0);
507
- set(pos2, ext[0], ext[2], ext[4]);
504
+ vec3.set(normal, 0.0, 0.0, -1.0);
505
+ vec3.set(pos2, ext[0], ext[2], ext[4]);
508
506
  break;
509
507
  }
510
508
 
511
- transformMat3(normal, normal, model.idxNormalMatrix);
512
- transformMat4(pos2, pos2, model.idxToView);
513
- var dist = -1.0 * dot(pos2, normal); // we have the plane in view coordinates
509
+ vec3.transformMat3(normal, normal, model.idxNormalMatrix);
510
+ vec3.transformMat4(pos2, pos2, model.idxToView);
511
+ var dist = -1.0 * vec3.dot(pos2, normal); // we have the plane in view coordinates
514
512
  // specify the planes in view coordinates
515
513
 
516
514
  program.setUniform3f("vPlaneNormal".concat(_i), normal[0], normal[1], normal[2]);
@@ -521,7 +519,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
521
519
  var worldToIndex = image.getWorldToIndex();
522
520
  program.setUniformMatrix('vWCtoIDX', worldToIndex); // Get the projection coordinate to world coordinate transformation matrix.
523
521
 
524
- invert(model.projectionToWorld, keyMats.wcpc);
522
+ mat4.invert(model.projectionToWorld, keyMats.wcpc);
525
523
  program.setUniformMatrix('PCWCMatrix', model.projectionToWorld);
526
524
  var size = publicAPI.getRenderTargetSize();
527
525
  program.setUniformf('vpWidth', size[0]);
@@ -529,7 +527,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
529
527
  }
530
528
  }
531
529
 
532
- invert(model.projectionToView, keyMats.vcpc);
530
+ mat4.invert(model.projectionToView, keyMats.vcpc);
533
531
  program.setUniformMatrix('PCVCMatrix', model.projectionToView); // handle lighting values
534
532
 
535
533
  switch (model.lastLightComplexity) {
@@ -559,8 +557,8 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
559
557
  lightColor[2] = dColor[2] * intensity;
560
558
  program.setUniform3fArray("lightColor".concat(lightNum), lightColor);
561
559
  var ldir = light.getDirection();
562
- set(normal, ldir[0], ldir[1], ldir[2]);
563
- transformMat3(normal, normal, keyMats.normalMatrix);
560
+ vec3.set(normal, ldir[0], ldir[1], ldir[2]);
561
+ vec3.transformMat3(normal, normal, keyMats.normalMatrix);
564
562
  program.setUniform3f("lightDirectionVC".concat(lightNum), normal[0], normal[1], normal[2]); // camera DOP is 0,0,-1.0 in VC
565
563
 
566
564
  var halfAngle = [-0.5 * normal[0], -0.5 * normal[1], -0.5 * (normal[2] - 1.0)];
@@ -668,9 +666,9 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
668
666
  for (var i = 0; i < clipPlaneSize; ++i) {
669
667
  var clipPlaneNormal = clipPlanes[i].getNormal();
670
668
  var clipPlanePos = clipPlanes[i].getOrigin();
671
- transformMat3(clipPlaneNormal, clipPlaneNormal, keyMats.normalMatrix);
672
- transformMat4(clipPlanePos, clipPlanePos, keyMats.wcvc);
673
- var clipPlaneDist = -1.0 * dot(clipPlanePos, clipPlaneNormal);
669
+ vec3.transformMat3(clipPlaneNormal, clipPlaneNormal, keyMats.normalMatrix);
670
+ vec3.transformMat4(clipPlanePos, clipPlanePos, keyMats.wcvc);
671
+ var clipPlaneDist = -1.0 * vec3.dot(clipPlanePos, clipPlaneNormal);
674
672
  clipPlaneNormals.push(clipPlaneNormal[0]);
675
673
  clipPlaneNormals.push(clipPlaneNormal[1]);
676
674
  clipPlaneNormals.push(clipPlaneNormal[2]);
@@ -1130,11 +1128,11 @@ function extend(publicAPI, model) {
1130
1128
  model.jitterTexture.setWrapS(Wrap.REPEAT);
1131
1129
  model.jitterTexture.setWrapT(Wrap.REPEAT);
1132
1130
  model.framebuffer = vtkOpenGLFramebuffer.newInstance();
1133
- model.idxToView = identity(new Float64Array(16));
1134
- model.idxNormalMatrix = identity$1(new Float64Array(9));
1135
- model.modelToView = identity(new Float64Array(16));
1136
- model.projectionToView = identity(new Float64Array(16));
1137
- model.projectionToWorld = identity(new Float64Array(16)); // Build VTK API
1131
+ model.idxToView = mat4.identity(new Float64Array(16));
1132
+ model.idxNormalMatrix = mat3.identity(new Float64Array(9));
1133
+ model.modelToView = mat4.identity(new Float64Array(16));
1134
+ model.projectionToView = mat4.identity(new Float64Array(16));
1135
+ model.projectionToWorld = mat4.identity(new Float64Array(16)); // Build VTK API
1138
1136
 
1139
1137
  setGet(publicAPI, model, ['context']); // Object methods
1140
1138
 
@@ -1,3 +1,3 @@
1
- var vtkPolyDataFS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.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// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n}\n";
1
+ var vtkPolyDataFS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.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// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Light::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n}\n";
2
2
 
3
3
  export { vtkPolyDataFS as v };
@@ -1,7 +1,7 @@
1
+ import { mat4 } from 'gl-matrix';
1
2
  import macro from '../../macros.js';
2
3
  import vtkViewNode from '../SceneGraph/ViewNode.js';
3
4
  import { registerOverride } from './ViewNodeFactory.js';
4
- import { j as transpose, i as identity, d as copy, g as invert, t as translate } from '../../vendor/gl-matrix/esm/mat4.js';
5
5
 
6
6
  // vtkWebGPUActor methods
7
7
  // ----------------------------------------------------------------------------
@@ -84,25 +84,25 @@ function vtkWebGPUActor(publicAPI, model) {
84
84
  model.bufferShift[0] = mcwc[3] - center[0];
85
85
  model.bufferShift[1] = mcwc[7] - center[1];
86
86
  model.bufferShift[2] = mcwc[11] - center[2];
87
- transpose(model.keyMatrices.bcwc, mcwc);
87
+ mat4.transpose(model.keyMatrices.bcwc, mcwc);
88
88
 
89
89
  if (model.renderable.getIsIdentity()) {
90
- identity(model.keyMatrices.normalMatrix);
90
+ mat4.identity(model.keyMatrices.normalMatrix);
91
91
  } else {
92
92
  // we use bcwc BEFORE the translate below (just to get transposed mcvc)
93
- copy(model.keyMatrices.normalMatrix, model.keyMatrices.bcwc); // zero out translation
93
+ mat4.copy(model.keyMatrices.normalMatrix, model.keyMatrices.bcwc); // zero out translation
94
94
 
95
95
  model.keyMatrices.normalMatrix[3] = 0.0;
96
96
  model.keyMatrices.normalMatrix[7] = 0.0;
97
97
  model.keyMatrices.normalMatrix[11] = 0.0;
98
- invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
99
- transpose(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
98
+ mat4.invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
99
+ mat4.transpose(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
100
100
  } // only meed the buffer shift to get to world
101
101
 
102
102
 
103
- translate(model.keyMatrices.bcwc, model.keyMatrices.bcwc, [-model.bufferShift[0], -model.bufferShift[1], -model.bufferShift[2]]); // to get to stabilized we also need the center
103
+ mat4.translate(model.keyMatrices.bcwc, model.keyMatrices.bcwc, [-model.bufferShift[0], -model.bufferShift[1], -model.bufferShift[2]]); // to get to stabilized we also need the center
104
104
 
105
- translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
105
+ mat4.translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
106
106
  model.keyMatricesTime.modified();
107
107
  }
108
108
 
@@ -1,7 +1,7 @@
1
+ import { mat4 } from 'gl-matrix';
1
2
  import macro from '../../macros.js';
2
3
  import vtkViewNode from '../SceneGraph/ViewNode.js';
3
4
  import { registerOverride } from './ViewNodeFactory.js';
4
- import { d as copy, g as invert, j as transpose, t as translate, m as multiply } from '../../vendor/gl-matrix/esm/mat4.js';
5
5
 
6
6
  // vtkWebGPUCamera methods
7
7
  // ----------------------------------------------------------------------------
@@ -17,25 +17,25 @@ function vtkWebGPUCamera(publicAPI, model) {
17
17
 
18
18
  if (Math.max(webGPURenderWindow.getMTime(), publicAPI.getMTime(), ren.getMTime(), model.renderable.getMTime(), webGPURenderer.getStabilizedTime()) > model.keyMatrixTime.getMTime()) {
19
19
  var wcvc = model.renderable.getViewMatrix();
20
- copy(model.keyMatrices.normalMatrix, wcvc); // zero out translation
20
+ mat4.copy(model.keyMatrices.normalMatrix, wcvc); // zero out translation
21
21
 
22
22
  model.keyMatrices.normalMatrix[3] = 0.0;
23
23
  model.keyMatrices.normalMatrix[7] = 0.0;
24
24
  model.keyMatrices.normalMatrix[11] = 0.0;
25
- invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
26
- transpose(model.keyMatrices.wcvc, wcvc);
25
+ mat4.invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
26
+ mat4.transpose(model.keyMatrices.wcvc, wcvc);
27
27
  var center = webGPURenderer.getStabilizedCenterByReference();
28
- translate(model.keyMatrices.scvc, model.keyMatrices.wcvc, center);
28
+ mat4.translate(model.keyMatrices.scvc, model.keyMatrices.wcvc, center);
29
29
  var aspectRatio = webGPURenderer.getAspectRatio();
30
30
  var vcpc = model.renderable.getProjectionMatrix(aspectRatio, -1, 1);
31
- transpose(model.keyMatrices.vcpc, vcpc); // adjust due to WebGPU using a different coordinate system in Z
31
+ mat4.transpose(model.keyMatrices.vcpc, vcpc); // adjust due to WebGPU using a different coordinate system in Z
32
32
 
33
33
  model.keyMatrices.vcpc[2] = 0.5 * vcpc[8] + 0.5 * vcpc[12];
34
34
  model.keyMatrices.vcpc[6] = 0.5 * vcpc[9] + 0.5 * vcpc[13];
35
35
  model.keyMatrices.vcpc[10] = 0.5 * vcpc[10] + 0.5 * vcpc[14];
36
36
  model.keyMatrices.vcpc[14] = 0.5 * vcpc[11] + 0.5 * vcpc[15];
37
- multiply(model.keyMatrices.scpc, model.keyMatrices.vcpc, model.keyMatrices.scvc);
38
- invert(model.keyMatrices.pcsc, model.keyMatrices.scpc);
37
+ mat4.multiply(model.keyMatrices.scpc, model.keyMatrices.vcpc, model.keyMatrices.scvc);
38
+ mat4.invert(model.keyMatrices.pcsc, model.keyMatrices.scpc);
39
39
  model.keyMatrixTime.modified();
40
40
  }
41
41
 
@@ -1,3 +1,4 @@
1
+ import { mat4, vec4 } from 'gl-matrix';
1
2
  import Constants from '../Core/ImageMapper/Constants.js';
2
3
  import { newInstance as newInstance$1, obj } from '../../macros.js';
3
4
  import vtkWebGPUShaderCache from './ShaderCache.js';
@@ -8,8 +9,6 @@ import vtkWebGPUSampler from './Sampler.js';
8
9
  import vtkViewNode from '../SceneGraph/ViewNode.js';
9
10
  import { InterpolationType } from '../Core/ImageProperty/Constants.js';
10
11
  import { registerOverride } from './ViewNodeFactory.js';
11
- import { i as identity, t as translate, j as transpose, g as invert, m as multiply, s as scale } from '../../vendor/gl-matrix/esm/mat4.js';
12
- import { t as transformMat4, s as subtract } from '../../vendor/gl-matrix/esm/vec4.js';
13
12
 
14
13
  var SlicingMode = Constants.SlicingMode;
15
14
  var imgFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Image::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n[[stage(fragment)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n //VTK::Image::Sample\n\n // var computedColor: vec4<f32> = vec4<f32>(1.0,0.7, 0.5, 1.0);\n\n//VTK::RenderEncoder::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
@@ -97,25 +96,25 @@ function vtkWebGPUImageMapper(publicAPI, model) {
97
96
  // compute the SCTCMatrix
98
97
  var image = volMapr.getInputData();
99
98
  var center = model.WebGPURenderer.getStabilizedCenterByReference();
100
- identity(tmpMat4);
101
- translate(tmpMat4, tmpMat4, center); // tmpMat4 is now SC->World
99
+ mat4.identity(tmpMat4);
100
+ mat4.translate(tmpMat4, tmpMat4, center); // tmpMat4 is now SC->World
102
101
 
103
102
  var mcwcmat = actor.getMatrix();
104
- transpose(tmp2Mat4, mcwcmat);
105
- invert(tmp2Mat4, tmp2Mat4); // tmp2Mat4 is now world to model
103
+ mat4.transpose(tmp2Mat4, mcwcmat);
104
+ mat4.invert(tmp2Mat4, tmp2Mat4); // tmp2Mat4 is now world to model
106
105
 
107
- multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmp4Mat is now SC->Model
106
+ mat4.multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmp4Mat is now SC->Model
108
107
  // the method on the data is world to index but the volume is in
109
108
  // model coordinates so really in this context it is model to index
110
109
 
111
110
  var modelToIndex = image.getWorldToIndex();
112
- multiply(tmpMat4, modelToIndex, tmpMat4); // tmpMat4 is now SC -> Index, save this as we need it later
111
+ mat4.multiply(tmpMat4, modelToIndex, tmpMat4); // tmpMat4 is now SC -> Index, save this as we need it later
113
112
 
114
- invert(tmp3Mat4, tmpMat4);
113
+ mat4.invert(tmp3Mat4, tmpMat4);
115
114
  var dims = image.getDimensions();
116
- identity(tmp2Mat4);
117
- scale(tmp2Mat4, tmp2Mat4, [1.0 / dims[0], 1.0 / dims[1], 1.0 / dims[2]]);
118
- multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmpMat4 is now SC -> Tcoord
115
+ mat4.identity(tmp2Mat4);
116
+ mat4.scale(tmp2Mat4, tmp2Mat4, [1.0 / dims[0], 1.0 / dims[1], 1.0 / dims[2]]);
117
+ mat4.multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmpMat4 is now SC -> Tcoord
119
118
 
120
119
  model.UBO.setArray('SCTCMatrix', tmpMat4); // need to compute the plane here in world coordinates
121
120
  // then pass that down in the UBO
@@ -151,22 +150,22 @@ function vtkWebGPUImageMapper(publicAPI, model) {
151
150
  ptsArray1[axis1] = ext[axis1 * 2];
152
151
  ptsArray1[axis2] = ext[axis2 * 2];
153
152
  ptsArray1[3] = 1.0;
154
- transformMat4(ptsArray1, ptsArray1, tmp3Mat4);
153
+ vec4.transformMat4(ptsArray1, ptsArray1, tmp3Mat4);
155
154
  model.UBO.setArray('Origin', ptsArray1);
156
155
  ptsArray2[axis0] = nSlice;
157
156
  ptsArray2[axis1] = ext[axis1 * 2 + 1];
158
157
  ptsArray2[axis2] = ext[axis2 * 2];
159
158
  ptsArray2[3] = 1.0;
160
- transformMat4(ptsArray2, ptsArray2, tmp3Mat4);
161
- subtract(ptsArray2, ptsArray2, ptsArray1);
159
+ vec4.transformMat4(ptsArray2, ptsArray2, tmp3Mat4);
160
+ vec4.subtract(ptsArray2, ptsArray2, ptsArray1);
162
161
  ptsArray2[3] = 1.0;
163
162
  model.UBO.setArray('Axis1', ptsArray2);
164
163
  ptsArray2[axis0] = nSlice;
165
164
  ptsArray2[axis1] = ext[axis1 * 2];
166
165
  ptsArray2[axis2] = ext[axis2 * 2 + 1];
167
166
  ptsArray2[3] = 1.0;
168
- transformMat4(ptsArray2, ptsArray2, tmp3Mat4);
169
- subtract(ptsArray2, ptsArray2, ptsArray1);
167
+ vec4.transformMat4(ptsArray2, ptsArray2, tmp3Mat4);
168
+ vec4.subtract(ptsArray2, ptsArray2, ptsArray1);
170
169
  ptsArray2[3] = 1.0;
171
170
  model.UBO.setArray('Axis2', ptsArray2); // three levels of shift scale combined into one
172
171
  // for performance in the fragment shader
@@ -407,8 +406,8 @@ function extend(publicAPI, model) {
407
406
  obj(model.lutBuildTime, {
408
407
  mtime: 0
409
408
  });
410
- model.imagemat = identity(new Float64Array(16));
411
- model.imagematinv = identity(new Float64Array(16));
409
+ model.imagemat = mat4.identity(new Float64Array(16));
410
+ model.imagematinv = mat4.identity(new Float64Array(16));
412
411
  model.VBOBuildTime = {};
413
412
  obj(model.VBOBuildTime); // Object methods
414
413
 
@@ -1,7 +1,7 @@
1
+ import { mat4 } from 'gl-matrix';
1
2
  import { newInstance as newInstance$1, obj, get } from '../../macros.js';
2
3
  import vtkViewNode from '../SceneGraph/ViewNode.js';
3
4
  import { registerOverride } from './ViewNodeFactory.js';
4
- import { i as identity, j as transpose, d as copy, g as invert, t as translate } from '../../vendor/gl-matrix/esm/mat4.js';
5
5
 
6
6
  // vtkWebGPUImageSlice methods
7
7
  // ----------------------------------------------------------------------------
@@ -87,25 +87,25 @@ function vtkWebGPUImageSlice(publicAPI, model) {
87
87
  model.bufferShift[0] = mcwc[3] - center[0];
88
88
  model.bufferShift[1] = mcwc[7] - center[1];
89
89
  model.bufferShift[2] = mcwc[11] - center[2];
90
- transpose(model.keyMatrices.bcwc, mcwc);
90
+ mat4.transpose(model.keyMatrices.bcwc, mcwc);
91
91
 
92
92
  if (model.renderable.getIsIdentity()) {
93
- identity(model.keyMatrices.normalMatrix);
93
+ mat4.identity(model.keyMatrices.normalMatrix);
94
94
  } else {
95
95
  // we use bcwc BEFORE the translate below (just to get transposed mcvc)
96
- copy(model.keyMatrices.normalMatrix, model.keyMatrices.bcwc); // zero out translation
96
+ mat4.copy(model.keyMatrices.normalMatrix, model.keyMatrices.bcwc); // zero out translation
97
97
 
98
98
  model.keyMatrices.normalMatrix[3] = 0.0;
99
99
  model.keyMatrices.normalMatrix[7] = 0.0;
100
100
  model.keyMatrices.normalMatrix[11] = 0.0;
101
- invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
102
- transpose(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
101
+ mat4.invert(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
102
+ mat4.transpose(model.keyMatrices.normalMatrix, model.keyMatrices.normalMatrix);
103
103
  } // only meed the buffer shift to get to world
104
104
 
105
105
 
106
- translate(model.keyMatrices.bcwc, model.keyMatrices.bcwc, [-model.bufferShift[0], -model.bufferShift[1], -model.bufferShift[2]]); // to get to stabilized we also need the center
106
+ mat4.translate(model.keyMatrices.bcwc, model.keyMatrices.bcwc, [-model.bufferShift[0], -model.bufferShift[1], -model.bufferShift[2]]); // to get to stabilized we also need the center
107
107
 
108
- translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
108
+ mat4.translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
109
109
  model.keyMatricesTime.modified();
110
110
  }
111
111
 
@@ -142,7 +142,7 @@ function extend(publicAPI, model) {
142
142
  mtime: 0
143
143
  });
144
144
  model.keyMatrices = {
145
- mcwc: identity(new Float64Array(16))
145
+ mcwc: mat4.identity(new Float64Array(16))
146
146
  };
147
147
  model.bufferShift = [0, 0, 0, 0];
148
148
  get(publicAPI, model, ['propID', 'keyMatricesTime']); // Object methods
@@ -1,3 +1,4 @@
1
+ import { mat3, mat4 } from 'gl-matrix';
1
2
  import { newInstance as newInstance$1, get, setGet } from '../../macros.js';
2
3
  import vtkMapper from '../Core/Mapper.js';
3
4
  import vtkProperty from '../Core/Property.js';
@@ -8,8 +9,6 @@ import vtkWebGPUUniformBuffer from './UniformBuffer.js';
8
9
  import vtkWebGPUMapperHelper from './MapperHelper.js';
9
10
  import vtkViewNode from '../SceneGraph/ViewNode.js';
10
11
  import { registerOverride } from './ViewNodeFactory.js';
11
- import { i as identity } from '../../vendor/gl-matrix/esm/mat3.js';
12
- import { i as identity$1 } from '../../vendor/gl-matrix/esm/mat4.js';
13
12
 
14
13
  var BufferUsage = vtkWebGPUBufferManager.BufferUsage,
15
14
  PrimitiveTypes = vtkWebGPUBufferManager.PrimitiveTypes;
@@ -619,8 +618,8 @@ function extend(publicAPI, model) {
619
618
  Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
620
619
 
621
620
  vtkViewNode.extend(publicAPI, model, initialValues);
622
- model.tmpMat3 = identity(new Float64Array(9));
623
- model.tmpMat4 = identity$1(new Float64Array(16));
621
+ model.tmpMat3 = mat3.identity(new Float64Array(9));
622
+ model.tmpMat4 = mat4.identity(new Float64Array(16));
624
623
  model.fragmentShaderTemplate = model.fragmentShaderTemplate || vtkWebGPUPolyDataFS;
625
624
  model.vertexShaderTemplate = model.vertexShaderTemplate || vtkWebGPUPolyDataVS;
626
625
  model.UBO = vtkWebGPUUniformBuffer.newInstance();
@@ -1,11 +1,10 @@
1
+ import { mat4, vec3 } from 'gl-matrix';
1
2
  import { newInstance as newInstance$1, obj, get, getArray, setGet, vtkDebugMacro as vtkDebugMacro$1 } from '../../macros.js';
2
3
  import vtkViewNode from '../SceneGraph/ViewNode.js';
3
4
  import vtkWebGPUBindGroup from './BindGroup.js';
4
5
  import vtkWebGPUFullScreenQuad from './FullScreenQuad.js';
5
6
  import vtkWebGPUUniformBuffer from './UniformBuffer.js';
6
7
  import { registerOverride } from './ViewNodeFactory.js';
7
- import { i as identity } from '../../vendor/gl-matrix/esm/mat4.js';
8
- import { b as scale, j as add, q as sub, r as len } from '../../vendor/gl-matrix/esm/vec3.js';
9
8
 
10
9
  var vtkDebugMacro = vtkDebugMacro$1;
11
10
  var clearFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n[[stage(fragment)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4<f32> = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; // ----------------------------------------------------------------------------
@@ -66,10 +65,10 @@ function vtkWebGPURenderer(publicAPI, model) {
66
65
  var dop = cam.getDirectionOfProjectionByReference();
67
66
  var center = [];
68
67
  var offset = [];
69
- scale(offset, dop, 0.5 * (clipRange[0] + clipRange[1]));
70
- add(center, pos, offset);
71
- sub(offset, center, model.stabilizedCenter);
72
- var length = len(offset);
68
+ vec3.scale(offset, dop, 0.5 * (clipRange[0] + clipRange[1]));
69
+ vec3.add(center, pos, offset);
70
+ vec3.sub(offset, center, model.stabilizedCenter);
71
+ var length = vec3.len(offset);
73
72
 
74
73
  if (length / (clipRange[1] - clipRange[0]) > model.recenterThreshold) {
75
74
  model.stabilizedCenter = center;
@@ -342,7 +341,7 @@ function extend(publicAPI, model) {
342
341
  model.bindGroup = vtkWebGPUBindGroup.newInstance();
343
342
  model.bindGroup.setName('rendererBG');
344
343
  model.bindGroup.setBindables([model.UBO]);
345
- model.tmpMat4 = identity(new Float64Array(16));
344
+ model.tmpMat4 = mat4.identity(new Float64Array(16));
346
345
  model.stabilizedTime = {};
347
346
  obj(model.stabilizedTime, {
348
347
  mtime: 0
@@ -80,29 +80,30 @@ function vtkWebGPUTexture(publicAPI, model) {
80
80
  // the data here before passing to the buffer. e.g. if it is unorm8x4 then
81
81
  // we need to have width be a multiple of 64
82
82
 
83
- var currWidthInBytes = model.width * req.nativeArray.BYTES_PER_ELEMENT; // is this a half float texture?
83
+ var inWidthInBytes = req.nativeArray.length / (model.height * model.depth) * req.nativeArray.BYTES_PER_ELEMENT; // is this a half float texture?
84
84
 
85
85
  var halfFloat = tDetails.elementSize === 2 && tDetails.sampleType === 'float'; // if we need to copy the data
86
86
 
87
- if (halfFloat || currWidthInBytes % 256) {
87
+ if (halfFloat || inWidthInBytes % 256) {
88
88
  var inArray = req.nativeArray;
89
- var bufferWidthInBytes = 256 * Math.floor((currWidthInBytes + 255) / 256);
90
- var bufferWidth = bufferWidthInBytes / tDetails.elementSize;
91
- var inWidth = currWidthInBytes / inArray.BYTES_PER_ELEMENT;
92
- var outArray = macro.newTypedArray(halfFloat ? 'Uint16Array' : inArray.constructor.name, bufferWidth * model.height * model.depth);
89
+ var inWidth = inWidthInBytes / inArray.BYTES_PER_ELEMENT;
90
+ var outBytesPerElement = tDetails.elementSize;
91
+ var outWidthInBytes = 256 * Math.floor((inWidth * outBytesPerElement + 255) / 256);
92
+ var outWidth = outWidthInBytes / outBytesPerElement;
93
+ var outArray = macro.newTypedArray(halfFloat ? 'Uint16Array' : inArray.constructor.name, outWidth * model.height * model.depth);
93
94
 
94
95
  for (var v = 0; v < model.height * model.depth; v++) {
95
96
  if (halfFloat) {
96
97
  for (var i = 0; i < inWidth; i++) {
97
- outArray[v * bufferWidth + i] = HalfFloat.toHalf(inArray[v * inWidth + i]);
98
+ outArray[v * outWidth + i] = HalfFloat.toHalf(inArray[v * inWidth + i]);
98
99
  }
99
100
  } else {
100
- outArray.set(inArray.subarray(v * inWidth, (v + 1) * inWidth), v * bufferWidth);
101
+ outArray.set(inArray.subarray(v * inWidth, (v + 1) * inWidth), v * outWidth);
101
102
  }
102
103
  }
103
104
 
104
105
  buffRequest.nativeArray = outArray;
105
- bufferBytesPerRow = bufferWidthInBytes;
106
+ bufferBytesPerRow = outWidthInBytes;
106
107
  }
107
108
 
108
109
  var buff = model.device.getBufferManager().getBuffer(buffRequest);
@@ -1,7 +1,7 @@
1
+ import { mat4 } from 'gl-matrix';
1
2
  import macro from '../../macros.js';
2
3
  import vtkViewNode from '../SceneGraph/ViewNode.js';
3
4
  import { registerOverride } from './ViewNodeFactory.js';
4
- import { j as transpose, t as translate } from '../../vendor/gl-matrix/esm/mat4.js';
5
5
 
6
6
  // vtkWebGPUVolume methods
7
7
  // ----------------------------------------------------------------------------
@@ -98,9 +98,9 @@ function vtkWebGPUVolume(publicAPI, model) {
98
98
  var mcwc = model.renderable.getMatrix(); // compute the net shift
99
99
 
100
100
  var center = wgpuRen.getStabilizedCenterByReference();
101
- transpose(model.keyMatrices.bcwc, mcwc); // to get to stabilized we also need the center
101
+ mat4.transpose(model.keyMatrices.bcwc, mcwc); // to get to stabilized we also need the center
102
102
 
103
- translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
103
+ mat4.translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
104
104
  model.keyMatricesTime.modified();
105
105
  }
106
106