Commit ab36828e authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot
Browse files

Merge topic 'fix_point_picking_cell_scalars' into paraview/release

4d5c903c

 Fix point picking used with cell scalars
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !4655
parents 2c934295 4d5c903c
......@@ -597,7 +597,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderRenderPass(
//------------------------------------------------------------------------------
void vtkOpenGLPolyDataMapper::ReplaceShaderColor(
std::map<vtkShader::Type, vtkShader *> shaders,
vtkRenderer *, vtkActor *actor)
vtkRenderer *ren, vtkActor *actor)
{
std::string VSSource = shaders[vtkShader::Vertex]->GetSource();
std::string GSSource = shaders[vtkShader::Geometry]->GetSource();
......@@ -625,6 +625,19 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderColor(
" float specularPower = specularPowerUniform;\n";
}
// for point picking we render primitives as points
// that means cell scalars will not have correct
// primitiveIds to lookup into the texture map
// so we must skip cell scalar coloring when point picking
// The boolean will be used in an else clause below
vtkHardwareSelector* selector = ren->GetSelector();
bool pointPicking = false;
if (selector &&
selector->GetFieldAssociation() == vtkDataObject::FIELD_ASSOCIATION_POINTS)
{
pointPicking = true;
}
// handle color point attributes
if (this->VBOs->GetNumberOfComponents("scalarColor") != 0 &&
!this->DrawingEdgesOrVertices)
......@@ -660,7 +673,7 @@ void vtkOpenGLPolyDataMapper::ReplaceShaderColor(
" float opacity = opacityUniform * texColor.a;";
}
// are we doing cell scalar coloring by texture?
else if (this->HaveCellScalars && !this->DrawingEdgesOrVertices)
else if (this->HaveCellScalars && !this->DrawingEdgesOrVertices && !pointPicking)
{
colorImpl +=
" vec4 texColor = texelFetchBuffer(textureC, gl_PrimitiveID + PrimitiveIDOffset);\n"
......
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