Files
gemini-viewer-examples/public/demo/bim_0.html

63 lines
1.8 KiB
HTML
Raw Normal View History

2022-11-04 11:39:56 +08:00
<html>
<head>
<link rel="icon" href="./demo/favicon.ico">
<link rel="stylesheet" type="text/css" href="./demo/global.css">
2023-05-15 19:30:47 +08:00
<style>
2022-11-04 11:39:56 +08:00
#myCanvas {
2023-05-15 19:30:47 +08:00
width: 100%;
height: 100%;
2022-11-04 11:39:56 +08:00
}
2023-05-15 19:30:47 +08:00
</style>
2022-11-04 11:39:56 +08:00
</head>
<body>
<div id="app">
<div id="myCanvas" class="container"></div>
2022-11-04 11:39:56 +08:00
</div>
<script type="module">
2023-07-15 00:28:57 +08:00
import {
AxisGizmoPlugin,
BimViewer,
MeasurementPlugin,
NavCubePlugin,
SectionPlugin,
ToolbarMenuId,
} from "./demo/libs/gemini-viewer.esm.min.js";
2022-11-04 11:39:56 +08:00
2023-07-15 11:25:33 +08:00
const filename = "rac_basic_sample_project.gltf";
const modelCfg = {
modelId: filename,
name: filename,
src: `./demo/models/gltf/${filename}`,
edges: true,
};
const viewerCfg = {
2022-11-04 11:39:56 +08:00
containerId: "myCanvas",
2023-07-15 11:25:33 +08:00
language: "en",
}
const viewer = new BimViewer(viewerCfg);
2022-11-04 11:39:56 +08:00
const toolbar = viewer.toolbar;
toolbar.updateMenu(ToolbarMenuId.BimTree, { visible: false });
2023-07-15 00:28:57 +08:00
new AxisGizmoPlugin(viewer);
new MeasurementPlugin(viewer);
new NavCubePlugin(viewer);
new SectionPlugin(viewer);
2023-04-10 17:23:36 +08:00
// 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.
2023-06-16 12:09:03 +08:00
const decoderPath = "./demo/three/js/libs/draco/gltf/";
2023-04-10 17:23:36 +08:00
viewer.setDracoDecoderPath(decoderPath);
2023-07-15 11:25:33 +08:00
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}`);
2022-11-04 11:39:56 +08:00
});
</script>
</body>
</html>