Commit e34a0e50 authored by Nicolas Vuaille's avatar Nicolas Vuaille

Fix point picking

  * In point picking, offset should be the number of points
parent a73e2533
......@@ -219,6 +219,26 @@ int TestCompositePolyDataMapper2Picking(int argc, char* argv[])
plane->SetCenter(block*0.25, 0.5, parent*0.5);
elev->SetLowPoint(block*0.25 - 0.2 + 0.2*block/nblocks, -0.02, 0.0);
elev->SetHighPoint(block*0.25 + 0.1 + 0.2*block/nblocks, 0.02, 0.0);
elev->Update();
vtkPolyData* poly = vtkPolyData::SafeDownCast(elev->GetOutput(0));
vtkNew<vtkCellArray> lines;
lines->InsertNextCell(2);
lines->InsertCellPoint(16);
lines->InsertCellPoint(17);
lines->InsertNextCell(2);
lines->InsertCellPoint(18);
lines->InsertCellPoint(19);
poly->SetLines(lines);
vtkNew<vtkCellArray> strips;
strips->InsertNextCell(5);
strips->InsertCellPoint(20);
strips->InsertCellPoint(21);
strips->InsertCellPoint(22);
strips->InsertCellPoint(23);
strips->InsertCellPoint(24);
poly->SetStrips(strips);
p2c->Update();
child->DeepCopy(p2c->GetOutput(0));
}
......
......@@ -762,19 +762,32 @@ void vtkCompositeMapperHelper2::AppendOneBufferObject(
hdata->PrimOffsets[1] = hdata->PrimOffsets[0] +
prims[0]->GetNumberOfConnectivityEntries() -
prims[0]->GetNumberOfCells();
hdata->PrimOffsets[2] = hdata->PrimOffsets[1] +
prims[1]->GetNumberOfConnectivityEntries() -
2*prims[1]->GetNumberOfCells();
this->AppendCellTextures(ren, act, prims, representation,
newColors, newNorms, poly);
hdata->PrimOffsets[4] = (!newColors.empty() ? newColors.size()/4 : newNorms.size()/4);
if (pointPicking)
{
for (int i = 1; i < 4; i++)
{
hdata->PrimOffsets[i+1] = hdata->PrimOffsets[i] +
prims[i]->GetNumberOfConnectivityEntries() -
prims[i]->GetNumberOfCells();
}
}
else
{
hdata->PrimOffsets[2] = hdata->PrimOffsets[1] +
prims[1]->GetNumberOfConnectivityEntries() -
2*prims[1]->GetNumberOfCells();
// we back compute the strip number
size_t triCount = prims[3]->GetNumberOfConnectivityEntries()
- 3*prims[3]->GetNumberOfCells();
hdata->PrimOffsets[3] = hdata->PrimOffsets[4] - triCount;
hdata->PrimOffsets[4] = (!newColors.empty() ? newColors.size()/4 : newNorms.size()/4);
// we back compute the strip number
size_t triCount = prims[3]->GetNumberOfConnectivityEntries()
- 3*prims[3]->GetNumberOfCells();
hdata->PrimOffsets[3] = hdata->PrimOffsets[4] - triCount;
}
// on Apple Macs with the AMD PrimID bug <rdar://20747550>
// we use a slow painful approach to work around it (pre 10.11).
......
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