@kitware/vtk.js 24.12.0 → 24.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +11 -1
- package/Common/Core/Math/index.js +2 -7
- package/Interaction/Style/InteractorStyleManipulator.js +6 -3
- package/Rendering/Core/Camera.js +19 -1
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +17 -0
- package/Rendering/Core/ColorTransferFunction.d.ts +3 -11
- package/Rendering/Core/Coordinate/Constants.d.ts +14 -0
- package/Rendering/Core/Coordinate.d.ts +5 -12
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +17 -0
- package/Rendering/Core/Glyph3DMapper.d.ts +3 -11
- package/Rendering/Core/ImageMapper/Constants.d.ts +14 -0
- package/Rendering/Core/ImageMapper.d.ts +2 -9
- package/Rendering/Core/ImageProperty/Constants.d.ts +9 -0
- package/Rendering/Core/ImageProperty.d.ts +30 -33
- package/Rendering/Core/Light.js +11 -5
- package/Rendering/Core/Property2D/Constants.d.ts +9 -0
- package/Rendering/Core/Property2D.d.ts +6 -5
- package/Rendering/Core/Renderer.js +3 -1
- package/Rendering/Core/ScalarBarActor.d.ts +42 -41
- package/Rendering/Core/VolumeProperty/Constants.d.ts +16 -0
- package/Rendering/OpenGL/VolumeMapper.js +86 -62
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Widgets/Representations/ArrowHandleRepresentation.js +6 -4
- package/Widgets/Widgets3D/ImageCroppingWidget/state.js +51 -50
- package/Widgets/Widgets3D/ImageCroppingWidget.js +2 -2
- package/index.d.ts +7 -0
- package/package.json +1 -1
package/BREAKING_CHANGES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## From 23.x to 24
|
|
2
2
|
|
|
3
|
-
All old-style widgets except OrientationMarkerWidget and PiecewiseGaussianWidget have been removed.
|
|
3
|
+
- All old-style widgets except OrientationMarkerWidget and PiecewiseGaussianWidget have been removed.
|
|
4
4
|
|
|
5
5
|
| **Old-style/deprecated widget** | **New-style widget** |
|
|
6
6
|
|-----------------------------------|---------------------------------|
|
|
@@ -15,6 +15,16 @@ All old-style widgets except OrientationMarkerWidget and PiecewiseGaussianWidget
|
|
|
15
15
|
| ResliceCursor | ResliceCursorWidget |
|
|
16
16
|
|
|
17
17
|
- In SVGLandmarkRepresentation: `model.showCircle` is replaced by `model.circleProps.visible`
|
|
18
|
+
- In vtk.js subclasses, prefix with '_' the following "protected" model variables:
|
|
19
|
+
- vtk*: model.openglRenderWindow -> model._openglRenderWindow
|
|
20
|
+
- vtk*: model.openglRenderer -> model._openglRenderer
|
|
21
|
+
- vtkInteractorObserver, vtkOrientationMarkerWidget : model.interactor -> model._interactor
|
|
22
|
+
- vtkAbstractWidget, vtkViewNode: model.parent -> model._parent
|
|
23
|
+
- vtkProp: model.parentProp -> model._parentProp
|
|
24
|
+
- vtkRenderWindowInteractor: model.view -> model._view
|
|
25
|
+
- vtkRenderer: model.renderWindow -> model._renderWindow
|
|
26
|
+
- vtkHardwareSelector: model.renderer -> model._renderer
|
|
27
|
+
- vtkAbstractWidget: model.widgetManager -> model._widgetManager
|
|
18
28
|
|
|
19
29
|
## From 22.x to 23
|
|
20
30
|
|
|
@@ -34,13 +34,8 @@ function vtkSwapVectors3(v1, v2) {
|
|
|
34
34
|
|
|
35
35
|
function createArray() {
|
|
36
36
|
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
while (array.length < size) {
|
|
40
|
-
array.push(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return array;
|
|
37
|
+
// faster than Array.from and/or while loop
|
|
38
|
+
return Array(size).fill(0);
|
|
44
39
|
} // ----------------------------------------------------------------------------
|
|
45
40
|
// Global methods
|
|
46
41
|
// ----------------------------------------------------------------------------
|
|
@@ -42,13 +42,16 @@ function dollyToPosition(fact, position, renderer, rwi) {
|
|
|
42
42
|
|
|
43
43
|
if (cam.getParallelProjection()) {
|
|
44
44
|
// Zoom relatively to the cursor
|
|
45
|
-
var
|
|
45
|
+
var view = rwi.getView();
|
|
46
|
+
var aSize = view.getViewportSize(renderer);
|
|
47
|
+
var viewport = renderer.getViewport();
|
|
48
|
+
var viewSize = view.getSize();
|
|
46
49
|
var w = aSize[0];
|
|
47
50
|
var h = aSize[1];
|
|
48
51
|
var x0 = w / 2;
|
|
49
52
|
var y0 = h / 2;
|
|
50
|
-
var x1 = position.x;
|
|
51
|
-
var y1 = position.y;
|
|
53
|
+
var x1 = position.x - viewport[0] * viewSize[0];
|
|
54
|
+
var y1 = position.y - viewport[1] * viewSize[1];
|
|
52
55
|
translateCamera(renderer, rwi, x0, y0, x1, y1);
|
|
53
56
|
cam.setParallelScale(cam.getParallelScale() / fact);
|
|
54
57
|
translateCamera(renderer, rwi, x1, y1, x0, y0);
|
package/Rendering/Core/Camera.js
CHANGED
|
@@ -27,6 +27,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
27
27
|
var dopbasis = new Float64Array([0.0, 0.0, -1.0]);
|
|
28
28
|
var upbasis = new Float64Array([0.0, 1.0, 0.0]);
|
|
29
29
|
var tmpMatrix = mat4.identity(new Float64Array(16));
|
|
30
|
+
var tmpMatrix2 = mat4.identity(new Float64Array(16));
|
|
30
31
|
var tmpvec1 = new Float64Array(3);
|
|
31
32
|
var tmpvec2 = new Float64Array(3);
|
|
32
33
|
var tmpvec3 = new Float64Array(3);
|
|
@@ -60,6 +61,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
60
61
|
model.position[2] = z; // recompute the focal distance
|
|
61
62
|
|
|
62
63
|
publicAPI.computeDistance();
|
|
64
|
+
publicAPI.computeCameraLightTransform();
|
|
63
65
|
publicAPI.modified();
|
|
64
66
|
};
|
|
65
67
|
|
|
@@ -73,6 +75,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
73
75
|
model.focalPoint[2] = z; // recompute the focal distance
|
|
74
76
|
|
|
75
77
|
publicAPI.computeDistance();
|
|
78
|
+
publicAPI.computeCameraLightTransform();
|
|
76
79
|
publicAPI.modified();
|
|
77
80
|
};
|
|
78
81
|
|
|
@@ -94,6 +97,7 @@ function vtkCamera(publicAPI, model) {
|
|
|
94
97
|
model.focalPoint[0] = model.position[0] + vec[0] * model.distance;
|
|
95
98
|
model.focalPoint[1] = model.position[1] + vec[1] * model.distance;
|
|
96
99
|
model.focalPoint[2] = model.position[2] + vec[2] * model.distance;
|
|
100
|
+
publicAPI.computeCameraLightTransform();
|
|
97
101
|
publicAPI.modified();
|
|
98
102
|
}; //----------------------------------------------------------------------------
|
|
99
103
|
// This method must be called when the focal point or camera position changes
|
|
@@ -293,7 +297,20 @@ function vtkCamera(publicAPI, model) {
|
|
|
293
297
|
publicAPI.getFrustumPlanes = function (aspect) {// Return array of 24 params (4 params for each of 6 plane equations)
|
|
294
298
|
};
|
|
295
299
|
|
|
296
|
-
publicAPI.getCameraLightTransformMatrix = function () {
|
|
300
|
+
publicAPI.getCameraLightTransformMatrix = function (matrix) {
|
|
301
|
+
mat4.copy(matrix, model.cameraLightTransform);
|
|
302
|
+
return matrix;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
publicAPI.computeCameraLightTransform = function () {
|
|
306
|
+
// not sure if this is the correct transformation, based on the same funciton in VTK
|
|
307
|
+
mat4.copy(tmpMatrix, publicAPI.getViewMatrix());
|
|
308
|
+
mat4.invert(tmpMatrix, tmpMatrix);
|
|
309
|
+
mat4.fromScaling(tmpMatrix2, [model.distance, model.distance, model.distance]);
|
|
310
|
+
mat4.multiply(tmpMatrix, tmpMatrix, tmpMatrix2);
|
|
311
|
+
mat4.identity(model.cameraLightTransform);
|
|
312
|
+
mat4.translate(model.cameraLightTransform, tmpMatrix, [0.0, 0.0, -1.0]);
|
|
313
|
+
};
|
|
297
314
|
|
|
298
315
|
publicAPI.deepCopy = function (sourceCamera) {};
|
|
299
316
|
|
|
@@ -602,6 +619,7 @@ var DEFAULT_VALUES = {
|
|
|
602
619
|
freezeFocalPoint: false,
|
|
603
620
|
projectionMatrix: null,
|
|
604
621
|
viewMatrix: null,
|
|
622
|
+
cameraLightTransform: mat4.create(),
|
|
605
623
|
// used for world to physical transformations
|
|
606
624
|
physicalTranslation: [0, 0, 0],
|
|
607
625
|
physicalScale: 1.0,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum ColorSpace {
|
|
2
|
+
RGB = 0,
|
|
3
|
+
HSV = 1,
|
|
4
|
+
LAB = 2,
|
|
5
|
+
DIVERGING = 3,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export declare enum Scale {
|
|
9
|
+
LINEAR = 0,
|
|
10
|
+
LOG10 = 1,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const _default: {
|
|
14
|
+
ColorSpace: typeof ColorSpace;
|
|
15
|
+
Scale: typeof Scale;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
|
+
import { ColorSpace, Scale } from './ColorTransferFunction/Constants';
|
|
2
3
|
|
|
3
|
-
export enum ColorSpace {
|
|
4
|
-
RGB,
|
|
5
|
-
HSV,
|
|
6
|
-
LAB,
|
|
7
|
-
DIVERGING,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum Scale {
|
|
11
|
-
LINEAR,
|
|
12
|
-
LOG10,
|
|
13
|
-
}
|
|
14
4
|
|
|
15
5
|
/* TODO: use VtkScalarsToColors instead of VtkObject */
|
|
16
6
|
export interface vtkColorTransferFunction extends vtkObject {
|
|
@@ -358,5 +348,7 @@ export function newInstance(initialValues?: object): vtkColorTransferFunction;
|
|
|
358
348
|
export declare const vtkColorTransferFunction: {
|
|
359
349
|
newInstance: typeof newInstance;
|
|
360
350
|
extend: typeof extend;
|
|
351
|
+
ColorSpace: typeof ColorSpace;
|
|
352
|
+
Scale: typeof Scale;
|
|
361
353
|
};
|
|
362
354
|
export default vtkColorTransferFunction;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum Coordinate {
|
|
2
|
+
DISPLAY = 0,
|
|
3
|
+
NORMALIZED_DISPLAY = 1,
|
|
4
|
+
VIEWPORT = 2,
|
|
5
|
+
NORMALIZED_VIEWPORT = 3,
|
|
6
|
+
PROJECTION = 4,
|
|
7
|
+
VIEW = 5,
|
|
8
|
+
WORLD = 6,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const _default: {
|
|
12
|
+
Coordinate: typeof Coordinate;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { vtkObject, vtkProperty } from './../../interfaces';
|
|
2
2
|
import vtkRenderer from './Renderer';
|
|
3
|
+
import { Coordinate } from './Coordinate/Constants';
|
|
3
4
|
|
|
4
|
-
export enum Coordinate {
|
|
5
|
-
DISPLAY,
|
|
6
|
-
NORMALIZED_DISPLAY,
|
|
7
|
-
VIEWPORT,
|
|
8
|
-
NORMALIZED_VIEWPORT,
|
|
9
|
-
PROJECTION,
|
|
10
|
-
VIEW,
|
|
11
|
-
WORLD,
|
|
12
|
-
}
|
|
13
5
|
|
|
14
6
|
/**
|
|
15
7
|
*
|
|
@@ -73,7 +65,7 @@ export interface vtkCoordinate extends vtkObject {
|
|
|
73
65
|
* options are Display, Normalized Display, Viewport, Normalized Viewport,
|
|
74
66
|
* View, and World.
|
|
75
67
|
*/
|
|
76
|
-
getCoordinateSystem():
|
|
68
|
+
getCoordinateSystem(): Coordinate;
|
|
77
69
|
|
|
78
70
|
/**
|
|
79
71
|
* Get the coordinate system which this coordinate is defined in as string.
|
|
@@ -251,7 +243,8 @@ export function newInstance(initialValues?: ICoordinateInitialValues): vtkCoordi
|
|
|
251
243
|
* @see [vtkActor](./Rendering_Core_Actor.html)2D
|
|
252
244
|
*/
|
|
253
245
|
export declare const vtkCoordinate: {
|
|
254
|
-
newInstance: typeof newInstance
|
|
255
|
-
extend: typeof extend
|
|
246
|
+
newInstance: typeof newInstance;
|
|
247
|
+
extend: typeof extend;
|
|
248
|
+
Coordinate: typeof Coordinate;
|
|
256
249
|
};
|
|
257
250
|
export default vtkCoordinate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum OrientationModes {
|
|
2
|
+
DIRECTION = 0,
|
|
3
|
+
ROTATION = 1,
|
|
4
|
+
MATRIX = 2,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare enum ScaleModes {
|
|
8
|
+
SCALE_BY_CONSTANT = 0,
|
|
9
|
+
SCALE_BY_MAGNITUDE = 1,
|
|
10
|
+
SCALE_BY_COMPONENTS = 2,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const _default: {
|
|
14
|
+
OrientationModes: typeof OrientationModes;
|
|
15
|
+
ScaleModes: typeof ScaleModes;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { Bounds } from './../../types';
|
|
2
2
|
import vtkMapper, { IMapperInitialValues } from './Mapper';
|
|
3
|
+
import { OrientationModes, ScaleModes } from './Glyph3DMapper/Constants';
|
|
3
4
|
|
|
4
|
-
export enum OrientationModes {
|
|
5
|
-
DIRECTION,
|
|
6
|
-
ROTATION,
|
|
7
|
-
MATRIX,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum ScaleModes {
|
|
11
|
-
SCALE_BY_CONSTANT,
|
|
12
|
-
SCALE_BY_MAGNITUDE,
|
|
13
|
-
SCALE_BY_COMPONENTS,
|
|
14
|
-
}
|
|
15
5
|
|
|
16
6
|
interface IPrimitiveCount {
|
|
17
7
|
points: number;
|
|
@@ -168,5 +158,7 @@ export function newInstance(initialValues?: IGlyph3DMapperInitialValues): vtkGly
|
|
|
168
158
|
export declare const vtkGlyph3DMapper: {
|
|
169
159
|
newInstance: typeof newInstance;
|
|
170
160
|
extend: typeof extend;
|
|
161
|
+
OrientationModes: typeof OrientationModes;
|
|
162
|
+
ScaleModes: typeof ScaleModes;
|
|
171
163
|
}
|
|
172
164
|
export default vtkGlyph3DMapper;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import vtkCamera from './Camera';
|
|
2
2
|
import vtkAbstractMapper, { IAbstractMapperInitialValues } from './AbstractMapper';
|
|
3
3
|
import { Bounds, Vector3 } from './../../types';
|
|
4
|
+
import { SlicingMode } from './ImageMapper/Constants';
|
|
4
5
|
|
|
5
|
-
export enum SlicingMode {
|
|
6
|
-
NONE,
|
|
7
|
-
I,
|
|
8
|
-
J,
|
|
9
|
-
K,
|
|
10
|
-
X,
|
|
11
|
-
Y,
|
|
12
|
-
Z,
|
|
13
|
-
}
|
|
14
6
|
|
|
15
7
|
interface IClosestIJKAxis {
|
|
16
8
|
ijkMode: SlicingMode,
|
|
@@ -325,5 +317,6 @@ export function newInstance(initialValues?: IImageMapperInitialValues): vtkImage
|
|
|
325
317
|
export declare const vtkImageMapper: {
|
|
326
318
|
newInstance: typeof newInstance;
|
|
327
319
|
extend: typeof extend;
|
|
320
|
+
SlicingMode: typeof SlicingMode;
|
|
328
321
|
}
|
|
329
322
|
export default vtkImageMapper;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
2
|
import vtkColorTransferFunction from './ColorTransferFunction';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
NEAREST,
|
|
6
|
-
LINEAR,
|
|
7
|
-
}
|
|
3
|
+
import vtkPiecewiseFunction from './../../Common/DataModel/PiecewiseFunction';
|
|
4
|
+
import { InterpolationType } from './ImageProperty/Constants';
|
|
8
5
|
|
|
9
6
|
interface IComponentData {
|
|
10
7
|
piecewiseFunction: number;
|
|
11
8
|
componentWeight: number;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
export interface
|
|
11
|
+
export interface IImagePropertyInitialValues {
|
|
15
12
|
independentComponents?: boolean;
|
|
16
13
|
interpolationType?: InterpolationType;
|
|
17
14
|
colorWindow?: number;
|
|
@@ -20,13 +17,13 @@ export interface IImageMapperInitialValues {
|
|
|
20
17
|
diffuse?: number;
|
|
21
18
|
opacity?: number;
|
|
22
19
|
componentData?: IComponentData[];
|
|
23
|
-
|
|
20
|
+
useLookupTableScalarRange?: boolean;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
export interface vtkImageProperty extends vtkObject {
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
|
-
|
|
26
|
+
* Get the lighting coefficient.
|
|
30
27
|
* @default 1.0
|
|
31
28
|
*/
|
|
32
29
|
getAmbient(): number;
|
|
@@ -50,7 +47,7 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
50
47
|
getComponentWeight(index: number): number;
|
|
51
48
|
|
|
52
49
|
/**
|
|
53
|
-
|
|
50
|
+
* Get the diffuse lighting coefficient.
|
|
54
51
|
* @default 1.0
|
|
55
52
|
*/
|
|
56
53
|
getDiffuse(): number;
|
|
@@ -72,7 +69,7 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
72
69
|
getInterpolationTypeAsString(): string;
|
|
73
70
|
|
|
74
71
|
/**
|
|
75
|
-
|
|
72
|
+
* Get the opacity of the object.
|
|
76
73
|
* @default 1.0
|
|
77
74
|
*/
|
|
78
75
|
getOpacity(): number;
|
|
@@ -81,25 +78,25 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
81
78
|
* Get the component weighting function.
|
|
82
79
|
* @param {Number} [idx]
|
|
83
80
|
*/
|
|
84
|
-
getPiecewiseFunction(idx?: number):
|
|
81
|
+
getPiecewiseFunction(idx?: number): vtkPiecewiseFunction;
|
|
85
82
|
|
|
86
83
|
/**
|
|
87
84
|
* Get the currently set RGB transfer function.
|
|
88
85
|
* @param {Number} [idx]
|
|
89
86
|
*/
|
|
90
|
-
getRGBTransferFunction(idx?: number):
|
|
87
|
+
getRGBTransferFunction(idx?: number): vtkColorTransferFunction;
|
|
91
88
|
|
|
92
89
|
/**
|
|
93
90
|
* Alias to get the piecewise function (backwards compatibility)
|
|
94
91
|
* @param {Number} [idx]
|
|
95
92
|
*/
|
|
96
|
-
getScalarOpacity(idx
|
|
93
|
+
getScalarOpacity(idx?: number): vtkPiecewiseFunction;
|
|
97
94
|
|
|
98
|
-
|
|
95
|
+
/**
|
|
99
96
|
* Set the ambient lighting coefficient.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
* @param {Number} ambient The ambient lighting coefficient.
|
|
98
|
+
*/
|
|
99
|
+
setAmbient(ambient: number): boolean;
|
|
103
100
|
|
|
104
101
|
/**
|
|
105
102
|
* Set the level value for window/level.
|
|
@@ -120,11 +117,11 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
120
117
|
*/
|
|
121
118
|
setComponentWeight(index: number, value: number): boolean;
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Set the diffuse lighting coefficient.
|
|
122
|
+
* @param {Number} diffuse The diffuse lighting coefficient.
|
|
123
|
+
*/
|
|
124
|
+
setDiffuse(diffuse: number): boolean;
|
|
128
125
|
|
|
129
126
|
/**
|
|
130
127
|
*
|
|
@@ -149,7 +146,7 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
149
146
|
setInterpolationTypeToNearest(): boolean;
|
|
150
147
|
|
|
151
148
|
/**
|
|
152
|
-
|
|
149
|
+
* Set the opacity of the object
|
|
153
150
|
* @param {Number} opacity The opacity value.
|
|
154
151
|
*/
|
|
155
152
|
setOpacity(opacity: number): boolean;
|
|
@@ -157,9 +154,9 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
157
154
|
/**
|
|
158
155
|
* Set the piecewise function
|
|
159
156
|
* @param {Number} index
|
|
160
|
-
* @param func
|
|
157
|
+
* @param {vtkPiecewiseFunction} func
|
|
161
158
|
*/
|
|
162
|
-
setPiecewiseFunction(index: number, func:
|
|
159
|
+
setPiecewiseFunction(index: number, func: vtkPiecewiseFunction): boolean;
|
|
163
160
|
|
|
164
161
|
/**
|
|
165
162
|
* Set the color of a volume to an RGB transfer function
|
|
@@ -171,14 +168,14 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
171
168
|
/**
|
|
172
169
|
* Alias to set the piecewise function
|
|
173
170
|
* @param {Number} index
|
|
174
|
-
* @param func
|
|
171
|
+
* @param {vtkPiecewiseFunction} func
|
|
175
172
|
*/
|
|
176
|
-
setScalarOpacity(index:
|
|
173
|
+
setScalarOpacity(index: number, func: vtkPiecewiseFunction): boolean;
|
|
177
174
|
|
|
178
175
|
/**
|
|
179
176
|
* Use the range that is set on the lookup table, instead of setting the range from the
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
* ColorWindow/ColorLevel settings
|
|
178
|
+
* @default false
|
|
182
179
|
* @param {Boolean} useLookupTableScalarRange
|
|
183
180
|
*/
|
|
184
181
|
setUseLookupTableScalarRange(useLookupTableScalarRange: boolean): boolean;
|
|
@@ -189,15 +186,15 @@ export interface vtkImageProperty extends vtkObject {
|
|
|
189
186
|
*
|
|
190
187
|
* @param publicAPI object on which methods will be bounds (public)
|
|
191
188
|
* @param model object on which data structure will be bounds (protected)
|
|
192
|
-
* @param {
|
|
189
|
+
* @param {IImagePropertyInitialValues} [initialValues] (default: {})
|
|
193
190
|
*/
|
|
194
|
-
export function extend(publicAPI: object, model: object, initialValues?:
|
|
191
|
+
export function extend(publicAPI: object, model: object, initialValues?: IImagePropertyInitialValues): void;
|
|
195
192
|
|
|
196
193
|
/**
|
|
197
194
|
* Method use to create a new instance of vtkImageProperty
|
|
198
|
-
* @param {
|
|
195
|
+
* @param {IImagePropertyInitialValues} [initialValues] for pre-setting some of its content
|
|
199
196
|
*/
|
|
200
|
-
export function newInstance(initialValues?:
|
|
197
|
+
export function newInstance(initialValues?: IImagePropertyInitialValues): vtkImageProperty;
|
|
201
198
|
|
|
202
199
|
/**
|
|
203
200
|
* vtkImageProperty provides 2D image display support for vtk.
|
package/Rendering/Core/Light.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import macro from '../../macros.js';
|
|
2
2
|
import { l as normalize, r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
3
|
+
import { vec3 } from 'gl-matrix';
|
|
3
4
|
|
|
4
5
|
var LIGHT_TYPES = ['HeadLight', 'CameraLight', 'SceneLight']; // ----------------------------------------------------------------------------
|
|
5
6
|
// vtkLight methods
|
|
@@ -8,21 +9,26 @@ var LIGHT_TYPES = ['HeadLight', 'CameraLight', 'SceneLight']; // ---------------
|
|
|
8
9
|
function vtkLight(publicAPI, model) {
|
|
9
10
|
// Set our className
|
|
10
11
|
model.classHierarchy.push('vtkLight');
|
|
12
|
+
var tmpVec = new Float64Array(3);
|
|
11
13
|
|
|
12
14
|
publicAPI.getTransformedPosition = function () {
|
|
13
15
|
if (model.transformMatrix) {
|
|
14
|
-
|
|
16
|
+
vec3.transformMat4(tmpVec, model.position, model.transformMatrix);
|
|
17
|
+
} else {
|
|
18
|
+
vec3.set(tmpVec, model.position[0], model.position[1], model.position[2]);
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
return
|
|
21
|
+
return tmpVec;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
publicAPI.getTransformedFocalPoint = function () {
|
|
21
25
|
if (model.transformMatrix) {
|
|
22
|
-
|
|
26
|
+
vec3.transformMat4(tmpVec, model.focalPoint, model.transformMatrix);
|
|
27
|
+
} else {
|
|
28
|
+
vec3.set(tmpVec, model.focalPoint[0], model.focalPoint[1], model.focalPoint[2]);
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
return
|
|
31
|
+
return tmpVec;
|
|
26
32
|
};
|
|
27
33
|
|
|
28
34
|
publicAPI.getDirection = function () {
|
|
@@ -96,7 +102,7 @@ function extend(publicAPI, model) {
|
|
|
96
102
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Build VTK API
|
|
97
103
|
|
|
98
104
|
macro.obj(publicAPI, model);
|
|
99
|
-
macro.setGet(publicAPI, model, ['intensity', 'switch', 'positional', 'exponent', 'coneAngle', 'transformMatrix', 'lightType', 'shadowAttenuation']);
|
|
105
|
+
macro.setGet(publicAPI, model, ['intensity', 'switch', 'positional', 'exponent', 'coneAngle', 'transformMatrix', 'lightType', 'shadowAttenuation', 'attenuationValues']);
|
|
100
106
|
macro.setGetArray(publicAPI, model, ['color', 'position', 'focalPoint', 'attenuationValues'], 3); // Object methods
|
|
101
107
|
|
|
102
108
|
vtkLight(publicAPI, model);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { vtkObject } from './../../interfaces';
|
|
2
2
|
import { RGBColor } from './../../types';
|
|
3
|
+
import { DisplayLocation } from './Property2D/Constants';
|
|
3
4
|
|
|
4
5
|
interface IProperty2DInitialValues{
|
|
5
6
|
color?: RGBColor;
|
|
6
7
|
opacity?: number;
|
|
7
8
|
pointSize?: number;
|
|
8
9
|
lineWidth?: number;
|
|
9
|
-
displayLocation?:
|
|
10
|
+
displayLocation?: DisplayLocation;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface vtkProperty2D extends vtkObject {
|
|
@@ -25,7 +26,7 @@ export interface vtkProperty2D extends vtkObject {
|
|
|
25
26
|
* Get the display location of the object.
|
|
26
27
|
* @default 'Foreground'
|
|
27
28
|
*/
|
|
28
|
-
getDisplayLocation():
|
|
29
|
+
getDisplayLocation(): DisplayLocation;
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Get the width of a Line.
|
|
@@ -84,7 +85,7 @@ export interface vtkProperty2D extends vtkObject {
|
|
|
84
85
|
* Set the display location of the object.
|
|
85
86
|
* @param {String} displayLocation
|
|
86
87
|
*/
|
|
87
|
-
setDisplayLocation(displayLocation:
|
|
88
|
+
setDisplayLocation(displayLocation: DisplayLocation): boolean;
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Set the width of a Line. The width is expressed in screen units.
|
|
@@ -138,7 +139,7 @@ export function newInstance(initialValues?: IProperty2DInitialValues): vtkProper
|
|
|
138
139
|
* like backface properties can be set and manipulated with this object.
|
|
139
140
|
*/
|
|
140
141
|
export declare const vtkProperty2D: {
|
|
141
|
-
newInstance: typeof newInstance
|
|
142
|
-
extend: typeof extend
|
|
142
|
+
newInstance: typeof newInstance;
|
|
143
|
+
extend: typeof extend;
|
|
143
144
|
};
|
|
144
145
|
export default vtkProperty2D;
|
|
@@ -55,11 +55,13 @@ function vtkRenderer(publicAPI, model) {
|
|
|
55
55
|
// another renderer is setting up.
|
|
56
56
|
var camera = publicAPI.getActiveCameraAndResetIfCreated();
|
|
57
57
|
model.lights.forEach(function (light) {
|
|
58
|
-
if (light.lightTypeIsSceneLight()
|
|
58
|
+
if (light.lightTypeIsSceneLight()) ; else if (light.lightTypeIsHeadLight()) {
|
|
59
59
|
// update position and orientation of light to match camera.
|
|
60
60
|
light.setPositionFrom(camera.getPositionByReference());
|
|
61
61
|
light.setFocalPointFrom(camera.getFocalPointByReference());
|
|
62
62
|
light.modified(camera.getMTime());
|
|
63
|
+
} else if (light.lightTypeIsCameraLight()) {
|
|
64
|
+
light.setTransformMatrix(camera.getCameraLightTransformMatrix(mat4.create()));
|
|
63
65
|
} else {
|
|
64
66
|
vtkErrorMacro('light has unknown light type', light.get());
|
|
65
67
|
}
|