HTLM2

import 'vtk.js/Sources/favicon'; import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor'; import vtkFullScreenRenderWindow from 'vtk.js/Sources/Rendering/Misc/FullScreenRenderWindow'; import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper'; import vtkSTLReader from 'vtk.js/Sources/IO/Geometry/STLReader'; // ---------------------------------------------------------------------------- // Example code // ---------------------------------------------------------------------------- const reader = vtkSTLReader.newInstance(); const mapper = vtkMapper.newInstance({ scalarVisibility: false }); const actor = vtkActor.newInstance(); actor.setMapper(mapper); mapper.setInputConnection(reader.getOutputPort()); // ---------------------------------------------------------------------------- function update() { const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance(); const renderer = fullScreenRenderer.getRenderer(); const renderWindow = fullScreenRenderer.getRenderWindow(); const resetCamera = renderer.resetCamera; const render = renderWindow.render; renderer.addActor(actor); resetCamera(); render(); }
https://kitware.github.io/vtk-js/examples/STLReader/index.html