xzw 4 rokov pred
rodič
commit
4e1c0de099

+ 79 - 81
package-lock.json

@@ -1752,6 +1752,63 @@
           "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
           "dev": true
         },
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
+          "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.2",
+          "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646655305&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz",
+          "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
+          "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz",
+          "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz",
+          "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz",
+          "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
         "ssri": {
           "version": "8.0.1",
           "resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364626710&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz",
@@ -1760,6 +1817,28 @@
           "requires": {
             "minipass": "^3.1.1"
           }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703414084&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
+          "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        },
+        "vue-loader-v16": {
+          "version": "npm:vue-loader@16.5.0",
+          "resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.5.0.tgz?cache=0&sync_timestamp=1628666727543&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-loader%2Fdownload%2Fvue-loader-16.5.0.tgz",
+          "integrity": "sha1-CcTgcSRmiZ40uZpoZSTxkWX7KJI=",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "chalk": "^4.1.0",
+            "hash-sum": "^2.0.0",
+            "loader-utils": "^2.0.0"
+          }
         }
       }
     },
@@ -11023,87 +11102,6 @@
         }
       }
     },
-    "vue-loader-v16": {
-      "version": "npm:vue-loader@16.2.0",
-      "resolved": "https://registry.nlark.com/vue-loader/download/vue-loader-16.2.0.tgz",
-      "integrity": "sha1-BGpTMI3Ufljv4g3ewe3sAnzjtG4=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "chalk": "^4.1.0",
-        "hash-sum": "^2.0.0",
-        "loader-utils": "^2.0.0"
-      },
-      "dependencies": {
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
-          "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "chalk": {
-          "version": "4.1.1",
-          "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.1.tgz?cache=0&sync_timestamp=1618995367379&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.1.tgz",
-          "integrity": "sha1-yAs/qyi/Y3HmhjMl7uZ+YYt35q0=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "ansi-styles": "^4.1.0",
-            "supports-color": "^7.1.0"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
-          "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz",
-          "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
-          "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.0",
-          "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz",
-          "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
-        },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1618560983872&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
-          "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        }
-      }
-    },
     "vue-router": {
       "version": "3.5.1",
       "resolved": "https://registry.nlark.com/vue-router/download/vue-router-3.5.1.tgz?cache=0&sync_timestamp=1620899536020&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-router%2Fdownload%2Fvue-router-3.5.1.tgz",

+ 52 - 10
public/SuperTwo/js/main_2020_show.js

@@ -15753,8 +15753,27 @@ window.Modernizr = function(n, e, t) {
         var geometry = new r.PlaneBufferGeometry( g_HotMeshSize.g_HotMeshWidth, g_HotMeshSize.g_HotMeshHeight,1,1);
         var defaultTex1 = te.load(g_HotImage.point);
         var defaultTex2 = te.load(g_HotImage.point2);
-         
+        var defaultTex3 = te.load('images/4dagePoint_shixin.png'); // 
+
 
+        hot.prototype.changeHighlightTex = function(state){
+            var u = this.mesh.material.uniforms
+            if(state){
+                u.texture2.value = defaultTex3  
+            }else{
+                u.texture2.value = defaultTex2
+            }
+        }
+        hot.prototype.dealIntersect = function(state){
+            if(state){
+                this.titleElem.addClass('hotactive'); 
+            }else{
+                this.titleElem.removeClass('hotactive');
+            }
+            this.changeHighlightTex(state)
+        }
+        
+        
         hot.prototype.changeTex = function(){
             var u = this.mesh.material.uniforms
             if(this.styleTex.length){
@@ -22517,21 +22536,41 @@ window.Modernizr = function(n, e, t) {
                         this.lastChangeTime = Date.now(),
                         !this.mouseDown && this.containsMouse && this.updateIntersect(),
                         this.emit(w.ViewChanged)
-                        if(this.intersectHot){
+                        /* if(this.intersectHot){
                             if(!this.intersectHot.titleElem)return;
                             this.intersectHot.titleElem.addClass('hotactive');
                             // this.intersectHot.titleElem.css('background-image','url(./images/hot_bg_active.png)');
-                        }
+                        } */
                         //this.intersectHot && this.intersectHot.showTitle() 
-                        for(var i in this.model.hots){
+                        /* for(var i in this.model.hots){
                             this.model.hots[i].update(this.camera)
-                        } 
+                        } */ 
 
                     }
 
-                    /* if(e.cameraChanged){
-                        this.controlVideosPlay()
-                    } */
+                    if(e.cameraChanged){
+                        //this.controlVideosPlay()
+                        
+                        for(var i in this.model.hots){
+                            this.model.hots[i].update(this.camera)
+                        } 
+                        if(this.mode == 'panorama')this.overlayGroup.children.forEach(overlay=>{
+                            if(overlay.overlayType == "video"){
+                                if(overlay.visible && overlay.inSight()){
+                                    overlay.videoControl(true) 
+                                }else{
+                                    overlay.videoControl(false) 
+                                }
+                            }else if(overlay.animateInfo){ 
+                                if(overlay.visible && overlay.inSight()){
+                                    GifTexDeal.start(overlay.animation)
+                                }else{
+                                    GifTexDeal.stop(overlay.animation)
+                                } 
+                            }
+                        })
+                        
+                    }
 
                     // this.mode == "panorama" && cad.setSign({ x: this.position.x, y: this.position.z },this.cameraControls.controls.panorama.lon);
                     this.model.supportsTiles && (this.updateTileDownloader(t),
@@ -22903,11 +22942,13 @@ window.Modernizr = function(n, e, t) {
                     points.length >= 1? ($('#player').css('cursor', 'cell'),window.hotPointPos = points[0].point): ($('#player').css('cursor', 'not-allowed'), window.hotPointsPos = false)
                 }
 				//this.intersectHot && this.intersectHot.hideTitle() 
-                if(this.intersectHot){
+                /* if(this.intersectHot){
                     if(!this.intersectHot.titleElem)return;
                     this.intersectHot.titleElem.removeClass('hotactive');
+                } */
+                if(this.intersectHot){
+                    this.intersectHot.dealIntersect(false)
                 }
-
                 if (0 === n.length){
 					this.intersectHot = null;  //add
 					if(g_HotStatus!="add") $("#player").css("cursor","");
@@ -22919,6 +22960,7 @@ window.Modernizr = function(n, e, t) {
 					this.intersectHot =  o.object.belongHot; 
                     //this.intersectHot.showTitle() 
 					this.intersectHot.noAction || $("#player").css("cursor","pointer");
+                    this.intersectHot.dealIntersect(true)
 					return;
 				}
                 

+ 146 - 59
public/SuperTwo/js/overlay.js

@@ -1,4 +1,6 @@
-
+var MathLight = {};
+MathLight.RADIANS_PER_DEGREE = Math.PI / 180;
+MathLight.DEGREES_PER_RADIAN = 180 / Math.PI;
 
  
  
@@ -56,8 +58,10 @@ var initOverlay = function(THREE) {
         overlayGroup.add(this);
 
         if (info.media) {
-            if (info.media.includes('video')) {
-                var video = $('<video controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>')[0]
+            if (info.media.includes('video')) { 
+                //var id = "video"+ this.sid    id="${ id }"
+                var video = $(`<video  controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>`)[0]
+                 
                 video.setAttribute("crossOrigin", 'Anonymous')
                 //要在src设置好前解决跨域
                 $(video).on('contextmenu', function() {
@@ -69,10 +73,18 @@ var initOverlay = function(THREE) {
                 info.media = video;
                 info.type = "video"
 
-                video.addEventListener('loadeddata', ()=>{
+                /* video.addEventListener('loadeddata', ()=>{
                     console.log(this.sid + " loaded!!!")
+                }) */
+                
+                video.oncanplaythrough = function() {
+                    plane.material.map.needsUpdate = !0
+                    if(video.shouldPlay){
+                        video.play()
+                    } 
                 }
-                )
+                
+                
                 video.volume = 0
                 video.muted = true
                 plane.material.opacity = 1;
@@ -85,8 +97,18 @@ var initOverlay = function(THREE) {
 
                 info.type = "photo"
                 plane.material.opacity = 0.1;
-            }
+                
+                /* this.animateInfo = {
+                        cellXcount : 4,
+                        cellYcount : 2,
+                        loop : true,
+                        duration : 1000 
+                    }
+                */
 
+        
+            }
+            
             plane.material.color = new THREE.Color(1,1,1)
         }
         if (info.width == void 0)
@@ -98,13 +120,29 @@ var initOverlay = function(THREE) {
 
     }
 
+
+
+
+
     Overlay.prototype.setFromInfo = function(info) {
         //1 恢复到编辑之前 2 初始加载 
-        var plane = this.plane;
-        this.transformAtPanos = info.transformAtPanos || {}
+        var plane = this.plane; 
+        var transformAtPanos = {}
+        for(var i in info.transformAtPanos){
+            transformAtPanos[i] = {
+                width : info.transformAtPanos[i].width,
+                height : info.transformAtPanos[i].height,
+                pos : info.transformAtPanos[i].pos.clone(),
+                qua : info.transformAtPanos[i].qua.clone(),
+            }      
+        } 
+        
+        this.transformAtPanos = transformAtPanos
         //在每个漫游点独立设置的position。  
-        var curPanoTransform = player.currentPano && this.transformAtPanos[player.currentPano.id] || {}
-
+        //var curPanoTransform = player.currentPano && this.transformAtPanos[player.currentPano.id] || {}
+        var curPanoTransform = this.transformAtPanos[ getTransformSid()] || {}
+         
+        
         info.depth && this.scale.setZ(info.depth / settings.overlay.depth)
 
         this.posCustom = info.pos ? info.pos.clone() : this.position.clone();
@@ -158,9 +196,30 @@ var initOverlay = function(THREE) {
 
         this.updateMatrixWorld()
         this.getVisiblePanos()
-
+        
+        
+        {//gif
+            if(this.animation){
+                GifTexDeal.remove(this.animation)
+            }
+            this.animateInfo = CloneObject(info.animateInfo) 
+            if(this.animateInfo && plane.material.map){
+                this.animation = GifTexDeal.addAnimation(plane.material.map, this, this.animateInfo, this.sid )
+                this.visible && this.inSight() && GifTexDeal.start(this.animation)
+            }    
+        }
+        
+        
+        
     }
 
+
+
+   
+
+
+
+
     Overlay.prototype.addBox = function(state) {
         if (state == !!this.hasBox) {
             return;
@@ -220,20 +279,31 @@ var initOverlay = function(THREE) {
 
     }
 
-    Overlay.prototype.getVisiblePanos = function() {
+    Overlay.prototype.getVisiblePanos = function() {//在不同点还不一样
         this.visiblePanos = common.getVisiblePano(this.plane.getWorldPosition(), {
-            model: null
+            model: null/* ,  transformAtPanos:info.transformAtPanos */
         });
 
     }
     
     
     Overlay.prototype.updateVisibles = function(panos) {
+        
+        if(settings.isEdit && EditOverlay.editPlane == this){
+            return true
+        }
+        
         this.visible = !!panos.find(pano=>this.visiblePanos.includes(pano))
-        if(!this.visible && this.overlayType == 'video'){
+        if (!this.visible && this.overlayType == 'video')
             this.videoControl('stop')
-            
-        }
+        
+        /* if(this.animateInfo){ //在player.update里更新
+            if(this.visible){
+                GifTexDeal.start(this.animation)
+            }else{
+                GifTexDeal.stop(this.animation)
+            }
+        } */ 
     }
     
     
@@ -244,55 +314,51 @@ var initOverlay = function(THREE) {
             player.overlayGroup.children.forEach(e=>e.updateVisibles(panos))
         }
     }
-    
+
     Overlay.prototype.videoControl = function(state){
         if(this.overlayType != "video")return
-        
-        
+        var video = this.plane.material.map.image
         if(!state || state == 'stop'){
-            this.plane.material.map.image.pause()
+            video.paused || video.pause()
             if(state == 'stop'){
-                this.plane.material.map.image.currentTime = 0;
-                this.playCount = 0
+                video.currentTime = 0;
+               
             }
-            console.log("pause")
-        }else if(state /* && (this.loop !== false || this.playCount == 0 || this.plane.material.map.image.currentTime<this.plane.material.map.image.duration) */){
-            this.plane.material.map.image.play()
-            //this.playCount = this.playCount ? (this.playCount+1) : 1
-            console.log("play")
+            video.shouldPlay = false
+            //console.log("pause")
+        }else if(state){ 
+            video.paused && video.play()
+            video.shouldPlay = true
+            //console.log("play")
         }
-        
-    }
-    
-    
-    
-    
+    }     
     Overlay.prototype.inSight = function(){
-        //var maxAngle = THREE.Math.degToRad( cameraLight.getHFOVFromVFOV(70, player.domElement.clientWidth, app.player.domElement.clientHeight) / 2);
-       
-        var position = this.plane.getWorldPosition()
-        var pos2d = math.getPos2d(position, player.camera, $("#player")[0])
-        if(pos2d.trueSide && pos2d.inSight){
-            return true
-        }else{ 
-            var cornerPoint = [
-                new THREE.Vector3(-settings.overlay.width/2, settings.overlay.height/2, 0),
-                new THREE.Vector3(settings.overlay.width/2, settings.overlay.height/2, 0),
-                new THREE.Vector3(settings.overlay.width/2, -settings.overlay.height/2, 0),
-                new THREE.Vector3(-settings.overlay.width/2, -settings.overlay.height/2, 0),
-            ];            
-            for(var i=0;i<4;i++){
-                cornerPoint[i].applyMatrix4(this.plane.matrixWorld);
-                var pos2d = math.getPos2d(cornerPoint[i], player.camera, $("#player")[0])
-                if(pos2d.trueSide && pos2d.inSight){
-                    return true
+        if(player.mode == 'panorama'){
+            var position = this.plane.getWorldPosition()
+            var pos2d = math.getPos2d(position, player.camera, $("#player")[0])
+            if(pos2d.trueSide && pos2d.inSight){
+                return true
+            }else{ 
+                var cornerPoint = [
+                    new THREE.Vector3(-settings.overlay.width/2, settings.overlay.height/2, 0),
+                    new THREE.Vector3(settings.overlay.width/2, settings.overlay.height/2, 0),
+                    new THREE.Vector3(settings.overlay.width/2, -settings.overlay.height/2, 0),
+                    new THREE.Vector3(-settings.overlay.width/2, -settings.overlay.height/2, 0),
+                ];            
+                for(var i=0;i<4;i++){//只要有一点可见就算看见
+                    cornerPoint[i].applyMatrix4(this.plane.matrixWorld);
+                    var pos2d = math.getPos2d(cornerPoint[i], player.camera, $("#player")[0])
+                    if(pos2d.trueSide && pos2d.inSight){
+                        return true
+                    }
                 }
             }
+        }else{//飞出要判断模型阻挡,有点耗时就算了
+            return true
         }
     }
     
     
-
     Overlay.prototype.addToLoadQueue = function() {
         if (this.overlayType == 'photo') {
             Overlay.loadQueue.includes(this) || Overlay.loadQueue.push(this)
@@ -309,7 +375,7 @@ var initOverlay = function(THREE) {
         var plane = this.plane;
 
         plane.material.map = Texture.load(this.file, ()=>{
-            plane.material.needsUpdate = true
+            
             if (this._loadDones) {
                 this._loadDones.forEach(e=>e())
                 this._loadDones = null
@@ -317,6 +383,13 @@ var initOverlay = function(THREE) {
             setTimeout(Overlay.loadNext, 50)
             plane.material.opacity = 1;
             console.log('overlay loaded: ' + this.sid)
+            
+            if(this.animateInfo){
+                this.animation = GifTexDeal.addAnimation(plane.material.map, this, this.animateInfo, this.sid )
+                this.visible && this.inSight() && GifTexDeal.start(this.animation)
+            }
+            
+            plane.material.needsUpdate = true
         })
         plane.material.map.wrapS = plane.material.map.wrapT = THREE.ClampToEdgeWrapping;
         plane.material.map.minFilter = THREE.LinearFilter;
@@ -335,9 +408,6 @@ var initOverlay = function(THREE) {
         Overlay.loadQueue.slice(0, Overlay.maxLoadingCount - loadings.length).forEach(e=>e.requestDownload())
         Overlay.loadQueue.splice(0, Overlay.maxLoadingCount - loadings.length)
     }
-    
-    
-    
 
     Overlay.getNeedLoad = function() {//计算获取loadQueue,每次都重新计算,覆盖旧的
         if (!player || !player.domElement || !player.mode)
@@ -355,11 +425,26 @@ var initOverlay = function(THREE) {
         }
         Overlay.loadWhenOutside = true
         var overlays = player.overlayGroup.children.filter(e=>!e.hasRequestLoad && e.visiblePanos.includes(player.currentPano))
+        //var maxAngle = THREE.Math.degToRad( cameraLight.getHFOVFromVFOV(70, player.domElement.clientWidth, app.player.domElement.clientHeight) / 2);
         var cameraDir = player.getDirection()
 
-         
+        /* var maxCount = 5; 
+        if(overlays.length>maxCount){
+            for(var i=0;i<overlays.length;i++){ 
+                //角度为可见范围 
+                var v1 = cameraDir.clone().setY(0);
+                var v2 = overlays[i].plane.getWorldPosition().sub(player.position).setY(0)
+                if(v1.angleTo(v2) <= maxAngle){
+                    Overlay.loadQueue.push(overlays[i])
+                    if(Overlay.loadQueue.length>=10) break;
+                }  
+            } 
+            if(Overlay.loadQueue.length<Overlay.maxLoadingCount){
+                Overlay.loadQueue.push()
+            }
+        }else{ */
         Overlay.loadQueue = overlays
-        
+        //} 
 
         var request = [(overlay)=>{
             return true
@@ -375,7 +460,7 @@ var initOverlay = function(THREE) {
             return -angle * 20
         }
         ]
-        var result = sortByScore(Overlay.loadQueue, request, rank);
+        var result = common.sortByScore(Overlay.loadQueue, request, rank);
         Overlay.loadQueue = result ? result.slice(0, 5).map(e=>e.item) : player.overlayGroup.children.filter(e=>!e.hasRequestLoad).slice(0, 2);
 
     }
@@ -395,3 +480,5 @@ var initOverlay = function(THREE) {
     window.Overlay = Overlay;
 
 }
+
+