Browse Source

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/bigSceneEdit_java

tremble 5 years ago
parent
commit
eae5798018
4 changed files with 109 additions and 20 deletions
  1. 3 3
      edit.html
  2. 3 3
      js/main_2020_edit.js
  3. 99 10
      js/main_2020_show.js
  4. 4 4
      js/manage.js

+ 3 - 3
edit.html

@@ -1117,7 +1117,7 @@
                         </li>
                         <li data-name="floorMarkerColor">
                             <div class="itemTitle">
-                                <span>选择地面/导览标志颜色</span>
+                                <span>当前位置标记/导览标记颜色</span>
                             </div>
                             <ul class="clearfix hotStyle-item colorWrap">
                                 <input id="floorMarkerColorTex" class="color-text" type="text" placeholder="请输入颜色" />
@@ -1126,7 +1126,7 @@
                         </li>
                         <li data-name="MouseMarkerColor">
                             <div class="itemTitle">
-                                <span>选择鼠标标志颜色</span>
+                                <span>鼠标标记颜色</span>
                             </div>
                             <ul class="clearfix hotStyle-item colorWrap">
                                 <input id="mouseMarkerColorTex" class="color-text" type="text" placeholder="请输入颜色" />
@@ -1154,7 +1154,7 @@
                                     <input name="hideFloorMarker" class="editCheckbox" type="checkbox"
                                         value="hideFloorMarker" id="hideFloorMarker">
                                     <label for="hideFloorMarker"></label>
-                                    <label for="hideFloorMarker">隐藏地面标记 </label>
+                                    <label for="hideFloorMarker">隐藏地面marker标记 </label>
                                 </li>
                                 <li>
                                     <input name="hideMouseMarker" class="editCheckbox" type="checkbox"

+ 3 - 3
js/main_2020_edit.js

@@ -17675,9 +17675,9 @@ function o(a, s, l) {
                     side: s.DoubleSide,
                     opacity: 0,
                     transparent: !0,
-                    depthWrite: !1,
-                    visible: this.showFloorMarker
-                })),
+                    depthWrite: !1  
+                })), 
+                this.marker.visible = this.showFloorMarker,  
                 this.marker.renderOrder = l.panoMarker,
                 this.marker.name = "marker",
                 (this.marker.pano = this).marker.layers.set(v.PANOMARKERS),

+ 99 - 10
js/main_2020_show.js

@@ -18438,9 +18438,9 @@ window.Modernizr = function(n, e, t) {
                     side: r.DoubleSide,
                     opacity: 0,
                     transparent: !0,
-                    depthWrite: !1,
-                    visible:this.showFloorMarker    // 隐藏/显示地面标志
+                    depthWrite: !1 
                 })),
+                this.marker.visible = this.showFloorMarker,  
                 this.marker.renderOrder = s.panoMarker,
                 this.marker.name = "marker",
                 this.marker.pano = this,
@@ -23433,9 +23433,25 @@ window.Modernizr = function(n, e, t) {
         n.prototype.render = function() {
             this.effects.currentBlur > 0 ? this.composer.render() : this.renderer.render(this.scene, this.camera)
         }
-        ,
+         
         /******************************************************************************************************徐世廷**********************************************************************/
-		n.prototype.boluoVrInit = function() {
+		
+        var vrPermission = {};
+        var vrPermissionCallBack = function(info1,info2){
+            if(info1 == "reset"){
+                vrPermission = {};  
+            }else{
+                vrPermission[info1] = info2
+                if(Object.keys(vrPermission).length == 2 && (vrPermission.deviceMotion != "granted" || vrPermission.deviceOrientation != "granted")){
+                     alert("运动和方向访问失败。这会导致画面视角一直固定。您需要完全关闭此应用,然后再次打开,并允许访问运动与方向。" )
+                }
+            } 
+        } 
+        
+        
+         
+        
+        n.prototype.boluoVrInit = function() {
 			
 			console.log("boluoVrInit")
 			
@@ -23462,9 +23478,76 @@ window.Modernizr = function(n, e, t) {
                     a.setSize(window.innerWidth, window.innerHeight),
                     window._vrEnabled = b
 					
-					
-					setTimeout(function(){console.log(player.cameraControls.activeControl.camera.fov)},500) 
+					if(b){
+                        setTimeout(function(){
+                            console.log("orientEnable"+window.orientEnable) 
+                            if(window.vrEnabled && !window.orientEnable){//很可能没能触发陀螺仪事件
+                                if(m.detectIOS()/*  && m.detectSafari()  */){
+                                    var b = m.iosVersion();//{major: 10, minor: 3, patch: 1}  
+                                    //console.log("开始获取权限  major"+b.major) 
+                                    if(b.major == 12 && b.minor>=2){ 
+                                        if(browser.detectSafari()) 	 alert("浏览器未能检测到转动。为完整体验VR效果,请打开 “设置” > “Safari” > “隐私和安全” 下的 “运动和方向访问” 开关,然后刷新此页面。")
+                                        else{//app??
+                                            alert("浏览器未能检测到转动。请在手机或浏览器设置中开启了运动和方向访问等设置,然后刷新此页面。")
+                                        }
+                                    }else if(b.major >= 13){
+                                        var hasFailed = window.vrPermission && (window.vrPermission.deviceMotion != "granted" || window.vrPermission.deviceOrientation != "granted")
+                                        hasFailed || alert("'请点击“允许”'");
+                                        setTimeout(()=>{
+                                            if(!window.vrEnabled || window.orientEnable)return;
+                                            vrPermissionCallBack("reset")	
+                                            if ( window.DeviceMotionEvent && window.DeviceMotionEvent.requestPermission && typeof window.DeviceMotionEvent.requestPermission === 'function') {
+                                                console.log("开始获取权限1")
+                                                ///注意:需要https   本地服务器permissionState会得到denied
+                                                window.DeviceMotionEvent.requestPermission().then(permissionState => {
+                                                    console.log("permissionState1: "+permissionState)
+                                                    vrPermissionCallBack("deviceMotion", permissionState)
+                                                     
+                                                }).catch(function(e){
+                                                    vrPermissionCallBack("deviceMotion", false)
+                                                    console.log(e)
+                                                })  
+                                            }else{
+                                                console.log("window.DeviceMotionEvent undefined")
+                                                vrPermissionCallBack("deviceMotion", false)
+                                            }
+                                            if ( window.DeviceOrientationEvent && window.DeviceOrientationEvent.requestPermission && typeof window.DeviceOrientationEvent.requestPermission === 'function') {
+                                                console.log("开始获取权限2")
+                                                window.DeviceOrientationEvent.requestPermission().then(permissionState => {
+                                                    console.log("permissionState2: "+permissionState)
+                                                     
+                                                    vrPermissionCallBack("deviceOrientation", permissionState)
+                                                }).catch(function(e){
+                                                    vrPermissionCallBack("deviceOrientation", false)
+                                                    console.log(e)
+                                                }) 
+                                            }else{
+                                                console.log("window.DeviceOrientationEvent undefined")
+                                                vrPermissionCallBack("deviceOrientation", false)
+                                            } 	
+                                             
+                                        },hasFailed ? 0 : 150)
+                                        
+                                        
+                                        /* /* setTimeout(function(){ 
+                                            if(settings.vrEnabled && !window.orientEnable){ 
+                                                $alert("若画面视角一直固定,您需要完全关闭Safari浏览器,然后再次打开以开启运动和方向访问。")
+                                            }
+                                        },4000) */  
 
+                                        
+                                    }else  console.log("陀螺仪未能启用 ios "+b.major+"."+b.minor) 
+                                }else{
+                                    //$alert("浏览器未能检测到转动", "请在手机或浏览器设置中开启了运动和方向访问等设置,然后刷新此页面。")
+                                }  
+                            }else{
+                                //已经触发了 
+                            }
+                        },200);
+                            
+                        
+                    }
+ 
                 }
             }),
             this.createCursor(.5, !1, 1, 16777215, 0);
@@ -23530,6 +23613,7 @@ window.Modernizr = function(n, e, t) {
         }
        
 		,
+        window.orientEnable = 0; //是否能触发deviceorientation
         n.prototype.CursorAnimation = function(a, b, c) {
             function d() {
                 g.orient = r.Math.degToRad(window.orientation || 0)
@@ -23537,7 +23621,9 @@ window.Modernizr = function(n, e, t) {
 			
 			
             function e(a) { 
-				//console.log("ro")
+				if(!window.vrEnabled && window.orientEnable) return;
+                window.orientEnable || (window.orientEnable = 1);
+		
                 var b = r.Math.degToRad(a.alpha)
                   , c = r.Math.degToRad(a.beta)
                   , d = r.Math.degToRad(a.gamma);
@@ -23602,9 +23688,10 @@ window.Modernizr = function(n, e, t) {
                 }(c)
             }),
             this.update = function(a) {
-                TWEEN.update(),
-                window.vrEnabled && (this.setObjectQuaternion(this.target.quaternion, this.alpha, this.beta, this.gamma, this.orient),
-                this.triggerTargetEvent())
+                TWEEN.update();
+                if(window.ifTest && window.vrEnabled) this.triggerTargetEvent() //测试时不根据陀螺仪来转向
+                else window.vrEnabled && (this.setObjectQuaternion(this.target.quaternion, this.alpha, this.beta, this.gamma, this.orient ),
+                this.triggerTargetEvent())   
             }
             ,
             this.triggerTargetEvent = function() {
@@ -23744,9 +23831,11 @@ window.Modernizr = function(n, e, t) {
             this._overlap = .064,
             this.cameraL = new r.PerspectiveCamera,
             this.cameraL.layers.enable(1),
+            this.cameraL.near = 0.01,//xzw add
             this.cameraL.matrixAutoUpdate = !1,
             this.cameraR = new r.PerspectiveCamera,
             this.cameraR.layers.enable(2),
+            this.cameraR.near = 0.01,//xzw add
             this.cameraR.matrixAutoUpdate = !1,
             this.eyeRight = new r.Matrix4,
             this.eyeLeft = new r.Matrix4,

+ 4 - 4
js/manage.js

@@ -237,11 +237,11 @@ Manage.prototype.weixinShare = function() {
         error:function(XMLHttpRequest,textStatus,errorThrown){    
             console.log("jsonp.error:"+textStatus);    
         }    
-        }); 
+    }); 
     
-        var success_jsonp = function(json){
-            console.log(json);
-        };
+    var success_jsonp = function(json){
+        console.log(json);
+    };
 
 
     wx.ready(function(){