|
@@ -54318,6 +54318,7 @@
|
|
|
viewer.scene.measurements.forEach((e)=>{
|
|
|
Potree.Utils.updateVisible(e, 'tranCamera', true);
|
|
|
});
|
|
|
+ this.applyToCamera(viewport.camera);
|
|
|
viewer.dispatchEvent({type:'camera_changed', viewport:viewer.mainViewport, changeInfo:{}});//update sprite
|
|
|
|
|
|
console.log('tranCamera end');
|
|
@@ -63055,6 +63056,8 @@ void main() {
|
|
|
depth = (pos.z + 1.0) / 2.0;
|
|
|
gl_FragDepthEXT = depth;
|
|
|
|
|
|
+ gl_FragDepthEXT = clamp(gl_FragDepthEXT, 0.0, 1.0);
|
|
|
+
|
|
|
#if defined(color_type_depth)
|
|
|
color.r = linearDepth;
|
|
|
color.g = expDepth;
|
|
@@ -75041,6 +75044,13 @@ void main()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ let boxHelper = new Potree.Box3Helper(viewer.bound.boundingBox);
|
|
|
+ boxHelper.matrixAutoUpdate = false;
|
|
|
+ viewer.scene.scene.add(boxHelper);
|
|
|
+ viewer.bound.boxHelper = boxHelper;
|
|
|
+ boxHelper.visible = false;
|
|
|
+
|
|
|
console.log('allLoaded');
|
|
|
viewer.dispatchEvent('allLoaded');
|
|
|
});
|
|
@@ -75108,8 +75118,8 @@ void main()
|
|
|
textarea.style.width = '160px';
|
|
|
textarea.style.height = '200px';
|
|
|
textarea.style.position = 'fixed';
|
|
|
- textarea.style.left = 0;
|
|
|
- textarea.style.bottom = '50px';
|
|
|
+ textarea.style.right = 0;
|
|
|
+ textarea.style.bottom = '1px';
|
|
|
textarea.style['z-index'] = 9999;
|
|
|
textarea.style.color = 'black';
|
|
|
textarea.style.opacity = 0.9;
|
|
@@ -76119,10 +76129,8 @@ void main()
|
|
|
material.fov = camera.fov * (Math.PI / 180);
|
|
|
/* material.screenWidth = renderer.domElement.clientWidth;
|
|
|
material.screenHeight = renderer.domElement.clientHeight; */
|
|
|
- material.resolution = resolution;
|
|
|
-
|
|
|
-
|
|
|
- //material.spacing = this.pcoGeometry.spacing; // * Math.max(this.scale.x, this.scale.y, this.scale.z); //应该不需要
|
|
|
+ material.resolution = resolution;
|
|
|
+ material.spacing = this.pcoGeometry.spacing; // * Math.max(this.scale.x, this.scale.y, this.scale.z);
|
|
|
material.near = camera.near;
|
|
|
material.far = camera.far;
|
|
|
material.uniforms.octreeSize.value = this.pcoGeometry.boundingBox.getSize(new Vector3()).x;
|
|
@@ -76137,7 +76145,7 @@ void main()
|
|
|
|
|
|
let getVal = (a, b) => a != void 0 ? a : b;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
let pickWindowSize_ = MathUtils$1.clamp( Math.round((1.1-this.maxLevel/this.nodeMaxLevel)*80), 5, 100);
|
|
|
let pickWindowSize = getVal(params.pickWindowSize, pickWindowSize_ ); /* 65 */ //拾取像素边长,越小越精准,但点云稀疏的话可能容易出现识别不到的情况。 另外左下侧会有缝隙无法识别到,缝隙大小和这个值有关//突然发现pickWindowSize在一百以内的变化对pick费时影响甚微,1和100差1毫秒不到,但400时会多4毫秒
|
|
@@ -76157,12 +76165,10 @@ void main()
|
|
|
window.testScreen = 0;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
let pointSizeType = getVal(params.pointSizeType, this.material.pointSizeType);
|
|
|
let pointSize = getVal(params.pointSize, this.material.size);
|
|
|
-
|
|
|
+
|
|
|
let nodes = this.nodesOnRay(this.visibleNodes, ray);
|
|
|
|
|
|
if (nodes.length === 0) {
|
|
@@ -76195,8 +76201,8 @@ void main()
|
|
|
|
|
|
{ // update pick material
|
|
|
pickMaterial.pointSizeType = pointSizeType;
|
|
|
- //pickMaterial.shape = this.material.shape;
|
|
|
- pickMaterial.shape = Potree.PointShape.PARABOLOID;
|
|
|
+ //pickMaterial.shape = this.material.shape;
|
|
|
+ pickMaterial.shape = Potree.PointShape.PARABOLOID;
|
|
|
|
|
|
pickMaterial.uniforms.uFilterReturnNumberRange.value = this.material.uniforms.uFilterReturnNumberRange.value;
|
|
|
pickMaterial.uniforms.uFilterNumberOfReturnsRange.value = this.material.uniforms.uFilterNumberOfReturnsRange.value;
|
|
@@ -76210,7 +76216,9 @@ void main()
|
|
|
pickMaterial.uniforms.maxSize.value = this.material.uniforms.maxSize.value;
|
|
|
pickMaterial.classification = this.material.classification;
|
|
|
pickMaterial.recomputeClassification();
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//pickClipped判断转移到上一层函数
|
|
|
let {bigClipInBox,clipBoxes_in,clipBoxes_out} = this.material;
|
|
|
pickMaterial.setClipBoxes(bigClipInBox, clipBoxes_in, clipBoxes_out, []);
|
|
@@ -76228,7 +76236,7 @@ void main()
|
|
|
parseInt(pixelPos.x - (pickWindowSize - 1) / 2),
|
|
|
parseInt(pixelPos.y - (pickWindowSize - 1) / 2),
|
|
|
parseInt(pickWindowSize), parseInt(pickWindowSize));
|
|
|
-
|
|
|
+
|
|
|
|
|
|
renderer.state.buffers.depth.setTest(pickMaterial.depthTest);
|
|
|
renderer.state.buffers.depth.setMask(pickMaterial.depthWrite);
|
|
@@ -76270,7 +76278,7 @@ void main()
|
|
|
|
|
|
let pixels = buffer;
|
|
|
let ibuffer = new Uint32Array(buffer.buffer); //四个数整合成一个
|
|
|
-
|
|
|
+ // console.log(pixels.join(','))
|
|
|
// find closest hit inside pixelWindow boundaries
|
|
|
let min = Number.MAX_VALUE;
|
|
|
let hits = [], hits2 = [], rSquare;
|
|
@@ -76479,7 +76487,7 @@ void main()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- console.log('changePointSize:' + this.dataset_id + ' , num: ' + (num && num.toPrecision(3)) + ' , size: ' + size.toPrecision(3), 'nodeMaxLevel', nodeMaxLevel.toPrecision(3), 'testMaxNodeCount',viewer.testMaxNodeCount /* this.material.spacing */);
|
|
|
+ //console.log('changePointSize:' + this.dataset_id + ' , num: ' + (num && num.toPrecision(3)) + ' , size: ' + size.toPrecision(3), 'nodeMaxLevel', nodeMaxLevel.toPrecision(3), 'testMaxNodeCount',viewer.testMaxNodeCount /* this.material.spacing */)
|
|
|
if(size){
|
|
|
if(Potree.settings.sortCloudMat){//被废弃,不给material分组了
|
|
|
this.size = size;this.material.size = size;
|
|
@@ -81193,6 +81201,8 @@ void main()
|
|
|
}
|
|
|
}
|
|
|
this.editStateChange(true);
|
|
|
+
|
|
|
+ viewer.dispatchEvent({type:'dragMarker', object:this});
|
|
|
return true
|
|
|
}
|
|
|
|
|
@@ -81470,7 +81480,7 @@ void main()
|
|
|
e.drag.endDragFun && e.drag.endDragFun(e);// addmarker
|
|
|
|
|
|
//if(this.changeCallBack)this.changeCallBack()
|
|
|
-
|
|
|
+ viewer.dispatchEvent({type:'dropMarker', object:this});
|
|
|
return true
|
|
|
};
|
|
|
|
|
@@ -88379,6 +88389,7 @@ void main()
|
|
|
|
|
|
//TODO adapt to multiple lights
|
|
|
//this.renderShadowMap(visiblePointClouds2, camera, lights); //???????
|
|
|
+
|
|
|
|
|
|
{
|
|
|
for (let pointcloud of visiblePointClouds2) {
|
|
@@ -88391,7 +88402,7 @@ void main()
|
|
|
material.near = camera.near;
|
|
|
material.far = camera.far;
|
|
|
material.uniforms.octreeSize.value = octreeSize;
|
|
|
-
|
|
|
+
|
|
|
if(useEDL ){
|
|
|
material.useEDL = true;
|
|
|
//material.fakeEDL = false; //add
|
|
@@ -89655,7 +89666,7 @@ void main()
|
|
|
let raycaster;
|
|
|
|
|
|
viewer.addTimeMark('getIntersect','start');
|
|
|
-
|
|
|
+
|
|
|
let getByDepthTex = ()=>{
|
|
|
let intersect;
|
|
|
if(prop.pos3d){
|
|
@@ -89693,6 +89704,9 @@ void main()
|
|
|
{pickClipped: true, isMeasuring: this.isMeasuring, pickWindowSize, cameraChanged: !!prop.pos3d }
|
|
|
|
|
|
);
|
|
|
+
|
|
|
+ console.log('intersectPoint', intersectPoint);
|
|
|
+
|
|
|
//恢复
|
|
|
if(prop.pos3d){
|
|
|
viewport.view.applyToCamera(camera);
|
|
@@ -90599,6 +90613,7 @@ void main()
|
|
|
|
|
|
|
|
|
let drag = (e) => {
|
|
|
+
|
|
|
if(!this.enabled)return
|
|
|
|
|
|
let viewport = e.dragViewport;
|
|
@@ -91745,16 +91760,8 @@ void main()
|
|
|
if(this.lastView){
|
|
|
this.switchView2(this.lastView);
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
render(){
|
|
@@ -91793,56 +91800,7 @@ void main()
|
|
|
this.switchView('perspective');
|
|
|
}
|
|
|
|
|
|
- /* switchView(type, dir, done){
|
|
|
- let view = viewer.mainViewport.view
|
|
|
- if(type == 'ortho'){
|
|
|
- if(viewer.mainViewport.camera != viewer.scene.cameraO){
|
|
|
- viewer.scene.cameraO.position.copy(viewer.mainViewport.camera.position)
|
|
|
- viewer.scene.cameraO.quaternion.copy(viewer.mainViewport.camera.quaternion)
|
|
|
- viewer.mainViewport.camera = viewer.scene.cameraO
|
|
|
- viewer.setCameraMode(CameraMode.ORTHOGRAPHIC)
|
|
|
- navCubeViewer.controls.setEnable(false)
|
|
|
-
|
|
|
- //假设保持到目前中心的视角范围不变
|
|
|
- splitScreen.setShiftTarget(viewer.mainViewport, viewer.bound.center)
|
|
|
- let dis = new THREE.Vector3().subVectors(viewer.mainViewport.shiftTarget, viewer.scene.cameraO.position).length() ; //-nearestPano[0].score
|
|
|
-
|
|
|
- //根据2d->3d的式子逆求zoom
|
|
|
- let halfHeight = Math.abs(dis) * Math.tan( THREE.Math.degToRad(viewer.scene.cameraP.fov/2));
|
|
|
- viewer.scene.cameraO.zoom = viewer.scene.cameraO.top / halfHeight;
|
|
|
- viewer.scene.cameraO.updateProjectionMatrix();
|
|
|
-
|
|
|
- console.log('zoom', viewer.scene.cameraO.zoom)
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- viewer.focusOnObject(viewer.bound, 'boundingBox', 1000, {dir }).promise.done(()=>{
|
|
|
- done && done()
|
|
|
- //console.log('回2', name)
|
|
|
- navCubeViewer.dispatchEvent('content_changed')
|
|
|
- })
|
|
|
- }else{
|
|
|
-
|
|
|
- if(viewer.mainViewport.camera == viewer.scene.cameraO){
|
|
|
- //viewer.scene.cameraP.position.copy(viewer.mainViewport.camera.position)
|
|
|
- //viewer.scene.cameraP.quaternion.copy(viewer.mainViewport.camera.quaternion)
|
|
|
- viewer.mainViewport.camera = viewer.scene.cameraP
|
|
|
- viewer.setCameraMode(CameraMode.PERSPECTIVE)
|
|
|
-
|
|
|
- //假设保持到目前中心的视角范围不变
|
|
|
-
|
|
|
- splitScreen.setShiftTarget(viewer.mainViewport, viewer.bound.center)
|
|
|
- viewer.mainViewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), viewer.bound.center )
|
|
|
- viewer.mainViewport.targetPlane.projectPoint(view.position, viewer.mainViewport.shiftTarget )
|
|
|
-
|
|
|
- let halfHeight = viewer.scene.cameraO.top/viewer.scene.cameraO.zoom
|
|
|
- let dis = halfHeight / Math.tan( THREE.Math.degToRad(viewer.scene.cameraP.fov/2))
|
|
|
-
|
|
|
- view.position.copy(viewer.mainViewport.shiftTarget).sub(view.direction.clone().multiplyScalar(dis));
|
|
|
- this.controls.setEnable(true)
|
|
|
- }
|
|
|
- }
|
|
|
- } */
|
|
|
+
|
|
|
switchView(type, {yaw, pitch, dir}={}, done){
|
|
|
if(viewer.mainViewport.view.isFlying())return
|
|
|
let view = viewer.mainViewport.view;
|
|
@@ -91852,9 +91810,7 @@ void main()
|
|
|
this.lastView.zoom = viewer.mainViewport.camera.zoom;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if(type == 'ortho'){
|
|
|
let startCamera, endCamera;
|
|
|
if(viewer.mainViewport.camera != viewer.scene.cameraO){
|
|
@@ -106127,10 +106083,13 @@ ENDSEC
|
|
|
//默认隐藏, 显示的条件:测量拖拽 或 外部消息setEnable
|
|
|
|
|
|
Potree.Utils.updateVisible(this, "default", false, 0); //默认隐藏
|
|
|
-
|
|
|
- viewer.addEventListener("MeasureDragChange",(e)=>{//测量drag
|
|
|
- Potree.Utils.updateVisible(this, "measure", e.state, 1, e.state?'add':'cancel');
|
|
|
- });
|
|
|
+
|
|
|
+ viewer.addEventListener("dragMarker",(e)=>{//测量drag
|
|
|
+ Potree.Utils.updateVisible(this, "measure", true, 1, 'add' );
|
|
|
+ });
|
|
|
+ viewer.addEventListener("dropMarker",(e)=>{//测量drag
|
|
|
+ Potree.Utils.updateVisible(this, "measure", false, 1, 'cancel' );
|
|
|
+ });
|
|
|
|
|
|
|
|
|
viewer.scene.view.addEventListener('flyingDone',()=>{
|
|
@@ -139313,10 +139272,16 @@ ENDSEC
|
|
|
var inv = camera.matrixWorldInverse;
|
|
|
}else {
|
|
|
var cameraTemp = camera.clone();
|
|
|
- cameraTemp.position.copy(cameraPos);
|
|
|
- cameraTemp.lookAt(target);
|
|
|
- cameraTemp.updateMatrix();
|
|
|
- cameraTemp.updateMatrixWorld();
|
|
|
+
|
|
|
+ let view = viewer.mainViewport.view.clone();
|
|
|
+ view.position.copy(cameraPos);
|
|
|
+ view.lookAt(target);
|
|
|
+ if(o.endPitch != void 0){
|
|
|
+ view.pitch = o.endPitch;
|
|
|
+ view.yaw = o.endYaw;
|
|
|
+ }
|
|
|
+ view.applyToCamera(cameraTemp);
|
|
|
+
|
|
|
//对镜头的bound
|
|
|
var inv = cameraTemp.matrixWorldInverse;
|
|
|
}
|
|
@@ -139329,7 +139294,7 @@ ENDSEC
|
|
|
scale = 1.3;
|
|
|
}else {
|
|
|
bound = boundingBox.applyMatrix4(inv);
|
|
|
- scale = 0.9;
|
|
|
+ scale = 1.0;//0.9;
|
|
|
}
|
|
|
|
|
|
boundSize = bound.getSize(new Vector3);
|
|
@@ -139464,7 +139429,7 @@ ENDSEC
|
|
|
if(Potree.settings.displayMode == 'showPointCloud'){ //点云
|
|
|
let minDis = 0.3;
|
|
|
|
|
|
- //if(o.checkIntersect){
|
|
|
+ if(o.checkIntersect){
|
|
|
let checkIntersect = ( )=>{
|
|
|
let intersect = this.inputHandler.ifBlockedByIntersect({pos3d:position, cameraPos: target});// 不一定准确
|
|
|
if(intersect){
|
|
@@ -139518,7 +139483,7 @@ ENDSEC
|
|
|
|
|
|
checkIntersect();
|
|
|
//多折线没有areaPlane 有时候会看向空白区域 - -
|
|
|
- //}
|
|
|
+ }
|
|
|
}else if(Potree.settings.displayMode == 'showPanos'){//全景 (比较难校准)
|
|
|
let target2, dir;
|
|
|
if( object.measureType.includes('MulDistance')){//因为该线不闭合,可能看向target的方向会没有线,所以换一个target
|