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

Method Initialize

Examples/Emscripten/Cxx/GeometryViewer/GeometryViewer.cxx:447–486  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

445
446//------------------------------------------------------------------------------
447void 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//------------------------------------------------------------------------------
489void GeometryViewer::Render()

Callers 15

mainFunction · 0.45
mainFunction · 0.45
android_mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 6

SetCanvasSelectorMethod · 0.80
AddRendererMethod · 0.45
SetInteractorMethod · 0.45
GetInteractorStyleMethod · 0.45

Tested by

no test coverage detected