File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed
Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ < html >
2+
3+ < head >
4+ < link rel ="icon " href ="./demo/favicon.ico " />
5+ < link rel ="stylesheet " type ="text/css " href ="./demo/global.css " />
6+ < style >
7+ # myCanvas {
8+ width : 100% ;
9+ height : 100% ;
10+ }
11+ </ style >
12+ </ head >
13+
14+ < body >
15+ < div id ="app ">
16+ < div id ="myCanvas " class ="container "> </ div >
17+ </ div >
18+ < script type ="module ">
19+ import {
20+ BimViewer ,
21+ ExplodePlugin ,
22+ } from "./demo/libs/gemini-viewer.esm.min.js" ;
23+
24+ const filename = "Duplex.gltf" ;
25+ const modelCfg = {
26+ modelId : filename ,
27+ name : filename ,
28+ src : `./demo/models/gltf/${ filename } ` ,
29+ edges : true ,
30+ } ;
31+ const viewerCfg = {
32+ containerId : "myCanvas" ,
33+ language : "en" ,
34+ enableToolbar : false ,
35+ }
36+ const viewer = new BimViewer ( viewerCfg ) ;
37+
38+ const explodePlugin = new ExplodePlugin ( viewer , { explodeUp : false } ) ;
39+ setTimeout ( ( ) => {
40+ let scale = 1 ;
41+ let increase = true ;
42+ setInterval ( ( ) => {
43+ explodePlugin . explode ( scale ) ;
44+ scale += ( increase ? 0.01 : - 0.06 ) ;
45+ if ( scale > 3 ) {
46+ increase = false ;
47+ } else if ( scale < 1 ) {
48+ increase = true ;
49+ }
50+ } , 20 ) ;
51+ } , 3000 ) ;
52+
53+ // draco decoder path is needed to load draco encoded models.
54+ // gemini-viewer js sdk user maintains draco decoder code somewhere, and provides the path here.
55+ const decoderPath = "./demo/three/js/libs/draco/gltf/" ;
56+ viewer . setDracoDecoderPath ( decoderPath ) ;
57+
58+ viewer . loadModel ( modelCfg , ( event ) => {
59+ console . log ( `[Demo] Loading model ${ modelCfg . src } ` ) ;
60+ } , ( event ) => {
61+ console . error ( "[Demo] Failed to load " + modelCfg . src + ". " + event . message ) ;
62+ } ) . then ( ( ) => {
63+ console . log ( `[Demo] Loaded model ${ modelCfg . src } ` ) ;
64+ } ) ;
65+ </ script >
66+ </ body >
67+
68+ </ html >
You can’t perform that action at this time.
0 commit comments