← Commit history

Add a standalone 1.4.0 assembly viewer

John Lauer ·fe636c69f6 · ·parent 3260037
1 file changed +44
3d/release-1.4.0/viewer.htmladded+44
@@ -0,0 +1,44 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width,initial-scale=1">+<title>Main board 1.4.0 · 3D assembly</title>+<style>+html,body,main { margin:0; height:100%; background:#111820; color:#eff3f6; font-family:system-ui,sans-serif }+#message { position:absolute; left:1rem; top:1rem; margin:0; pointer-events:none }+</style>+</head>+<body>+<main id="assembly" aria-label="Interactive 3D assembly of the 110 × 104 mm main board"></main>+<p id="message" role="status">Loading main board…</p>+<script>window.global = window.global || window;</script>+<script type="module">+const message = document.getElementById("message");+const assets = "https://wiki.adom.inc/static/vendor/adom-3d-viewer-babylon9/";+try {+  await import(assets + "adom-3d-viewer-babylon9.esm.js");+  const engine = await window.Adom3DViewerBabylon9.loadBabylon();+  if (engine?.DracoCompression) {+    engine.DracoCompression.Configuration = {decoder: {+      wasmUrl: assets + "draco/draco_wasm_wrapper_gltf.js",+      wasmBinaryUrl: assets + "draco/draco_decoder_gltf.wasm",+      fallbackUrl: assets + "draco/draco_decoder_gltf.js"+    }};+  }+  const viewer = window.Adom3DViewerBabylon9.init(document.getElementById("assembly"), {zUp:true});+  await viewer.whenReady();+  await viewer.loadModel("https://wiki.adom.inc/api/pages/john/self-mixing-interferometer/files/3d/release-1.4.0/self-mixing-interferometer.glb?v=1987ffc2");+  const scene = viewer.getScene();+  if (!scene) throw new Error("The main board scene could not be found");+  if (viewer.goHome) viewer.goHome(); else viewer.frameModel();+  await scene.whenReadyAsync();+  scene.render();+  message.hidden = true;+  document.documentElement.dataset.modelLoaded = "true";+} catch (error) {+  message.textContent = "Could not load the main board. " + error.message;+}+</script>+</body>+</html>