Skip to content

Commit

Permalink
refactor(VolumeMapper): change useIndependentComponents arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
bruyeret authored and finetjul committed Mar 20, 2024
1 parent 7317248 commit 75a3019
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/Rendering/OpenGL/VolumeMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
shaders.Geometry = '';
};

publicAPI.useIndependentComponents = (actor) => {
const iComps = actor.getProperty().getIndependentComponents();
publicAPI.useIndependentComponents = (actorProperty) => {
const iComps = actorProperty.getIndependentComponents();
const image = model.currentInput;
const numComp = image
?.getPointData()
?.getScalars()
?.getNumberOfComponents();
const colorMixPreset = actor.getProperty().getColorMixPreset();
const colorMixPreset = actorProperty.getColorMixPreset();
return (iComps && numComp >= 2) || !!colorMixPreset;
};

Expand Down Expand Up @@ -219,7 +219,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
`#define vtkNumComponents ${numComp}`
).result;

const useIndependentComps = publicAPI.useIndependentComponents(actor);
const useIndependentComps = publicAPI.useIndependentComponents(actorProps);
if (useIndependentComps) {
FSSource = vtkShaderProgram.substitute(
FSSource,
Expand Down Expand Up @@ -1054,7 +1054,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {

// set the component mix when independent
const numComp = model.scalarTexture.getComponents();
const useIndependentComps = publicAPI.useIndependentComponents(actor);
const useIndependentComps = publicAPI.useIndependentComponents(vprop);
if (useIndependentComps) {
for (let i = 0; i < numComp; i++) {
program.setUniformf(
Expand Down Expand Up @@ -1519,7 +1519,7 @@ function vtkOpenGLVolumeMapper(publicAPI, model) {
}

const numComp = scalars.getNumberOfComponents();
const useIndependentComps = publicAPI.useIndependentComponents(actor);
const useIndependentComps = publicAPI.useIndependentComponents(vprop);
const numIComps = useIndependentComps ? numComp : 1;

const scalarOpacityFunc = vprop.getScalarOpacity();
Expand Down

0 comments on commit 75a3019

Please sign in to comment.