import '@kitware/vtk.js/favicon';
import '@kitware/vtk.js/Rendering/Profiles/Geometry';
import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow'; import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; import vtkTriangleFilter from '@kitware/vtk.js/Filters/General/TriangleFilter'; import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper';
import vtk2DShape from '@kitware/vtk.js/Filters/Sources/Arrow2DSource/';
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ background: [0, 0, 0], }); const renderer = fullScreenRenderer.getRenderer(); const renderWindow = fullScreenRenderer.getRenderWindow();
const initialValues = { shape: 'star' }; const shapeSource = vtk2DShape.newInstance(initialValues); const triangleFilter = vtkTriangleFilter.newInstance(); const mapper = vtkMapper.newInstance(); const actor = vtkActor.newInstance();
triangleFilter.setInputConnection(shapeSource.getOutputPort()); mapper.setInputConnection(triangleFilter.getOutputPort()); actor.setMapper(mapper);
renderer.addActor(actor); renderer.resetCamera(); renderWindow.render();
|