import '@kitware/vtk.js/favicon';
import '@kitware/vtk.js/Rendering/Profiles/Geometry';
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow'; import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper'; import vtkDracoReader from '@kitware/vtk.js/IO/Geometry/DracoReader'; import vtkResourceLoader from '@kitware/vtk.js/IO/Core/ResourceLoader';
const reader = vtkDracoReader.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(); }
window.module = {};
vtkResourceLoader .loadScript('https://unpkg.com/draco3d@1.3.4/draco_decoder_nodejs.js') .then(() => { vtkDracoReader.setDracoDecoder(window.CreateDracoModule);
reader .setUrl( 'https://kitware.github.io/vtk-js-datasets/data/draco/throw_14.drc' ) .then(update); });
|