12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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
- this.chunks = []
- }
-
-
- build(){
-
-
-
- /* this.panos.forEach(function (pano) {
- pano.build2()
- }) */
- this.floors.forEach(
- function (floor) {
- this.boundingBox.union(floor.boundingBox)
- this.chunks.push(...floor.chunks)
- }.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)
- }
- }
|