------------------------------------------------------------------------------
| 373 | |
| 374 | //------------------------------------------------------------------------------ |
| 375 | void vtkValuePass::PopulateCellCellMap(const vtkRenderState* s) |
| 376 | { |
| 377 | int const count = s->GetPropArrayCount(); |
| 378 | for (int i = 0; i < count; ++i) |
| 379 | { |
| 380 | vtkProp* prop = s->GetPropArray()[i]; |
| 381 | vtkActor* actor = vtkActor::SafeDownCast(prop); |
| 382 | if (!actor) |
| 383 | { |
| 384 | continue; |
| 385 | } |
| 386 | vtkProperty* property = actor->GetProperty(); |
| 387 | vtkMapper* mapper = actor->GetMapper(); |
| 388 | |
| 389 | // The mapper may be a vtkCompositePolyDataMapper, in that case, we should not return. |
| 390 | // It is hard to determine if that CPDM uses OpenGL delegates. But if execution reaches |
| 391 | // here, it is very likely that OpenGL classes are used. |
| 392 | vtkOpenGLPolyDataMapper* pdm = vtkOpenGLPolyDataMapper::SafeDownCast(mapper); |
| 393 | vtkCompositePolyDataMapper* cpdm = vtkCompositePolyDataMapper::SafeDownCast(mapper); |
| 394 | if (!pdm && !cpdm) |
| 395 | { |
| 396 | continue; |
| 397 | } |
| 398 | |
| 399 | vtkMTimeType maptime = pdm->GetInputDataObject(0, 0)->GetMTime(); |
| 400 | if (this->ImplFloat->CCMapTime >= maptime) |
| 401 | { |
| 402 | // reuse |
| 403 | return; |
| 404 | } |
| 405 | this->ImplFloat->CellCellMap.clear(); |
| 406 | this->ImplFloat->CCMapTime = maptime; |
| 407 | |
| 408 | if (cpdm) |
| 409 | { |
| 410 | vtkIdType offset = 0; |
| 411 | std::vector<vtkPolyData*> pdl = cpdm->GetRenderedList(); |
| 412 | std::vector<vtkPolyData*>::iterator it; |
| 413 | for (it = pdl.begin(); it != pdl.end(); ++it) |
| 414 | { |
| 415 | vtkPolyData* poly = *it; |
| 416 | vtkCellArray* prims[4]; |
| 417 | prims[0] = poly->GetVerts(); |
| 418 | prims[1] = poly->GetLines(); |
| 419 | prims[2] = poly->GetPolys(); |
| 420 | prims[3] = poly->GetStrips(); |
| 421 | int representation = property->GetRepresentation(); |
| 422 | vtkPoints* points = poly->GetPoints(); |
| 423 | vtkNew<vtkOpenGLCellToVTKCellMap> aCellCellMap; |
| 424 | aCellCellMap->Update(prims, representation, points); |
| 425 | for (size_t c = 0; c < aCellCellMap->GetSize(); ++c) |
| 426 | { |
| 427 | this->ImplFloat->CellCellMap.push_back(aCellCellMap->GetValue(c) + offset); |
| 428 | } |
| 429 | offset += poly->GetNumberOfCells(); |
| 430 | } |
| 431 | } |
| 432 | else if (pdm) |
no test coverage detected