@kitware/vtk.js 23.4.3 → 23.4.4
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/Math/Constants.js +12 -0
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/Common/Core/ScalarsToColors/Constants.d.ts +18 -0
- package/Common/DataModel/AbstractPointLocator.d.ts +54 -0
- package/Common/DataModel/AbstractPointLocator.js +40 -0
- package/Common/DataModel/BoundingBox.d.ts +659 -0
- package/Common/DataModel/Collection.d.ts +118 -0
- package/Common/DataModel/Collection.js +113 -0
- package/Common/DataModel/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/EdgeLocator.d.ts +79 -0
- package/Common/DataModel/EdgeLocator.js +85 -0
- package/Common/DataModel/ITKHelper.d.ts +54 -0
- package/Common/DataModel/IncrementalOctreeNode.d.ts +297 -0
- package/Common/DataModel/IncrementalOctreeNode.js +640 -0
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +61 -0
- package/Common/DataModel/IncrementalOctreePointLocator.js +398 -0
- package/Common/DataModel/Locator.d.ts +43 -0
- package/Common/DataModel/Locator.js +37 -0
- package/Common/DataModel/Plane.js +1 -1
- package/Common/DataModel/PolyData/Constants.d.ts +6 -0
- package/Common/DataModel/PolyLine.d.ts +63 -0
- package/Common/DataModel/PolyLine.js +77 -0
- package/Common/DataModel/Polygon/Constants.js +12 -0
- package/Common/DataModel/Polygon.js +1 -1
- package/Common/DataModel/Quad/Constants.js +9 -0
- package/Common/DataModel/Quad.d.ts +91 -0
- package/Common/DataModel/Quad.js +235 -0
- package/Common/DataModel/SelectionNode/Constants.d.ts +27 -0
- package/Common/DataModel/Spline1D/Constants.js +17 -0
- package/Common/DataModel/Spline3D/Constants.d.ts +9 -0
- package/Common/Transform/Transform.js +51 -0
- package/Filters/Core/PolyDataNormals.js +124 -0
- package/Filters/General/ClipClosedSurface/Constants.js +10 -0
- package/Filters/General/ClipClosedSurface.d.ts +95 -0
- package/Filters/General/ClipClosedSurface.js +972 -0
- package/Filters/General/ContourTriangulator/Constants.js +6 -0
- package/Filters/General/ContourTriangulator/helper.js +1951 -0
- package/Filters/General/ContourTriangulator.d.ts +136 -0
- package/Filters/General/ContourTriangulator.js +202 -0
- package/Filters/General/ImageMarchingCubes.js +1 -1
- package/Filters/General/MoleculeToRepresentation.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1243 -0
- package/Filters/General/TubeFilter.js +1 -1
- package/Filters/Sources/LineSource.js +1 -1
- package/Filters/Sources/PlaneSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/CompositeCameraManipulator.d.ts +68 -0
- package/Interaction/Manipulators/CompositeGestureManipulator.d.ts +168 -0
- package/Interaction/Manipulators/CompositeKeyboardManipulator.d.ts +48 -0
- package/Interaction/Manipulators/CompositeMouseManipulator.d.ts +149 -0
- package/Interaction/Manipulators/CompositeVRManipulator.d.ts +44 -0
- package/Interaction/Manipulators/GestureCameraManipulator.d.ts +34 -0
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseBoxSelectorManipulator.d.ts +88 -0
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.d.ts +32 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.d.ts +33 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.d.ts +67 -0
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.d.ts +45 -0
- package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.d.ts +26 -0
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseRangeManipulator.d.ts +53 -0
- package/Interaction/Style/InteractorStyleImage.d.ts +107 -0
- package/Interaction/Style/InteractorStyleMPRSlice.js +1 -1
- package/Interaction/Style/InteractorStyleManipulator.d.ts +348 -0
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +170 -0
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +1 -1
- package/Interaction/Widgets/LabelRepresentation.js +1 -1
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +11 -0
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -1
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -1
- package/Proxy/Core/AbstractRepresentationProxy.d.ts +24 -0
- package/Proxy/Core/LookupTableProxy.d.ts +45 -0
- package/Proxy/Core/PiecewiseFunctionProxy.d.ts +62 -0
- package/Proxy/Core/ProxyManager.d.ts +115 -0
- package/Proxy/Core/SourceProxy.d.ts +22 -0
- package/Proxy/Core/View2DProxy.d.ts +7 -0
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Proxy/Core/ViewProxy.d.ts +86 -0
- package/Proxy/Representations/SliceRepresentationProxy.d.ts +27 -0
- package/Proxy/Representations/VolumeRepresentationProxy.d.ts +44 -0
- package/README.md +2 -2
- package/Rendering/Core/AbstractImageMapper/helper.js +127 -0
- package/Rendering/Core/AbstractImageMapper.d.ts +82 -0
- package/Rendering/Core/AbstractImageMapper.js +44 -0
- package/Rendering/Core/Camera.js +1 -1
- package/Rendering/Core/CellPicker.js +1 -1
- package/Rendering/Core/ColorTransferFunction/ColorMaps.d.ts +24 -0
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/HardwareSelector.d.ts +84 -0
- package/Rendering/Core/ImageArrayMapper.d.ts +253 -0
- package/Rendering/Core/ImageArrayMapper.js +242 -0
- package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
- package/Rendering/Core/ImageResliceMapper/Constants.d.ts +11 -0
- package/Rendering/Core/ImageResliceMapper/Constants.js +11 -0
- package/Rendering/Core/ImageResliceMapper.d.ts +245 -0
- package/Rendering/Core/ImageResliceMapper.js +70 -0
- package/Rendering/Core/InteractorObserver.d.ts +132 -0
- package/Rendering/Core/InteractorStyle/Constants.d.ts +16 -0
- package/Rendering/Core/InteractorStyle.d.ts +229 -0
- package/Rendering/Core/Light.js +1 -1
- package/Rendering/Core/Mapper/Constants.d.ts +26 -0
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Picker.js +1 -1
- package/Rendering/Core/Prop/Constants.d.ts +9 -0
- package/Rendering/Core/Prop/Constants.js +9 -0
- package/Rendering/Core/Property/Constants.d.ts +24 -0
- package/Rendering/Core/Property2D/Constants.d.ts +9 -0
- package/Rendering/Core/RenderWindow.js +1 -1
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +31 -0
- package/Rendering/Core/Renderer.js +1 -1
- package/Rendering/Core/VolumeMapper/Constants.d.ts +20 -0
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager/CameraSynchronizer.js +129 -0
- package/Rendering/Misc/SynchronizableRenderWindow/BehaviorManager.js +131 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.js +763 -0
- package/Rendering/OpenGL/HardwareSelector/Constants.d.ts +8 -0
- package/Rendering/OpenGL/HardwareSelector.d.ts +339 -0
- package/Rendering/OpenGL/ImageResliceMapper.js +996 -0
- package/Rendering/OpenGL/PolyDataMapper.js +1 -1
- package/Rendering/OpenGL/PolyDataMapper2D.js +1 -1
- package/Rendering/OpenGL/RenderWindow/Constants.d.ts +10 -0
- package/Rendering/OpenGL/RenderWindow/Constants.js +13 -0
- package/Rendering/OpenGL/RenderWindow/ContextProxy.js +70 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperFS.glsl.js +3 -0
- package/Rendering/OpenGL/glsl/vtkImageResliceMapperVS.glsl.js +3 -0
- package/Rendering/WebGPU/Actor2D.js +151 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +853 -0
- package/Rendering/WebGPU/IndexBuffer.js +397 -0
- package/Rendering/WebGPU/PolyDataMapper2D.js +99 -0
- package/Rendering/WebGPU/SimpleMapper.js +290 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +131 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +24 -0
- package/Widgets/Core/StateBuilder/orientationMixin.js +1 -1
- package/Widgets/Core/StateBuilder.d.ts +29 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +231 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.js +1 -1
- package/Widgets/Representations/GlyphRepresentation.js +325 -0
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +1 -1
- package/Widgets/Representations/WidgetRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget.js +1 -1
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +157 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +78 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/index.d.ts +133 -74
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { mat3, mat4, vec3 } from 'gl-matrix';
|
|
|
3
3
|
import { newInstance as newInstance$1, setGet, obj, vtkErrorMacro as vtkErrorMacro$1 } from '../../macros.js';
|
|
4
4
|
import vtkHelper from './Helper.js';
|
|
5
5
|
import vtkMapper from '../Core/Mapper.js';
|
|
6
|
-
import {
|
|
6
|
+
import { g as normalize, u as uninitializeBounds } from '../../Common/Core/Math/index.js';
|
|
7
7
|
import vtkOpenGLTexture from './Texture.js';
|
|
8
8
|
import vtkProperty from '../Core/Property.js';
|
|
9
9
|
import vtkShaderProgram from './ShaderProgram.js';
|
|
@@ -9,7 +9,7 @@ import { v as vtkPolyData2DVS } from './glsl/vtkPolyData2DVS.glsl.js';
|
|
|
9
9
|
import vtkReplacementShaderMapper from './ReplacementShaderMapper.js';
|
|
10
10
|
import vtkShaderProgram from './ShaderProgram.js';
|
|
11
11
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
12
|
-
import {
|
|
12
|
+
import { E as round } from '../../Common/Core/Math/index.js';
|
|
13
13
|
import { Representation } from '../Core/Property/Constants.js';
|
|
14
14
|
import { DisplayLocation } from '../Core/Property2D/Constants.js';
|
|
15
15
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var XrSessionTypes = {
|
|
2
|
+
HmdVR: 0,
|
|
3
|
+
// Head-mounted display (HMD), two-camera virtual reality session
|
|
4
|
+
MobileAR: 1,
|
|
5
|
+
// Mobile device, single-camera augmented reality session
|
|
6
|
+
LookingGlassVR: 2 // Looking Glass hologram display, N-camera virtual reality session
|
|
7
|
+
|
|
8
|
+
};
|
|
9
|
+
var Constants = {
|
|
10
|
+
XrSessionTypes: XrSessionTypes
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { XrSessionTypes, Constants as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// This is used to access the underlying 3D context
|
|
2
|
+
var GET_UNDERLYING_CONTEXT = '__getUnderlyingContext';
|
|
3
|
+
function createContextProxyHandler() {
|
|
4
|
+
var cache = new Map();
|
|
5
|
+
var getParameterHandler = {
|
|
6
|
+
apply: function apply(target, gl, args) {
|
|
7
|
+
if (cache.has(args[0])) {
|
|
8
|
+
return cache.get(args[0]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return target.apply(gl, args);
|
|
12
|
+
}
|
|
13
|
+
}; // only supports single-value setters
|
|
14
|
+
|
|
15
|
+
function cachedSetterHandler(key) {
|
|
16
|
+
return {
|
|
17
|
+
apply: function apply(target, gl, args) {
|
|
18
|
+
cache.set(key, args[0]);
|
|
19
|
+
return target.apply(gl, args);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
} // When a property is accessed on the webgl context proxy,
|
|
23
|
+
// it's accessed is intercepted. If the property name matches
|
|
24
|
+
// any of the keys of `propHandlers`, then that handler is called
|
|
25
|
+
// with the following arguments: (gl, prop, receiver, propValue)
|
|
26
|
+
// - gl (WebGL2RenderingContext): the underlying webgl context
|
|
27
|
+
// - propName (string): the property name
|
|
28
|
+
// - receiver (Proxy): the webgl context proxy
|
|
29
|
+
// - propValue (unknown): the value of `gl[propName]`
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var propHandlers = Object.create(null); // Sets getParameter(property) as a cached getter proxy.
|
|
33
|
+
// propValue.bind(gl) is to avoid Illegal Invocation errors.
|
|
34
|
+
|
|
35
|
+
propHandlers.getParameter = function (gl, prop, receiver, propValue) {
|
|
36
|
+
return new Proxy(propValue.bind(gl), getParameterHandler);
|
|
37
|
+
}; // Sets depthMask(flag) as a cached setter proxy.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
propHandlers.depthMask = function (gl, prop, receiver, propValue) {
|
|
41
|
+
return new Proxy(propValue.bind(gl), cachedSetterHandler(gl.DEPTH_WRITEMASK));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
get: function get(gl, prop, receiver) {
|
|
46
|
+
if (prop === GET_UNDERLYING_CONTEXT) return function () {
|
|
47
|
+
return gl;
|
|
48
|
+
};
|
|
49
|
+
var value = Reflect.get(gl, prop, gl);
|
|
50
|
+
|
|
51
|
+
if (value instanceof Function) {
|
|
52
|
+
// prevents Illegal Invocation errors
|
|
53
|
+
value = value.bind(gl);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var propHandler = propHandlers[prop];
|
|
57
|
+
|
|
58
|
+
if (propHandler) {
|
|
59
|
+
return propHandler(gl, prop, receiver, value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var ContextProxy = {
|
|
67
|
+
createContextProxyHandler: createContextProxyHandler
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { GET_UNDERLYING_CONTEXT, createContextProxyHandler, ContextProxy as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var vtkImageResliceMapperFS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the gpu image mapper fragment shader\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n\n //VTK::RenderPassFragmentShader::Impl\n}\n";
|
|
2
|
+
|
|
3
|
+
export { vtkImageResliceMapperFS as v };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var vtkImageResliceMapperVS = "//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkImageResliceMapperVS.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\n// all variables that represent positions or directions have a suffix\n// indicating the coordinate system they are in. The possible values are\n// MC - Model coordinates\n// WC - World coordinates\n// VC - View coordinates\n// DC - Display coordinates\n// TC - Texture coordinates\n\n// frag position in VC\n//VTK::PositionVC::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// camera and actor matrix values\n//VTK::Camera::Dec\n\nvoid main()\n{\n //VTK::PositionVC::Impl\n\n //VTK::TCoord::Impl\n\n //VTK::Picking::Impl\n}\n";
|
|
2
|
+
|
|
3
|
+
export { vtkImageResliceMapperVS as v };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { mat4 } from 'gl-matrix';
|
|
2
|
+
import macro from '../../macros.js';
|
|
3
|
+
import vtkProp from '../Core/Prop.js';
|
|
4
|
+
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
5
|
+
import { registerOverride } from './ViewNodeFactory.js';
|
|
6
|
+
|
|
7
|
+
var CoordinateSystem = vtkProp.CoordinateSystem; // ----------------------------------------------------------------------------
|
|
8
|
+
// vtkWebGPUActor methods
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
function vtkWebGPUActor2D(publicAPI, model) {
|
|
12
|
+
// Set our className
|
|
13
|
+
model.classHierarchy.push('vtkWebGPUActor2D'); // Builds myself.
|
|
14
|
+
|
|
15
|
+
publicAPI.buildPass = function (prepass) {
|
|
16
|
+
if (prepass) {
|
|
17
|
+
model.WebGPURenderer = publicAPI.getFirstAncestorOfType('vtkWebGPURenderer');
|
|
18
|
+
model.WebGPURenderWindow = model.WebGPURenderer.getFirstAncestorOfType('vtkWebGPURenderWindow');
|
|
19
|
+
|
|
20
|
+
if (model.propID === undefined) {
|
|
21
|
+
model.propID = model.WebGPURenderWindow.getUniquePropID();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
publicAPI.prepareNodes();
|
|
25
|
+
publicAPI.addMissingNode(model.renderable.getMapper());
|
|
26
|
+
publicAPI.removeUnusedNodes();
|
|
27
|
+
}
|
|
28
|
+
}; // we draw textures, then mapper, then post pass textures
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
publicAPI.traverseOpaquePass = function (renderPass) {
|
|
32
|
+
if (!model.renderable || !model.renderable.getNestedVisibility() || !model.renderable.getIsOpaque() || model.WebGPURenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
publicAPI.apply(renderPass, true);
|
|
37
|
+
|
|
38
|
+
if (model.children[0]) {
|
|
39
|
+
model.children[0].traverse(renderPass);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
publicAPI.apply(renderPass, false);
|
|
43
|
+
}; // we draw textures, then mapper, then post pass textures
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
publicAPI.traverseTranslucentPass = function (renderPass) {
|
|
47
|
+
if (!model.renderable || !model.renderable.getNestedVisibility() || model.renderable.getIsOpaque() || model.WebGPURenderer.getSelector() && !model.renderable.getNestedPickable()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
publicAPI.apply(renderPass, true);
|
|
52
|
+
|
|
53
|
+
if (model.children[0]) {
|
|
54
|
+
model.children[0].traverse(renderPass);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
publicAPI.apply(renderPass, false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
publicAPI.queryPass = function (prepass, renderPass) {
|
|
61
|
+
if (prepass) {
|
|
62
|
+
if (!model.renderable || !model.renderable.getVisibility()) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (model.renderable.getIsOpaque()) {
|
|
67
|
+
renderPass.incrementOpaqueActorCount();
|
|
68
|
+
} else {
|
|
69
|
+
renderPass.incrementTranslucentActorCount();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
publicAPI.getBufferShift = function (wgpuRen) {
|
|
75
|
+
publicAPI.getKeyMatrices(wgpuRen);
|
|
76
|
+
return model.bufferShift;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
publicAPI.getKeyMatrices = function (wgpuRen) {
|
|
80
|
+
// has the actor or stabilization center changed?
|
|
81
|
+
if (Math.max(model.renderable.getMTime(), wgpuRen.getStabilizedTime()) > model.keyMatricesTime.getMTime()) {
|
|
82
|
+
// compute the net shift, only apply stabilized coords with world coordinates
|
|
83
|
+
model.bufferShift[0] = 0.0;
|
|
84
|
+
model.bufferShift[1] = 0.0;
|
|
85
|
+
model.bufferShift[2] = 0.0;
|
|
86
|
+
var center = wgpuRen.getStabilizedCenterByReference();
|
|
87
|
+
|
|
88
|
+
if (model.renderable.getCoordinateSystem() === CoordinateSystem.WORLD) {
|
|
89
|
+
model.bufferShift[0] -= center[0];
|
|
90
|
+
model.bufferShift[1] -= center[1];
|
|
91
|
+
model.bufferShift[2] -= center[2];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
mat4.identity(model.keyMatrices.bcwc);
|
|
95
|
+
mat4.identity(model.keyMatrices.normalMatrix); // only meed the buffer shift to get to world
|
|
96
|
+
|
|
97
|
+
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
|
|
98
|
+
|
|
99
|
+
if (model.renderable.getCoordinateSystem() === CoordinateSystem.WORLD) {
|
|
100
|
+
mat4.translate(model.keyMatrices.bcsc, model.keyMatrices.bcwc, [-center[0], -center[1], -center[2]]);
|
|
101
|
+
} else {
|
|
102
|
+
mat4.copy(model.keyMatrices.bcsc, model.keyMatrices.bcwc);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
model.keyMatricesTime.modified();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return model.keyMatrices;
|
|
109
|
+
};
|
|
110
|
+
} // ----------------------------------------------------------------------------
|
|
111
|
+
// Object factory
|
|
112
|
+
// ----------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var DEFAULT_VALUES = {
|
|
116
|
+
keyMatricesTime: null,
|
|
117
|
+
keyMatrices: null,
|
|
118
|
+
propID: undefined,
|
|
119
|
+
bufferShift: undefined
|
|
120
|
+
}; // ----------------------------------------------------------------------------
|
|
121
|
+
|
|
122
|
+
function extend(publicAPI, model) {
|
|
123
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
124
|
+
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
125
|
+
|
|
126
|
+
vtkViewNode.extend(publicAPI, model, initialValues);
|
|
127
|
+
model.keyMatricesTime = {};
|
|
128
|
+
macro.obj(model.keyMatricesTime, {
|
|
129
|
+
mtime: 0
|
|
130
|
+
});
|
|
131
|
+
model.keyMatrices = {
|
|
132
|
+
normalMatrix: new Float64Array(16),
|
|
133
|
+
bcwc: new Float64Array(16),
|
|
134
|
+
bcsc: new Float64Array(16)
|
|
135
|
+
};
|
|
136
|
+
macro.get(publicAPI, model, ['propID', 'keyMatricesTime']);
|
|
137
|
+
model.bufferShift = [0, 0, 0, 0]; // Object methods
|
|
138
|
+
|
|
139
|
+
vtkWebGPUActor2D(publicAPI, model);
|
|
140
|
+
} // ----------------------------------------------------------------------------
|
|
141
|
+
|
|
142
|
+
var newInstance = macro.newInstance(extend); // ----------------------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
var index = {
|
|
145
|
+
newInstance: newInstance,
|
|
146
|
+
extend: extend
|
|
147
|
+
}; // Register ourself to WebGPU backend if imported
|
|
148
|
+
|
|
149
|
+
registerOverride('vtkActor2D', newInstance);
|
|
150
|
+
|
|
151
|
+
export { index as default, extend, newInstance };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import { newInstance as newInstance$1, obj, setGet, newTypedArray, vtkDebugMacro as vtkDebugMacro$1 } from '../../macros.js';
|
|
3
|
-
import {
|
|
3
|
+
import { k as cross, g as normalize } from '../../Common/Core/Math/index.js';
|
|
4
4
|
import vtkWebGPUBuffer from './Buffer.js';
|
|
5
5
|
import vtkWebGPUTypes from './Types.js';
|
|
6
6
|
import vtkProperty from '../Core/Property.js';
|