@kitware/vtk.js 26.1.0 → 26.1.2
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.
|
@@ -755,7 +755,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
755
755
|
|
|
756
756
|
model.context.pixelStorei(model.context.UNPACK_FLIP_Y_WEBGL, flip);
|
|
757
757
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
758
|
-
|
|
758
|
+
|
|
759
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
760
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
761
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, scaledData[0]);
|
|
762
|
+
} else {
|
|
763
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, scaledData[0]);
|
|
764
|
+
}
|
|
759
765
|
|
|
760
766
|
if (model.generateMipmap) {
|
|
761
767
|
model.context.generateMipmap(model.target);
|
|
@@ -819,7 +825,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
819
825
|
} // Source texture data from the PBO.
|
|
820
826
|
|
|
821
827
|
|
|
822
|
-
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
828
|
+
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
829
|
+
|
|
830
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
831
|
+
model.context.texStorage2D(model.target, 6, model.internalFormat, model.width, model.height);
|
|
832
|
+
} // We get the 6 images
|
|
833
|
+
|
|
823
834
|
|
|
824
835
|
for (var _i3 = 0; _i3 < 6; _i3++) {
|
|
825
836
|
// For each mipmap level
|
|
@@ -837,7 +848,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
837
848
|
tempData = invertedData[6 * j + _i3];
|
|
838
849
|
}
|
|
839
850
|
|
|
840
|
-
model.
|
|
851
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
852
|
+
model.context.texSubImage2D(model.context.TEXTURE_CUBE_MAP_POSITIVE_X + _i3, j, 0, 0, w, h, model.format, model.openGLDataType, tempData);
|
|
853
|
+
} else {
|
|
854
|
+
model.context.texImage2D(model.context.TEXTURE_CUBE_MAP_POSITIVE_X + _i3, j, model.internalFormat, w, h, 0, model.format, model.openGLDataType, tempData);
|
|
855
|
+
}
|
|
856
|
+
|
|
841
857
|
j++;
|
|
842
858
|
w /= 2;
|
|
843
859
|
h /= 2;
|
|
@@ -885,7 +901,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
885
901
|
// model.context.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
886
902
|
|
|
887
903
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
888
|
-
|
|
904
|
+
|
|
905
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
906
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
907
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, data);
|
|
908
|
+
} else {
|
|
909
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, data);
|
|
910
|
+
}
|
|
889
911
|
|
|
890
912
|
if (model.generateMipmap) {
|
|
891
913
|
model.context.generateMipmap(model.target);
|
|
@@ -931,7 +953,13 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
931
953
|
ctx.scale(1, -1);
|
|
932
954
|
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
|
|
933
955
|
var safeImage = canvas;
|
|
934
|
-
|
|
956
|
+
|
|
957
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
958
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
959
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, safeImage);
|
|
960
|
+
} else {
|
|
961
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, safeImage);
|
|
962
|
+
}
|
|
935
963
|
|
|
936
964
|
if (model.generateMipmap) {
|
|
937
965
|
model.context.generateMipmap(model.target);
|
|
@@ -1058,7 +1086,12 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1058
1086
|
// model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
1059
1087
|
// openGLDataType
|
|
1060
1088
|
|
|
1061
|
-
model.
|
|
1089
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1090
|
+
model.context.texStorage3D(model.target, 1, model.internalFormat, model.width, model.height, model.depth);
|
|
1091
|
+
model.context.texSubImage3D(model.target, 0, 0, 0, 0, model.width, model.height, model.depth, model.format, model.openGLDataType, scaledData[0]);
|
|
1092
|
+
} else {
|
|
1093
|
+
model.context.texImage3D(model.target, 0, model.internalFormat, model.width, model.height, model.depth, 0, model.format, model.openGLDataType, scaledData[0]);
|
|
1094
|
+
}
|
|
1062
1095
|
|
|
1063
1096
|
if (model.generateMipmap) {
|
|
1064
1097
|
model.context.generateMipmap(model.target);
|
|
@@ -1293,7 +1326,14 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
1293
1326
|
|
|
1294
1327
|
|
|
1295
1328
|
model.context.pixelStorei(model.context.UNPACK_ALIGNMENT, 1);
|
|
1296
|
-
|
|
1329
|
+
|
|
1330
|
+
if (model._openGLRenderWindow.getWebgl2()) {
|
|
1331
|
+
model.context.texStorage2D(model.target, 1, model.internalFormat, model.width, model.height);
|
|
1332
|
+
model.context.texSubImage2D(model.target, 0, 0, 0, model.width, model.height, model.format, model.openGLDataType, newArray);
|
|
1333
|
+
} else {
|
|
1334
|
+
model.context.texImage2D(model.target, 0, model.internalFormat, model.width, model.height, 0, model.format, model.openGLDataType, newArray);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1297
1337
|
publicAPI.deactivate();
|
|
1298
1338
|
return true;
|
|
1299
1339
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
1
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
3
|
import { newInstance as newInstance$1, obj, setGet, chain, vtkWarningMacro as vtkWarningMacro$1, vtkErrorMacro as vtkErrorMacro$1 } from '../../macros.js';
|
|
3
4
|
import { mat4, mat3, vec3 } from 'gl-matrix';
|
|
@@ -534,9 +535,28 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
|
|
|
534
535
|
if (actor.getProperty().getUseLabelOutline()) {
|
|
535
536
|
var image = model.currentInput;
|
|
536
537
|
var worldToIndex = image.getWorldToIndex();
|
|
537
|
-
program.setUniformMatrix('vWCtoIDX', worldToIndex);
|
|
538
|
+
program.setUniformMatrix('vWCtoIDX', worldToIndex);
|
|
539
|
+
var camera = ren.getActiveCamera();
|
|
538
540
|
|
|
539
|
-
|
|
541
|
+
var _camera$getClippingRa = camera.getClippingRange(),
|
|
542
|
+
_camera$getClippingRa2 = _slicedToArray(_camera$getClippingRa, 2),
|
|
543
|
+
cRange0 = _camera$getClippingRa2[0],
|
|
544
|
+
cRange1 = _camera$getClippingRa2[1];
|
|
545
|
+
|
|
546
|
+
var distance = camera.getDistance(); // set the clipping range to be model.distance and model.distance + 0.1
|
|
547
|
+
// since we use the in the keyMats.wcpc (world to projection) matrix
|
|
548
|
+
// the projection matrix calculation relies on the clipping range to be
|
|
549
|
+
// set correctly. This is done inside the interactorStyleMPRSlice which
|
|
550
|
+
// limits use cases where the interactor style is not used.
|
|
551
|
+
|
|
552
|
+
camera.setClippingRange(distance, distance + 0.1);
|
|
553
|
+
var labelOutlineKeyMats = model.openGLCamera.getKeyMatrices(ren); // Get the projection coordinate to world coordinate transformation matrix.
|
|
554
|
+
|
|
555
|
+
mat4.invert(model.projectionToWorld, labelOutlineKeyMats.wcpc); // reset the clipping range since the keyMats are cached
|
|
556
|
+
|
|
557
|
+
camera.setClippingRange(cRange0, cRange1); // to re compute the matrices for the current camera and cache them
|
|
558
|
+
|
|
559
|
+
model.openGLCamera.getKeyMatrices(ren);
|
|
540
560
|
program.setUniformMatrix('PCWCMatrix', model.projectionToWorld);
|
|
541
561
|
var size = publicAPI.getRenderTargetSize();
|
|
542
562
|
program.setUniformf('vpWidth', size[0]);
|