xzw 1 anno fa
parent
commit
a97ee2d782

+ 7 - 0
libs/three.js/3dtiles/three-loader-3dtiles.esm.js

@@ -17739,7 +17739,14 @@ class Loader3DTiles {
                         
                         if(!ifForce) ifForce = tileset.nextForceUpdate
                         tileset.nextForceUpdate = false
+                        if(tileset.needRenderNext){//必须在下一帧渲染刷新否则无法显示
+                            viewer.dispatchEvent('content_changed')
+                        } 
+                        tileset.needRenderNext = ifForce
                         
+                        
+                        
+                       
                         if (tileset && (timer >= UPDATE_INTERVAL || ifForce)) {
                             if (!lastRootTransform.equals(root.matrixWorld)) {
                                 timer = 0;

+ 7 - 1
libs/three.js/loaders/GLTFLoader.js

@@ -3320,7 +3320,13 @@ class GLTFParser {
                 //为了防止chrome出现报错  The source image could not be decoded. 导致reject,重新写贴图加载方式: xzw
 
                 parser.textureLoader.load(sourceURI, (tex)=>{
-                    tex.minFilter = THREE.LinearMipmapLinearFilter //原本:NearestMipMapNearestFilter 闪烁
+                    
+                    THREE.LinearMipmapLinearFilter //原本:NearestMipMapNearestFilter 闪烁
+                    //有一个block文件离远了有裂缝,只能使用LinearFilter,但是这样似乎更卡,且锯齿
+                    /* tex.minFilter = THREE.LinearFilter
+                    tex.generateMipmaps = false */
+                    
+                    
                     
                     Potree.Utils.makeTexDontResize(tex) 
                     //console.log(tex.image.width, tex.image.height)

+ 3 - 3
src/ExtendPointCloudOctree.js

@@ -225,8 +225,8 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
 		let getVal = (a, b) => a != void 0 ? a : b;
         
         
-      
-        let pickWindowSize_ = THREE.Math.clamp( Math.round((1.1-this.maxLevel/this.nodeMaxLevel)*80),  5, 100)
+        let r0 = this.nodeMaxLevel > 0 ? this.maxLevel/this.nodeMaxLevel : 0.5
+        let pickWindowSize_ = THREE.Math.clamp( Math.round((1.1-r0)*80),  5, 100)
 		let pickWindowSize = getVal(params.pickWindowSize, pickWindowSize_    ); /* 65 */ //拾取像素边长,越小越精准,但点云稀疏的话可能容易出现识别不到的情况。 另外左下侧会有缝隙无法识别到,缝隙大小和这个值有关//突然发现pickWindowSize在一百以内的变化对pick费时影响甚微,1和100差1毫秒不到,但400时会多4毫秒
             
         if(camera.type == 'OrthographicCamera'){
@@ -565,7 +565,7 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
                 }else{
                     
                     let base = this.material.spacing / Math.pow(2, this.maxLevel) //点云大小在level为0时设置为spacing,每长一级,大小就除以2.  (不同场景还是会有偏差)
-                    let r = this.maxLevel /  nodeMaxLevel  //越大,越精细,需要越缩小
+                    let r = nodeMaxLevel > 0 ? this.maxLevel /  nodeMaxLevel : 0.5  //越大,越精细,需要越缩小
                     base *=  nodeMaxLevel > 0 ? Math.max(0.1, Math.pow(r, 3*r+0.3 )) : 0.1 //低质量的缩小点,因为视觉上看太大了。navvis是不铺满的,我们也留一点缝隙(但是ortho是不用缩小的,如果能分开判断就好了)
                     
                     //base *=  nodeMaxLevel > 0 ? Math.max(0.1, Math.pow(this.maxLevel /  nodeMaxLevel, 1.1)) : 0.1 //低质量的缩小点,因为视觉上看太大了。navvis是不铺满的,我们也留一点缝隙(但是ortho是不用缩小的,如果能分开判断就好了)

+ 22 - 5
src/Potree.js

@@ -151,9 +151,10 @@ export {scriptPath, resourcePath};
 //add: 
 export async function loadFile(path, params , callback, onError){
     params = params || {}
-    if(Potree.fileServer){
-         
-        Potree.fileServer.get(path, { params }).then(data=>{ 
+    let fetchMethod = params.fetchMethod || 'get'
+    delete params.fetchMethod
+    if(Potree.fileServer){ 
+        Potree.fileServer[fetchMethod](path, { params }).then(data=>{ 
             if(data.data)data = data.data
             if(data.data)data = data.data //融合页面getdataset需要查找两次data
             callback && callback(data)
@@ -169,9 +170,10 @@ export async function loadFile(path, params , callback, onError){
                     index ++ 
                 }
             }
-             
+            let info={}
+            if(fetchMethod == 'post')info.method = 'POST'
             
-            let response = await fetch(path); 
+            let response = await fetch(path, info); 
             let text = await response.text();
             var data = JSON.parse(text)
             if(data.data) data = data.data
@@ -288,6 +290,21 @@ export async function loadPanosInfo(callback){
 
 
 
+export async function loadImgVersion( callback){
+    var path 
+    //let query = `?datasetId=${datasetId}`                  //`?lat=${center.lat}&lon=${center.lon}&radius=200000`
+    /* if(Potree.fileServer){
+        path = `/laser/filter/${Potree.settings.number}/query` 
+    }else{  */
+        path = `/laser/init/getSceneNumVersion/${Potree.settings.number}` 
+     //api/laser/init
+    //}
+    return loadFile(path, {fetchMethod:'post'}, callback, callback) 
+    
+}
+
+
+
 //site_model
 /* {
     "area": 2503.30551910935,

+ 3 - 3
src/custom/mergeStartTest.js

@@ -519,11 +519,11 @@ var start = function(dom, mapDom, number, fileServer, webSite){ //t-Zvd3w0m
                 },callback,onprogress) */
                 
             }else if(name == 'glb'){
-                
+                 
                 let angle = 0
-                let fileName = '87b3a367bc3e4273832cb4fa398782e5.glb'    
-                
+                let fileName = 'block-远看有裂缝.glb'//'87b3a367bc3e4273832cb4fa398782e5.glb'    
                 
+                 
                 /* let angle = Math.PI/2
                 let fileName = 'coffeemat.glb',  //0.3s */
                  

+ 2 - 2
src/custom/modules/datasetAlignment/Alignment.js

@@ -289,7 +289,7 @@ var Alignment = {
     
     
     
-    
+     
     enter:function(){
         //this.saveTemp()  
         this.originData = this.getTemp() 
@@ -298,7 +298,7 @@ var Alignment = {
          
         /* viewer.images360.panos.forEach(pano=>{
             Potree.Utils.updateVisible(pano.mapMarker, 'split4Screens', false)
-        }) */ 
+        }) */  
         
         viewer.viewports.find(e=>e.name == 'mapViewport').alignment = {rotate:true,translate:true};
         viewer.viewports.find(e=>e.name == 'right').alignment = {translate:true, translateVec:new THREE.Vector3(0,0,1)}; //只能上下移动

+ 11 - 9
src/custom/modules/panos/Images360.js

@@ -407,7 +407,7 @@ export class Images360 extends THREE.EventDispatcher{
                                 viewer.scene.pointclouds.forEach(e=>{
                                     e.material.pointSizeType = 'FIXED'   
                                 })
-                            } 
+                            }  
                             this.updateCube(this.currentPano)
                             
                         }else{
@@ -1157,7 +1157,7 @@ export class Images360 extends THREE.EventDispatcher{
 
 
 
-    isNeighbour(pano0, pano1, dontCompute, onlyUseTex,  computeDirFirst){//是否之间没有遮挡(在加载visibles之前,自己算) 最好pano0是currentPano
+    isNeighbour(pano0, pano1, {dontCompute, onlyUseTex,  computeDirFirst, computeTwoDir}={}){//是否之间没有遮挡(在加载visibles之前,自己算) 最好pano0是currentPano
          
         if(!pano0 || !pano1 )return
         
@@ -1202,7 +1202,7 @@ export class Images360 extends THREE.EventDispatcher{
             }
         } 
            
-        if( map0[pano1.id] == void 0 && !ifNeighbour ) {//主方向为空且不为邻居
+        if(!ifNeighbour && (map0[pano1.id] == void 0 || (computeTwoDir && map1[pano0.id] == void 0))) {//主方向为空且不为邻居
             let simpleJudge = pano0.position.distanceToSquared(pano1.position) > 300 //在远处去掉对floorPosition的判断
             if(pano0.depthTex || pano1.depthTex){
                              
@@ -1216,7 +1216,7 @@ export class Images360 extends THREE.EventDispatcher{
                     map0[pano1.id] = !!is        
                 }
                  
-                if( ifNeighbour == void 0 && /* map1[pano0.id] == void 0 && */ pano1.depthTex){ //若正向为false,反向暂且不算,等到pano0为主时再算
+                if(map1[pano0.id] == void 0 && pano1.depthTex){  
                     let is = getNeighbour(pano1, pano0, !ifNeighbour, simpleJudge)
                     if(is){
                         ifNeighbour = true
@@ -1425,8 +1425,7 @@ export class Images360 extends THREE.EventDispatcher{
                     } 
                 } */ 
                 // 不会再changeTex了
-                
-                let isNeighbour = this.isNeighbour(this.currentPano, pano,  false, true);  
+                let isNeighbour = this.isNeighbour(this.currentPano, pano,  {onlyUseTex:true});  
                  
                 if(isNeighbour || pano.noNeighbour && disSquareMap.get(pano) < 200){//在靠近孤立点时可以通行。但是不好把握这个距离,太远的话很多地方都会不小心到孤立点,太近的话可能永远到不了。
                     return true
@@ -1451,7 +1450,7 @@ export class Images360 extends THREE.EventDispatcher{
             Images360.scoreFunctions[o]( this.position, direction, true),
                
             (pano)=>{
-                let neighbour = this.isNeighbour(this.currentPano, pano, true, true) //不计算的
+                let neighbour = this.isNeighbour(this.currentPano, pano, {dontCompute:true, isNeighbour:true}) //不计算的
                                                                                         
                 return neighbour ? directionFactor  : 0; 
             }  ,
@@ -2285,10 +2284,13 @@ Images360.prototype.getNeighbours = function(){ //逐渐自动获取neighbours
              
             for(let a=0, b=g.length; a<b; a++){
                 let item = g[a]
-                if(this.isNeighbour(pano, item.item,  true) != void 0) continue
+                if(item.item == pano)continue  
+                if(this.isNeighbour(pano,item.item,{dontCompute:true}) || this.neighbourMap[pano.id][item.item.id]!= void 0 && this.neighbourMap[item.item.id][pano.id]!= void 0)continue //为true或两个方向都算了的
                 
+                //console.log('check isNeighbour', pano.id, item.item.id)
+                 
                 let byCloud = !pano.pointcloud.hasDepthTex
-                let result = this.isNeighbour(pano, item.item,  false, !byCloud, true)//计算 
+                let result = this.isNeighbour(pano, item.item,  {onlyUseTex: !byCloud, computeDirFirst:true, computeTwoDir:true})//计算 
                 
                 if(result != void 0){//计算了 
                     //console.log('提前计算neighbor', pano.id,  item.item.id)

+ 7 - 5
src/custom/modules/panos/Panorama.js

@@ -82,7 +82,7 @@ class Panorama extends THREE.EventDispatcher{
             if(e.reason == 'screenshot' || e.visible){
                 this.label && (this.label.visible = e.visible)//截图时隐藏下
             }
-            //this.label2 && Potree.Utils.updateVisible(this.label2, 'panoVisi', e.visible)
+            this.label2 && Potree.Utils.updateVisible(this.label2, 'panoVisi', e.visible)
         })
         /*  
         漫游点可见性:旧
@@ -251,8 +251,10 @@ class Panorama extends THREE.EventDispatcher{
     loadDepthImg(){ 
         if(!this.pointcloud.hasDepthTex || this.depthTex || this.depthTexLoading)return
         this.depthTexLoading = true
-        let src = //Potree.settings.number == 'SS-t-7DUfWAUZ3V' ?  `${Potree.scriptPath}/data/${Potree.settings.number}/depthMap/${this.originID}.png` :
-                 `${Potree.settings.urls.prefix1}/${Potree.settings.webSite}/${this.pointcloud.sceneCode}/data/${this.pointcloud.sceneCode}/depthmap/${this.originID}.png`
+        let mapping = Potree.settings.isLocal2 ? '' : this.pointcloud.datasetData.mapping //非离线包的话加mapping
+        let src = `${Potree.settings.urls.prefix1}/${mapping?(mapping+'/'):''}${Potree.settings.webSite}/${this.pointcloud.sceneCode}/data/${this.pointcloud.sceneCode}/depthmap/${this.originID}.png` 
+               
+               //  `${Potree.settings.urls.prefix1}/${Potree.settings.webSite}/${this.pointcloud.sceneCode}/data/${this.pointcloud.sceneCode}/depthmap/${this.originID}.png`
         //console.log('开始下载depthImg', this.id)
         let texture = texLoader.load( src, ()=>{
             this.depthTex = texture
@@ -566,11 +568,11 @@ class Panorama extends THREE.EventDispatcher{
         //let s = 0.25
         //this.label2.scale.set(s,s,s)
         Potree.Utils.updateVisible(this.label2, 'notDisplay', false)
-        //Potree.Utils.updateVisible(this.label2, 'panoVisi', this.visible)
+        Potree.Utils.updateVisible(this.label2, 'panoVisi', this.visible)
         
         
         
-        Potree.Utils.setObjectLayers(this.label2, 'bothMapAndScene') 
+        //Potree.Utils.setObjectLayers(this.label2, 'bothMapAndScene') 
     }
     
     removeTextLabel(){

+ 24 - 5
src/custom/modules/panos/tile/TileDownloader.js

@@ -379,8 +379,8 @@ class TileDownloader extends THREE.EventDispatcher{
 
     getTiles(d, sceneNum, useV4url, pointcloud){ 
         
-        if(Potree.settings.isLocal2 && !this.local2SrcFailed || useV4url){//新的地址  scene_view_data/场景码/images/tiles
-            if(pointcloud.datasetData.mapping){
+        if(Potree.settings.isLocal && !this.local2SrcFailed || useV4url){//新的地址  scene_view_data/场景码/images/tiles
+            if(pointcloud.datasetData.mapping && !Potree.settings.isLocal2){//非离线包的话加mapping
                 return `${Potree.settings.urls.prefix3}/${pointcloud.datasetData.mapping}/scene_view_data/${sceneNum}/images/${d}`  
             }else{
                 return `${Potree.settings.urls.prefix3}/scene_view_data/${sceneNum}/images/${d}` 
@@ -517,10 +517,29 @@ TileDownloader.prototype.getTileUrl = function() {
             d = this.getTiles(d, sceneCode, useV4url, o.pano.pointcloud);
             g = "&" 
         } 
-        
-        d += g + 'time='+o.pano.pointcloud.timeStamp  //加后缀
-         
+        //Potree.settings.panoVersion = 4
+        d += g + (Potree.settings.panoVersion ? 'version='+Potree.settings.panoVersion : 'time='+o.pano.pointcloud.timeStamp ) //加后缀
+          
         return d;
+        
+        
+        
+        
+        
+        /* 4dkk
+            getViewImagesURL(url) {
+                if (url.indexOf('&_=') !== -1) {
+                    return url
+                }
+                let version = url.indexOf('/panorama/') !== -1 ? this.linkVersion : this.imageVersion
+                if (url.indexOf('?') !== -1) {
+                    return this.$app.config.resource + `scene_view_data/${this.num}/images/${url}&_=${version}`
+                }
+                return this.$app.config.resource + `scene_view_data/${this.num}/images/${url}?_=${version}`
+            }
+            /**
+         */
+        
     }
 }();
 

+ 2 - 2
src/custom/modules/siteModel/SiteModel.js

@@ -177,7 +177,7 @@ var SiteModel = {
         
         viewer.images360.panos.forEach(pano=>{
             Potree.Utils.setObjectLayers(pano.marker, 'siteModelMapUnvisi' )
-            Potree.Utils.setObjectLayers(pano.label2, 'bothMapAndScene')             
+            //Potree.Utils.setObjectLayers(pano.label2, 'bothMapAndScene')             
         }) 
         mapViewport.layersAdd('siteModeOnlyMapVisi') //只有mapViewport能看到marker
        
@@ -205,7 +205,7 @@ var SiteModel = {
 
         viewer.images360.panos.forEach(pano=>{
             Potree.Utils.setObjectLayers(pano.marker, 'sceneObjects' ) 
-            Potree.Utils.setObjectLayers(pano.label2, 'bothMapAndScene') 
+            //Potree.Utils.setObjectLayers(pano.label2, 'bothMapAndScene') 
         })
         
         mapViewport.layersRemove('siteModeOnlyMapVisi') 

+ 1 - 0
src/custom/potree.shim.js

@@ -769,6 +769,7 @@ Utils.makeTexDontResize = function(map){//避免贴图因非2的次方而缩小
     if(THREE.Math.isPowerOfTwo(map.image.width ) && THREE.Math.isPowerOfTwo(map.image.height ))return
     map.wrapS = map.wrapT = THREE.ClampToEdgeWrapping; //原默认 RepeatWrapping 
     map.minFilter = THREE.LinearFilter; // or THREE.NearestFilter  原默认 LinearMipmapLinearFilter
+    map.generateMipmaps = false
     map.needsUpdate = true
 } 
 

+ 16 - 1
src/custom/start.js

@@ -290,7 +290,13 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
                         viewer.images360.addPanoData(data, dataset.id )
                         panosLoaded ++; 
                         if(panosLoaded == datasetLength){
-                            panosLoadDone() 
+                            
+                            Potree.loadImgVersion((e={})=>{ 
+                                Potree.settings.panoVersion = e.imgVersion//全景图被替换后
+                                panosLoadDone() 
+                            })
+                            
+                            
                         } 
                     })
                 })
@@ -511,6 +517,15 @@ export function panoEditStart(dom, number, fileServer){
         panoData.forEach((pano, index)=>{
             //let cloudPath = `${Potree.scriptPath}/data/panoEdit/uuidcloud/${pano.uuid}/cloud.js` 
             let cloudPath = `${Potree.settings.urls.prefix1}/${Potree.settings.webSite}/${Potree.settings.number}/data/bundle_${Potree.settings.number}/building/uuidcloud/${pano.uuid}/cloud.js`
+             
+            
+            /*  if(Potree.settings.isLocal && dataset.mapping){
+                var cloudPath = `${Potree.settings.urls.prefix1}/${dataset.mapping}/${dataset.webBin}`  //webBin添加原因:每次裁剪之类的操作会换路径,因为oss文件缓存太严重,更新慢
+            }else{
+                var cloudPath = `${Potree.settings.urls.prefix1}/${dataset.webBin}`  //webBin添加原因:每次裁剪之类的操作会换路径,因为oss文件缓存太严重,更新慢
+            } */
+        
+            
             
             let name = datasetId + '-'+pano.uuid
             let timeStamp = 0

+ 20 - 19
src/custom/utils/Common.js

@@ -118,35 +118,36 @@ var Common = {
     
     ,
      
-    CloneObject : function(copyObj, result, isSimpleCopy, simpleCopyList=[]) {
+    CloneObject : function (copyObj, isSimpleCopy, simpleCopyList = [], judgeSimpleCopyFun) {
         //isSimpleCopy 只复制最外层
         //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
-         
-        simpleCopyList.push(THREE.Object3D) //遇到simpleCopyList中的类直接使用不拷贝
+
+        simpleCopyList.includes(THREE.Object3D) || simpleCopyList.push(THREE.Object3D) //遇到simpleCopyList中的类直接使用不拷贝
+        judgeSimpleCopyFun || (judgeSimpleCopyFun=()=>{})
         
-        if(!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className)){
-            return copyObj 
+        if (!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className) || judgeSimpleCopyFun(copyObj)) {
+            return copyObj
         }
-        
-        result = result || {};
+
         if (copyObj instanceof Array) {
-            return copyObj.map(e=>{ 
-                return this.CloneObject(e) 
-            }) 
-        }else{
-            if(copyObj.clone instanceof Function ){ //解决一部分
+            return copyObj.map(e => {
+                return this.CloneObject(e, isSimpleCopy, simpleCopyList, judgeSimpleCopyFun)
+            })
+        } else {
+            if (copyObj.clone instanceof Function) {
+                //解决一部分
                 return copyObj.clone()
             }
         }
+
+        let result = {}
         for (var key in copyObj) {
-            if (copyObj[key] instanceof Object && !isSimpleCopy)
-                result[key] = this.CloneObject(copyObj[key]);
-            else
-                result[key] = copyObj[key];
+            if (copyObj[key] instanceof Object && !isSimpleCopy ) result[key] = this.CloneObject(copyObj[key], isSimpleCopy, simpleCopyList, judgeSimpleCopyFun)
+            else result[key] = copyObj[key]
             //如果是函数类同基本数据,即复制引用
         }
-        return result;
-    }
+        return result
+    }  
     ,
     CloneClassObject :function(copyObj, {ignoreList=[],simpleCopyList=[]}={}){//复杂类对象
         var newobj = new copyObj.constructor();
@@ -166,7 +167,7 @@ var Common = {
             }else if(simpleCopyList.includes(i)){
                 targetObj[i] = copyObj[i]
             }else{
-                targetObj[i] = this.CloneObject(copyObj[i], null, false, simpleCopyList )  
+                targetObj[i] = this.CloneObject(copyObj[i], false, simpleCopyList )  
             }
                 
             

+ 4 - 4
src/custom/utils/SplitScreen4Views.js

@@ -77,11 +77,11 @@ SplitScreen4Views.split = function(o={}){
     }) */
         
         
-    viewer.images360.panos.forEach(pano=>{
+    /* viewer.images360.panos.forEach(pano=>{
         pano.addLabel2()
         Potree.Utils.updateVisible(pano.label2, 'notDisplay', true)
         pano.dispatchEvent({type:'changeMarkerTex',name:'ring'})
-    }) 
+    }) */ 
         
     //材质 
     this.statesBefore = { 
@@ -208,10 +208,10 @@ SplitScreen4Views.recover = function(){
         Potree.Utils.updateVisible(pano.mapMarker, 'split4Screens', true)
     }) */
     
-    viewer.images360.panos.forEach(pano=>{
+    /* viewer.images360.panos.forEach(pano=>{
         Potree.Utils.updateVisible(pano.label2, 'notDisplay', false  )
         pano.dispatchEvent({type:'changeMarkerTex',name:'default'})
-    })
+    }) */
     
     mapViewport.noPointcloud = true
     { 

+ 2 - 1
src/custom/viewer/ViewerNew.js

@@ -4438,7 +4438,7 @@ export class Viewer extends ViewerBase{
         })  
         this.ifAllLoaded()
     }
-    
+     
     setView(o={}){
         let callback = ()=>{
             if(o.displayMode){
@@ -4883,6 +4883,7 @@ export class Viewer extends ViewerBase{
                     }
                 })  
             }
+             
             
             
         }

+ 1 - 1
src/viewer/NavigationCube.js

@@ -105,7 +105,7 @@ export class NavigationCube extends THREE.Object3D {
 			
 			if(this.pickedFace) {
 				this.viewer.setView(this.pickedFace);
-			}
+			} 
 		};
 
 		this.viewer.renderer.domElement.addEventListener('mousedown', onMouseDown, false);