Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## From 32.x to 33

- **vtkMapper**: many properties have moved to `vtkVolumeProperty`. The full list of changed methods is: `getAnisotropy`, `getComputeNormalFromOpacity`, `getFilterMode`, `getFilterModeAsString`, `getGlobalIlluminationReach`, `getIpScalarRange`, `getIpScalarRangeByReference`, `getLAOKernelRadius`, `getLAOKernelSize`, `getLocalAmbientOcclusion`, `getPreferSizeOverAccuracy`, `getVolumetricScatteringBlending`, `setAnisotropy`, `setAverageIPScalarRange`, `setComputeNormalFromOpacity`, `setFilterMode`, `setFilterModeToNormalized`, `setFilterModeToOff`, `setFilterModeToRaw`, `setGlobalIlluminationReach`, `setIpScalarRange`, `setIpScalarRangeFrom`, `setLAOKernelRadius`, `setLAOKernelSize`, `setLocalAmbientOcclusion`, `setPreferSizeOverAccuracy`, `setVolumetricScatteringBlending`.
- **vtkOpenGLTexture**: The public `create2D*` and `create3D*` methods used to have positional parameters. These methods now use named parameters via passing in an object record.

## From 31.x to 32

- **vtkMapper**: remove `mapScalarsToTexture` from the public API. The function becomes protected and its API changes. This shouldn't cause any issue in most cases.
Expand Down
14 changes: 7 additions & 7 deletions Sources/Rendering/OpenGL/Framebuffer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ function vtkFramebuffer(publicAPI, model) {
texture.setOpenGLRenderWindow(model._openGLRenderWindow);
texture.setMinificationFilter(Filter.LINEAR);
texture.setMagnificationFilter(Filter.LINEAR);
texture.create2DFromRaw(
model.glFramebuffer.width,
model.glFramebuffer.height,
4,
VtkDataTypes.UNSIGNED_CHAR,
null
);
texture.create2DFromRaw({
width: model.glFramebuffer.width,
height: model.glFramebuffer.height,
numComps: 4,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: null,
});
publicAPI.setColorBuffer(texture);

// for now do not count on having a depth buffer texture
Expand Down
85 changes: 42 additions & 43 deletions Sources/Rendering/OpenGL/ImageCPRMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
model.context.getExtension('EXT_texture_norm16')
);
model.volumeTexture.resetFormatAndType();
model.volumeTexture.create3DFilterableFromDataArray(
dims[0],
dims[1],
dims[2],
scalars,
model.renderable.getPreferSizeOverAccuracy()
);
model.volumeTexture.create3DFilterableFromDataArray({
width: dims[0],
height: dims[1],
depth: dims[2],
dataArray: scalars,
preferSizeOverAccuracy: model.renderable.getPreferSizeOverAccuracy(),
});
model._openGLRenderWindow.setGraphicsResourceForObject(
scalars,
model.volumeTexture,
Expand All @@ -246,14 +246,13 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
property.setUpdatedExtents([]);

const dims = image.getDimensions();
model.volumeTexture.create3DFilterableFromDataArray(
dims[0],
dims[1],
dims[2],
scalars,
false,
updatedExtents
);
model.volumeTexture.create3DFilterableFromDataArray({
width: dims[0],
height: dims[1],
depth: dims[2],
dataArray: scalars,
updatedExtents,
});
}

// Rebuild the color texture if needed
Expand Down Expand Up @@ -309,27 +308,27 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
}
}
model.colorTexture.resetFormatAndType();
model.colorTexture.create2DFromRaw(
cWidth,
textureHeight,
3,
VtkDataTypes.UNSIGNED_CHAR,
cTable
);
model.colorTexture.create2DFromRaw({
width: cWidth,
height: textureHeight,
numComps: 3,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: cTable,
});
} else {
for (let i = 0; i < cWidth * 3; ++i) {
cTable[i] = (255.0 * i) / ((cWidth - 1) * 3);
cTable[i + 1] = (255.0 * i) / ((cWidth - 1) * 3);
cTable[i + 2] = (255.0 * i) / ((cWidth - 1) * 3);
}
model.colorTexture.resetFormatAndType();
model.colorTexture.create2DFromRaw(
cWidth,
1,
3,
VtkDataTypes.UNSIGNED_CHAR,
cTable
);
model.colorTexture.create2DFromRaw({
width: cWidth,
height: 1,
numComps: 3,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: cTable,
});
}

if (firstColorTransferFunc) {
Expand Down Expand Up @@ -407,24 +406,24 @@ function vtkOpenGLImageCPRMapper(publicAPI, model) {
}
}
model.pwfTexture.resetFormatAndType();
model.pwfTexture.create2DFromRaw(
pwfWidth,
textureHeight,
1,
VtkDataTypes.FLOAT,
pwfFloatTable
);
model.pwfTexture.create2DFromRaw({
width: pwfWidth,
height: textureHeight,
numComps: 1,
dataType: VtkDataTypes.FLOAT,
data: pwfFloatTable,
});
} else {
// default is opaque
pwfTable.fill(255.0);
model.pwfTexture.resetFormatAndType();
model.pwfTexture.create2DFromRaw(
pwfWidth,
1,
1,
VtkDataTypes.UNSIGNED_CHAR,
pwfTable
);
model.pwfTexture.create2DFromRaw({
width: pwfWidth,
height: 1,
numComps: 1,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: pwfTable,
});
}
if (firstPwFunc) {
model._openGLRenderWindow.setGraphicsResourceForObject(
Expand Down
89 changes: 45 additions & 44 deletions Sources/Rendering/OpenGL/ImageMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,26 +1001,26 @@ function vtkOpenGLImageMapper(publicAPI, model) {
}
}
model.colorTexture.resetFormatAndType();
model.colorTexture.create2DFromRaw(
cWidth,
textureHeight,
3,
VtkDataTypes.UNSIGNED_CHAR,
cTable
);
model.colorTexture.create2DFromRaw({
width: cWidth,
height: textureHeight,
numComps: 3,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: cTable,
});
} else {
for (let i = 0; i < cWidth * 3; ++i) {
cTable[i] = (255.0 * i) / ((cWidth - 1) * 3);
cTable[i + 1] = (255.0 * i) / ((cWidth - 1) * 3);
cTable[i + 2] = (255.0 * i) / ((cWidth - 1) * 3);
}
model.colorTexture.create2DFromRaw(
cWidth,
1,
3,
VtkDataTypes.UNSIGNED_CHAR,
cTable
);
model.colorTexture.create2DFromRaw({
width: cWidth,
height: 1,
numComps: 3,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: cTable,
});
}

if (firstColorTransferFunc) {
Expand Down Expand Up @@ -1109,23 +1109,23 @@ function vtkOpenGLImageMapper(publicAPI, model) {
}
}
model.pwfTexture.resetFormatAndType();
model.pwfTexture.create2DFromRaw(
pwfWidth,
textureHeight,
1,
VtkDataTypes.FLOAT,
pwfFloatTable
);
model.pwfTexture.create2DFromRaw({
width: pwfWidth,
height: textureHeight,
numComps: 1,
dataType: VtkDataTypes.FLOAT,
data: pwfFloatTable,
});
} else {
// default is opaque
pwfTable.fill(255.0);
model.pwfTexture.create2DFromRaw(
pwfWidth,
1,
1,
VtkDataTypes.UNSIGNED_CHAR,
pwfTable
);
model.pwfTexture.create2DFromRaw({
width: pwfWidth,
height: 1,
numComps: 1,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: pwfTable,
});
}

if (firstPwFunc) {
Expand Down Expand Up @@ -1344,15 +1344,16 @@ function vtkOpenGLImageMapper(publicAPI, model) {
// Don't share this resource as `scalars` is created in this function
// so it is impossible to share
model.openGLTexture.resetFormatAndType();
model.openGLTexture.create2DFilterableFromRaw(
dims[0],
dims[1],
numComp,
imgScalars.getDataType(),
scalars,
model.renderable.getPreferSizeOverAccuracy?.(),
ranges
);
model.openGLTexture.create2DFilterableFromRaw({
width: dims[0],
height: dims[1],
numComps: numComp,
dataType: imgScalars.getDataType(),
data: scalars,
preferSizeOverAccuracy:
!!model.renderable.getPreferSizeOverAccuracy?.(),
ranges,
});
model.openGLTexture.activate();
model.openGLTexture.sendParameters();
model.openGLTexture.deactivate();
Expand Down Expand Up @@ -1439,13 +1440,13 @@ function vtkOpenGLImageMapper(publicAPI, model) {
model.labelOutlineThicknessTexture.setMagnificationFilter(Filter.NEAREST);

// Create a 2D texture (acting as 1D) from the raw data
model.labelOutlineThicknessTexture.create2DFromRaw(
lWidth,
lHeight,
1,
VtkDataTypes.UNSIGNED_CHAR,
lTable
);
model.labelOutlineThicknessTexture.create2DFromRaw({
width: lWidth,
height: lHeight,
numComps: 1,
dataType: VtkDataTypes.UNSIGNED_CHAR,
data: lTable,
});

if (labelOutlineThicknessArray) {
model._openGLRenderWindow.setGraphicsResourceForObject(
Expand Down
Loading