Commit 001482dc authored by LE BRETON Come's avatar LE BRETON Come

Uses the lowest alpha of the opacity transfer function for color mapping.

parent 2c5fd73c
......@@ -84,7 +84,6 @@ dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap
d->mapper->SetScalarVisibility(true);
d->actor = vtkSmartPointer<vtkActor>::New();
d->actor->GetProperty()->SetOpacity(0.1);
d->actor->SetMapper(d->mapper);
d->actor->SetVisibility(true);
}
......@@ -271,6 +270,7 @@ void dtkVisualizationDecoratorScalarColorMap::setCanvas(dtkVisualizationCanvas *
connect(clut_editor, &dtkVisualizationWidgetsClutEditor::updated, [=] () {
this->blockSignals(true);
this->setCurrentColorTransferFunction(reinterpret_cast<vtkColorTransferFunction *>(clut_editor->colorTransferFunction()));
this->setCurrentOpacityTransferFunction(reinterpret_cast<vtkPiecewiseFunction *>(clut_editor->opacityTransferFunction()));
this->blockSignals(false);
});
}
......@@ -412,7 +412,17 @@ void dtkVisualizationDecoratorScalarColorMap::setCurrentOpacityTransferFunction(
d->opacity_functions[d->current_field_name] = opacity_function;
int size = opacity_function->GetSize();
double *val = new double[4];
double opacity_min = 1.;
for(std::size_t i = 0; i < size; ++i) {
opacity_function->GetNodeValue(i, val);
if(val[1] < opacity_min) opacity_min = val[1];
}
d->actor->GetProperty()->SetOpacity(opacity_min);
d->actor->Modified();
if (this->canvas() && this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
......
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