diff --git a/src/navigation/EarthControls.js b/src/navigation/EarthControls.js index 18f52fe0..a5e47ab7 100644 --- a/src/navigation/EarthControls.js +++ b/src/navigation/EarthControls.js @@ -122,7 +122,8 @@ Potree.EarthControls = class EarthControls extends THREE.EventDispatcher { e.mouse, this.scene.getActiveCamera(), this.viewer, - this.scene.pointclouds); + this.scene.pointclouds, + {pickClipped: true}); if (I) { this.pivot = I.location; diff --git a/src/navigation/OrbitControls.js b/src/navigation/OrbitControls.js index 6a651eab..070a8104 100644 --- a/src/navigation/OrbitControls.js +++ b/src/navigation/OrbitControls.js @@ -132,7 +132,8 @@ Potree.OrbitControls = class OrbitControls extends THREE.EventDispatcher{ mouse, camera, this.viewer, - this.scene.pointclouds); + this.scene.pointclouds, + {pickClipped: true}); if (I === null) { return; diff --git a/src/viewer/profile.js b/src/viewer/profile.js index ef5993ed..d454bfe4 100644 --- a/src/viewer/profile.js +++ b/src/viewer/profile.js @@ -621,20 +621,25 @@ Potree.ProfileWindow = class ProfileWindow extends THREE.EventDispatcher { entry.addPoints(points); this.pointCloudRoot.add(entry.sceneNode); + this.projectedBox.union(entry.projectedBox); + //console.log(this.projectedBox.min.toArray().map(v => v.toFixed(2)).join(", ")); + //console.log(this.projectedBox.getSize().toArray().map(v => v.toFixed(2)).join(", ")); if (this.autoFit) { let width = this.renderArea[0].clientWidth; let height = this.renderArea[0].clientHeight; - let size = entry.projectedBox.getSize(); + let size = this.projectedBox.getSize(); let sx = width / size.x; - let sy = height / size.y; + let sy = height / size.z; let scale = Math.min(sx, sy); - let center = entry.projectedBox.getCenter(); + let center = this.projectedBox.getCenter(); this.scale.set(scale, scale, 1); this.camera.position.copy(center); + + //console.log("camera: ", this.camera.position.toArray().join(", ")); } //console.log(entry); diff --git a/src/workers/BinaryDecoderWorker.js b/src/workers/BinaryDecoderWorker.js index 0d12fbd1..15f347d3 100644 --- a/src/workers/BinaryDecoderWorker.js +++ b/src/workers/BinaryDecoderWorker.js @@ -34,6 +34,8 @@ function CustomView (buffer) { Potree = {}; onmessage = function (event) { + + performance.mark("binary-decoder-start"); let buffer = event.data.buffer; let pointAttributes = event.data.pointAttributes; @@ -273,18 +275,6 @@ onmessage = function (event) { } performance.mark("spacing-end"); - - { // print timings - performance.measure("spacing", "spacing-start", "spacing-end"); - let measure = performance.getEntriesByType("measure")[0]; - let dpp = 1000 * measure.duration / numPoints; - let debugMessage = `${measure.duration.toFixed(3)} ms, ${numPoints} points, ${dpp.toFixed(3)} µs / point`; - console.log(debugMessage); - } - - performance.clearMarks(); - performance.clearMeasures(); - } { // add indices @@ -294,6 +284,20 @@ onmessage = function (event) { } } + performance.mark("binary-decoder-end"); + + //{ // print timings + // //performance.measure("spacing", "spacing-start", "spacing-end"); + // performance.measure("binary-decoder", "binary-decoder-start", "binary-decoder-end"); + // let measure = performance.getEntriesByType("measure")[0]; + // let dpp = 1000 * measure.duration / numPoints; + // let debugMessage = `${measure.duration.toFixed(3)} ms, ${numPoints} points, ${dpp.toFixed(3)} µs / point`; + // console.log(debugMessage); + //} + + performance.clearMarks(); + performance.clearMeasures(); + let message = { mean: mean, data: iData,