------------------------------------------------------------------------------
| 445 | |
| 446 | //------------------------------------------------------------------------------ |
| 447 | void GeometryViewer::Initialize() |
| 448 | { |
| 449 | std::cout << __func__ << std::endl; |
| 450 | this->P->Renderer->GradientBackgroundOn(); |
| 451 | this->P->Renderer->SetGradientMode( |
| 452 | vtkRenderer::GradientModes::VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_CORNER); |
| 453 | // initialize picker data |
| 454 | this->P->HighlighterData.Renderer = this->P->Renderer; |
| 455 | // create the default renderer |
| 456 | this->P->Window->AddRenderer(this->P->Renderer); |
| 457 | this->P->Window->SetInteractor(this->P->Interactor); |
| 458 | auto iren = vtkWebAssemblyRenderWindowInteractor::SafeDownCast(this->P->Interactor); |
| 459 | iren->SetCanvasSelector("#vtk-3d-canvas"); |
| 460 | if (auto wasmWebGPURenderWindow = vtkWebAssemblyWebGPURenderWindow::SafeDownCast(this->P->Window)) |
| 461 | { |
| 462 | wasmWebGPURenderWindow->SetCanvasSelector("#vtk-3d-canvas"); |
| 463 | } |
| 464 | if (auto wasmOpenGLRenderWindow = vtkWebAssemblyOpenGLRenderWindow::SafeDownCast(this->P->Window)) |
| 465 | { |
| 466 | wasmOpenGLRenderWindow->SetCanvasSelector("#vtk-3d-canvas"); |
| 467 | } |
| 468 | // turn on camera manipulator |
| 469 | // this->P->CameraManipulator->SetParentRenderer(this->P->Renderer); |
| 470 | // this->P->CameraManipulator->SetAnimate(false); |
| 471 | // vtkCameraOrientationRepresentation::SafeDownCast( |
| 472 | // this->P->CameraManipulator->GetRepresentation()) |
| 473 | // ->AnchorToLowerLeft(); |
| 474 | // this->P->CameraManipulator->On(); |
| 475 | // do not simulate infinite loop. |
| 476 | vtkRenderWindowInteractor::InteractorManagesTheEventLoop = false; |
| 477 | // set the current style to TrackBallCamera. Default is joystick |
| 478 | if (auto iStyle = vtkInteractorStyle::SafeDownCast(this->P->Interactor->GetInteractorStyle())) |
| 479 | { |
| 480 | if (auto switchStyle = vtkInteractorStyleSwitch::SafeDownCast(iStyle)) |
| 481 | { |
| 482 | switchStyle->SetCurrentStyleToTrackballCamera(); |
| 483 | } |
| 484 | } |
| 485 | this->SetMouseWheelMotionFactor(0.15); |
| 486 | } |
| 487 | |
| 488 | //------------------------------------------------------------------------------ |
| 489 | void GeometryViewer::Render() |
no test coverage detected