------------------------------------------------------------------------------
| 1438 | |
| 1439 | //------------------------------------------------------------------------------ |
| 1440 | void vtkWebGPUPolyDataMapper::UpdateMeshGeometryBuffers(vtkWebGPURenderWindow* wgpuRenderWindow) |
| 1441 | { |
| 1442 | vtkLogScopeFunction(TRACE); |
| 1443 | if ((this->CachedInput != nullptr) && (this->CurrentInput != nullptr) && |
| 1444 | (this->CurrentInput != this->CachedInput)) |
| 1445 | { |
| 1446 | // invalidate any existing pipeline/bindgroups because input mesh changed. |
| 1447 | this->ReleaseGraphicsResources(wgpuRenderWindow); |
| 1448 | } |
| 1449 | if (this->CachedInput == nullptr) |
| 1450 | { |
| 1451 | vtkDebugMacro(<< "No cached input."); |
| 1452 | this->InvokeEvent(vtkCommand::StartEvent, nullptr); |
| 1453 | if (!this->Static) |
| 1454 | { |
| 1455 | this->GetInputAlgorithm()->Update(); |
| 1456 | } |
| 1457 | this->CachedInput = this->CurrentInput = this->GetInput(); |
| 1458 | this->InvokeEvent(vtkCommand::EndEvent, nullptr); |
| 1459 | } |
| 1460 | else |
| 1461 | { |
| 1462 | this->CurrentInput = this->CachedInput; |
| 1463 | } |
| 1464 | if (this->CurrentInput == nullptr) |
| 1465 | { |
| 1466 | vtkErrorMacro(<< "No input!"); |
| 1467 | // invalidate any existing pipeline/bindgroups because input mesh changed. |
| 1468 | this->ReleaseGraphicsResources(wgpuRenderWindow); |
| 1469 | return; |
| 1470 | } |
| 1471 | |
| 1472 | // if there are no points then we are done |
| 1473 | if (!this->CurrentInput->GetPoints()) |
| 1474 | { |
| 1475 | // invalidate any existing pipeline/bindgroups because input mesh changed. |
| 1476 | this->ReleaseGraphicsResources(wgpuRenderWindow); |
| 1477 | return; |
| 1478 | } |
| 1479 | |
| 1480 | // For vertex coloring, this sets this->Colors as side effect. |
| 1481 | // For texture map coloring, this sets ColorCoordinates |
| 1482 | // and ColorTextureMap as a side effect. |
| 1483 | int cellFlag = 0; |
| 1484 | this->MapScalars(this->CurrentInput, 1.0, cellFlag); |
| 1485 | if (this->ColorTextureMap) |
| 1486 | { |
| 1487 | if (this->ColorTextureHostResource == nullptr) |
| 1488 | { |
| 1489 | this->ColorTextureHostResource = vtk::TakeSmartPointer(vtkWebGPUTexture::New()); |
| 1490 | this->ColorTextureHostResource->RepeatOff(); |
| 1491 | } |
| 1492 | this->ColorTextureHostResource->SetInputData(this->ColorTextureMap); |
| 1493 | } |
| 1494 | else |
| 1495 | { |
| 1496 | this->ColorTextureHostResource = nullptr; |
| 1497 | } |
no test coverage detected