3D model viewer
This package is UI agnostic which means that you need to build it yourself. Viewer provides various properties and events to build own reactive viewer interface
use npm i m3dv
to install this package
You can simply create Viewer
object
const canvas = document.getElementById("canvas") as HTMLCanvasElement;
const viewer = new Viewer(canvas);
To load model file use LoadModelFile()
method of Viewer
object
viewer.LoadModelFile("fileNameWithExtension.gltf", "UrlToFile");
In order to load CAD models you can specify wasm path to occt-import-js
const occtImportJsWasmPath = new URL("pathToWasm/occt-import-js.wasm", import.meta.url).href;
const viewer = new Viewer(canvas, { occtImportJsWasmPath: occtImportJsWasmPath });
see example folder to see basic usage of viewer