Set tight bounding box for correct elevation clamps.
This commit is contained in:
parent
1b50c55c17
commit
a39d78de85
@ -1951,6 +1951,7 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
var version = new Potree.Version('1.4');
|
||||
|
||||
var globalBounds = greyhoundInfo.bounds;
|
||||
var globalTightBounds = greyhoundInfo.boundsConforming;
|
||||
|
||||
// Center around the origin.
|
||||
var offset = [
|
||||
@ -1966,6 +1967,10 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
return (v - offset[i % 3]) / SCALE;
|
||||
});
|
||||
|
||||
var localTightBounds = globalTightBounds.map(function(v, i) {
|
||||
return (v - offset[i % 3]) / SCALE;
|
||||
});
|
||||
|
||||
var baseDepth = Math.max(8, greyhoundInfo.baseDepth);
|
||||
|
||||
var pgg = new Potree.PointCloudGreyhoundGeometry();
|
||||
@ -2022,22 +2027,27 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
pgg.pointAttributes = new Potree.PointAttributes(attributes);
|
||||
pgg.pointAttributes.byteSize = pointSize;
|
||||
|
||||
var min = new THREE.Vector3(
|
||||
localBounds[0], localBounds[1], localBounds[2]);
|
||||
var max = new THREE.Vector3(
|
||||
localBounds[3], localBounds[4], localBounds[5]);
|
||||
var offset = new THREE.Vector3(offset[0], offset[1], offset[2]);
|
||||
var boundingBox = new THREE.Box3(min, max);
|
||||
var tightBoundingBox = boundingBox.clone();
|
||||
|
||||
// var nodeOffset = new THREE.Vector3(0,0,0);
|
||||
// var globalOffset = new THREE.Vector3(0,0,0);
|
||||
var boundingBox = new THREE.Box3(
|
||||
new THREE.Vector3(
|
||||
localBounds[0],
|
||||
localBounds[1],
|
||||
localBounds[2]),
|
||||
new THREE.Vector3(
|
||||
localBounds[3],
|
||||
localBounds[4],
|
||||
localBounds[5]));
|
||||
|
||||
var extent = {
|
||||
'x': max.x - min.x,
|
||||
'y': max.y - min.y,
|
||||
'z': max.z - min.z
|
||||
};
|
||||
var tightBoundingBox = new THREE.Box3(
|
||||
new THREE.Vector3(
|
||||
localTightBounds[0],
|
||||
localTightBounds[1],
|
||||
localTightBounds[2]),
|
||||
new THREE.Vector3(
|
||||
localTightBounds[3],
|
||||
localTightBounds[4],
|
||||
localTightBounds[5]));
|
||||
|
||||
pgg.projection = greyhoundInfo.srs;
|
||||
pgg.boundingBox = boundingBox;
|
||||
|
||||
14
build/potree/potree.min.js
vendored
14
build/potree/potree.min.js
vendored
File diff suppressed because one or more lines are too long
@ -108,6 +108,7 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
var version = new Potree.Version('1.4');
|
||||
|
||||
var globalBounds = greyhoundInfo.bounds;
|
||||
var globalTightBounds = greyhoundInfo.boundsConforming;
|
||||
|
||||
// Center around the origin.
|
||||
var offset = [
|
||||
@ -123,6 +124,10 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
return (v - offset[i % 3]) / SCALE;
|
||||
});
|
||||
|
||||
var localTightBounds = globalTightBounds.map(function(v, i) {
|
||||
return (v - offset[i % 3]) / SCALE;
|
||||
});
|
||||
|
||||
var baseDepth = Math.max(8, greyhoundInfo.baseDepth);
|
||||
|
||||
var pgg = new Potree.PointCloudGreyhoundGeometry();
|
||||
@ -179,22 +184,27 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
pgg.pointAttributes = new Potree.PointAttributes(attributes);
|
||||
pgg.pointAttributes.byteSize = pointSize;
|
||||
|
||||
var min = new THREE.Vector3(
|
||||
localBounds[0], localBounds[1], localBounds[2]);
|
||||
var max = new THREE.Vector3(
|
||||
localBounds[3], localBounds[4], localBounds[5]);
|
||||
var offset = new THREE.Vector3(offset[0], offset[1], offset[2]);
|
||||
var boundingBox = new THREE.Box3(min, max);
|
||||
var tightBoundingBox = boundingBox.clone();
|
||||
|
||||
// var nodeOffset = new THREE.Vector3(0,0,0);
|
||||
// var globalOffset = new THREE.Vector3(0,0,0);
|
||||
var boundingBox = new THREE.Box3(
|
||||
new THREE.Vector3(
|
||||
localBounds[0],
|
||||
localBounds[1],
|
||||
localBounds[2]),
|
||||
new THREE.Vector3(
|
||||
localBounds[3],
|
||||
localBounds[4],
|
||||
localBounds[5]));
|
||||
|
||||
var extent = {
|
||||
'x': max.x - min.x,
|
||||
'y': max.y - min.y,
|
||||
'z': max.z - min.z
|
||||
};
|
||||
var tightBoundingBox = new THREE.Box3(
|
||||
new THREE.Vector3(
|
||||
localTightBounds[0],
|
||||
localTightBounds[1],
|
||||
localTightBounds[2]),
|
||||
new THREE.Vector3(
|
||||
localTightBounds[3],
|
||||
localTightBounds[4],
|
||||
localTightBounds[5]));
|
||||
|
||||
pgg.projection = greyhoundInfo.srs;
|
||||
pgg.boundingBox = boundingBox;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user