|
@@ -74161,8 +74161,8 @@ void main()
|
|
|
let maxLevel = pointcloud.maxLevel == void 0 ? Infinity : pointcloud.maxLevel;
|
|
|
let level = node.getLevel();
|
|
|
let visible = insideFrustum;
|
|
|
- visible = visible && !(numVisiblePoints + node.getNumPoints() > Potree.pointBudget);
|
|
|
- visible = visible && !(numVisiblePointsInPointclouds.get(pointcloud) + node.getNumPoints() > pointcloud.pointBudget); // pointcloud.pointBudget一直是Infinity
|
|
|
+ visible = visible && (Potree.settings.pointNoLimit || !(numVisiblePoints + node.getNumPoints() > Potree.pointBudget));
|
|
|
+ visible = visible && (Potree.settings.pointNoLimit || !(numVisiblePointsInPointclouds.get(pointcloud) + node.getNumPoints() > pointcloud.pointBudget)); // pointcloud.pointBudget一直是Infinity
|
|
|
visible = visible && level <= maxLevel; //< 改为 <=
|
|
|
//visible = visible || node.getLevel() <= 2;
|
|
|
|
|
@@ -74274,7 +74274,7 @@ void main()
|
|
|
lowestSpacing = Math.min(lowestSpacing, node.geometryNode.spacing);
|
|
|
}
|
|
|
|
|
|
- if (numVisiblePoints + node.getNumPoints() > Potree.pointBudget) {
|
|
|
+ if (!Potree.settings.pointNoLimit && numVisiblePoints + node.getNumPoints() > Potree.pointBudget) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -74437,11 +74437,24 @@ void main()
|
|
|
for (let i = 0; i < Math.min(maxNodesLoading, unloadedGeometry.length); i++) {
|
|
|
unloadedGeometry[i].node.load(unloadedGeometry[i].pointcloud.pcoGeometry);
|
|
|
}
|
|
|
+ if(!Potree.pointsLoading){
|
|
|
+ Potree.pointsLoading = true;
|
|
|
+ console.log('startLoad');
|
|
|
+ viewer.dispatchEvent('startLoadPoints');
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(Potree.pointsLoading){
|
|
|
+ Potree.pointsLoading = false;
|
|
|
+ console.log('load done!');
|
|
|
+ setTimeout(()=>{
|
|
|
+ Potree.pointsLoading || viewer.dispatchEvent('pointsLoaded');
|
|
|
+ },50);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
//add:
|
|
|
Potree.numVisiblePoints = numVisiblePoints;
|
|
|
|
|
@@ -75393,21 +75406,25 @@ void main()
|
|
|
maxLevelPercent: 0.4, //最小为0
|
|
|
percentByUser:true, //如果用户定义了percent,使用用户的
|
|
|
pointBudget : browser.isMobile() ? 1*1000*1000 : 2*1000*1000,
|
|
|
- minNodeSize : 40 / window.devicePixelRatio ,
|
|
|
+ minNodeSize : 50 / window.devicePixelRatio ,
|
|
|
},
|
|
|
middle:{//balanced //不同场景相同级别所产生的numVisibleNodes和numVisiblePoints不同,如果分层比较细,可能要到level8才能看清,那么level5看到的点就很大且很少,如隧道t-e2Kb2iU
|
|
|
maxLevelPercent: 0.7,
|
|
|
percentByUser:true,
|
|
|
pointBudget: browser.isMobile() ? 2.0*1000*1000 : 3.5*1000*1000,
|
|
|
- minNodeSize : 30 / window.devicePixelRatio ,
|
|
|
+ minNodeSize : 40 / window.devicePixelRatio ,
|
|
|
},
|
|
|
high:{//highQuality
|
|
|
maxLevelPercent: 1,
|
|
|
percentByUser:true,
|
|
|
- pointBudget:browser.isMobile() ? 3*1000*1000 : 6*1000*1000, //原本最高是8,但是大部分电脑都太卡了,降
|
|
|
- minNodeSize : 20 / window.devicePixelRatio , //手机上因为像素点小,远一点的时候更需要加载密集的点云。(没事,有pointBudget限制着,会先从近处加载高级node,再远就不加载了)
|
|
|
+ pointBudget:browser.isMobile() ? 4*1000*1000 : 6*1000*1000, //原本最高是8,但是大部分电脑都太卡了,降
|
|
|
+ minNodeSize : 40 / window.devicePixelRatio , //手机上因为像素点小,远一点的时候更需要加载密集的点云。(没事,有pointBudget限制着,会先从近处加载高级node,再远就不加载了)
|
|
|
+ },
|
|
|
+ screenshot:{
|
|
|
+ maxLevelPercent: 1,
|
|
|
+ pointBudget: 8*1000*1000,
|
|
|
+ minNodeSize : 40 / window.devicePixelRatio ,
|
|
|
}
|
|
|
-
|
|
|
|
|
|
//数值由testLevelSteps得来,其中nodeMaxLevel为2时,low和middle的都是1,如果真有这么低的点云就单独处理下。
|
|
|
//多个viewport尽量保证pointBudget一样,或者pointBudget不能太低于所需,否则会反复加载了又清除
|
|
@@ -75548,7 +75565,7 @@ void main()
|
|
|
ultraHighQualityMaxZoom: 3,
|
|
|
panoFieldRadius : 10, //当前位置多远范围内可以切全景模式
|
|
|
clickMaxDragDis:5,
|
|
|
- clickMaxPressTime:100, //ms 设置过大的话,点击两下不会触发完成
|
|
|
+ clickMaxPressTime:500, //ms
|
|
|
doubleClickTime:200,//双击间隔时间
|
|
|
testNodeCount1: browser.isMobile() ? 5 : 3, //testMaxNode次数达到这个数字时,changePointSize才使用nodeMaxLevel。 (调试时比较卡,在线上实际只需要3)
|
|
|
|
|
@@ -81589,7 +81606,7 @@ void main()
|
|
|
|| !e.isAtDomElement && this.isNew//如果是刚添加时在其他dom点击, 不要响应
|
|
|
|| e.hoverViewport != viewer.mainViewport && this.unableDragAtMap //垂直的测量线不允许在地图上放点
|
|
|
|| this.isNew && !getDifferentPoint(this.points, this.points.length ) //不允许和之前的点相同, 但这句在点云稀疏时会导致难结束
|
|
|
- || this.isNew && (Date.now() - this.beginAddTime) < Potree.config.clickMaxPressTime && e.pressDistance < Potree.config.clickMaxDragDis/* && e.pressTime<Potree.config.clickMaxPressTime */ //有的设备过于灵敏,点击一下就结束测量了,是因为滑动了被判断为拖拽。所以判断下如果滑动距离过近不时间过短就算单击
|
|
|
+ || this.isNew && (Date.now() - this.beginAddTime) < Potree.config.clickMaxPressTime/5 && e.pressDistance < Potree.config.clickMaxDragDis/* && e.pressTime<Potree.config.clickMaxPressTime */ //有的设备过于灵敏,点击一下就结束测量了,是因为滑动了被判断为拖拽。所以判断下如果滑动距离过近不时间过短就算单击
|
|
|
|
|
|
)
|
|
|
){
|
|
@@ -88633,7 +88650,7 @@ void main()
|
|
|
|
|
|
let target = params.target || null;
|
|
|
|
|
|
- const resolution = (rtEDL && Potree.settings.useRTPoint) ? new Vector2(rtEDL.width,rtEDL.height) : params.viewport ? params.viewport.resolution2 : this.viewer.renderer.getSize(new Vector2());//突然发现mobile用resolution2点云会放大
|
|
|
+ const resolution = (rtEDL && Potree.settings.useRTPoint) ? new Vector2(rtEDL.width,rtEDL.height) : params.target ? new Vector2(params.target.width, params.target.height ) : params.viewport ? params.viewport.resolution2 : this.viewer.renderer.getSize(new Vector2());//突然发现mobile用resolution2点云会放大
|
|
|
|
|
|
|
|
|
|
|
@@ -131979,19 +131996,33 @@ ENDSEC
|
|
|
|
|
|
this.writeBuffer = this.renderTarget1;
|
|
|
this.readBuffer = this.renderTarget2;
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
|
|
|
setSize: function ( width, height, scaleRatio ) {
|
|
|
-
|
|
|
+
|
|
|
scaleRatio = scaleRatio || this.scaleRatio || 1;
|
|
|
//console.log('setSize', width * scaleRatio, height * scaleRatio)
|
|
|
- this.renderTarget1.setSize( width * scaleRatio , height * scaleRatio );
|
|
|
- this.renderTarget2.setSize( width * scaleRatio, height * scaleRatio );
|
|
|
+ let maxTexWidth = 8192;
|
|
|
+ let w = width * scaleRatio;
|
|
|
+ let h = height * scaleRatio;
|
|
|
+ if(w > maxTexWidth || h > maxTexWidth){ //超出会崩溃
|
|
|
+ if(w>h){
|
|
|
+ scaleRatio = maxTexWidth / width;
|
|
|
+ }else {
|
|
|
+ scaleRatio = maxTexWidth / height;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ w = width * scaleRatio;
|
|
|
+ h = height * scaleRatio;
|
|
|
+
|
|
|
+
|
|
|
+ this.renderTarget1.setSize( w, h );
|
|
|
+ this.renderTarget2.setSize( w, h );
|
|
|
|
|
|
for ( var i = 0; i < this.passes.length; i ++ ) {
|
|
|
|
|
|
- this.passes[ i ].setSize( width * scaleRatio, height * scaleRatio );
|
|
|
+ this.passes[ i ].setSize( w, h );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -134349,7 +134380,7 @@ ENDSEC
|
|
|
*/
|
|
|
|
|
|
this.composer = new EffectComposer( this.renderer );
|
|
|
- this.composer.scaleRatio = 4; //将底图和测量线绘制在一张高倍贴图上,for测量线不模糊
|
|
|
+ this.composer.scaleRatio = 2; //将底图和测量线绘制在一张高倍贴图上,for测量线不模糊
|
|
|
this.composer.readTarget = true; //把底图和测量线一起fxaa
|
|
|
const renderPass = new RenderPass();
|
|
|
|
|
@@ -137262,6 +137293,14 @@ ENDSEC
|
|
|
};
|
|
|
|
|
|
{//恢复:
|
|
|
+ setTimeout(()=>{
|
|
|
+ if(!this.screenshoting){
|
|
|
+ Potree.settings.pointNoLimit = false;
|
|
|
+ Potree.settings.pointDensity = 'high';
|
|
|
+ }
|
|
|
+ },100); //延迟:避免连续多次截图时释放点云
|
|
|
+ this.screenshoting = false;
|
|
|
+
|
|
|
|
|
|
if(info.type == 'measure'){
|
|
|
this.scene.measurements.forEach(e=>Potree.Utils.updateVisible(e, 'screenshot',true));
|
|
@@ -137374,7 +137413,9 @@ ENDSEC
|
|
|
Potree.Utils.updateVisible(this.reticule, 'screenshot', false);//令reticule不可见
|
|
|
|
|
|
|
|
|
-
|
|
|
+ //Potree.settings.pointNoLimit = true //使点云加载不受 pointBudget限制, 但缓存还是会有一个最大限制
|
|
|
+ Potree.settings.pointDensity = 'screenshot';
|
|
|
+
|
|
|
|
|
|
|
|
|
if(info.type == 'measure'){//要截图双屏
|
|
@@ -137405,6 +137446,7 @@ ENDSEC
|
|
|
};
|
|
|
|
|
|
let {promise}= this.focusOnObject(info.measurement, 'measure', 0, {basePanoSize:1024} );//注意:不同角度截图 得到三维的会不一样,因为focusOnObject是根据方向的
|
|
|
+
|
|
|
promise.done(()=>{
|
|
|
//console.log('promise.done')
|
|
|
//根据当前位置更新floorplan显示
|
|
@@ -137429,15 +137471,31 @@ ENDSEC
|
|
|
|
|
|
});
|
|
|
|
|
|
- }else {
|
|
|
- screenshot();
|
|
|
+ }else {
|
|
|
+ //viewer.dispatchEvent('content_changed')
|
|
|
+ setTimeout(()=>{
|
|
|
+ if(Potree.pointsLoading){//如果还在加载
|
|
|
+ viewer.addEventListener('pointsLoaded',()=>{
|
|
|
+ screenshot();
|
|
|
+ },{once:true});
|
|
|
+ }else {
|
|
|
+ screenshot();
|
|
|
+ }
|
|
|
+ },300);//先加载一段时间
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
测量线的截图因为要调用分屏的,会改变画面
|
|
|
但是普通截图的话,不会改变画面
|
|
|
*/
|
|
|
-
|
|
|
+ this.screenshoting = true;
|
|
|
return {getImagePromise:getImageDeferred.promise(), finishPromise:finishDeferred.promise()}
|
|
|
|
|
|
|
|
@@ -139480,7 +139538,7 @@ ENDSEC
|
|
|
let pointBudget = 1 * 1000 * 1000;
|
|
|
let framenumber = 0;
|
|
|
let numNodesLoading = 0;
|
|
|
- let maxNodesLoading = 4;
|
|
|
+ let maxNodesLoading = 4;
|
|
|
|
|
|
const debug = {};
|
|
|
|