MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdateMaximumPointCellIds

Method UpdateMaximumPointCellIds

Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx:3355–3413  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3353
3354//------------------------------------------------------------------------------
3355void vtkOpenGLPolyDataMapper::UpdateMaximumPointCellIds(vtkRenderer* ren, vtkActor* actor)
3356{
3357 vtkHardwareSelector* selector = ren->GetSelector();
3358
3359 // our maximum point id is the is the index of the max of
3360 // 1) the maximum used value in our points array
3361 // 2) the largest used value in a provided pointIdArray
3362 // To make this quicker we use the number of points for (1)
3363 // and the max range for (2)
3364 vtkIdType maxPointId = this->CurrentInput->GetPoints()->GetNumberOfPoints() - 1;
3365 if (this->CurrentInput && this->CurrentInput->GetPointData())
3366 {
3367 vtkIdTypeArray* pointArrayId = this->PointIdArrayName
3368 ? vtkArrayDownCast<vtkIdTypeArray>(
3369 this->CurrentInput->GetPointData()->GetArray(this->PointIdArrayName))
3370 : nullptr;
3371 if (pointArrayId)
3372 {
3373 maxPointId =
3374 maxPointId < pointArrayId->GetRange()[1] ? pointArrayId->GetRange()[1] : maxPointId;
3375 }
3376 }
3377 selector->UpdateMaximumPointId(maxPointId);
3378
3379 // the maximum number of cells in a draw call is the max of
3380 // 1) the sum of IBO size divided by the stride
3381 // 2) the max of any used call in a cellIdArray
3382 vtkIdType maxCellId = 0;
3383 int representation = actor->GetProperty()->GetRepresentation();
3384 for (int i = vtkOpenGLPolyDataMapper::PrimitiveStart;
3385 i < vtkOpenGLPolyDataMapper::PrimitiveVertices; i++)
3386 {
3387 if (this->Primitives[i].IBO->IndexCount)
3388 {
3389 GLenum mode = this->GetOpenGLMode(representation, i);
3390 if (this->PointPicking)
3391 {
3392 mode = GL_POINTS;
3393 }
3394 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
3395 unsigned int stride = (mode == GL_POINTS ? 1 : (mode == GL_LINES ? 2 : 3));
3396 vtkIdType strideMax = static_cast<vtkIdType>(this->Primitives[i].IBO->IndexCount / stride);
3397 maxCellId += strideMax;
3398 }
3399 }
3400
3401 if (this->CurrentInput && this->CurrentInput->GetCellData())
3402 {
3403 vtkIdTypeArray* cellArrayId = this->CellIdArrayName
3404 ? vtkArrayDownCast<vtkIdTypeArray>(
3405 this->CurrentInput->GetCellData()->GetArray(this->CellIdArrayName))
3406 : nullptr;
3407 if (cellArrayId)
3408 {
3409 maxCellId = maxCellId < cellArrayId->GetRange()[1] ? cellArrayId->GetRange()[1] : maxCellId;
3410 }
3411 }
3412 selector->UpdateMaximumCellId(maxCellId);

Callers 3

RenderPieceStartMethod · 0.95
RenderPieceMethod · 0.45
RenderPieceMethod · 0.45

Calls 12

GetOpenGLModeMethod · 0.95
UpdateMaximumPointIdMethod · 0.80
GetRepresentationMethod · 0.80
UpdateMaximumCellIdMethod · 0.80
GetSelectorMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetPointsMethod · 0.45
GetPointDataMethod · 0.45
GetArrayMethod · 0.45
GetRangeMethod · 0.45
GetPropertyMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected