@kitware/vtk.js 26.0.0-beta.4 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +1 -0
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +8 -2
- package/Interaction/UI/Icons/Logo.svg.js +1 -1
- package/Interaction/UI/Icons/Tint.svg.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget.js +3 -1
- package/Rendering/Core/RenderWindowInteractor.d.ts +2 -1
- package/Rendering/Core/RenderWindowInteractor.js +1 -1
- package/Rendering/Core/SphereMapper.d.ts +12 -0
- package/Rendering/Core/SphereMapper.js +3 -2
- package/Rendering/OpenGL/ImageMapper.js +7 -10
- package/Rendering/OpenGL/PolyDataMapper.js +4 -8
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +6 -1
- package/Rendering/OpenGL/RenderWindow.d.ts +1 -1
- package/Rendering/OpenGL/RenderWindow.js +40 -3
- package/Rendering/OpenGL/SphereMapper.js +12 -0
- package/Rendering/OpenGL/Texture.js +58 -28
- package/Rendering/OpenGL/VolumeMapper.js +8 -4
- package/Rendering/OpenGL/glsl/vtkSphereMapperVS.glsl.js +1 -1
- package/Rendering/WebGPU/SphereMapper.js +1 -1
- package/package.json +3 -3
package/BREAKING_CHANGES.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Instead, a `vtkSphereHandleRepresentation` is used for `rotation` and `center` handles,
|
|
5
5
|
and a `vtkLineHandleRepresenttion` is used for the axes. `rotateLineInView()` now
|
|
6
6
|
takes an axis name (string, e.g. 'XinY') instead of a substate.
|
|
7
|
+
- SVGRepresentation and SVG widget support has been fully removed.
|
|
7
8
|
|
|
8
9
|
## From 24.x to 25
|
|
9
10
|
|
|
@@ -129,8 +129,13 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
publicAPI.onButtonUp = function (interactor, renderer) {
|
|
132
|
-
if (!previousPosition || !currentPosition) {
|
|
132
|
+
if (!previousPosition || !currentPosition && !model.boxChangeOnClick) {
|
|
133
133
|
return;
|
|
134
|
+
} // needed because of boxChangeOnClick
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if (!currentPosition) {
|
|
138
|
+
currentPosition = previousPosition;
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
publicAPI.invokeBoxSelectChange({
|
|
@@ -158,6 +163,7 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
|
|
|
158
163
|
function DEFAULT_VALUES(initialValues) {
|
|
159
164
|
return _objectSpread(_objectSpread({
|
|
160
165
|
// container: null,
|
|
166
|
+
boxChangeOnClick: false,
|
|
161
167
|
renderSelection: true
|
|
162
168
|
}, initialValues), {}, {
|
|
163
169
|
selectionStyle: _objectSpread(_objectSpread({}, DEFAULT_STYLE), initialValues.selectionStyle)
|
|
@@ -175,7 +181,7 @@ function extend(publicAPI, model) {
|
|
|
175
181
|
|
|
176
182
|
event(publicAPI, model, 'BoxSelectInput'); // Trigger while dragging
|
|
177
183
|
|
|
178
|
-
setGet(publicAPI, model, ['renderSelection', 'selectionStyle', 'container']); // Object specific methods
|
|
184
|
+
setGet(publicAPI, model, ['renderSelection', 'boxChangeOnClick', 'selectionStyle', 'container']); // Object specific methods
|
|
179
185
|
|
|
180
186
|
vtkMouseBoxSelectionManipulator(publicAPI, model);
|
|
181
187
|
} // ----------------------------------------------------------------------------
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var svgLogo = "<svg viewBox=\"0 0 196 196\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M67.77 157.024a86.095 86.095 0
|
|
1
|
+
var svgLogo = "<svg viewBox=\"0 0 196 196\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M67.77 157.024a86.095 86.095 0 0 1-2.3 9.306c-.977 3.206-2.44 6.116-4.392 8.73-1.952 2.614-4.531 4.758-7.738 6.43-3.206 1.674-7.284 2.51-12.233 2.51-6.343 0-11.501-1.55-15.474-4.653-3.974-3.102-6.518-7.301-7.633-12.599l16.102-5.228c.279 1.882 1.01 3.485 2.196 4.81 1.185 1.324 2.753 1.986 4.705 1.986 3.067 0 5.262-1.08 6.587-3.24 1.324-2.162 2.265-4.88 2.823-8.156l8.574-48.933h17.565l-8.783 49.037Zm58.029-31.053c-1.394-1.883-3.137-3.311-5.228-4.287-2.091-.976-4.426-1.464-7.005-1.464-1.185 0-2.44.157-3.764.47a10.815 10.815 0 0 0-3.608 1.569 9.806 9.806 0 0 0-2.718 2.77c-.732 1.116-1.098 2.475-1.098 4.078 0 2.091.819 3.747 2.457 4.967 1.638 1.22 3.921 2.352 6.849 3.398 3.206 1.115 6.064 2.352 8.573 3.712 2.51 1.359 4.636 2.91 6.378 4.652 1.743 1.743 3.067 3.712 3.974 5.908.906 2.196 1.359 4.688 1.359 7.476 0 4.461-.924 8.26-2.77 11.397-1.848 3.136-4.236 5.698-7.163 7.685-2.928 1.986-6.204 3.433-9.829 4.339-3.624.906-7.214 1.359-10.769 1.359-2.649 0-5.298-.244-7.946-.732a42.608 42.608 0 0 1-7.633-2.143 31.681 31.681 0 0 1-6.796-3.608c-2.092-1.463-3.869-3.136-5.333-5.018l12.86-10.456c1.465 2.23 3.625 4.043 6.483 5.437 2.858 1.394 5.751 2.091 8.679 2.091 1.533 0 3.014-.157 4.443-.47 1.43-.314 2.701-.837 3.817-1.569a8.267 8.267 0 0 0 2.666-2.823c.662-1.15.993-2.527.993-4.13 0-2.579-1.045-4.618-3.136-6.117-2.092-1.498-4.88-2.84-8.365-4.025a58.492 58.492 0 0 1-6.849-2.823c-2.126-1.046-3.973-2.335-5.541-3.869-1.569-1.533-2.823-3.363-3.764-5.489-.941-2.126-1.412-4.688-1.412-7.685 0-3.764.784-7.162 2.353-10.194a23.324 23.324 0 0 1 6.43-7.738c2.719-2.126 5.89-3.764 9.515-4.914 3.624-1.15 7.493-1.725 11.606-1.725 2.16 0 4.356.21 6.587.627a35.853 35.853 0 0 1 6.43 1.83 28.502 28.502 0 0 1 5.699 2.98c1.742 1.185 3.206 2.544 4.39 4.078L125.8 125.97Z\" fill=\"#8A8B8A\"/><rect fill=\"#1C4678\" transform=\"rotate(45 169.749 159.749)\" x=\"152.249\" y=\"142.249\" width=\"35\" height=\"35\" rx=\"17.5\"/><path fill=\"#1C4678\" d=\"m7.775 11 20.483 86.069h22.53l34.24-71.408H63.841L42.91 70.03 28.259 11zM88.663 25.344h50.476l-8.093 16.562-17.246-.049-9.652 54.62H85.609l9.572-54.535H80.99zM141.366 25.344l16.072.066-4.414 24.987h2.388l16.856-25.053h20.975l-22.442 33.403 13.203 54.063h-20.94l-10.652-44.43h-2.296l-5.125 28.135h-21.024l9.763-55.043z\"/><path fill=\"#8A8B8A\" d=\"M3 11h3.182l20.864 85.944h-3.187zM58.102 25.344h2.788L43.747 61.155l-.955-3.866zM88.608 44.469h2.883l-9.157 52.096H79.4zM126.785 44.469h2.924l-9.186 52.046H117.6zM166.38 25.344h3.594l-12.582 18.854 1.316-7.545zM150.902 74.75l8.917 37.613h-3.311l-7.075-29.073z\"/></g></svg>";
|
|
2
2
|
|
|
3
3
|
export { svgLogo as s };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var Tint = "<svg viewBox=\"0 0 180 180\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M90 24c20 29.485 45 58.5 45 86s-17.5 46.485-45 46.485S45 137.5 45 110s25-56.515 45-
|
|
1
|
+
var Tint = "<svg viewBox=\"0 0 180 180\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M90 24c20 29.485 45 58.5 45 86s-17.5 46.485-45 46.485S45 137.5 45 110s25-56.515 45-86Z\" stroke=\"#000\" stroke-width=\"10\" fill=\"#000\" fill-rule=\"evenodd\"/></svg>";
|
|
2
2
|
|
|
3
3
|
export { Tint as T };
|
|
@@ -173,6 +173,8 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
173
173
|
publicAPI.updateMarkerOrientation();
|
|
174
174
|
model.enabled = true;
|
|
175
175
|
} else {
|
|
176
|
+
var _model$_interactor, _model$_interactor$fi;
|
|
177
|
+
|
|
176
178
|
if (!model.enabled) {
|
|
177
179
|
return;
|
|
178
180
|
}
|
|
@@ -190,7 +192,7 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
|
|
|
190
192
|
model.actor.setVisibility(false);
|
|
191
193
|
selfRenderer.removeViewProp(model.actor);
|
|
192
194
|
|
|
193
|
-
var _renderWindow = model._interactor.findPokedRenderer().getRenderWindow();
|
|
195
|
+
var _renderWindow = (_model$_interactor = model._interactor) === null || _model$_interactor === void 0 ? void 0 : (_model$_interactor$fi = _model$_interactor.findPokedRenderer()) === null || _model$_interactor$fi === void 0 ? void 0 : _model$_interactor$fi.getRenderWindow();
|
|
194
196
|
|
|
195
197
|
if (_renderWindow) {
|
|
196
198
|
_renderWindow.removeRenderer(selfRenderer);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { vtkObject, vtkSubscription } from './../../interfaces';
|
|
2
|
+
import { Nullable } from './../../types';
|
|
2
3
|
import vtkRenderer from './Renderer';
|
|
3
4
|
import { Axis, Device, Input } from './RenderWindowInteractor/Constants';
|
|
4
5
|
|
|
@@ -1152,7 +1153,7 @@ export interface vtkRenderWindowInteractor extends vtkObject {
|
|
|
1152
1153
|
* @param {Number} x
|
|
1153
1154
|
* @param {Number} y
|
|
1154
1155
|
*/
|
|
1155
|
-
findPokedRenderer(x: number, y: number): vtkRenderer
|
|
1156
|
+
findPokedRenderer(x: number, y: number): Nullable<vtkRenderer>;
|
|
1156
1157
|
|
|
1157
1158
|
/**
|
|
1158
1159
|
* only render if we are not animating. If we are animating
|
|
@@ -779,7 +779,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
779
779
|
|
|
780
780
|
var rc = (_model$_view2 = model._view) === null || _model$_view2 === void 0 ? void 0 : (_model$_view2$getRend = _model$_view2.getRenderable()) === null || _model$_view2$getRend === void 0 ? void 0 : _model$_view2$getRend.getRenderers();
|
|
781
781
|
|
|
782
|
-
if (!rc) {
|
|
782
|
+
if (!rc || rc.length === 0) {
|
|
783
783
|
return null;
|
|
784
784
|
}
|
|
785
785
|
|
|
@@ -16,6 +16,11 @@ export interface vtkSphereMapper extends vtkMapper {
|
|
|
16
16
|
*/
|
|
17
17
|
getScaleArray(): any;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
getScaleFactor(): number;
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
*
|
|
21
26
|
* @param {Number} radius
|
|
@@ -27,6 +32,13 @@ export interface vtkSphereMapper extends vtkMapper {
|
|
|
27
32
|
* @param scaleArray
|
|
28
33
|
*/
|
|
29
34
|
setScaleArray(scaleArray: any): boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Factor multiplied with scale array elements. Radius is used when no scale array is given.
|
|
38
|
+
* @param scaleFactor number to multiply with when a scale array is provided. 1 by default.
|
|
39
|
+
* @see getScaleFactor(), setScaleArray(), setRadius()
|
|
40
|
+
*/
|
|
41
|
+
setScaleFactor(scaleFactor: number): boolean;
|
|
30
42
|
}
|
|
31
43
|
|
|
32
44
|
/**
|
|
@@ -14,7 +14,8 @@ function vtkSphereMapper(publicAPI, model) {
|
|
|
14
14
|
|
|
15
15
|
var DEFAULT_VALUES = {
|
|
16
16
|
scaleArray: null,
|
|
17
|
-
radius: 0.05
|
|
17
|
+
radius: 0.05,
|
|
18
|
+
scaleFactor: 1.0
|
|
18
19
|
}; // ----------------------------------------------------------------------------
|
|
19
20
|
|
|
20
21
|
function extend(publicAPI, model) {
|
|
@@ -22,7 +23,7 @@ function extend(publicAPI, model) {
|
|
|
22
23
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
23
24
|
|
|
24
25
|
vtkMapper.extend(publicAPI, model, initialValues);
|
|
25
|
-
macro.setGet(publicAPI, model, ['radius', 'scaleArray']); // Object methods
|
|
26
|
+
macro.setGet(publicAPI, model, ['radius', 'scaleArray', 'scaleFactor']); // Object methods
|
|
26
27
|
|
|
27
28
|
vtkSphereMapper(publicAPI, model);
|
|
28
29
|
} // ----------------------------------------------------------------------------
|
|
@@ -101,7 +101,8 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
publicAPI.buildShaders = function (shaders, ren, actor) {
|
|
104
|
-
publicAPI.getShaderTemplate(shaders, ren, actor);
|
|
104
|
+
publicAPI.getShaderTemplate(shaders, ren, actor);
|
|
105
|
+
model.lastRenderPassShaderReplacement = model.currentRenderPass ? model.currentRenderPass.getShaderReplacement() : null; // apply any renderPassReplacements
|
|
105
106
|
|
|
106
107
|
if (model.lastRenderPassShaderReplacement) {
|
|
107
108
|
model.lastRenderPassShaderReplacement(shaders);
|
|
@@ -254,18 +255,13 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
254
255
|
// property modified (representation interpolation and lighting)
|
|
255
256
|
// input modified
|
|
256
257
|
// light complexity changed
|
|
258
|
+
// render pass shader replacement changed
|
|
257
259
|
var tNumComp = model.openGLTexture.getComponents();
|
|
258
260
|
var iComp = actor.getProperty().getIndependentComponents(); // has the render pass shader replacement changed? Two options
|
|
259
261
|
|
|
260
262
|
var needRebuild = false;
|
|
261
263
|
|
|
262
|
-
if (!model.currentRenderPass && model.lastRenderPassShaderReplacement) {
|
|
263
|
-
needRebuild = true;
|
|
264
|
-
model.lastRenderPassShaderReplacement = null;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (model.currentRenderPass && model.currentRenderPass.getShaderReplacement() !== model.lastRenderPassShaderReplacement) {
|
|
268
|
-
model.lastRenderPassShaderReplacement = model.currentRenderPass.getShaderReplacement();
|
|
264
|
+
if (!model.currentRenderPass && model.lastRenderPassShaderReplacement || model.currentRenderPass && model.currentRenderPass.getShaderReplacement() !== model.lastRenderPassShaderReplacement) {
|
|
269
265
|
needRebuild = true;
|
|
270
266
|
}
|
|
271
267
|
|
|
@@ -568,6 +564,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
568
564
|
model.pwfTexture.setMagnificationFilter(Filter.LINEAR);
|
|
569
565
|
}
|
|
570
566
|
|
|
567
|
+
var dataType = imgScalars.getDataType();
|
|
571
568
|
var numComp = imgScalars.getNumberOfComponents();
|
|
572
569
|
var iComps = actorProperty.getIndependentComponents();
|
|
573
570
|
var numIComps = iComps ? numComp : 1;
|
|
@@ -702,7 +699,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
702
699
|
var dims = image.getDimensions();
|
|
703
700
|
|
|
704
701
|
if (iType === InterpolationType.NEAREST) {
|
|
705
|
-
if (numComp ===
|
|
702
|
+
if (new Set([1, 3, 4]).has(numComp) && dataType === VtkDataTypes.UNSIGNED_CHAR && !iComps) {
|
|
706
703
|
model.openGLTexture.setGenerateMipmap(true);
|
|
707
704
|
model.openGLTexture.setMinificationFilter(Filter.NEAREST);
|
|
708
705
|
} else {
|
|
@@ -711,7 +708,7 @@ function vtkOpenGLImageMapper(publicAPI, model) {
|
|
|
711
708
|
|
|
712
709
|
model.openGLTexture.setMagnificationFilter(Filter.NEAREST);
|
|
713
710
|
} else {
|
|
714
|
-
if (numComp === 4) {
|
|
711
|
+
if (numComp === 4 && dataType === VtkDataTypes.UNSIGNED_CHAR && !iComps) {
|
|
715
712
|
model.openGLTexture.setGenerateMipmap(true);
|
|
716
713
|
model.openGLTexture.setMinificationFilter(Filter.LINEAR_MIPMAP_LINEAR);
|
|
717
714
|
} else {
|
|
@@ -106,7 +106,8 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
publicAPI.buildShaders = function (shaders, ren, actor) {
|
|
109
|
-
publicAPI.getShaderTemplate(shaders, ren, actor);
|
|
109
|
+
publicAPI.getShaderTemplate(shaders, ren, actor);
|
|
110
|
+
model.lastRenderPassShaderReplacement = model.currentRenderPass ? model.currentRenderPass.getShaderReplacement() : null; // apply any renderPassReplacements
|
|
110
111
|
|
|
111
112
|
if (model.lastRenderPassShaderReplacement) {
|
|
112
113
|
model.lastRenderPassShaderReplacement(shaders);
|
|
@@ -651,19 +652,14 @@ function vtkOpenGLPolyDataMapper(publicAPI, model) {
|
|
|
651
652
|
} // has the render pass shader replacement changed? Two options
|
|
652
653
|
|
|
653
654
|
|
|
654
|
-
if (!model.currentRenderPass && model.lastRenderPassShaderReplacement) {
|
|
655
|
-
needRebuild = true;
|
|
656
|
-
model.lastRenderPassShaderReplacement = null;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
if (model.currentRenderPass && model.currentRenderPass.getShaderReplacement() !== model.lastRenderPassShaderReplacement) {
|
|
660
|
-
model.lastRenderPassShaderReplacement = model.currentRenderPass.getShaderReplacement();
|
|
655
|
+
if (!model.currentRenderPass && model.lastRenderPassShaderReplacement || model.currentRenderPass && model.currentRenderPass.getShaderReplacement() !== model.lastRenderPassShaderReplacement) {
|
|
661
656
|
needRebuild = true;
|
|
662
657
|
} // has something changed that would require us to recreate the shader?
|
|
663
658
|
// candidates are
|
|
664
659
|
// property modified (representation interpolation and lighting)
|
|
665
660
|
// input modified
|
|
666
661
|
// light complexity changed
|
|
662
|
+
// render pass shader replacement changed
|
|
667
663
|
|
|
668
664
|
|
|
669
665
|
if (model.lastHaveSeenDepthRequest !== model.haveSeenDepthRequest || cellBO.getShaderSourceTime().getMTime() < model.renderable.getMTime() || cellBO.getShaderSourceTime().getMTime() < model.currentInput.getMTime() || cellBO.getShaderSourceTime().getMTime() < model.selectionStateChanged.getMTime() || needRebuild) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// This is used to access the underlying 3D context
|
|
2
|
+
var GET_UNDERLYING_CONTEXT = '__getUnderlyingContext';
|
|
1
3
|
function createContextProxyHandler() {
|
|
2
4
|
var cache = new Map();
|
|
3
5
|
var getParameterHandler = {
|
|
@@ -41,6 +43,9 @@ function createContextProxyHandler() {
|
|
|
41
43
|
|
|
42
44
|
return {
|
|
43
45
|
get: function get(gl, prop, receiver) {
|
|
46
|
+
if (prop === GET_UNDERLYING_CONTEXT) return function () {
|
|
47
|
+
return gl;
|
|
48
|
+
};
|
|
44
49
|
var value = Reflect.get(gl, prop, gl);
|
|
45
50
|
|
|
46
51
|
if (value instanceof Function) {
|
|
@@ -62,4 +67,4 @@ var ContextProxy = {
|
|
|
62
67
|
createContextProxyHandler: createContextProxyHandler
|
|
63
68
|
};
|
|
64
69
|
|
|
65
|
-
export { createContextProxyHandler, ContextProxy as default };
|
|
70
|
+
export { GET_UNDERLYING_CONTEXT, createContextProxyHandler, ContextProxy as default };
|
|
@@ -270,7 +270,7 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
|
|
|
270
270
|
* @param {Number} numComps
|
|
271
271
|
* @param {Boolean} useFloat
|
|
272
272
|
*/
|
|
273
|
-
getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number,
|
|
273
|
+
getDefaultTextureInternalFormat(vtktype: VtkDataTypes, numComps: number, oglNorm16Ext?: unknown): void;
|
|
274
274
|
|
|
275
275
|
/**
|
|
276
276
|
*
|
|
@@ -12,7 +12,7 @@ import vtkTextureUnitManager from './TextureUnitManager.js';
|
|
|
12
12
|
import vtkViewNodeFactory from './ViewNodeFactory.js';
|
|
13
13
|
import vtkRenderPass from '../SceneGraph/RenderPass.js';
|
|
14
14
|
import vtkRenderWindowViewNode from '../SceneGraph/RenderWindowViewNode.js';
|
|
15
|
-
import { createContextProxyHandler } from './RenderWindow/ContextProxy.js';
|
|
15
|
+
import { createContextProxyHandler, GET_UNDERLYING_CONTEXT } from './RenderWindow/ContextProxy.js';
|
|
16
16
|
|
|
17
17
|
var vtkDebugMacro = macro.vtkDebugMacro,
|
|
18
18
|
vtkErrorMacro = macro.vtkErrorMacro;
|
|
@@ -310,7 +310,8 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
310
310
|
return gl.makeXRCompatible();
|
|
311
311
|
|
|
312
312
|
case 6:
|
|
313
|
-
glLayer = new global.XRWebGLLayer(model.xrSession,
|
|
313
|
+
glLayer = new global.XRWebGLLayer(model.xrSession, // constructor needs unproxied context
|
|
314
|
+
gl[GET_UNDERLYING_CONTEXT]());
|
|
314
315
|
publicAPI.setSize(glLayer.framebufferWidth, glLayer.framebufferHeight);
|
|
315
316
|
model.xrSession.updateRenderState({
|
|
316
317
|
baseLayer: glLayer
|
|
@@ -535,7 +536,9 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
535
536
|
return -1;
|
|
536
537
|
};
|
|
537
538
|
|
|
538
|
-
publicAPI.getDefaultTextureInternalFormat = function (vtktype, numComps
|
|
539
|
+
publicAPI.getDefaultTextureInternalFormat = function (vtktype, numComps) {
|
|
540
|
+
var oglNorm16Ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
541
|
+
|
|
539
542
|
if (model.webgl2) {
|
|
540
543
|
switch (vtktype) {
|
|
541
544
|
case VtkDataTypes.UNSIGNED_CHAR:
|
|
@@ -554,6 +557,40 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
554
557
|
return model.context.RGBA8;
|
|
555
558
|
}
|
|
556
559
|
|
|
560
|
+
case oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
|
|
561
|
+
switch (numComps) {
|
|
562
|
+
case 1:
|
|
563
|
+
return oglNorm16Ext.R16_EXT;
|
|
564
|
+
|
|
565
|
+
case 2:
|
|
566
|
+
return oglNorm16Ext.RG16_EXT;
|
|
567
|
+
|
|
568
|
+
case 3:
|
|
569
|
+
return oglNorm16Ext.RGB16_EXT;
|
|
570
|
+
|
|
571
|
+
case 4:
|
|
572
|
+
default:
|
|
573
|
+
return oglNorm16Ext.RGBA16_EXT;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// prioritize norm16 over float
|
|
577
|
+
|
|
578
|
+
case oglNorm16Ext && VtkDataTypes.SHORT:
|
|
579
|
+
switch (numComps) {
|
|
580
|
+
case 1:
|
|
581
|
+
return oglNorm16Ext.R16_SNORM_EXT;
|
|
582
|
+
|
|
583
|
+
case 2:
|
|
584
|
+
return oglNorm16Ext.RG16_SNORM_EXT;
|
|
585
|
+
|
|
586
|
+
case 3:
|
|
587
|
+
return oglNorm16Ext.RGB16_SNORM_EXT;
|
|
588
|
+
|
|
589
|
+
case 4:
|
|
590
|
+
default:
|
|
591
|
+
return oglNorm16Ext.RGBA16_SNORM_EXT;
|
|
592
|
+
}
|
|
593
|
+
|
|
557
594
|
case VtkDataTypes.FLOAT:
|
|
558
595
|
default:
|
|
559
596
|
switch (numComps) {
|
|
@@ -88,6 +88,18 @@ function vtkOpenGLSphereMapper(publicAPI, model) {
|
|
|
88
88
|
cellBO.getProgram().setUniformf('invertedDepth', model.invert ? -1.0 : 1.0);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
if (cellBO.getProgram().isUniformUsed('scaleFactor')) {
|
|
92
|
+
// apply scaling factor only if a scale array has been provided.
|
|
93
|
+
var poly = model.currentInput;
|
|
94
|
+
var pointData = poly.getPointData();
|
|
95
|
+
|
|
96
|
+
if (model.renderable.getScaleArray() != null && pointData.hasArray(model.renderable.getScaleArray())) {
|
|
97
|
+
cellBO.getProgram().setUniformf('scaleFactor', model.renderable.getScaleFactor());
|
|
98
|
+
} else {
|
|
99
|
+
cellBO.getProgram().setUniformf('scaleFactor', 1.0);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
superClass.setMapperShaderParameters(cellBO, ren, actor);
|
|
92
104
|
};
|
|
93
105
|
|
|
@@ -20,8 +20,6 @@ var vtkDebugMacro = vtkDebugMacro$1,
|
|
|
20
20
|
// ----------------------------------------------------------------------------
|
|
21
21
|
|
|
22
22
|
function vtkOpenGLTexture(publicAPI, model) {
|
|
23
|
-
var _this = this;
|
|
24
|
-
|
|
25
23
|
// Set our className
|
|
26
24
|
model.classHierarchy.push('vtkOpenGLTexture'); // Renders myself
|
|
27
25
|
|
|
@@ -313,14 +311,11 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
313
311
|
publicAPI.getDefaultInternalFormat = function (vtktype, numComps) {
|
|
314
312
|
var result = 0; // try default next
|
|
315
313
|
|
|
316
|
-
result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps,
|
|
314
|
+
result = model._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, model.oglNorm16Ext);
|
|
317
315
|
|
|
318
316
|
if (result) {
|
|
319
317
|
return result;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
result = _this._openGLRenderWindow.getDefaultTextureInternalFormat(vtktype, numComps, true);
|
|
318
|
+
}
|
|
324
319
|
|
|
325
320
|
if (!result) {
|
|
326
321
|
vtkDebugMacro('Unsupported internal texture type!');
|
|
@@ -396,8 +391,6 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
396
391
|
|
|
397
392
|
|
|
398
393
|
publicAPI.getDefaultDataType = function (vtkScalarType) {
|
|
399
|
-
var useHalfFloatType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
400
|
-
|
|
401
394
|
// DON'T DEAL with VTK_CHAR as this is platform dependent.
|
|
402
395
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
403
396
|
switch (vtkScalarType) {
|
|
@@ -405,11 +398,20 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
405
398
|
// return model.context.BYTE;
|
|
406
399
|
case VtkDataTypes.UNSIGNED_CHAR:
|
|
407
400
|
return model.context.UNSIGNED_BYTE;
|
|
401
|
+
// prefer norm16 since that is accurate compared to
|
|
402
|
+
// half float which is not
|
|
403
|
+
|
|
404
|
+
case model.oglNorm16Ext && VtkDataTypes.SHORT:
|
|
405
|
+
return model.context.SHORT;
|
|
408
406
|
|
|
409
|
-
case
|
|
407
|
+
case model.oglNorm16Ext && VtkDataTypes.UNSIGNED_SHORT:
|
|
408
|
+
return model.context.UNSIGNED_SHORT;
|
|
409
|
+
// use half float type
|
|
410
|
+
|
|
411
|
+
case model.useHalfFloat && VtkDataTypes.SHORT:
|
|
410
412
|
return model.context.HALF_FLOAT;
|
|
411
413
|
|
|
412
|
-
case
|
|
414
|
+
case model.useHalfFloat && VtkDataTypes.UNSIGNED_SHORT:
|
|
413
415
|
return model.context.HALF_FLOAT;
|
|
414
416
|
// case VtkDataTypes.INT:
|
|
415
417
|
// return model.context.INT;
|
|
@@ -459,10 +461,10 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
459
461
|
|
|
460
462
|
|
|
461
463
|
publicAPI.getOpenGLDataType = function (vtkScalarType) {
|
|
462
|
-
var
|
|
464
|
+
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
463
465
|
|
|
464
|
-
if (!model.openGLDataType) {
|
|
465
|
-
model.openGLDataType = publicAPI.getDefaultDataType(vtkScalarType
|
|
466
|
+
if (!model.openGLDataType || forceUpdate) {
|
|
467
|
+
model.openGLDataType = publicAPI.getDefaultDataType(vtkScalarType);
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
return model.openGLDataType;
|
|
@@ -1000,8 +1002,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1000
1002
|
}
|
|
1001
1003
|
|
|
1002
1004
|
function checkUseHalfFloat(dataType, offset, scale, preferSizeOverAccuracy) {
|
|
1003
|
-
|
|
1004
|
-
publicAPI.getOpenGLDataType(dataType, useHalfFloatType);
|
|
1005
|
+
publicAPI.getOpenGLDataType(dataType);
|
|
1005
1006
|
var useHalfFloat = false;
|
|
1006
1007
|
|
|
1007
1008
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
@@ -1027,8 +1028,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1027
1028
|
|
|
1028
1029
|
publicAPI.create3DFromRaw = function (width, height, depth, numComps, dataType, data) {
|
|
1029
1030
|
// Permit OpenGLDataType to be half float, if applicable, for 3D
|
|
1030
|
-
|
|
1031
|
-
publicAPI.getOpenGLDataType(dataType, useHalfFloatType); // Now determine the texture parameters using the arguments.
|
|
1031
|
+
publicAPI.getOpenGLDataType(dataType); // Now determine the texture parameters using the arguments.
|
|
1032
1032
|
|
|
1033
1033
|
publicAPI.getInternalFormat(dataType, numComps);
|
|
1034
1034
|
publicAPI.getFormat(dataType, numComps);
|
|
@@ -1056,6 +1056,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1056
1056
|
var scaledData = scaleTextureToHighestPowerOfTwo(pixData); // Source texture data from the PBO.
|
|
1057
1057
|
// model.context.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
1058
1058
|
// model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
1059
|
+
// openGLDataType
|
|
1059
1060
|
|
|
1060
1061
|
model.context.texImage3D(model.target, 0, model.internalFormat, model.width, model.height, model.depth, 0, model.format, model.openGLDataType, scaledData[0]);
|
|
1061
1062
|
|
|
@@ -1100,17 +1101,40 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1100
1101
|
computedScale = _computeScaleOffsets.scale;
|
|
1101
1102
|
|
|
1102
1103
|
model.volumeInfo.dataComputedScale = computedScale;
|
|
1103
|
-
model.volumeInfo.dataComputedOffset = computedOffset;
|
|
1104
|
-
|
|
1104
|
+
model.volumeInfo.dataComputedOffset = computedOffset; // if we can use norm16, there is no need to use halfFloat then
|
|
1105
|
+
|
|
1106
|
+
model.useHalfFloat = model.oglNorm16Ext ? false : checkUseHalfFloat(dataType, computedOffset, computedScale, preferSizeOverAccuracy); // since our default is to use half float, in case that we can't use it
|
|
1107
|
+
// we need to use another type
|
|
1108
|
+
|
|
1109
|
+
if (!model.useHalfFloat) {
|
|
1110
|
+
publicAPI.getOpenGLDataType(dataType, true);
|
|
1111
|
+
} // WebGL2 path, we have 3d textures etc
|
|
1112
|
+
|
|
1105
1113
|
|
|
1106
1114
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1107
|
-
if (dataType === VtkDataTypes.FLOAT || useHalfFloat && (dataType === VtkDataTypes.SHORT || dataType === VtkDataTypes.UNSIGNED_SHORT)) {
|
|
1115
|
+
if (dataType === VtkDataTypes.FLOAT || model.useHalfFloat && (dataType === VtkDataTypes.SHORT || dataType === VtkDataTypes.UNSIGNED_SHORT)) {
|
|
1108
1116
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1109
1117
|
}
|
|
1110
1118
|
|
|
1111
|
-
if (dataType === VtkDataTypes.
|
|
1119
|
+
if (model.oglNorm16Ext && dataType === VtkDataTypes.SHORT) {
|
|
1112
1120
|
for (var _c3 = 0; _c3 < numComps; ++_c3) {
|
|
1113
|
-
model.volumeInfo.scale[_c3] =
|
|
1121
|
+
model.volumeInfo.scale[_c3] = 32767.0;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
if (model.oglNorm16Ext && dataType === VtkDataTypes.UNSIGNED_SHORT) {
|
|
1128
|
+
for (var _c4 = 0; _c4 < numComps; ++_c4) {
|
|
1129
|
+
model.volumeInfo.scale[_c4] = 65535.0;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1136
|
+
for (var _c5 = 0; _c5 < numComps; ++_c5) {
|
|
1137
|
+
model.volumeInfo.scale[_c5] = 255.0;
|
|
1114
1138
|
}
|
|
1115
1139
|
|
|
1116
1140
|
return publicAPI.create3DFromRaw(width, height, depth, numComps, dataType, data);
|
|
@@ -1149,9 +1173,9 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1149
1173
|
var dataTypeToUse = VtkDataTypes.UNSIGNED_CHAR; // unsigned char gets used as is
|
|
1150
1174
|
|
|
1151
1175
|
if (dataType === VtkDataTypes.UNSIGNED_CHAR) {
|
|
1152
|
-
for (var
|
|
1153
|
-
res.offset[
|
|
1154
|
-
res.scale[
|
|
1176
|
+
for (var _c6 = 0; _c6 < numComps; ++_c6) {
|
|
1177
|
+
res.offset[_c6] = 0.0;
|
|
1178
|
+
res.scale[_c6] = 255.0;
|
|
1155
1179
|
}
|
|
1156
1180
|
} else if (model.context.getExtension('OES_texture_float') && model.context.getExtension('OES_texture_float_linear')) {
|
|
1157
1181
|
// use float textures scaled to 0.0 to 1.0
|
|
@@ -1326,7 +1350,13 @@ var DEFAULT_VALUES = {
|
|
|
1326
1350
|
maxLOD: 1000.0,
|
|
1327
1351
|
baseLevel: 0,
|
|
1328
1352
|
maxLevel: 1000,
|
|
1329
|
-
generateMipmap: false
|
|
1353
|
+
generateMipmap: false,
|
|
1354
|
+
// use half float by default, but it will get set
|
|
1355
|
+
// to false if the context does not support it or
|
|
1356
|
+
// the voxel intensity range is out of the accurate
|
|
1357
|
+
// range of half float
|
|
1358
|
+
useHalfFloat: true,
|
|
1359
|
+
oglNorm16Ext: null
|
|
1330
1360
|
}; // ----------------------------------------------------------------------------
|
|
1331
1361
|
|
|
1332
1362
|
function extend(publicAPI, model) {
|
|
@@ -1344,7 +1374,7 @@ function extend(publicAPI, model) {
|
|
|
1344
1374
|
}); // Build VTK API
|
|
1345
1375
|
|
|
1346
1376
|
set(publicAPI, model, ['format', 'openGLDataType']);
|
|
1347
|
-
setGet(publicAPI, model, ['keyMatrixTime', 'minificationFilter', 'magnificationFilter', 'wrapS', 'wrapT', 'wrapR', 'generateMipmap']);
|
|
1377
|
+
setGet(publicAPI, model, ['keyMatrixTime', 'minificationFilter', 'magnificationFilter', 'wrapS', 'wrapT', 'wrapR', 'generateMipmap', 'oglNorm16Ext']);
|
|
1348
1378
|
get(publicAPI, model, ['width', 'height', 'volumeInfo', 'components', 'handle', 'target']);
|
|
1349
1379
|
moveToProtected(publicAPI, model, ['openGLRenderWindow']); // Object methods
|
|
1350
1380
|
|
|
@@ -180,7 +180,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
180
180
|
|
|
181
181
|
if (model.zBufferTexture !== null) {
|
|
182
182
|
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Dec', ['uniform sampler2D zBufferTexture;', 'uniform float vpWidth;', 'uniform float vpHeight;']).result;
|
|
183
|
-
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Impl', ['vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpWidth, gl_FragCoord.y/vpHeight));', 'float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;', 'zdepth = zdepth * 2.0 - 1.0;', 'zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;', 'zdepth = -zdepth/rayDir.z;', 'dists.y = min(zdepth,dists.y);']).result;
|
|
183
|
+
FSSource = vtkShaderProgram.substitute(FSSource, '//VTK::ZBuffer::Impl', ['vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpWidth, gl_FragCoord.y/vpHeight));', 'float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;', 'zdepth = zdepth * 2.0 - 1.0;', 'if (cameraParallel == 0) {', 'zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;}', 'else {', 'zdepth = (zdepth + 1.0) * 0.5 * (camFar - camNear);}\n', 'zdepth = -zdepth/rayDir.z;', 'dists.y = min(zdepth,dists.y);']).result;
|
|
184
184
|
} // Set the BlendMode approach
|
|
185
185
|
|
|
186
186
|
|
|
@@ -673,8 +673,10 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
673
673
|
program.setUniformf("oscale".concat(_i3), oscale);
|
|
674
674
|
var cfun = vprop.getRGBTransferFunction(target);
|
|
675
675
|
var cRange = cfun.getRange();
|
|
676
|
-
|
|
677
|
-
|
|
676
|
+
var cshift = (volInfo.offset[_i3] - cRange[0]) / (cRange[1] - cRange[0]);
|
|
677
|
+
var cScale = sscale / (cRange[1] - cRange[0]);
|
|
678
|
+
program.setUniformf("cshift".concat(_i3), cshift);
|
|
679
|
+
program.setUniformf("cscale".concat(_i3), cScale);
|
|
678
680
|
}
|
|
679
681
|
|
|
680
682
|
if (model.gopacity) {
|
|
@@ -1096,7 +1098,9 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
1096
1098
|
|
|
1097
1099
|
if (model.scalarTextureString !== toString) {
|
|
1098
1100
|
// Build the textures
|
|
1099
|
-
var dims = image.getDimensions();
|
|
1101
|
+
var dims = image.getDimensions(); // Use norm16 for scalar texture if the extension is available
|
|
1102
|
+
|
|
1103
|
+
model.scalarTexture.setOglNorm16Ext(model.context.getExtension('EXT_texture_norm16'));
|
|
1100
1104
|
model.scalarTexture.releaseGraphicsResources(model._openGLRenderWindow);
|
|
1101
1105
|
model.scalarTexture.resetFormatAndType();
|
|
1102
1106
|
model.scalarTexture.create3DFilterableFromRaw(dims[0], dims[1], dims[2], numComp, scalars.getDataType(), scalars.getData(), model.renderable.getPreferSizeOverAccuracy());
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var vtkSphereMapperVS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(
|
|
1
|
+
var vtkSphereMapperVS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkSphereMapperVS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// this shader implements imposters in OpenGL for Spheres\n\nattribute vec4 vertexMC;\nattribute vec2 offsetMC;\n\n// optional normal declaration\n//VTK::Normal::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\nuniform mat3 normalMatrix; // transform model coordinate directions to view coordinates\n\n// material property values\n//VTK::Color::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvarying vec4 vertexVCVSOutput;\nvarying float radiusVCVSOutput;\nvarying vec3 centerVCVSOutput;\n\nuniform int cameraParallel;\nuniform float scaleFactor;\n\nvoid main()\n{\n //VTK::Color::Impl\n\n //VTK::Normal::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Clip::Impl\n\n // compute the projected vertex position\n vec2 scaledOffsetMC = scaleFactor * offsetMC;\n vertexVCVSOutput = MCVCMatrix * vertexMC;\n centerVCVSOutput = vertexVCVSOutput.xyz;\n radiusVCVSOutput = length(scaledOffsetMC)*0.5;\n\n // make the triangle face the camera\n if (cameraParallel == 0)\n {\n vec3 dir = normalize(-vertexVCVSOutput.xyz);\n vec3 base2 = normalize(cross(dir,vec3(1.0,0.0,0.0)));\n vec3 base1 = cross(base2,dir);\n vertexVCVSOutput.xyz = vertexVCVSOutput.xyz + scaledOffsetMC.x*base1 + scaledOffsetMC.y*base2;\n }\n else\n {\n // add in the offset\n vertexVCVSOutput.xy = vertexVCVSOutput.xy + scaledOffsetMC;\n }\n\n gl_Position = VCPCMatrix * vertexVCVSOutput;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { vtkSphereMapperVS as v };
|
|
@@ -134,7 +134,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
|
|
|
134
134
|
var radius = model.renderable.getRadius();
|
|
135
135
|
|
|
136
136
|
if (scales) {
|
|
137
|
-
radius = scales[_id];
|
|
137
|
+
radius = scales[_id] * model.renderable.getScaleFactor();
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
_tmpVBO[_vboIdx++] = -2.0 * radius * cos30;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "26.0.0
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"babel-loader": "8.2.5",
|
|
65
65
|
"babel-plugin-istanbul": "6.1.1",
|
|
66
66
|
"buffer": "6.0.3",
|
|
67
|
-
"commitizen": "4.2.
|
|
67
|
+
"commitizen": "4.2.5",
|
|
68
68
|
"concurrently": "7.1.0",
|
|
69
69
|
"copy-webpack-plugin": "10.2.4",
|
|
70
70
|
"cross-env": "7.0.3",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"rollup-plugin-polyfill-node": "0.9.0",
|
|
111
111
|
"rollup-plugin-postcss": "4.0.2",
|
|
112
112
|
"rollup-plugin-string": "3.0.0",
|
|
113
|
-
"rollup-plugin-svgo": "
|
|
113
|
+
"rollup-plugin-svgo": "2.0.0",
|
|
114
114
|
"rollup-plugin-web-worker-loader": "1.6.1",
|
|
115
115
|
"semantic-release": "19.0.3",
|
|
116
116
|
"snabbdom": "^3.5.1",
|