import * as THREE from 'three' import PanoramaCollection from './PanoramaCollection.js' import FloorCollection from './FloorCollection.js' export default class Model extends THREE.Object3D{ constructor( ){ super() this.panos = new PanoramaCollection(this) this.floors = new FloorCollection(this) this.boundingBox = new THREE.Box3 this.supportsTiles = true } build(){ /* this.panos.forEach(function (pano) { pano.build2() }) */ this.floors.forEach( function (floor) { this.boundingBox.union(floor.boundingBox) }.bind(this) ) var size = new THREE.Vector3() var center = new THREE.Vector3() this.boundingBox.getSize(size) this.boundingBox.getCenter(center) this.size = size this.center = center this.builded = true //xzw this.dispatchEvent({ type: 'builded' }) } addChunk(floorIndex, chunk) { this.floors.getOrMakeFloor(floorIndex).addChunk(chunk) } }