xzw hace 1 año
padre
commit
5ca271e2f2

+ 7 - 1
src/custom/modules/panos/DepthImageSampler.js

@@ -47,7 +47,13 @@ class DepthImageSampler extends THREE.EventDispatcher{
             this.canvas.width = img.width 
             this.canvas.height = img.height 
             this.context.drawImage(img, 0, 0) 
-            let data = this.context.getImageData(0, 0, img.width , img.height ).data;     //getImageData 1px时 : pc chrome 耗时0.01毫秒左右(排除第一次的50) , 但firefox: 4。但换贴图之后就多达5甚至几十  
+            let o = this.context.getImageData(0, 0, img.width , img.height )
+            let data = o && o.data;    //getImageData 1px时 : pc chrome 耗时0.01毫秒左右(排除第一次的50) , 但firefox: 4。但换贴图之后就多达5甚至几十  
+            if(!data){
+                console.error('getImageData 得不到?!why!')
+                return false
+            }
+            
             //console.log('changeImg',pano.id ) 
             //this.img = img
              

+ 1 - 1
src/custom/modules/panos/Images360.js

@@ -1555,7 +1555,7 @@ Images360.prototype.getNeighbours = function(){ //逐渐自动获取neighbours
         this.depthSampler.updateNearPanos(panos)
         
         let maxWaitDur = browser.isMobile() ? 30 : 60  
-        let changeCount = 0, maxChangeTex = browser.isMobile() ? 2 : 4, getCount = 0
+        let changeCount = 0, maxChangeTex = browser.isMobile() ? 1 : 4, getCount = 0
         let changeTexCount = ()=>{
             changeCount ++;
         }