// MAP CALLBACKS refresh() { const frustum = new THREE.Frustum(); frustum.setFromMatrix( new THREE.Matrix4().multiplyMatrices( this.camera.projectionMatrix, this.camera.matrixWorldInverse ) ); this.tileset.root.checkLoad(frustum, this._getCameraPosition()); }
render(gl, viewProjectionMatrix) { this.viewProjectionMatrix = viewProjectionMatrix; const l = new THREE.Matrix4().fromArray(viewProjectionMatrix); this.renderer.state.reset(); // The root tile transform is applied to the camera while rendering // instead of to the root tile. This avoids precision errors. this.camera.projectionMatrix = l.multiply(this.rootTransform); this.renderer.render(this.scene, this.camera); if (this.loadStatus === 1) { // first render after root tile is loaded this.loadStatus = 2; const frustum = new THREE.Frustum(); frustum.setFromMatrix( new THREE.Matrix4().multiplyMatrices( this.camera.projectionMatrix, this.camera.matrixWorldInverse ) ); if (this.tileset) { this.tileset.update(frustum, this._getCameraPosition()); } } }