DEM mostly done; some perf improvements to annotations
This commit is contained in:
parent
afd3d67323
commit
b7f7180af3
@ -109,6 +109,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree{
|
||||
let sceneNode = new THREE.Points(geometryNode.geometry, this.material);
|
||||
sceneNode.name = geometryNode.name;
|
||||
sceneNode.position.copy(geometryNode.boundingBox.min);
|
||||
sceneNode.frustumCulled = false;
|
||||
sceneNode.onBeforeRender = (_this, scene, camera, geometry, material, group) => {
|
||||
|
||||
if(material.program){
|
||||
|
||||
@ -320,7 +320,7 @@ function createDEMMesh(dem){
|
||||
|
||||
let box = dem.boundingBox;
|
||||
|
||||
let steps = 1024;
|
||||
let steps = 256;
|
||||
let triangles = [];
|
||||
for(let i = 0; i < steps; i++){
|
||||
for(let j = 0; j < steps; j++){
|
||||
@ -545,34 +545,6 @@ Potree.updateVisibility = function(pointclouds, camera, renderer){
|
||||
node.boundingBoxNode.visible = false;
|
||||
}
|
||||
|
||||
//if(!node.dem){
|
||||
// if(!Potree.getDEMWorkerInstance().working){
|
||||
// Potree.getDEMWorkerInstance().onmessage = (e) => {
|
||||
//
|
||||
// node.dem = e.data.dem;
|
||||
//
|
||||
// Potree.getDEMWorkerInstance().working = false;
|
||||
// };
|
||||
//
|
||||
// let position = node.geometryNode.geometry.attributes.position.array;
|
||||
//
|
||||
// let message = {
|
||||
// boundingBox: {
|
||||
// min: node.getBoundingBox().min.toArray(),
|
||||
// max:node.getBoundingBox().max.toArray()
|
||||
// },
|
||||
// position: new Float32Array(position).buffer
|
||||
// };
|
||||
//
|
||||
// let transferables = [message.position];
|
||||
//
|
||||
// Potree.getDEMWorkerInstance().working = true;
|
||||
//
|
||||
// Potree.getDEMWorkerInstance().postMessage(message, transferables);
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
// add child nodes to priorityQueue
|
||||
@ -605,10 +577,10 @@ Potree.updateVisibility = function(pointclouds, camera, renderer){
|
||||
|
||||
}// end priority queue loop
|
||||
|
||||
for(let pointcloud of pointclouds.filter(p => p.dem instanceof Potree.DEM)){
|
||||
let updatingNodes = pointcloud.visibleNodes.filter(n => n.getLevel() <= 8);
|
||||
pointcloud.dem.update(updatingNodes);
|
||||
}
|
||||
//for(let pointcloud of pointclouds.filter(p => p.dem instanceof Potree.DEM)){
|
||||
// let updatingNodes = pointcloud.visibleNodes.filter(n => n.getLevel() <= 8);
|
||||
// pointcloud.dem.update(updatingNodes);
|
||||
//}
|
||||
|
||||
|
||||
for(let i = 0; i < Math.min(5, unloadedGeometry.length); i++){
|
||||
|
||||
@ -286,6 +286,10 @@ Potree.MapView = class{
|
||||
|
||||
this.onAnnotationAdded = e => {
|
||||
|
||||
if(!this.sceneProjection){
|
||||
return;
|
||||
}
|
||||
|
||||
let annotation = e.annotation;
|
||||
let position = annotation.position;
|
||||
let mapPos = this.toMap.forward([position.x, position.y]);
|
||||
|
||||
@ -1158,6 +1158,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
let height = this.renderArea.clientHeight;
|
||||
|
||||
this.renderer = new THREE.WebGLRenderer({premultipliedAlpha: false});
|
||||
this.renderer.sortObjects = false;
|
||||
this.renderer.setSize(width, height);
|
||||
this.renderer.autoClear = false;
|
||||
this.renderArea.appendChild(this.renderer.domElement);
|
||||
@ -1240,6 +1241,28 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
screenSize = radius * projFactor;
|
||||
}
|
||||
|
||||
{
|
||||
let p = position.clone().applyMatrix4(viewer.scene.camera.matrixWorldInverse);
|
||||
let visible = p.z < 0;
|
||||
|
||||
if(annotation.__visible !== visible){
|
||||
if(visible){
|
||||
annotation.domElement.show();
|
||||
}else{
|
||||
annotation.domElement.hide();
|
||||
}
|
||||
|
||||
annotation.__visible = visible;
|
||||
}
|
||||
//annotation.__visible = p.z < 0;
|
||||
//if(p.z > 0){
|
||||
// annotation.domElement.hide();
|
||||
//}else{
|
||||
// annotation.domElement.show();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
//element.css("left", screenPos.x + "px");
|
||||
//element.css("top", screenPos.y + "px");
|
||||
element[0].style.left = screenPos.x + "px";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user