@kitware/vtk.js 20.1.4 → 20.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/Core/Base64.d.ts +14 -2
- package/Common/Core/Base64.js +31 -2
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.d.ts +168 -158
- package/Common/Core/Math.js +1 -1
- package/Common/Core/MatrixBuilder.js +39 -41
- package/Common/DataModel/Box.d.ts +73 -0
- package/Common/DataModel/ImageData.js +12 -14
- package/Common/Transform/LandmarkTransform.js +6 -7
- package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
- package/Filters/General/PaintFilter.js +11 -11
- package/Filters/Sources/CubeSource.d.ts +7 -6
- package/Filters/Sources/PlaneSource.js +12 -13
- package/IO/Core/BinaryHelper.js +2 -4
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
- package/IO/Core/ZipMultiDataSetReader.js +1 -1
- package/IO/Core/ZipMultiDataSetWriter.js +1 -1
- package/IO/Geometry/STLWriter.js +4 -4
- package/IO/Misc/OBJReader.d.ts +9 -8
- package/IO/Misc/SkyboxReader.js +1 -1
- package/IO/XML/XMLReader.js +3 -4
- package/IO/XML/XMLWriter.js +5 -6
- package/Imaging/Core/ImageReslice.js +18 -19
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
- package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
- package/Rendering/Core/Actor.js +3 -4
- package/Rendering/Core/AnnotatedCubeActor.d.ts +5 -6
- package/Rendering/Core/Camera.js +81 -84
- package/Rendering/Core/CellPicker.js +2 -2
- package/Rendering/Core/CubeAxesActor.js +37 -34
- package/Rendering/Core/Follower.js +20 -21
- package/Rendering/Core/Glyph3DMapper.js +30 -32
- package/Rendering/Core/ImageMapper.js +2 -2
- package/Rendering/Core/ImageSlice.js +5 -6
- package/Rendering/Core/Picker.d.ts +5 -5
- package/Rendering/Core/Picker.js +5 -6
- package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
- package/Rendering/Core/Prop3D.js +24 -25
- package/Rendering/Core/Renderer.js +11 -12
- package/Rendering/Core/ScalarBarActor.js +37 -34
- package/Rendering/Core/Volume.js +3 -4
- package/Rendering/OpenGL/Actor.js +9 -10
- package/Rendering/OpenGL/Camera.js +8 -9
- package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
- package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
- package/Rendering/OpenGL/ImageMapper.js +7 -7
- package/Rendering/OpenGL/ImageSlice.js +4 -4
- package/Rendering/OpenGL/PolyDataMapper.js +11 -13
- package/Rendering/OpenGL/RenderWindow.d.ts +21 -35
- package/Rendering/OpenGL/ShaderCache.js +1 -1
- package/Rendering/OpenGL/Skybox.js +4 -5
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +3 -4
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
- package/Rendering/OpenGL/Volume.js +6 -7
- package/Rendering/OpenGL/VolumeMapper.js +47 -49
- package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
- package/Rendering/WebGPU/Actor.js +8 -8
- package/Rendering/WebGPU/Camera.js +8 -8
- package/Rendering/WebGPU/ImageMapper.js +18 -19
- package/Rendering/WebGPU/ImageSlice.js +9 -9
- package/Rendering/WebGPU/PolyDataMapper.js +3 -4
- package/Rendering/WebGPU/Renderer.js +6 -7
- package/Rendering/WebGPU/Volume.js +3 -3
- package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
- package/ThirdParty/index.js +2 -2
- package/Widgets/Manipulators/TrackballManipulator.js +5 -6
- package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
- package/Widgets/Representations/CircleContextRepresentation.js +4 -5
- package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
- package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
- package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
- package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
- package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
- package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
- package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
- package/package.json +2 -2
- package/types.d.ts +1 -0
- package/vtk.js +2 -2
- package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
- package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
- package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
- package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
- package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
- package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
- package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
- package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
- package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
- package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
- package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
- package/_virtual/commonjsHelpers.js +0 -22
- package/_virtual/polyfill-node.buffer.js +0 -1971
- package/_virtual/polyfill-node.global.js +0 -5
- package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
- package/vendor/base64-js/index.js +0 -72
- package/vendor/blueimp-md5/js/md5.js +0 -402
- package/vendor/d3-array/src/array.js +0 -1
- package/vendor/d3-array/src/ascending.js +0 -5
- package/vendor/d3-array/src/bin.js +0 -1
- package/vendor/d3-array/src/bisect.js +0 -10
- package/vendor/d3-array/src/bisector.js +0 -46
- package/vendor/d3-array/src/constant.js +0 -1
- package/vendor/d3-array/src/count.js +0 -1
- package/vendor/d3-array/src/cross.js +0 -1
- package/vendor/d3-array/src/cumsum.js +0 -1
- package/vendor/d3-array/src/descending.js +0 -1
- package/vendor/d3-array/src/deviation.js +0 -1
- package/vendor/d3-array/src/difference.js +0 -1
- package/vendor/d3-array/src/disjoint.js +0 -1
- package/vendor/d3-array/src/every.js +0 -1
- package/vendor/d3-array/src/extent.js +0 -1
- package/vendor/d3-array/src/filter.js +0 -1
- package/vendor/d3-array/src/fsum.js +0 -1
- package/vendor/d3-array/src/greatest.js +0 -1
- package/vendor/d3-array/src/greatestIndex.js +0 -1
- package/vendor/d3-array/src/group.js +0 -1
- package/vendor/d3-array/src/groupSort.js +0 -1
- package/vendor/d3-array/src/identity.js +0 -1
- package/vendor/d3-array/src/index.js +0 -1
- package/vendor/d3-array/src/intersection.js +0 -1
- package/vendor/d3-array/src/least.js +0 -1
- package/vendor/d3-array/src/leastIndex.js +0 -1
- package/vendor/d3-array/src/map.js +0 -1
- package/vendor/d3-array/src/max.js +0 -1
- package/vendor/d3-array/src/maxIndex.js +0 -1
- package/vendor/d3-array/src/mean.js +0 -1
- package/vendor/d3-array/src/median.js +0 -1
- package/vendor/d3-array/src/merge.js +0 -1
- package/vendor/d3-array/src/min.js +0 -1
- package/vendor/d3-array/src/minIndex.js +0 -1
- package/vendor/d3-array/src/mode.js +0 -1
- package/vendor/d3-array/src/nice.js +0 -1
- package/vendor/d3-array/src/number.js +0 -5
- package/vendor/d3-array/src/pairs.js +0 -1
- package/vendor/d3-array/src/permute.js +0 -1
- package/vendor/d3-array/src/quantile.js +0 -1
- package/vendor/d3-array/src/quickselect.js +0 -1
- package/vendor/d3-array/src/range.js +0 -1
- package/vendor/d3-array/src/reduce.js +0 -1
- package/vendor/d3-array/src/reverse.js +0 -1
- package/vendor/d3-array/src/scan.js +0 -1
- package/vendor/d3-array/src/set.js +0 -1
- package/vendor/d3-array/src/shuffle.js +0 -1
- package/vendor/d3-array/src/some.js +0 -1
- package/vendor/d3-array/src/sort.js +0 -1
- package/vendor/d3-array/src/subset.js +0 -1
- package/vendor/d3-array/src/sum.js +0 -1
- package/vendor/d3-array/src/superset.js +0 -1
- package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
- package/vendor/d3-array/src/threshold/scott.js +0 -1
- package/vendor/d3-array/src/threshold/sturges.js +0 -1
- package/vendor/d3-array/src/ticks.js +0 -56
- package/vendor/d3-array/src/transpose.js +0 -1
- package/vendor/d3-array/src/union.js +0 -1
- package/vendor/d3-array/src/variance.js +0 -1
- package/vendor/d3-array/src/zip.js +0 -1
- package/vendor/d3-color/src/color.js +0 -373
- package/vendor/d3-color/src/cubehelix.js +0 -1
- package/vendor/d3-color/src/define.js +0 -12
- package/vendor/d3-color/src/index.js +0 -1
- package/vendor/d3-color/src/lab.js +0 -1
- package/vendor/d3-color/src/math.js +0 -1
- package/vendor/d3-format/src/defaultLocale.js +0 -20
- package/vendor/d3-format/src/exponent.js +0 -7
- package/vendor/d3-format/src/formatDecimal.js +0 -22
- package/vendor/d3-format/src/formatGroup.js +0 -20
- package/vendor/d3-format/src/formatNumerals.js +0 -9
- package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
- package/vendor/d3-format/src/formatRounded.js +0 -13
- package/vendor/d3-format/src/formatSpecifier.js +0 -49
- package/vendor/d3-format/src/formatTrim.js +0 -13
- package/vendor/d3-format/src/formatTypes.js +0 -21
- package/vendor/d3-format/src/identity.js +0 -5
- package/vendor/d3-format/src/index.js +0 -1
- package/vendor/d3-format/src/locale.js +0 -150
- package/vendor/d3-format/src/precisionFixed.js +0 -7
- package/vendor/d3-format/src/precisionPrefix.js +0 -7
- package/vendor/d3-format/src/precisionRound.js +0 -8
- package/vendor/d3-interpolate/src/array.js +0 -19
- package/vendor/d3-interpolate/src/basis.js +0 -1
- package/vendor/d3-interpolate/src/basisClosed.js +0 -1
- package/vendor/d3-interpolate/src/color.js +0 -26
- package/vendor/d3-interpolate/src/constant.js +0 -3
- package/vendor/d3-interpolate/src/cubehelix.js +0 -1
- package/vendor/d3-interpolate/src/date.js +0 -8
- package/vendor/d3-interpolate/src/discrete.js +0 -1
- package/vendor/d3-interpolate/src/hcl.js +0 -1
- package/vendor/d3-interpolate/src/hsl.js +0 -1
- package/vendor/d3-interpolate/src/hue.js +0 -1
- package/vendor/d3-interpolate/src/index.js +0 -1
- package/vendor/d3-interpolate/src/lab.js +0 -1
- package/vendor/d3-interpolate/src/number.js +0 -7
- package/vendor/d3-interpolate/src/numberArray.js +0 -16
- package/vendor/d3-interpolate/src/object.js +0 -25
- package/vendor/d3-interpolate/src/piecewise.js +0 -1
- package/vendor/d3-interpolate/src/quantize.js +0 -1
- package/vendor/d3-interpolate/src/rgb.js +0 -26
- package/vendor/d3-interpolate/src/round.js +0 -7
- package/vendor/d3-interpolate/src/string.js +0 -66
- package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
- package/vendor/d3-interpolate/src/transform/index.js +0 -1
- package/vendor/d3-interpolate/src/transform/parse.js +0 -1
- package/vendor/d3-interpolate/src/value.js +0 -24
- package/vendor/d3-interpolate/src/zoom.js +0 -1
- package/vendor/d3-scale/src/band.js +0 -1
- package/vendor/d3-scale/src/constant.js +0 -7
- package/vendor/d3-scale/src/continuous.js +0 -129
- package/vendor/d3-scale/src/diverging.js +0 -1
- package/vendor/d3-scale/src/identity.js +0 -1
- package/vendor/d3-scale/src/index.js +0 -1
- package/vendor/d3-scale/src/init.js +0 -10
- package/vendor/d3-scale/src/linear.js +0 -72
- package/vendor/d3-scale/src/log.js +0 -1
- package/vendor/d3-scale/src/nice.js +0 -1
- package/vendor/d3-scale/src/number.js +0 -5
- package/vendor/d3-scale/src/ordinal.js +0 -1
- package/vendor/d3-scale/src/pow.js +0 -1
- package/vendor/d3-scale/src/quantile.js +0 -1
- package/vendor/d3-scale/src/quantize.js +0 -1
- package/vendor/d3-scale/src/radial.js +0 -1
- package/vendor/d3-scale/src/sequential.js +0 -1
- package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
- package/vendor/d3-scale/src/symlog.js +0 -1
- package/vendor/d3-scale/src/threshold.js +0 -1
- package/vendor/d3-scale/src/tickFormat.js +0 -35
- package/vendor/d3-scale/src/time.js +0 -1
- package/vendor/d3-scale/src/utcTime.js +0 -1
- package/vendor/d3-time/src/day.js +0 -1
- package/vendor/d3-time/src/duration.js +0 -1
- package/vendor/d3-time/src/hour.js +0 -1
- package/vendor/d3-time/src/index.js +0 -1
- package/vendor/d3-time/src/interval.js +0 -1
- package/vendor/d3-time/src/millisecond.js +0 -1
- package/vendor/d3-time/src/minute.js +0 -1
- package/vendor/d3-time/src/month.js +0 -1
- package/vendor/d3-time/src/second.js +0 -1
- package/vendor/d3-time/src/ticks.js +0 -1
- package/vendor/d3-time/src/utcDay.js +0 -1
- package/vendor/d3-time/src/utcHour.js +0 -1
- package/vendor/d3-time/src/utcMinute.js +0 -1
- package/vendor/d3-time/src/utcMonth.js +0 -1
- package/vendor/d3-time/src/utcWeek.js +0 -1
- package/vendor/d3-time/src/utcYear.js +0 -1
- package/vendor/d3-time/src/week.js +0 -1
- package/vendor/d3-time/src/year.js +0 -1
- package/vendor/d3-time-format/src/defaultLocale.js +0 -1
- package/vendor/d3-time-format/src/index.js +0 -1
- package/vendor/d3-time-format/src/isoFormat.js +0 -1
- package/vendor/d3-time-format/src/isoParse.js +0 -1
- package/vendor/d3-time-format/src/locale.js +0 -1
- package/vendor/define-properties/index.js +0 -60
- package/vendor/gl-matrix/esm/common.js +0 -30
- package/vendor/gl-matrix/esm/index.js +0 -1
- package/vendor/gl-matrix/esm/mat2.js +0 -1
- package/vendor/gl-matrix/esm/mat2d.js +0 -1
- package/vendor/gl-matrix/esm/mat3.js +0 -817
- package/vendor/gl-matrix/esm/mat4.js +0 -1868
- package/vendor/gl-matrix/esm/quat.js +0 -330
- package/vendor/gl-matrix/esm/quat2.js +0 -1
- package/vendor/gl-matrix/esm/vec2.js +0 -1
- package/vendor/gl-matrix/esm/vec3.js +0 -842
- package/vendor/gl-matrix/esm/vec4.js +0 -153
- package/vendor/globalthis/implementation.browser.js +0 -11
- package/vendor/globalthis/index.js +0 -25
- package/vendor/globalthis/polyfill.js +0 -14
- package/vendor/globalthis/shim.js +0 -25
- package/vendor/internmap/src/index.js +0 -1
- package/vendor/jszip/dist/jszip.min.js +0 -11
- package/vendor/object-keys/implementation.js +0 -124
- package/vendor/object-keys/index.js +0 -35
- package/vendor/object-keys/isArguments.js +0 -17
- package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
- package/vendor/seedrandom/index.js +0 -77
- package/vendor/seedrandom/lib/alea.js +0 -117
- package/vendor/seedrandom/lib/tychei.js +0 -105
- package/vendor/seedrandom/lib/xor128.js +0 -84
- package/vendor/seedrandom/lib/xor4096.js +0 -150
- package/vendor/seedrandom/lib/xorshift7.js +0 -101
- package/vendor/seedrandom/lib/xorwow.js +0 -89
- package/vendor/seedrandom/seedrandom.js +0 -256
- package/vendor/webworker-promise/lib/register.js +0 -158
- package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
- package/vendor/webworker-promise/src/index.js +0 -110
- package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
- package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +0 -13
|
@@ -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
|
|
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
|
|
@@ -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
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
|
+
import { mat4 } from 'gl-matrix';
|
|
3
4
|
import vtkWebGPUFullScreenQuad from './FullScreenQuad.js';
|
|
4
5
|
import vtkWebGPUUniformBuffer from './UniformBuffer.js';
|
|
5
6
|
import vtkWebGPUShaderCache from './ShaderCache.js';
|
|
@@ -7,7 +8,6 @@ import vtkWebGPUStorageBuffer from './StorageBuffer.js';
|
|
|
7
8
|
import vtkWebGPUSampler from './Sampler.js';
|
|
8
9
|
import vtkWebGPUTypes from './Types.js';
|
|
9
10
|
import { BlendMode } from '../Core/VolumeMapper/Constants.js';
|
|
10
|
-
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';
|
|
11
11
|
|
|
12
12
|
var volFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::Volume::TraverseDec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\nfn getTextureValue(vTex: texture_3d<f32>, tpos: vec4<f32>) -> f32\n{\n // todo multicomponent support\n return textureSampleLevel(vTex, clampSampler, tpos.xyz, 0.0).r;\n}\n\nfn getGradient(vTex: texture_3d<f32>, tpos: vec4<f32>, vNum: i32, scalar: f32) -> vec4<f32>\n{\n var result: vec4<f32>;\n\n var tstep: vec4<f32> = volumeSSBO.values[vNum].tstep;\n result.x = getTextureValue(vTex, tpos + vec4<f32>(tstep.x, 0.0, 0.0, 1.0)) - scalar;\n result.y = getTextureValue(vTex, tpos + vec4<f32>(0.0, tstep.y, 0.0, 1.0)) - scalar;\n result.z = getTextureValue(vTex, tpos + vec4<f32>(0.0, 0.0, tstep.z, 1.0)) - scalar;\n\n // divide by spacing\n result = result / volumeSSBO.values[vNum].spacing;\n\n var grad: f32 = length(result.xyz);\n\n // // rotate to View Coords, needed for lighting and shading\n // result.xyz =\n // result.x * vPlaneNormal0 +\n // result.y * vPlaneNormal2 +\n // result.z * vPlaneNormal4;\n\n if (grad > 0.0)\n {\n result = result * (1.0 / grad);\n }\n\n result.w = grad;\n\n return result;\n}\n\nfn processVolume(vTex: texture_3d<f32>, vNum: i32, cNum: i32, posSC: vec4<f32>, tfunRows: f32) -> vec4<f32>\n{\n var outColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n\n // convert to tcoords and reject if outside the volume\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*posSC;\n if (tpos.x < 0.0 || tpos.y < 0.0 || tpos.z < 0.0 ||\n tpos.x > 1.0 || tpos.y > 1.0 || tpos.z > 1.0) { return outColor; }\n\n var scalar: f32 = getTextureValue(vTex, tpos);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n\n var gofactor: f32 = 1.0;\n if (componentSSBO.values[cNum].gomin < 1.0)\n {\n var normal: vec4<f32> = getGradient(vTex, tpos, vNum, scalar);\n gofactor = clamp(normal.a*componentSSBO.values[cNum].goScale + componentSSBO.values[cNum].goShift,\n componentSSBO.values[cNum].gomin, componentSSBO.values[cNum].gomax);\n }\n\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n\n outColor = vec4<f32>(color.rgb, gofactor * opacity);\n\n//VTK::Volume::Process\n\n return outColor;\n}\n\n// adjust the start and end point of a raycast such that it intersects the unit cube.\n// This function is used to take a raycast starting point and step vector\n// and numSteps and return the startijng and ending steps for intersecting the\n// unit cube. Recall for a 3D texture, the unit cube is the range of texture coordsinates\n// that have valid values. So this funtion can be used to take a ray in texture coordinates\n// and bound it to intersecting the texture.\n//\nfn adjustBounds(tpos: vec4<f32>, tstep: vec4<f32>, numSteps: f32) -> vec2<f32>\n{\n var result: vec2<f32> = vec2<f32>(0.0, numSteps);\n var tpos2: vec4<f32> = tpos + tstep*numSteps;\n\n // move tpos to the start of the volume\n var adjust: f32 =\n min(\n max(tpos.x/tstep.x, (tpos.x - 1.0)/tstep.x),\n min(\n max((tpos.y - 1.0)/tstep.y, tpos.y/tstep.y),\n max((tpos.z - 1.0)/tstep.z, tpos.z/tstep.z)));\n if (adjust < 0.0)\n {\n result.x = result.x - adjust;\n }\n\n // adjust length to the end\n adjust =\n max(\n min(tpos2.x/tstep.x, (tpos2.x - 1.0)/tstep.x),\n max(\n min((tpos2.y - 1.0)/tstep.y, tpos2.y/tstep.y),\n min((tpos2.z - 1.0)/tstep.z, tpos2.z/tstep.z)));\n if (adjust > 0.0)\n {\n result.y = result.y - adjust;\n }\n\n return result;\n}\n\nfn getSimpleColor(scalar: f32, vNum: i32, cNum: i32) -> vec4<f32>\n{\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var coord: vec2<f32> =\n vec2<f32>(scalar * componentSSBO.values[cNum].cScale + componentSSBO.values[cNum].cShift,\n (0.5 + 2.0 * f32(vNum)) / tfunRows);\n var color: vec4<f32> = textureSampleLevel(tfunTexture, clampSampler, coord, 0.0);\n coord.x = (scalar * componentSSBO.values[cNum].oScale + componentSSBO.values[cNum].oShift);\n var opacity: f32 = textureSampleLevel(ofunTexture, clampSampler, coord, 0.0).r;\n return vec4<f32>(color.rgb, opacity);\n}\n\nfn traverseMax(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var maxVal: f32 = -1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar > maxVal)\n {\n maxVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(maxVal, vNum, cNum);\n}\n\nfn traverseMin(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var minVal: f32 = 1.0e37;\n loop\n {\n var scalar: f32 = getTextureValue(vTex, tpos);\n if (scalar < minVal)\n {\n minVal = scalar;\n }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(minVal, vNum, cNum);\n}\n\nfn traverseAverage(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var avgVal: f32 = 0.0;\n var sampleCount: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n avgVal = avgVal + sample;\n sampleCount = sampleCount + 1.0;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n if (sampleCount <= 0.0)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(avgVal/sampleCount, vNum, cNum);\n}\n\nfn traverseAdditive(vTex: texture_3d<f32>, vNum: i32, cNum: i32, rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>)\n{\n // convert to tcoords and reject if outside the volume\n var numSteps: f32 = rayLengthSC/mapperUBO.SampleDistance;\n var tpos: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*minPosSC;\n var tpos2: vec4<f32> = volumeSSBO.values[vNum].SCTCMatrix*(minPosSC + rayStepSC);\n var tstep: vec4<f32> = tpos2 - tpos;\n\n var rayBounds: vec2<f32> = adjustBounds(tpos, tstep, numSteps);\n\n // did we hit anything\n if (rayBounds.x >= rayBounds.y)\n {\n traverseVals[vNum] = vec4<f32>(0.0,0.0,0.0,0.0);\n return;\n }\n\n let ipRange: vec4<f32> = volumeSSBO.values[vNum].ipScalarRange;\n tpos = tpos + tstep*rayBounds.x;\n var curDist: f32 = rayBounds.x;\n var sumVal: f32 = 0.0;\n loop\n {\n var sample: f32 = getTextureValue(vTex, tpos);\n // right now leave filtering off until WebGL changes get merged\n // if (ipRange.z == 0.0 || sample >= ipRange.x && sample <= ipRange.y)\n // {\n sumVal = sumVal + sample;\n // }\n\n // increment position\n curDist = curDist + 1.0;\n tpos = tpos + tstep;\n\n // check if we have reached a terminating condition\n if (curDist > rayBounds.y) { break; }\n }\n\n // process to get the color and opacity\n traverseVals[vNum] = getSimpleColor(sumVal, vNum, cNum);\n}\n\nfn composite(rayLengthSC: f32, minPosSC: vec4<f32>, rayStepSC: vec4<f32>) -> vec4<f32>\n{\n // initial ray position is at the beginning\n var rayPosSC: vec4<f32> = minPosSC;\n\n // how many rows (tfuns) do we have in our tfunTexture\n var tfunRows: f32 = f32(textureDimensions(tfunTexture).y);\n\n var curDist: f32 = 0.0;\n var computedColor: vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);\n var sampleColor: vec4<f32>;\n//VTK::Volume::TraverseCalls\n\n loop\n {\n // for each volume, sample and accumulate color\n//VTK::Volume::CompositeCalls\n\n // increment position\n curDist = curDist + mapperUBO.SampleDistance;\n rayPosSC = rayPosSC + rayStepSC;\n\n // check if we have reached a terminating condition\n if (curDist > rayLengthSC) { break; }\n if (computedColor.a > 0.98) { break; }\n }\n return computedColor;\n}\n\n[[stage(fragment)]]\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var rayMax: f32 = textureSampleLevel(maxTexture, clampSampler, input.tcoordVS, 0.0).r;\n var rayMin: f32 = textureSampleLevel(minTexture, clampSampler, input.tcoordVS, 0.0).r;\n\n // discard empty rays\n if (rayMax <= rayMin) { discard; }\n else\n {\n var winDimsI32: vec2<i32> = textureDimensions(minTexture);\n var winDims: vec2<f32> = vec2<f32>(f32(winDimsI32.x), f32(winDimsI32.y));\n\n // compute start and end ray positions in view coordinates\n var minPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0*input.fragPos.x/winDims.x - 1.0, 1.0 - 2.0 * input.fragPos.y/winDims.y, rayMin, 1.0);\n minPosSC = minPosSC * (1.0 / minPosSC.w);\n var maxPosSC: vec4<f32> = rendererUBO.PCSCMatrix*vec4<f32>(2.0*input.fragPos.x/winDims.x - 1.0, 1.0 - 2.0 * input.fragPos.y/winDims.y, rayMax, 1.0);\n maxPosSC = maxPosSC * (1.0 / maxPosSC.w);\n\n var rayLengthSC: f32 = distance(minPosSC.xyz, maxPosSC.xyz);\n var rayStepSC: vec4<f32> = (maxPosSC - minPosSC)*(mapperUBO.SampleDistance/rayLengthSC);\n rayStepSC.w = 0.0;\n\n var computedColor: vec4<f32>;\n\n//VTK::Volume::Loop\n\n//VTK::RenderEncoder::Impl\n }\n\n return output;\n}\n";
|
|
13
13
|
var tmpMat4 = new Float64Array(16);
|
|
@@ -255,26 +255,26 @@ function vtkWebGPUVolumePassFSQ(publicAPI, model) {
|
|
|
255
255
|
|
|
256
256
|
var _image3 = _volMapr2.getInputData();
|
|
257
257
|
|
|
258
|
-
identity(tmpMat4);
|
|
259
|
-
translate(tmpMat4, tmpMat4, center); // tmpMat4 is now SC->World
|
|
258
|
+
mat4.identity(tmpMat4);
|
|
259
|
+
mat4.translate(tmpMat4, tmpMat4, center); // tmpMat4 is now SC->World
|
|
260
260
|
|
|
261
261
|
var mcwcmat = actor.getMatrix();
|
|
262
|
-
transpose(tmp2Mat4, mcwcmat);
|
|
263
|
-
invert(tmp2Mat4, tmp2Mat4); // tmp2Mat4 is now world to model
|
|
262
|
+
mat4.transpose(tmp2Mat4, mcwcmat);
|
|
263
|
+
mat4.invert(tmp2Mat4, tmp2Mat4); // tmp2Mat4 is now world to model
|
|
264
264
|
|
|
265
|
-
multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmp4Mat is now SC->Model
|
|
265
|
+
mat4.multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmp4Mat is now SC->Model
|
|
266
266
|
// the method on the data is world to index but the volume is in
|
|
267
267
|
// model coordinates so really in this context it is model to index
|
|
268
268
|
|
|
269
269
|
var modelToIndex = _image3.getWorldToIndex();
|
|
270
270
|
|
|
271
|
-
multiply(tmpMat4, modelToIndex, tmpMat4); // tmpMat4 is now SC -> Index
|
|
271
|
+
mat4.multiply(tmpMat4, modelToIndex, tmpMat4); // tmpMat4 is now SC -> Index
|
|
272
272
|
|
|
273
273
|
var dims = _image3.getDimensions();
|
|
274
274
|
|
|
275
|
-
identity(tmp2Mat4);
|
|
276
|
-
scale(tmp2Mat4, tmp2Mat4, [1.0 / dims[0], 1.0 / dims[1], 1.0 / dims[2]]);
|
|
277
|
-
multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmpMat4 is now SC -> Tcoord
|
|
275
|
+
mat4.identity(tmp2Mat4);
|
|
276
|
+
mat4.scale(tmp2Mat4, tmp2Mat4, [1.0 / dims[0], 1.0 / dims[1], 1.0 / dims[2]]);
|
|
277
|
+
mat4.multiply(tmpMat4, tmp2Mat4, tmpMat4); // tmpMat4 is now SC -> Tcoord
|
|
278
278
|
|
|
279
279
|
for (var j = 0; j < 16; j++) {
|
|
280
280
|
marray[vidx * 16 + j] = tmpMat4[j];
|
package/ThirdParty/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import { j as cross, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
3
|
-
import { i as identity, r as rotate } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
4
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
5
4
|
|
|
6
5
|
function trackballRotate(prevX, prevY, curX, curY, origin, direction, renderer, glRenderWindow) {
|
|
7
6
|
var dx = curX - prevX;
|
|
@@ -16,10 +15,10 @@ function trackballRotate(prevX, prevY, curX, curY, origin, direction, renderer,
|
|
|
16
15
|
var xDisplayAxis = viewUp;
|
|
17
16
|
var yDisplayAxis = [0, 0, 0];
|
|
18
17
|
cross(dop, viewUp, yDisplayAxis);
|
|
19
|
-
var rot = identity(new Float64Array(16));
|
|
20
|
-
rotate(rot, rot, radiansFromDegrees(xdeg), xDisplayAxis);
|
|
21
|
-
rotate(rot, rot, radiansFromDegrees(-ydeg), yDisplayAxis);
|
|
22
|
-
transformMat4(newDirection, newDirection, rot);
|
|
18
|
+
var rot = mat4.identity(new Float64Array(16));
|
|
19
|
+
mat4.rotate(rot, rot, radiansFromDegrees(xdeg), xDisplayAxis);
|
|
20
|
+
mat4.rotate(rot, rot, radiansFromDegrees(-ydeg), yDisplayAxis);
|
|
21
|
+
vec3.transformMat4(newDirection, newDirection, rot);
|
|
23
22
|
return newDirection;
|
|
24
23
|
} // ----------------------------------------------------------------------------
|
|
25
24
|
// vtkTrackballManipulator methods
|
|
@@ -15,10 +15,8 @@ import vtkCubeSource from '../../Filters/Sources/CubeSource.js';
|
|
|
15
15
|
import vtkViewFinderSource from '../../Filters/Sources/ViewFinderSource.js';
|
|
16
16
|
import Constants from '../Widgets3D/LineWidget/Constants.js';
|
|
17
17
|
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
18
|
+
import { mat4, mat3, vec3 } from 'gl-matrix';
|
|
18
19
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
19
|
-
import { i as identity } from '../../vendor/gl-matrix/esm/mat4.js';
|
|
20
|
-
import { f as fromMat4, i as identity$1, a as invert, m as multiply } from '../../vendor/gl-matrix/esm/mat3.js';
|
|
21
|
-
import { p as transformMat3 } 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
|
|
|
@@ -210,18 +208,18 @@ function vtkArrowHandleRepresentation(publicAPI, model) {
|
|
|
210
208
|
function getOrientationRotation(viewMatrixInv) {
|
|
211
209
|
var displayOrientation = new Float64Array(3);
|
|
212
210
|
var baseDir = [0, 1, 0];
|
|
213
|
-
transformMat3(displayOrientation, model.orientation, viewMatrixInv);
|
|
211
|
+
vec3.transformMat3(displayOrientation, model.orientation, viewMatrixInv);
|
|
214
212
|
displayOrientation[2] = 0;
|
|
215
213
|
var displayMatrix = vtkMatrixBuilder.buildFromDegree().rotateFromDirections(baseDir, displayOrientation).getMatrix();
|
|
216
214
|
var displayRotation = new Float64Array(9);
|
|
217
|
-
fromMat4(displayRotation, displayMatrix);
|
|
215
|
+
mat3.fromMat4(displayRotation, displayMatrix);
|
|
218
216
|
return displayRotation;
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
function getCameraFacingRotation(scale3, displayRotation, viewMatrix) {
|
|
222
220
|
var rotation = new Float64Array(9);
|
|
223
|
-
multiply(rotation, viewMatrix, displayRotation);
|
|
224
|
-
transformMat3(scale3, scale3, rotation);
|
|
221
|
+
mat3.multiply(rotation, viewMatrix, displayRotation);
|
|
222
|
+
vec3.transformMat3(scale3, scale3, rotation);
|
|
225
223
|
return rotation;
|
|
226
224
|
}
|
|
227
225
|
/**
|
|
@@ -235,11 +233,11 @@ function vtkArrowHandleRepresentation(publicAPI, model) {
|
|
|
235
233
|
function getGlyphRotation(scale3) {
|
|
236
234
|
var shouldFaceCamera = model.faceCamera === true || model.faceCamera == null && publicAPI.is2DShape();
|
|
237
235
|
var viewMatrix = new Float64Array(9);
|
|
238
|
-
fromMat4(viewMatrix, model.viewMatrix);
|
|
239
|
-
var viewMatrixInv = identity
|
|
236
|
+
mat3.fromMat4(viewMatrix, model.viewMatrix);
|
|
237
|
+
var viewMatrixInv = mat3.identity(new Float64Array(9));
|
|
240
238
|
|
|
241
239
|
if (shouldFaceCamera) {
|
|
242
|
-
invert(viewMatrixInv, viewMatrix);
|
|
240
|
+
mat3.invert(viewMatrixInv, viewMatrix);
|
|
243
241
|
}
|
|
244
242
|
|
|
245
243
|
var orientationRotation = null;
|
|
@@ -247,7 +245,7 @@ function vtkArrowHandleRepresentation(publicAPI, model) {
|
|
|
247
245
|
if (publicAPI.isOrientableShape()) {
|
|
248
246
|
orientationRotation = getOrientationRotation(viewMatrixInv);
|
|
249
247
|
} else {
|
|
250
|
-
orientationRotation = identity
|
|
248
|
+
orientationRotation = mat3.identity(new Float64Array(9));
|
|
251
249
|
}
|
|
252
250
|
|
|
253
251
|
if (shouldFaceCamera) {
|
|
@@ -352,7 +350,7 @@ function defaultValues(initialValues) {
|
|
|
352
350
|
faceCamera: null,
|
|
353
351
|
orientation: [1, 0, 0],
|
|
354
352
|
shape: ShapeType.SPHERE,
|
|
355
|
-
viewMatrix: identity(new Float64Array(16))
|
|
353
|
+
viewMatrix: mat4.identity(new Float64Array(16))
|
|
356
354
|
}, initialValues);
|
|
357
355
|
} // ----------------------------------------------------------------------------
|
|
358
356
|
|
|
@@ -9,8 +9,7 @@ import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
|
|
|
9
9
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
10
10
|
import vtkWidgetRepresentation from './WidgetRepresentation.js';
|
|
11
11
|
import { ScalarMode } from '../../Rendering/Core/Mapper/Constants.js';
|
|
12
|
-
import {
|
|
13
|
-
import { t as transformMat4 } from '../../vendor/gl-matrix/esm/vec3.js';
|
|
12
|
+
import { mat3, vec3 } from 'gl-matrix';
|
|
14
13
|
|
|
15
14
|
// vtkCircleContextRepresentation methods
|
|
16
15
|
// ----------------------------------------------------------------------------
|
|
@@ -141,9 +140,9 @@ function vtkCircleContextRepresentation(publicAPI, model) {
|
|
|
141
140
|
var reorientCircleSource4 = vtkMatrixBuilder.buildFromDegree().rotateFromDirections([1, 0, 0], [0, 0, 1]) // from X to Z
|
|
142
141
|
.getMatrix();
|
|
143
142
|
var reorientCircleSource3 = [];
|
|
144
|
-
fromMat4(reorientCircleSource3, reorientCircleSource4);
|
|
145
|
-
transformMat4(scale3, scale3, reorientCircleSource4);
|
|
146
|
-
multiply(rotation, rotation, reorientCircleSource3);
|
|
143
|
+
mat3.fromMat4(reorientCircleSource3, reorientCircleSource4);
|
|
144
|
+
vec3.transformMat4(scale3, scale3, reorientCircleSource4);
|
|
145
|
+
mat3.multiply(rotation, rotation, reorientCircleSource3);
|
|
147
146
|
|
|
148
147
|
for (var j = 0; j < 9; j += 1) {
|
|
149
148
|
typedArray.direction[i * 9 + j] = rotation[j];
|
|
@@ -3,7 +3,7 @@ import vtkActor from '../../Rendering/Core/Actor.js';
|
|
|
3
3
|
import vtkContextRepresentation from './ContextRepresentation.js';
|
|
4
4
|
import vtkMapper from '../../Rendering/Core/Mapper.js';
|
|
5
5
|
import vtkPolyData from '../../Common/DataModel/PolyData.js';
|
|
6
|
-
import {
|
|
6
|
+
import { vec3 } from 'gl-matrix';
|
|
7
7
|
|
|
8
8
|
// vtkRectangleContextRepresentation methods
|
|
9
9
|
// ----------------------------------------------------------------------------
|
|
@@ -52,9 +52,9 @@ function vtkRectangleContextRepresentation(publicAPI, model) {
|
|
|
52
52
|
var point1 = state.getOrigin();
|
|
53
53
|
var point2 = state.getCorner();
|
|
54
54
|
var diagonal = [0, 0, 0];
|
|
55
|
-
subtract(diagonal, point2, point1);
|
|
55
|
+
vec3.subtract(diagonal, point2, point1);
|
|
56
56
|
var up = state.getUp();
|
|
57
|
-
var upComponent = dot(diagonal, up);
|
|
57
|
+
var upComponent = vec3.dot(diagonal, up);
|
|
58
58
|
var points = new Float32Array(4 * 3);
|
|
59
59
|
points[0] = point1[0];
|
|
60
60
|
points[1] = point1[1];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import widgetBehavior$1 from '../ShapeWidget/behavior.js';
|
|
3
|
-
import {
|
|
3
|
+
import { vec3 } from 'gl-matrix';
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
@@ -25,13 +25,13 @@ function widgetBehavior(publicAPI, model) {
|
|
|
25
25
|
|
|
26
26
|
var center = [0.5 * (point1[0] + point2[0]), 0.5 * (point1[1] + point2[1]), 0.5 * (point1[2] + point2[2])];
|
|
27
27
|
var diagonal = [0, 0, 0];
|
|
28
|
-
subtract(diagonal, point2, center);
|
|
28
|
+
vec3.subtract(diagonal, point2, center);
|
|
29
29
|
var right = model.shapeHandle.getRight();
|
|
30
30
|
var up = model.shapeHandle.getUp();
|
|
31
31
|
var dir = model.shapeHandle.getDirection();
|
|
32
|
-
var rightComponent = dot(diagonal, right);
|
|
33
|
-
var upComponent = dot(diagonal, up);
|
|
34
|
-
var dirComponent = dot(diagonal, dir);
|
|
32
|
+
var rightComponent = vec3.dot(diagonal, right);
|
|
33
|
+
var upComponent = vec3.dot(diagonal, up);
|
|
34
|
+
var dirComponent = vec3.dot(diagonal, dir);
|
|
35
35
|
model.shapeHandle.setOrigin(center);
|
|
36
36
|
model.shapeHandle.setScale3([rightComponent, upComponent, dirComponent]);
|
|
37
37
|
};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import {
|
|
3
|
-
import { c as create$1 } from '../../../vendor/gl-matrix/esm/quat.js';
|
|
4
|
-
import { n as getRotation } from '../../../vendor/gl-matrix/esm/mat4.js';
|
|
2
|
+
import { vec3, quat, mat4 } from 'gl-matrix';
|
|
5
3
|
|
|
6
4
|
var AXES = ['-', '=', '+']; // ----------------------------------------------------------------------------
|
|
7
5
|
|
|
8
6
|
function transformVec3(ain, transform) {
|
|
9
7
|
var vout = new Float64Array(3);
|
|
10
|
-
transformMat4(vout, ain, transform);
|
|
8
|
+
vec3.transformMat4(vout, ain, transform);
|
|
11
9
|
return vout;
|
|
12
10
|
} // ----------------------------------------------------------------------------
|
|
13
11
|
|
|
14
12
|
function rotateVec3(vec, transform) {
|
|
15
13
|
// transform is a mat4
|
|
16
|
-
var out = create();
|
|
17
|
-
var q = create
|
|
18
|
-
getRotation(q, transform);
|
|
19
|
-
transformQuat(out, vec, q);
|
|
14
|
+
var out = vec3.create();
|
|
15
|
+
var q = quat.create();
|
|
16
|
+
mat4.getRotation(q, transform);
|
|
17
|
+
vec3.transformQuat(out, vec, q);
|
|
20
18
|
return out;
|
|
21
19
|
} // ----------------------------------------------------------------------------
|
|
22
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
2
|
import macro from '../../../macros.js';
|
|
3
|
-
import {
|
|
3
|
+
import { vec3 } from 'gl-matrix';
|
|
4
4
|
|
|
5
5
|
function widgetBehavior(publicAPI, model) {
|
|
6
6
|
publicAPI.handleLeftButtonPress = function (callData) {
|
|
@@ -36,7 +36,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
36
36
|
var normal = model.camera.getDirectionOfProjection();
|
|
37
37
|
var up = model.camera.getViewUp();
|
|
38
38
|
var right = [];
|
|
39
|
-
cross(right, up, normal);
|
|
39
|
+
vec3.cross(right, up, normal);
|
|
40
40
|
|
|
41
41
|
(_model$activeState = model.activeState).setUp.apply(_model$activeState, _toConsumableArray(up));
|
|
42
42
|
|