|
@@ -659,7 +659,7 @@ export class Viewer extends ViewerBase{
|
|
},
|
|
},
|
|
set: (far)=>{
|
|
set: (far)=>{
|
|
if(far != cameraFar){
|
|
if(far != cameraFar){
|
|
- if(Potree.settings.displayMode != 'showPanos'){
|
|
|
|
|
|
+ if(Potree.settings.displayMode != 'showPanos' && !this.fixCamFar){
|
|
this.mainViewport.camera.far = far;
|
|
this.mainViewport.camera.far = far;
|
|
this.mainViewport.camera.updateProjectionMatrix()
|
|
this.mainViewport.camera.updateProjectionMatrix()
|
|
}
|
|
}
|
|
@@ -806,12 +806,13 @@ export class Viewer extends ViewerBase{
|
|
console.warn('visibilitychange', v )
|
|
console.warn('visibilitychange', v )
|
|
this.dispatchEvent({type:'pageVisible', v } )
|
|
this.dispatchEvent({type:'pageVisible', v } )
|
|
|
|
|
|
- if(this.screenshoting && !v){
|
|
|
|
|
|
+ if(this.screenshoting && !v){//截图过程中离开页面需要照常loop。但是尽量别离开页面,效果只能达到90%
|
|
interval = setInterval(()=>{
|
|
interval = setInterval(()=>{
|
|
|
|
+ //console.log('force loop', Date.now())
|
|
if(this.screenshoting){ //截图完成时如果还没回来就不loop
|
|
if(this.screenshoting){ //截图完成时如果还没回来就不loop
|
|
this.loop(Date.now())
|
|
this.loop(Date.now())
|
|
}
|
|
}
|
|
- },30)
|
|
|
|
|
|
+ },50) //实际>1000, 浏览器会放慢定时器,放慢多少不确定
|
|
}else if(v && interval){
|
|
}else if(v && interval){
|
|
clearInterval(interval)
|
|
clearInterval(interval)
|
|
}
|
|
}
|
|
@@ -3675,20 +3676,25 @@ export class Viewer extends ViewerBase{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- let maxTime = 1000
|
|
|
|
|
|
+ let maxTime = document.hidden ? 6000 : 1000 //离开页面后会变成1秒1帧
|
|
|
|
+
|
|
setTimeout(()=>{
|
|
setTimeout(()=>{
|
|
if(Potree.pointsLoading && Potree.settings.displayMode == 'showPointCloud'){//如果还在加载
|
|
if(Potree.pointsLoading && Potree.settings.displayMode == 'showPointCloud'){//如果还在加载
|
|
|
|
|
|
viewer.addEventListener('pointsLoaded',()=>{ //点云加载完时(不一定准确)
|
|
viewer.addEventListener('pointsLoaded',()=>{ //点云加载完时(不一定准确)
|
|
- //if(!finish)console.warn('加载完毕', ' numVisiblePoints', Potree.numVisiblePoints)
|
|
|
|
|
|
+ if(!finish)console.warn('加载完毕', ' numVisiblePoints', Potree.numVisiblePoints)
|
|
dealDone()
|
|
dealDone()
|
|
},{once:true})
|
|
},{once:true})
|
|
|
|
|
|
-
|
|
|
|
- setTimeout(()=>{//超时不候(其实之后等待地图还会再加载几秒)
|
|
|
|
- //if(!finish)console.warn('超时, numVisiblePoints', Potree.numVisiblePoints)
|
|
|
|
|
|
+ let overTime = ()=>{//超时不候(其实之后等待地图还会再加载几秒)
|
|
|
|
+ if(document.hidden){
|
|
|
|
+ return setTimeout(overTime, maxTime)
|
|
|
|
+ }
|
|
|
|
+ if(!finish)console.warn('超时, numVisiblePoints', Potree.numVisiblePoints)
|
|
dealDone()
|
|
dealDone()
|
|
- },maxTime)
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setTimeout(overTime, maxTime)
|
|
}else{
|
|
}else{
|
|
dealDone()
|
|
dealDone()
|
|
}
|
|
}
|
|
@@ -4233,6 +4239,23 @@ export class Viewer extends ViewerBase{
|
|
else pointcloud = this.scene.pointclouds.find(p => p.dataset_id == o.id);
|
|
else pointcloud = this.scene.pointclouds.find(p => p.dataset_id == o.id);
|
|
|
|
|
|
let duration = o.duration == void 0 ? 1000 : o.duration
|
|
let duration = o.duration == void 0 ? 1000 : o.duration
|
|
|
|
+ if(o.focusOnPoint){//focus点云上一点,避免center区域刚好没有点
|
|
|
|
+ if(pointcloud.root.geometryNode){
|
|
|
|
+ let posArr = pointcloud.root.geometryNode.geometry.attributes.position.array
|
|
|
|
+
|
|
|
|
+ let count = pointcloud.root.geometryNode.geometry.attributes.position.count
|
|
|
|
+ let index = Math.ceil(count / 2) //随便取一个点
|
|
|
|
+ let point = new THREE.Vector3(posArr[index*3+0],posArr[index*3+1],posArr[index*3+2])
|
|
|
|
+ //point.applyMatrix4(pointcloud.root.pointcloud.matrixWorld)
|
|
|
|
+ point.applyMatrix4(pointcloud.root.sceneNode.matrixWorld)
|
|
|
|
+ viewer.focusOnObject({position:point},'point',duration,{dontChangeCamDir:true, distance:15})
|
|
|
|
+
|
|
|
|
+ o.dontMoveMap || viewer.mapViewer.fitToPointcloud(pointcloud, duration)
|
|
|
|
+ console.log('flyToDataset focusOnPoint done')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
var center = pointcloud.bound.getCenter(new THREE.Vector3);
|
|
var center = pointcloud.bound.getCenter(new THREE.Vector3);
|
|
let position
|
|
let position
|
|
let getPano = ()=>{//获取离中心最近的pano
|
|
let getPano = ()=>{//获取离中心最近的pano
|
|
@@ -4450,10 +4473,10 @@ export class Viewer extends ViewerBase{
|
|
|
|
|
|
loop(timestamp){
|
|
loop(timestamp){
|
|
//let startTime = performance.now()
|
|
//let startTime = performance.now()
|
|
- console.log('间隔:' /*, parseInt((startTime - this.lastEndTime)*100 )/100 */)
|
|
|
|
- if(this.paused)return
|
|
|
|
|
|
+ //console.log('间隔:' /*, parseInt((startTime - this.lastEndTime)*100 )/100 */)
|
|
|
|
+ if(this.paused)return
|
|
if(performance.getEntriesByName("loopWaitNext-start").length)viewer.addTimeMark('loopWaitNext','end')
|
|
if(performance.getEntriesByName("loopWaitNext-start").length)viewer.addTimeMark('loopWaitNext','end')
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
if(this.stats){
|
|
if(this.stats){
|
|
this.stats.begin();
|
|
this.stats.begin();
|
|
@@ -5112,7 +5135,13 @@ export class Viewer extends ViewerBase{
|
|
this.paused = !state
|
|
this.paused = !state
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
addFire(){
|
|
addFire(){
|
|
|
|
|
|
if(Potree.settings.number == 't-CwfhfqJ'){
|
|
if(Potree.settings.number == 't-CwfhfqJ'){
|