|
@@ -721,7 +721,7 @@ window.initHot = function(model){
|
|
|
|
|
|
let maxCount = browser.isMobile() ? 2000 : 5000
|
|
|
let c = model.panos.list.length * model.colliders.length
|
|
|
- if(settings.isEdit || c < maxCount){
|
|
|
+ if(window.isEdit || c < maxCount){ //编辑页面保险起见还是全部算完后才可浏览,就能保证保存全部的visiblePano
|
|
|
this.info.visiblePanos = common.getVisiblePano(customPositions, model.panos.list, {
|
|
|
model: model.colliders , posAtPanos
|
|
|
})
|
|
@@ -744,15 +744,15 @@ window.initHot = function(model){
|
|
|
console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
|
|
|
clearInterval(interval)
|
|
|
}
|
|
|
- }, Hot.visiEveryDurSlice )
|
|
|
+ }, Hot.visiEveryDurSlice )// visiEveryDurSlice 等在main中定义
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
updateVisible(panos, visibility) {
|
|
|
- if(settings.isEdit && editTool.hotpoint.editSpot == this){
|
|
|
- return true
|
|
|
+ if(window.isEdit && editTool.hotpoint.editSpot == this){
|
|
|
+ return this.visible = true
|
|
|
}
|
|
|
|
|
|
this.visible = visibility != void 0 ? visibility : (!this.info.visiblePanos || !!panos.find(pano=>this.info.visiblePanos.includes(pano.id)))
|
|
@@ -881,7 +881,7 @@ window.initHot = function(model){
|
|
|
|
|
|
inSight(){
|
|
|
//return true
|
|
|
- if(settings.isEdit)return true // 太容易move了
|
|
|
+ if(window.isEdit)return true // 太容易move了
|
|
|
|
|
|
if(player.mode == 'panorama'){
|
|
|
if(!player.camera) return
|
|
@@ -1032,36 +1032,45 @@ window.initHot = function(model){
|
|
|
var a = new THREE.Vector3;
|
|
|
i.push(function(e) {
|
|
|
return Math.abs(e.position.x - r.x) > window._settings.tags.visibility.cameraClearance || Math.abs(e.position.z - r.z) > window._settings.tags.visibility.cameraClearance
|
|
|
- }, function(e) {
|
|
|
+ },
|
|
|
+
|
|
|
+ function(e) {
|
|
|
a.copy(r).sub(e.position);
|
|
|
var t = -THREE.Math.radToDeg(Math.atan(a.y / Math.sqrt(a.x * a.x + a.z * a.z)))
|
|
|
, i = window._settings.tags.navigate.tiltTolerance
|
|
|
return window._settings.insideLookLimitDown - i < t && t < window._settings.insideLookLimitUp + i
|
|
|
- },
|
|
|
+ },
|
|
|
+
|
|
|
(pano)=>{ // add
|
|
|
return player.checkHasNeighbor(pano)
|
|
|
- }
|
|
|
-
|
|
|
- ),
|
|
|
- n.push( function(t, i) {//scoreFunctions.distanceSquared
|
|
|
- return i = i || a.navigation.distanceFactor,
|
|
|
- function(e) {
|
|
|
- return t ? t.position.distanceToSquared(e.position) * i : 0
|
|
|
+ },
|
|
|
+
|
|
|
+ (pano)=>{ // add
|
|
|
+ return this.info.visiblePanos.includes(pano.id)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ n.push(
|
|
|
+ (function(hot, i) { //scoreFunctions.distanceSquared
|
|
|
+ return function(pano) {
|
|
|
+ //i = a.navigation.distanceFactor
|
|
|
+ return hot ? hot.position.distanceToSquared(pano.position) * i : 0
|
|
|
}
|
|
|
- }(this, -2));
|
|
|
+ })(this, -2)
|
|
|
+ ,
|
|
|
+
|
|
|
+ (pano)=>{//尽量正对hot
|
|
|
+ let dir = new THREE.Vector3(0,0,1).applyQuaternion(this.quaternion)
|
|
|
+ let dir2 = new THREE.Vector3().subVectors(pano.position, this.position).normalize();
|
|
|
+ let s = dir.dot(dir2) * 10;
|
|
|
+ //console.log(pano.id + ":" + s)
|
|
|
+ return s
|
|
|
+ }
|
|
|
+
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
var s = t.model.panos.sortByScore(i, n);
|
|
|
- /* if (s && window._settings.tags.navigate.lineOfSight) {
|
|
|
- for (var l = 0; l < s.length; l++) {
|
|
|
- var c = s[l].pano
|
|
|
- , h = c.position.distanceTo(r);
|
|
|
- p.set(c.position, r.clone().sub(c.position).normalize());
|
|
|
- var u = p.intersectObjects(t.model.colliders);
|
|
|
- if (0 === u.length || u[0].distance > h)
|
|
|
- return console.log(l),
|
|
|
- c
|
|
|
- }
|
|
|
- return null
|
|
|
- } */
|
|
|
+ console.log(s)
|
|
|
return s && 0 < s.length && s[0].pano
|
|
|
}
|
|
|
|
|
@@ -1299,15 +1308,19 @@ window.initHot = function(model){
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
changeBoxHelperDisplay(show){
|
|
|
- this.visible_ = this.visible
|
|
|
if(show){
|
|
|
+ this.visible_ = this.visible
|
|
|
this.visible = true
|
|
|
this.mesh.boxHelper.visible = true
|
|
|
}else{
|
|
|
- this.visible = this.visible_
|
|
|
+ if(this.visible_ != void 0){
|
|
|
+ this.visible = this.visible_
|
|
|
+ }
|
|
|
this.mesh.boxHelper.visible = false
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1347,7 +1360,7 @@ window.initHot = function(model){
|
|
|
e.texMedia = tex.image
|
|
|
|
|
|
{//animation不同致使的不能使用同一个texture
|
|
|
- if(settings.isEdit){
|
|
|
+ if(window.isEdit){
|
|
|
if(animateTexSrcs[e.info.texSrc]){
|
|
|
e.material_.map = tex.clone(); //编辑动画直接不用一个texture, 故而animation也不同
|
|
|
e.material_.map.needsUpdate = true
|
|
@@ -1440,7 +1453,7 @@ window.initHot = function(model){
|
|
|
}
|
|
|
|
|
|
Hot.beginShineHot = function(){
|
|
|
- if(!settings.isEdit && shineMats.length == 0)return
|
|
|
+ if(!window.isEdit && shineMats.length == 0)return
|
|
|
|
|
|
|
|
|
transitions.trigger({
|
|
@@ -1596,6 +1609,27 @@ window.initHot = function(model){
|
|
|
$('#closepop').on("click",Hot.closePopup);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ Hot.createHotList = function() {
|
|
|
+ var docFragment = document.createDocumentFragment();
|
|
|
+ var hots = hotGroup.children.filter(hot=>hot.info.actionType.openHot);
|
|
|
+ hots = hots.sort((a,b)=>{return a.order - b.order});
|
|
|
+ hots.forEach((hot)=>{
|
|
|
+ var li = document.createElement('li');
|
|
|
+ var span = document.createElement('span');
|
|
|
+ span.innerHTML = hot.info.title || '热点';
|
|
|
+ // console.log(span.innerHTML);
|
|
|
+ li.hot = hot; // 列表每一项对应一个热点
|
|
|
+ li.appendChild(span);
|
|
|
+ docFragment.appendChild(li);
|
|
|
+
|
|
|
+ })
|
|
|
+ var ul = document.querySelector('#hotListContent ul');
|
|
|
+ ul && ul.appendChild(docFragment);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|