read spacing from cloud.js; display only root from far away; added zoom factor to camera.zoomTo(node)

This commit is contained in:
mschuetz 2014-07-10 16:15:10 +02:00
parent 0a8ed33f74
commit bab7b9991f
3 changed files with 9 additions and 2 deletions

View File

@ -78,7 +78,7 @@ Potree.PointCloudOctree.prototype.update = function(camera){
var visible = true;
visible = visible && frustum.intersectsBox(box);
if(object.level > 1){
if(object.level > 0){
visible = visible && radius / distance > (1 / this.LOD);
visible = visible && (this.numVisiblePoints + object.numPoints < Potree.pointLoadLimit);
visible = visible && (this.numVisibleNodes <= this.maxVisibleNodes);

View File

@ -1,5 +1,9 @@
THREE.PerspectiveCamera.prototype.zoomTo = function(node){
THREE.PerspectiveCamera.prototype.zoomTo = function(node, factor){
if(factor === undefined){
factor = 1;
}
node.updateMatrixWorld();
this.updateMatrix();
this.updateMatrixWorld();
@ -38,6 +42,7 @@ THREE.PerspectiveCamera.prototype.zoomTo = function(node){
max = Math.max(max, distance);
}
var offset = dir.clone().multiplyScalar(-max);
offset.multiplyScalar(factor);
pos.add(offset);
this.position.copy(pos);

View File

@ -32,6 +32,8 @@ POCLoader.load = function load(url) {
pco.octreeDir = url + "/../" + fMno.octreeDir;
}
pco.spacing = fMno.spacing;
var nodes = {};
{ // load root