fixes and formatting
This commit is contained in:
parent
d99f94075f
commit
0bbc74ff13
@ -97,7 +97,7 @@
|
|||||||
});
|
});
|
||||||
potreeViewer.setEDLEnabled(true);
|
potreeViewer.setEDLEnabled(true);
|
||||||
potreeViewer.setFOV(60);
|
potreeViewer.setFOV(60);
|
||||||
potreeViewer.setPointBudget(100*1000);
|
potreeViewer.setPointBudget(1000*1000);
|
||||||
potreeViewer.setMinNodeSize(0);
|
potreeViewer.setMinNodeSize(0);
|
||||||
potreeViewer.loadSettingsFromURL();
|
potreeViewer.loadSettingsFromURL();
|
||||||
potreeViewer.setBackground(null);
|
potreeViewer.setBackground(null);
|
||||||
|
|||||||
@ -297,7 +297,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
|
|||||||
let bbWorld = node.boundingBox.clone().applyMatrix4(this.matrixWorld);
|
let bbWorld = node.boundingBox.clone().applyMatrix4(this.matrixWorld);
|
||||||
let bsWorld = bbWorld.getBoundingSphere();
|
let bsWorld = bbWorld.getBoundingSphere();
|
||||||
|
|
||||||
let intersects = false;
|
let intersects = false;
|
||||||
|
|
||||||
for (let i = 0; i < profile.points.length - 1; i++) {
|
for (let i = 0; i < profile.points.length - 1; i++) {
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
|
|||||||
intersects = intersects || (distance < (bsWorld.radius + profile.width));
|
intersects = intersects || (distance < (bsWorld.radius + profile.width));
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(`${node.name}: ${intersects}`);
|
//console.log(`${node.name}: ${intersects}`);
|
||||||
|
|
||||||
return intersects;
|
return intersects;
|
||||||
}
|
}
|
||||||
@ -692,14 +692,14 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
let point = null;
|
let point = null;
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
point = {};
|
point = {};
|
||||||
|
|
||||||
if (!nodes[hit.pcIndex]) {
|
if (!nodes[hit.pcIndex]) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = nodes[hit.pcIndex];
|
let node = nodes[hit.pcIndex];
|
||||||
let pc = node.sceneNode;
|
let pc = node.sceneNode;
|
||||||
let iBuffer = node.geometryNode.buffer;
|
let iBuffer = node.geometryNode.buffer;
|
||||||
@ -708,7 +708,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
|
|||||||
|
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
for (let attribute of iBuffer.attributes) {
|
for (let attribute of iBuffer.attributes) {
|
||||||
|
|
||||||
if (attribute.name === 'position') {
|
if (attribute.name === 'position') {
|
||||||
let x = view.getFloat32(iBuffer.stride * hit.pIndex + offset + 0, true);
|
let x = view.getFloat32(iBuffer.stride * hit.pIndex + offset + 0, true);
|
||||||
let y = view.getFloat32(iBuffer.stride * hit.pIndex + offset + 4, true);
|
let y = view.getFloat32(iBuffer.stride * hit.pIndex + offset + 4, true);
|
||||||
@ -716,10 +716,10 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
|
|||||||
|
|
||||||
let position = new THREE.Vector3(x, y, z);
|
let position = new THREE.Vector3(x, y, z);
|
||||||
position.applyMatrix4(pc.matrixWorld);
|
position.applyMatrix4(pc.matrixWorld);
|
||||||
|
|
||||||
point[attribute.name] = position;
|
point[attribute.name] = position;
|
||||||
} else if (attribute.name === 'indices') {
|
} else if (attribute.name === 'indices') {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//if (values.itemSize === 1) {
|
//if (values.itemSize === 1) {
|
||||||
// point[attribute.name] = values.array[hit.pIndex];
|
// point[attribute.name] = values.array[hit.pIndex];
|
||||||
|
|||||||
@ -427,7 +427,7 @@ Potree.updateVisibility = function(pointclouds, camera, renderer){
|
|||||||
|
|
||||||
if (pointcloud.showBoundingBox && !node.boundingBoxNode && node.getBoundingBox) {
|
if (pointcloud.showBoundingBox && !node.boundingBoxNode && node.getBoundingBox) {
|
||||||
let boxHelper = new Potree.Box3Helper(node.getBoundingBox());
|
let boxHelper = new Potree.Box3Helper(node.getBoundingBox());
|
||||||
boxHelper.matrixAutoUpdate = false;
|
boxHelper.matrixAutoUpdate = false;
|
||||||
pointcloud.boundingBoxNodes.push(boxHelper);
|
pointcloud.boundingBoxNodes.push(boxHelper);
|
||||||
node.boundingBoxNode = boxHelper;
|
node.boundingBoxNode = boxHelper;
|
||||||
node.boundingBoxNode.matrix.copy(pointcloud.matrixWorld);
|
node.boundingBoxNode.matrix.copy(pointcloud.matrixWorld);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
// let getQueryParam = function(name) {
|
// let getQueryParam = function(name) {
|
||||||
// name = name.replace(/[\[\]]/g, "\\$&");
|
// name = name.replace(/[\[\]]/g, "\\$&");
|
||||||
// let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
// let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||||
// results = regex.exec(window.location.href);
|
// results = regex.exec(window.location.href);
|
||||||
// if (!results) return null;
|
// if (!results) return null;
|
||||||
// if (!results[2]) return '';
|
// if (!results[2]) return '';
|
||||||
// return decodeURIComponent(results[2].replace(/\+/g, " "));
|
// return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Potree.View = class {
|
Potree.View = class {
|
||||||
@ -212,9 +212,9 @@ Potree.Scene = class extends THREE.EventDispatcher{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBoundingBox(pointclouds = this.pointclouds){
|
getBoundingBox(pointclouds = this.pointclouds){
|
||||||
let box = new THREE.Box3();
|
let box = new THREE.Box3();
|
||||||
|
|
||||||
this.scenePointCloud.updateMatrixWorld(true);
|
this.scenePointCloud.updateMatrixWorld(true);
|
||||||
@ -229,7 +229,7 @@ Potree.Scene = class extends THREE.EventDispatcher{
|
|||||||
}
|
}
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPointCloud (pointcloud) {
|
addPointCloud (pointcloud) {
|
||||||
this.pointclouds.push(pointcloud);
|
this.pointclouds.push(pointcloud);
|
||||||
@ -628,10 +628,10 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
this.loadSettingsFromURL();
|
this.loadSettingsFromURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start rendering!
|
// start rendering!
|
||||||
if(args.useDefaultRenderLoop === undefined || args.useDefaultRenderLoop === true){
|
if(args.useDefaultRenderLoop === undefined || args.useDefaultRenderLoop === true){
|
||||||
requestAnimationFrame(this.loop.bind(this));
|
requestAnimationFrame(this.loop.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadGUI = this.loadGUI.bind(this);
|
this.loadGUI = this.loadGUI.bind(this);
|
||||||
}
|
}
|
||||||
@ -996,7 +996,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
};
|
};
|
||||||
|
|
||||||
getBoundingBox (pointclouds) {
|
getBoundingBox (pointclouds) {
|
||||||
return this.scene.getBoundingBox(pointclouds);
|
return this.scene.getBoundingBox(pointclouds);
|
||||||
};
|
};
|
||||||
|
|
||||||
fitToScreen (factor = 1) {
|
fitToScreen (factor = 1) {
|
||||||
@ -1441,7 +1441,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
|
|
||||||
update (delta, timestamp) {
|
update (delta, timestamp) {
|
||||||
|
|
||||||
if(Potree.measureTimings) performance.mark("update-start");
|
if(Potree.measureTimings) performance.mark("update-start");
|
||||||
|
|
||||||
// if(window.urlToggle === undefined){
|
// if(window.urlToggle === undefined){
|
||||||
// window.urlToggle = 0;
|
// window.urlToggle = 0;
|
||||||
@ -1491,7 +1491,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
|
|
||||||
|
|
||||||
let scene = this.scene;
|
let scene = this.scene;
|
||||||
let camera = scene.getActiveCamera();
|
let camera = scene.getActiveCamera();
|
||||||
|
|
||||||
Potree.pointLoadLimit = Potree.pointBudget * 2;
|
Potree.pointLoadLimit = Potree.pointBudget * 2;
|
||||||
|
|
||||||
@ -1522,7 +1522,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
|
|
||||||
let capIndex = parseInt((intensities.length - 1) * 0.75);
|
let capIndex = parseInt((intensities.length - 1) * 0.75);
|
||||||
let cap = intensities[capIndex];
|
let cap = intensities[capIndex];
|
||||||
|
|
||||||
if (cap <= 1) {
|
if (cap <= 1) {
|
||||||
pointcloud.material.intensityRange = [0, 1];
|
pointcloud.material.intensityRange = [0, 1];
|
||||||
} else if (cap <= 256) {
|
} else if (cap <= 256) {
|
||||||
@ -1566,27 +1566,27 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if(this.showBoundingBox){
|
if(this.showBoundingBox){
|
||||||
let bbRoot = this.scene.scene.getObjectByName("potree_bounding_box_root");
|
let bbRoot = this.scene.scene.getObjectByName("potree_bounding_box_root");
|
||||||
if(!bbRoot){
|
if(!bbRoot){
|
||||||
let node = new THREE.Object3D();
|
let node = new THREE.Object3D();
|
||||||
node.name = "potree_bounding_box_root";
|
node.name = "potree_bounding_box_root";
|
||||||
this.scene.scene.add(node);
|
this.scene.scene.add(node);
|
||||||
bbRoot = node;
|
bbRoot = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
let visibleBoxes = [];
|
let visibleBoxes = [];
|
||||||
for(let pointcloud of this.scene.pointclouds){
|
for(let pointcloud of this.scene.pointclouds){
|
||||||
for(let node of pointcloud.visibleNodes){
|
for(let node of pointcloud.visibleNodes){
|
||||||
let box = node.boundingBoxNode;
|
let box = node.boundingBoxNode;
|
||||||
visibleBoxes.push(box);
|
visibleBoxes.push(box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bbRoot.children = visibleBoxes;
|
bbRoot.children = visibleBoxes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.freeze) {
|
if (!this.freeze) {
|
||||||
let result = Potree.updatePointClouds(scene.pointclouds, camera, this.renderer);
|
let result = Potree.updatePointClouds(scene.pointclouds, camera, this.renderer);
|
||||||
@ -1629,11 +1629,11 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
this.scene.cameraO.rotation.order = "ZXY";
|
this.scene.cameraO.rotation.order = "ZXY";
|
||||||
this.scene.cameraO.rotation.x = Math.PI / 2 + this.scene.view.pitch;
|
this.scene.cameraO.rotation.x = Math.PI / 2 + this.scene.view.pitch;
|
||||||
this.scene.cameraO.rotation.z = this.scene.view.yaw;
|
this.scene.cameraO.rotation.z = this.scene.view.yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera.updateMatrix();
|
camera.updateMatrix();
|
||||||
camera.updateMatrixWorld();
|
camera.updateMatrixWorld();
|
||||||
camera.matrixWorldInverse.getInverse(camera.matrixWorld);
|
camera.matrixWorldInverse.getInverse(camera.matrixWorld);
|
||||||
|
|
||||||
{ // update clip boxes
|
{ // update clip boxes
|
||||||
// ordinary clip boxes (clip planes)
|
// ordinary clip boxes (clip planes)
|
||||||
@ -1693,16 +1693,16 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
this.dispatchEvent({
|
this.dispatchEvent({
|
||||||
'type': 'update',
|
'type': 'update',
|
||||||
'delta': delta,
|
'delta': delta,
|
||||||
'timestamp': timestamp});
|
'timestamp': timestamp});
|
||||||
|
|
||||||
if(Potree.measureTimings) {
|
if(Potree.measureTimings) {
|
||||||
performance.mark("update-end");
|
performance.mark("update-end");
|
||||||
performance.measure("update", "update-start", "update-end");
|
performance.measure("update", "update-start", "update-end");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
if(Potree.measureTimings) performance.mark("render-start");
|
if(Potree.measureTimings) performance.mark("render-start");
|
||||||
|
|
||||||
if(this.useRep){
|
if(this.useRep){
|
||||||
if (!this.repRenderer) {
|
if (!this.repRenderer) {
|
||||||
@ -1720,16 +1720,16 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.potreeRenderer.render();
|
this.potreeRenderer.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Potree.measureTimings){
|
if(Potree.measureTimings){
|
||||||
performance.mark("render-end");
|
performance.mark("render-end");
|
||||||
performance.measure("render", "render-start", "render-end");
|
performance.measure("render", "render-start", "render-end");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveTimings(timestamp){
|
resolveTimings(timestamp){
|
||||||
if(Potree.measureTimings){
|
if(Potree.measureTimings){
|
||||||
if(!this.toggle){
|
if(!this.toggle){
|
||||||
this.toggle = timestamp;
|
this.toggle = timestamp;
|
||||||
}
|
}
|
||||||
@ -1826,7 +1826,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
this.toggle = timestamp;
|
this.toggle = timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loop (timestamp) {
|
loop (timestamp) {
|
||||||
requestAnimationFrame(this.loop.bind(this));
|
requestAnimationFrame(this.loop.bind(this));
|
||||||
@ -1845,9 +1845,9 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
|||||||
if(Potree.measureTimings){
|
if(Potree.measureTimings){
|
||||||
performance.mark("loop-end");
|
performance.mark("loop-end");
|
||||||
performance.measure("loop", "loop-start", "loop-end");
|
performance.measure("loop", "loop-start", "loop-end");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.resolveTimings(timestamp);
|
this.resolveTimings(timestamp);
|
||||||
|
|
||||||
this.stats.end();
|
this.stats.end();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user