Commit dfcbfe78 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri

Use the right component for updating transfer function tables

In case of dependent components, update the first table.
parent 276e272c
......@@ -1157,16 +1157,13 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateOpacityTransferFunction(
}
vtkVolumeProperty* volumeProperty = vol->GetProperty();
vtkPiecewiseFunction* scalarOpacity = 0;
if (!vol->GetProperty()->GetIndependentComponents())
{
scalarOpacity = volumeProperty->GetScalarOpacity(0);
}
else
{
scalarOpacity = volumeProperty->GetScalarOpacity(component);
}
// Transfer function component used based on whether independent / dependent
// components. If dependent, use the first scalar opacity transfer function
unsigned int dependentComponent = volumeProperty->GetIndependentComponents() ?
component : 0;
vtkPiecewiseFunction* scalarOpacity =
volumeProperty->GetScalarOpacity(dependentComponent);
if (scalarOpacity->GetSize() < 1)
{
......@@ -1184,9 +1181,7 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateOpacityTransferFunction(
scalarRange[i] = this->ScalarsRange[component][i];
}
int tableIndex = component < this->OpacityTables->GetNumberOfTables() ?
component : this->OpacityTables->GetNumberOfTables() - 1;
this->OpacityTables->GetTable(tableIndex)->Update(
this->OpacityTables->GetTable(dependentComponent)->Update(
scalarOpacity,this->Parent->BlendMode,
this->ActualSampleDistance,
scalarRange,
......@@ -1213,26 +1208,22 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::
vtkVolumeProperty* volumeProperty = vol->GetProperty();
// Transfer function component used based on whether independent / dependent
// components. If dependent, use the first gradient opacity transfer function
unsigned int dependentComponent = volumeProperty->GetIndependentComponents() ?
component : 0;
// TODO Currently we expect the all of the tables will
// be initialized once and if at that time, the gradient
// opacity was not enabled then it is not used later.
// if (!volumeProperty->HasGradientOpacity(component) ||
// !this->GradientOpacityTables)
// {
// return 1;
// }
vtkPiecewiseFunction* gradientOpacity = 0;
if (!vol->GetProperty()->GetIndependentComponents())
{
gradientOpacity = volumeProperty->GetGradientOpacity(0);
}
else
if (!volumeProperty->HasGradientOpacity(dependentComponent) ||
!this->GradientOpacityTables)
{
gradientOpacity = volumeProperty->GetGradientOpacity(component);
return 1;
}
vtkPiecewiseFunction* gradientOpacity =
volumeProperty->GetGradientOpacity(dependentComponent);
if (gradientOpacity->GetSize() < 1)
{
gradientOpacity->AddPoint(this->ScalarsRange[component][0], 0.0);
......@@ -1249,10 +1240,7 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::
scalarRange[i] = this->ScalarsRange[component][i];
}
int tableIndex =
component < this->GradientOpacityTables->GetNumberOfTables() ?
component : this->GradientOpacityTables->GetNumberOfTables() - 1;
this->GradientOpacityTables->GetTable(tableIndex)->Update(
this->GradientOpacityTables->GetTable(dependentComponent)->Update(
gradientOpacity,
this->ActualSampleDistance,
scalarRange,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment