@inweb/viewer-three
Version:
JavaScript library for rendering CAD and BIM files in a browser using Three.js
2 lines (1 loc) • 2.64 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,(function(e,t){"use strict";class s extends e.Scene{constructor(){super();const t=new e.BoxGeometry;t.deleteAttribute("uv");const s=new e.MeshStandardMaterial({side:e.BackSide}),n=new e.MeshStandardMaterial,o=new e.PointLight(16777215,900,28,2);o.position.set(.418,16.199,.3),this.add(o);const a=new e.Mesh(t,s);a.position.set(-.757,13.219,.717),a.scale.set(31.713,28.305,28.591),this.add(a);const r=new e.InstancedMesh(t,n,6),d=new e.Object3D;d.position.set(-10.906,2.009,1.846),d.rotation.set(0,-.195,0),d.scale.set(2.328,7.905,4.651),d.updateMatrix(),r.setMatrixAt(0,d.matrix),d.position.set(-5.607,-.754,-.758),d.rotation.set(0,.994,0),d.scale.set(1.97,1.534,3.955),d.updateMatrix(),r.setMatrixAt(1,d.matrix),d.position.set(6.167,.857,7.803),d.rotation.set(0,.561,0),d.scale.set(3.927,6.285,3.687),d.updateMatrix(),r.setMatrixAt(2,d.matrix),d.position.set(-2.017,.018,6.124),d.rotation.set(0,.333,0),d.scale.set(2.002,4.566,2.064),d.updateMatrix(),r.setMatrixAt(3,d.matrix),d.position.set(2.291,-.756,-2.621),d.rotation.set(0,-.286,0),d.scale.set(1.546,1.552,1.496),d.updateMatrix(),r.setMatrixAt(4,d.matrix),d.position.set(-2.193,-.369,-5.547),d.rotation.set(0,.516,0),d.scale.set(3.875,3.487,2.986),d.updateMatrix(),r.setMatrixAt(5,d.matrix),this.add(r);const c=new e.Mesh(t,i(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);const h=new e.Mesh(t,i(50));h.position.set(-16.109,18.021,-8.207),h.scale.set(.1,2.425,2.751),this.add(h);const p=new e.Mesh(t,i(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const M=new e.Mesh(t,i(43));M.position.set(-.462,8.89,14.52),M.scale.set(4.38,5.441,.088),this.add(M);const l=new e.Mesh(t,i(20));l.position.set(3.235,11.486,-12.541),l.scale.set(2.5,2,.1),this.add(l);const w=new e.Mesh(t,i(100));w.position.set(0,20,0),w.scale.set(1,.1,1),this.add(w)}dispose(){const e=new Set;this.traverse((t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))}));for(const t of e)t.dispose()}}function i(t){return new e.MeshLambertMaterial({color:0,emissive:16777215,emissiveIntensity:t})}class n{constructor(t){this.viewer=t;const i=new s,n=new e.PMREMGenerator(this.viewer.renderer);this.viewer.scene.environment=n.fromScene(i).texture,i.dispose()}dispose(){this.viewer.scene.environment=void 0}}t.components.registerComponent("LightComponent",(e=>new n(e)))}));