@kitware/vtk.js 32.1.0 → 32.1.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/Rendering/OpenGL/Texture.js +10 -7
- package/package.json +1 -1
|
@@ -295,7 +295,7 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
295
295
|
}
|
|
296
296
|
return result;
|
|
297
297
|
};
|
|
298
|
-
publicAPI.useHalfFloat = () => model.
|
|
298
|
+
publicAPI.useHalfFloat = () => model.enableUseHalfFloat && model.canUseHalfFloat;
|
|
299
299
|
|
|
300
300
|
//----------------------------------------------------------------------------
|
|
301
301
|
publicAPI.setInternalFormat = iFormat => {
|
|
@@ -929,18 +929,21 @@ function vtkOpenGLTexture(publicAPI, model) {
|
|
|
929
929
|
}
|
|
930
930
|
function setCanUseHalfFloat(dataType, offset, scale, preferSizeOverAccuracy) {
|
|
931
931
|
publicAPI.getOpenGLDataType(dataType);
|
|
932
|
+
|
|
933
|
+
// Don't consider halfFloat and convert back to Float when the range of data does not generate an accurate halfFloat
|
|
934
|
+
// AND it is not preferable to have a smaller texture than an exact texture.
|
|
935
|
+
const isExactHalfFloat = hasExactHalfFloat(offset, scale) || preferSizeOverAccuracy;
|
|
932
936
|
let useHalfFloat = false;
|
|
933
937
|
if (model._openGLRenderWindow.getWebgl2()) {
|
|
934
|
-
|
|
938
|
+
// If OES_texture_float_linear is not available, and using a half float would still be exact, force half floats
|
|
939
|
+
// This is because half floats are always texture filterable in webgl2, while full *32F floats are not (unless the extension is present)
|
|
940
|
+
const forceHalfFloat = model.openGLDataType === model.context.FLOAT && model.context.getExtension('OES_texture_float_linear') === null && isExactHalfFloat;
|
|
941
|
+
useHalfFloat = forceHalfFloat || model.openGLDataType === model.context.HALF_FLOAT;
|
|
935
942
|
} else {
|
|
936
943
|
const halfFloatExt = model.context.getExtension('OES_texture_half_float');
|
|
937
944
|
useHalfFloat = halfFloatExt && model.openGLDataType === halfFloatExt.HALF_FLOAT_OES;
|
|
938
945
|
}
|
|
939
|
-
|
|
940
|
-
// Don't consider halfFloat and convert back to Float when the range of data does not generate an accurate halfFloat
|
|
941
|
-
// AND it is not preferable to have a smaller texture than an exact texture.
|
|
942
|
-
const isHalfFloat = useHalfFloat && (hasExactHalfFloat(offset, scale) || preferSizeOverAccuracy);
|
|
943
|
-
model.canUseHalfFloat = isHalfFloat;
|
|
946
|
+
model.canUseHalfFloat = useHalfFloat && isExactHalfFloat;
|
|
944
947
|
}
|
|
945
948
|
function processDataArray(dataArray, preferSizeOverAccuracy) {
|
|
946
949
|
const numComps = dataArray.getNumberOfComponents();
|