Skip to content

Commit

Permalink
Merge pull request #106 from pattern-x/feature/update-demo
Browse files Browse the repository at this point in the history
Upload missed file
  • Loading branch information
pattern-x committed Jul 15, 2023
2 parents 4644d13 + 7af5304 commit ad877dc
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions public/demo/bim_3_explode.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<html>

<head>
<link rel="icon" href="./demo/favicon.ico" />
<link rel="stylesheet" type="text/css" href="./demo/global.css" />
<style>
#myCanvas {
width: 100%;
height: 100%;
}
</style>
</head>

<body>
<div id="app">
<div id="myCanvas" class="container"></div>
</div>
<script type="module">
import {
BimViewer,
ExplodePlugin,
} from "./demo/libs/gemini-viewer.esm.min.js";

const filename = "Duplex.gltf";
const modelCfg = {
modelId: filename,
name: filename,
src: `./demo/models/gltf/${filename}`,
edges: true,
};
const viewerCfg = {
containerId: "myCanvas",
language: "en",
enableToolbar: false,
}
const viewer = new BimViewer(viewerCfg);

const explodePlugin = new ExplodePlugin(viewer, { explodeUp: false });
setTimeout(() => {
let scale = 1;
let increase = true;
setInterval(() => {
explodePlugin.explode(scale);
scale += (increase ? 0.01 : -0.06);
if (scale > 3) {
increase = false;
} else if (scale < 1) {
increase = true;
}
}, 20);
}, 3000);

// draco decoder path is needed to load draco encoded models.
// gemini-viewer js sdk user maintains draco decoder code somewhere, and provides the path here.
const decoderPath = "./demo/three/js/libs/draco/gltf/";
viewer.setDracoDecoderPath(decoderPath);

viewer.loadModel(modelCfg, (event) => {
console.log(`[Demo] Loading model ${modelCfg.src}`);
}, (event) => {
console.error("[Demo] Failed to load " + modelCfg.src + ". " + event.message);
}).then(() => {
console.log(`[Demo] Loaded model ${modelCfg.src}`);
});
</script>
</body>

</html>

0 comments on commit ad877dc

Please sign in to comment.