fix arena4d multiple load of same data bug; fix arena4d point pick bug

This commit is contained in:
mschuetz 2015-12-01 15:17:56 +01:00
parent 701519986b
commit 88757f18a8
7 changed files with 66 additions and 38 deletions

View File

@ -315,7 +315,7 @@ Potree.Shaders["pointcloud.vs"] = [
" vColor = uColor;",
" #elif defined color_type_tree_depth",
" float depth = getLocalTreeDepth();",
" float w = depth / 10.0;",
" float w = depth / 30.0;",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" #elif defined color_type_point_index",
" vColor = indices.rgb;",
@ -4845,7 +4845,7 @@ Potree.PointCloudOctree.prototype.pick = function(renderer, camera, ray, params)
this.pickMaterial.pointSizeType = this.material.pointSizeType;
this.pickMaterial.size = this.material.size;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.interpolate = this.material.interpolate;
this.pickMaterial.minSize = this.material.minSize;
this.pickMaterial.maxSize = this.material.maxSize;
@ -8631,12 +8631,6 @@ Potree.PointCloudArena4D.prototype.updateMaterial = function(camera, renderer){
this.material.spacing = this.pcoGeometry.spacing;
this.material.near = camera.near;
this.material.far = camera.far;
// reduce shader source updates by setting maxLevel slightly higher than actually necessary
if(this.maxLevel > this.material.levels){
this.material.levels = this.maxLevel + 2;
}
this.material.minSize = 3;
var bbSize = this.boundingBox.size();
@ -9091,22 +9085,21 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
}
this.pickMaterial.pointSizeType = this.material.pointSizeType;
this.pickMaterial.size = this.material.size;
if(this.pickMaterial.pointSizeType === Potree.PointSizeType.ADAPTIVE){
this.updateVisibilityTexture(this.pickMaterial, nodes);
}
this.pickMaterial.size = this.material.size;
this.pickMaterial.fov = this.material.fov;
this.pickMaterial.screenWidth = this.material.screenWidth;
this.pickMaterial.screenHeight = this.material.screenHeight;
this.pickMaterial.spacing = this.material.spacing;
this.pickMaterial.near = this.material.near;
this.pickMaterial.far = this.material.far;
this.pickMaterial.levels = this.material.levels;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.interpolate = this.material.interpolate;
this.pickMaterial.minSize = this.material.minSize;
this.pickMaterial.maxSize = this.material.maxSize;
this.pickMaterial.bbSize = this.material.bbSize;
if(this.pickMaterial.pointSizeType === Potree.PointSizeType.ADAPTIVE){
this.updateVisibilityTexture(this.pickMaterial, nodes);
}
var _gl = renderer.context;
@ -9172,6 +9165,23 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
pickWindowSize, pickWindowSize,
renderer.context.RGBA, renderer.context.UNSIGNED_BYTE, pixels);
//{ // show big render target for debugging purposes
// var br = new ArrayBuffer(width*height*4);
// var bp = new Uint8Array(br);
// renderer.context.readPixels( 0, 0, width, height,
// renderer.context.RGBA, renderer.context.UNSIGNED_BYTE, bp);
//
// var img = pixelsArrayToImage(bp, width, height);
// img.style.boder = "2px solid red";
// img.style.position = "absolute";
// img.style.top = "0px";
// img.style.width = width + "px";
// img.style.height = height + "px";
// img.onclick = function(){document.body.removeChild(img)};
// document.body.appendChild(img);
//}
// find closest hit inside pixelWindow boundaries
var min = Number.MAX_VALUE;
var hit = null;
@ -9366,6 +9376,8 @@ Potree.PointCloudArena4DGeometryNode.prototype.load = function(){
return;
}
this.loading = true;
Potree.PointCloudArena4DGeometryNode.nodesLoading++;
var url = this.pcoGeometry.url + "?node=" + this.number;
@ -9421,6 +9433,8 @@ Potree.PointCloudArena4DGeometryNode.prototype.load = function(){
geometry.boundingSphere = scope.boundingSphere;
scope.numPoints = numPoints;
scope.loading = false;
};
xhr.send(null);

File diff suppressed because one or more lines are too long

View File

@ -253,7 +253,7 @@ Potree.Shaders["pointcloud.vs"] = [
" vColor = uColor;",
" #elif defined color_type_tree_depth",
" float depth = getLocalTreeDepth();",
" float w = depth / 10.0;",
" float w = depth / 30.0;",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" #elif defined color_type_point_index",
" vColor = indices.rgb;",

View File

@ -767,7 +767,7 @@ Potree.PointCloudOctree.prototype.pick = function(renderer, camera, ray, params)
this.pickMaterial.pointSizeType = this.material.pointSizeType;
this.pickMaterial.size = this.material.size;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.interpolate = this.material.interpolate;
this.pickMaterial.minSize = this.material.minSize;
this.pickMaterial.maxSize = this.material.maxSize;

View File

@ -55,12 +55,6 @@ Potree.PointCloudArena4D.prototype.updateMaterial = function(camera, renderer){
this.material.spacing = this.pcoGeometry.spacing;
this.material.near = camera.near;
this.material.far = camera.far;
// reduce shader source updates by setting maxLevel slightly higher than actually necessary
if(this.maxLevel > this.material.levels){
this.material.levels = this.maxLevel + 2;
}
this.material.minSize = 3;
var bbSize = this.boundingBox.size();
@ -515,22 +509,21 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
}
this.pickMaterial.pointSizeType = this.material.pointSizeType;
this.pickMaterial.size = this.material.size;
if(this.pickMaterial.pointSizeType === Potree.PointSizeType.ADAPTIVE){
this.updateVisibilityTexture(this.pickMaterial, nodes);
}
this.pickMaterial.size = this.material.size;
this.pickMaterial.fov = this.material.fov;
this.pickMaterial.screenWidth = this.material.screenWidth;
this.pickMaterial.screenHeight = this.material.screenHeight;
this.pickMaterial.spacing = this.material.spacing;
this.pickMaterial.near = this.material.near;
this.pickMaterial.far = this.material.far;
this.pickMaterial.levels = this.material.levels;
this.pickMaterial.pointShape = this.material.pointShape;
this.pickMaterial.interpolate = this.material.interpolate;
this.pickMaterial.minSize = this.material.minSize;
this.pickMaterial.maxSize = this.material.maxSize;
this.pickMaterial.bbSize = this.material.bbSize;
if(this.pickMaterial.pointSizeType === Potree.PointSizeType.ADAPTIVE){
this.updateVisibilityTexture(this.pickMaterial, nodes);
}
var _gl = renderer.context;
@ -596,6 +589,23 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
pickWindowSize, pickWindowSize,
renderer.context.RGBA, renderer.context.UNSIGNED_BYTE, pixels);
//{ // show big render target for debugging purposes
// var br = new ArrayBuffer(width*height*4);
// var bp = new Uint8Array(br);
// renderer.context.readPixels( 0, 0, width, height,
// renderer.context.RGBA, renderer.context.UNSIGNED_BYTE, bp);
//
// var img = pixelsArrayToImage(bp, width, height);
// img.style.boder = "2px solid red";
// img.style.position = "absolute";
// img.style.top = "0px";
// img.style.width = width + "px";
// img.style.height = height + "px";
// img.onclick = function(){document.body.removeChild(img)};
// document.body.appendChild(img);
//}
// find closest hit inside pixelWindow boundaries
var min = Number.MAX_VALUE;
var hit = null;

View File

@ -25,6 +25,8 @@ Potree.PointCloudArena4DGeometryNode.prototype.load = function(){
return;
}
this.loading = true;
Potree.PointCloudArena4DGeometryNode.nodesLoading++;
var url = this.pcoGeometry.url + "?node=" + this.number;
@ -80,6 +82,8 @@ Potree.PointCloudArena4DGeometryNode.prototype.load = function(){
geometry.boundingSphere = scope.boundingSphere;
scope.numPoints = numPoints;
scope.loading = false;
};
xhr.send(null);

View File

@ -252,7 +252,7 @@ void main() {
vColor = uColor;
#elif defined color_type_tree_depth
float depth = getLocalTreeDepth();
float w = depth / 10.0;
float w = depth / 30.0;
vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;
#elif defined color_type_point_index
vColor = indices.rgb;