Commit cc68987d authored by Mathieu Westphal's avatar Mathieu Westphal
Browse files

Scale and Opacity table fix for point gaussian representation

ScaleTable and OpacityTable were not always correctly computed
because of timestamp mismanagement. It is now fixed and keep
track of timestamp for the table idependantly.
parent c6eb8803
......@@ -832,38 +832,42 @@ void vtkOpenGLPointGaussianMapper::Render(
return;
}
// the first step is to update the helpers if needed
if (this->HelperUpdateTime < this->GetInputDataObject(0, 0)->GetMTime() ||
this->HelperUpdateTime < this->GetInputAlgorithm()->GetMTime() ||
this->HelperUpdateTime < this->GetMTime())
// update tables
if (this->GetScaleFunction() && this->GetScaleArray())
{
// update tables
if (this->GetScaleFunction() && this->GetScaleArray() != nullptr)
if (this->ScaleTableUpdateTime < this->GetScaleFunction()->GetMTime() ||
this->ScaleTableUpdateTime < this->GetMTime())
{
this->BuildScaleTable();
this->ScaleTableUpdateTime.Modified();
}
else
{
if (this->ScaleTable)
{
delete [] this->ScaleTable;
this->ScaleTable = nullptr;
}
}
}
else
{
delete [] this->ScaleTable;
this->ScaleTable = nullptr;
}
if (this->GetScalarOpacityFunction() && this->GetOpacityArray() != nullptr)
if (this->GetScalarOpacityFunction() && this->GetOpacityArray())
{
if (this->OpacityTableUpdateTime < this->GetScalarOpacityFunction()->GetMTime() ||
this->OpacityTableUpdateTime < this->GetMTime())
{
this->BuildOpacityTable();
this->OpacityTableUpdateTime.Modified();
}
else
{
if (this->OpacityTable)
{
delete [] this->OpacityTable;
this->OpacityTable = nullptr;
}
}
}
else
{
delete [] this->OpacityTable;
this->OpacityTable = nullptr;
}
// the first step is to update the helpers if needed
if (this->HelperUpdateTime < this->GetInputDataObject(0, 0)->GetMTime() ||
this->HelperUpdateTime < this->GetInputAlgorithm()->GetMTime() ||
this->HelperUpdateTime < this->GetMTime())
{
// clear old helpers
for (auto hiter = this->Helpers.begin(); hiter != this->Helpers.end(); ++hiter)
{
......@@ -1043,6 +1047,7 @@ void vtkOpenGLPointGaussianMapper::BuildScaleTable()
this->ScaleScale = (tableSize - 1.0)/(range[1] - range[0]);
this->ScaleOffset = range[0];
}
this->Modified();
}
//-------------------------------------------------------------------------
......@@ -1066,7 +1071,7 @@ void vtkOpenGLPointGaussianMapper::BuildOpacityTable()
this->OpacityScale = (tableSize - 1.0)/(range[1] - range[0]);
this->OpacityOffset = range[0];
}
this->Modified();
}
//----------------------------------------------------------------------------
......
......@@ -72,6 +72,8 @@ protected:
vtkOpenGLPointGaussianMapperHelper *helper);
vtkTimeStamp HelperUpdateTime;
vtkTimeStamp ScaleTableUpdateTime;
vtkTimeStamp OpacityTableUpdateTime;
// unused
void RenderPiece(vtkRenderer *, vtkActor *) override {};
......
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