|
@@ -53,15 +53,10 @@ window.initHot = function (model) {
|
|
|
var src = ''
|
|
|
var r = link.substring(link.indexOf('html') + 4),
|
|
|
o = 'en' == manage.number('lang') ? '&lang=' + manage.number('lang') : ''
|
|
|
- ;-1 == r.indexOf('?')
|
|
|
- ? (src = link + '?time=' + randomTime().getTime() + '&id=' + window.number + o)
|
|
|
- : (src = link + '&time=' + randomTime().getTime() + '&id=' + window.number + o)
|
|
|
-
|
|
|
- // return src.replace(
|
|
|
- // 'https://www.4dmodel.com/SuperTwo/hot_online1',
|
|
|
- // 'https://houseoss.4dkankan.com/project/HainanMuseum/hot'
|
|
|
- // )
|
|
|
- return src.replace('https://www.4dmodel.com/SuperTwo/hot_online1', 'http://localhost:8080')
|
|
|
+ ;-1 == r.indexOf('?') ? (src = link + '?time=' + randomTime().getTime() + '&id=' + window.number + o) : (src = link + '&time=' + randomTime().getTime() + '&id=' + window.number + o)
|
|
|
+
|
|
|
+ return src.replace('https://www.4dmodel.com/SuperTwo/hot_online1', 'https://houseoss.4dkankan.com/project/WuhanMuseum/hot')
|
|
|
+ // return src.replace('https://www.4dmodel.com/SuperTwo/hot_online1', 'http://localhost:8080')
|
|
|
// return src
|
|
|
}
|
|
|
var removeSrcPostMark = function (url) {
|
|
@@ -75,12 +70,7 @@ window.initHot = function (model) {
|
|
|
{
|
|
|
//get plane Bound
|
|
|
var planeBound = new THREE.Box3()
|
|
|
- var cornerPoint = [
|
|
|
- new THREE.Vector3(-0.5, 0.5, 0),
|
|
|
- new THREE.Vector3(0.5, 0.5, 0),
|
|
|
- new THREE.Vector3(0.5, -0.5, 0),
|
|
|
- new THREE.Vector3(-0.5, -0.5, 0)
|
|
|
- ]
|
|
|
+ var cornerPoint = [new THREE.Vector3(-0.5, 0.5, 0), new THREE.Vector3(0.5, 0.5, 0), new THREE.Vector3(0.5, -0.5, 0), new THREE.Vector3(-0.5, -0.5, 0)]
|
|
|
cornerPoint.forEach(e => {
|
|
|
planeBound.expandByPoint(e)
|
|
|
})
|
|
@@ -88,9 +78,7 @@ window.initHot = function (model) {
|
|
|
|
|
|
var shineMats = []
|
|
|
var getShineMat = function (texture1, texture2) {
|
|
|
- var mat = shineMats.find(
|
|
|
- e => e.uniforms.texture1.value == texture1 && e.uniforms.texture2.value == texture2
|
|
|
- )
|
|
|
+ var mat = shineMats.find(e => e.uniforms.texture1.value == texture1 && e.uniforms.texture2.value == texture2)
|
|
|
if (mat) return mat
|
|
|
else {
|
|
|
var mat = new THREE.ShaderMaterial({
|
|
@@ -108,8 +96,7 @@ window.initHot = function (model) {
|
|
|
value: texture2
|
|
|
}
|
|
|
},
|
|
|
- vertexShader:
|
|
|
- 'varying vec2 vUv;\n\nvoid main() {\n\n vUv = uv ;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n',
|
|
|
+ vertexShader: 'varying vec2 vUv;\n\nvoid main() {\n\n vUv = uv ;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n',
|
|
|
fragmentShader:
|
|
|
'varying vec3 vNormal;\n\nvarying vec2 vUv;\n\nuniform float opac;\n\n uniform sampler2D texture1;\n\nuniform sampler2D texture2;\n\nvoid main() {\n\nvec4 tcolor1 = texture2D( texture1, vUv );\n\nvec4 tcolor2 = texture2D( texture2, vUv );\n\ngl_FragColor = mix(tcolor1,tcolor2 ,opac) + tcolor2*0.2; }\n',
|
|
|
transparent: !0
|
|
@@ -199,12 +186,7 @@ window.initHot = function (model) {
|
|
|
}
|
|
|
|
|
|
if (this.info.animateInfo && this.material_.map) {
|
|
|
- this.animation = GifTexDeal.addAnimation(
|
|
|
- this.material_.map,
|
|
|
- this,
|
|
|
- this.info.animateInfo,
|
|
|
- this.sid
|
|
|
- )
|
|
|
+ this.animation = GifTexDeal.addAnimation(this.material_.map, this, this.info.animateInfo, this.sid)
|
|
|
this.visible && this.inSight() && GifTexDeal.start(this.animation)
|
|
|
}
|
|
|
}
|
|
@@ -252,10 +234,7 @@ window.initHot = function (model) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (
|
|
|
- this.material_ &&
|
|
|
- !hotGroup.children.find(e => e != this && e.material_ == this.material_)
|
|
|
- ) {
|
|
|
+ if (this.material_ && !hotGroup.children.find(e => e != this && e.material_ == this.material_)) {
|
|
|
this.material_.dispose()
|
|
|
}
|
|
|
|
|
@@ -297,9 +276,7 @@ window.initHot = function (model) {
|
|
|
} else {
|
|
|
if (!this.info.texSrc) return
|
|
|
|
|
|
- var video = $(
|
|
|
- `<video controls="controls" loop x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload" preload="meta" ></video>`
|
|
|
- )[0]
|
|
|
+ var video = $(`<video controls="controls" loop x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload" preload="meta" ></video>`)[0]
|
|
|
if (window.isEdit) video.src = manage.dealURL(this.info.texSrc) //注意,src赋值就会自动加载, preload="meta" 只加载元数据,提高加载速度,否则一开始卡
|
|
|
|
|
|
/* let src = this.info.texSrc
|
|
@@ -463,9 +440,7 @@ window.initHot = function (model) {
|
|
|
info.quaternion = convertValue(info.quaternion, THREE.Quaternion)
|
|
|
} else {
|
|
|
info.rotation = convertValue(info.rotation, THREE.Vector3)
|
|
|
- info.quaternion = new THREE.Quaternion().setFromEuler(
|
|
|
- new THREE.Euler().setFromVector3(info.rotation)
|
|
|
- ) //热点的旧数据很多是字符串
|
|
|
+ info.quaternion = new THREE.Quaternion().setFromEuler(new THREE.Euler().setFromVector3(info.rotation)) //热点的旧数据很多是字符串
|
|
|
}
|
|
|
|
|
|
var s = Hot.getDefaulScale(info.hotIconScale) //旧版的大小,统一转换成新版
|
|
@@ -502,9 +477,7 @@ window.initHot = function (model) {
|
|
|
delete info.depth
|
|
|
delete info.file
|
|
|
} else {
|
|
|
- info.quaternion = new THREE.Quaternion().setFromEuler(
|
|
|
- new THREE.Euler().fromArray(info.rotation)
|
|
|
- ) //.setFromVector3(info.rotation)
|
|
|
+ info.quaternion = new THREE.Quaternion().setFromEuler(new THREE.Euler().fromArray(info.rotation)) //.setFromVector3(info.rotation)
|
|
|
}
|
|
|
|
|
|
info.model = info.model || [] //模型链接
|
|
@@ -533,14 +506,8 @@ window.initHot = function (model) {
|
|
|
|
|
|
for (let i in info.transformAtPanos) {
|
|
|
info.transformAtPanos[i].pos = new THREE.Vector3().fromArray(info.transformAtPanos[i].pos)
|
|
|
- info.transformAtPanos[i].qua &&
|
|
|
- (info.transformAtPanos[i].qua = new THREE.Quaternion().fromArray(
|
|
|
- info.transformAtPanos[i].qua
|
|
|
- ))
|
|
|
- info.transformAtPanos[i].scale &&
|
|
|
- (info.transformAtPanos[i].scale = new THREE.Vector3().fromArray(
|
|
|
- info.transformAtPanos[i].scale
|
|
|
- ))
|
|
|
+ info.transformAtPanos[i].qua && (info.transformAtPanos[i].qua = new THREE.Quaternion().fromArray(info.transformAtPanos[i].qua))
|
|
|
+ info.transformAtPanos[i].scale && (info.transformAtPanos[i].scale = new THREE.Vector3().fromArray(info.transformAtPanos[i].scale))
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -690,10 +657,7 @@ window.initHot = function (model) {
|
|
|
let visible =
|
|
|
visibility != void 0
|
|
|
? visibility
|
|
|
- : !this.info.visiblePanos ||
|
|
|
- (type == 'every'
|
|
|
- ? panos.every(pano => this.info.visiblePanos.includes(pano.id))
|
|
|
- : panos.some(pano => this.info.visiblePanos.includes(pano.id))) //type为every时,需要panos中每个都可见才显示
|
|
|
+ : !this.info.visiblePanos || (type == 'every' ? panos.every(pano => this.info.visiblePanos.includes(pano.id)) : panos.some(pano => this.info.visiblePanos.includes(pano.id))) //type为every时,需要panos中每个都可见才显示
|
|
|
|
|
|
convertTool.updateVisible(this, 'visi', visible)
|
|
|
|
|
@@ -724,12 +688,7 @@ window.initHot = function (model) {
|
|
|
var center //中心点
|
|
|
if (this.plane) {
|
|
|
center = this.plane.getWorldPosition()
|
|
|
- boundPoint = [
|
|
|
- new THREE.Vector3(-0.5, 0.5, 0),
|
|
|
- new THREE.Vector3(0.5, 0.5, 0),
|
|
|
- new THREE.Vector3(0.5, -0.5, 0),
|
|
|
- new THREE.Vector3(-0.5, -0.5, 0)
|
|
|
- ]
|
|
|
+ boundPoint = [new THREE.Vector3(-0.5, 0.5, 0), new THREE.Vector3(0.5, 0.5, 0), new THREE.Vector3(0.5, -0.5, 0), new THREE.Vector3(-0.5, -0.5, 0)]
|
|
|
} else {
|
|
|
var bound = new THREE.Box3().copy(this.info.modelBound.bound)
|
|
|
boundPoint = [
|
|
@@ -789,12 +748,7 @@ window.initHot = function (model) {
|
|
|
minLon = minLon + centerDirInfo.lon
|
|
|
minLat = minLat + centerDirInfo.lat
|
|
|
|
|
|
- var dirs = [
|
|
|
- math.getDirByLonLat(maxLon, maxLat),
|
|
|
- math.getDirByLonLat(minLon, minLat),
|
|
|
- math.getDirByLonLat(maxLon, minLat),
|
|
|
- math.getDirByLonLat(minLon, maxLat)
|
|
|
- ]
|
|
|
+ var dirs = [math.getDirByLonLat(maxLon, maxLat), math.getDirByLonLat(minLon, minLat), math.getDirByLonLat(maxLon, minLat), math.getDirByLonLat(minLon, maxLat)]
|
|
|
cornerPoint = dirs.map(e => {
|
|
|
return e.clone().add(pos1)
|
|
|
})
|
|
@@ -875,10 +829,7 @@ window.initHot = function (model) {
|
|
|
//飞出 只判断在不在画面内
|
|
|
//return playVideoWhenFlyOut//true
|
|
|
let frustumMatrix = new THREE.Matrix4()
|
|
|
- frustumMatrix.multiplyMatrices(
|
|
|
- player.camera.projectionMatrix,
|
|
|
- player.camera.matrixWorldInverse
|
|
|
- )
|
|
|
+ frustumMatrix.multiplyMatrices(player.camera.projectionMatrix, player.camera.matrixWorldInverse)
|
|
|
|
|
|
let frustum = new THREE.Frustum()
|
|
|
frustum.setFromMatrix(frustumMatrix)
|
|
@@ -1028,9 +979,7 @@ window.initHot = function (model) {
|
|
|
if (!this.titleElem) return
|
|
|
this.hovered = !!state
|
|
|
|
|
|
- var v =
|
|
|
- this.info.titleShowType != 'unvisible' &&
|
|
|
- (this.info.titleShowType == 'always' || this.hovered)
|
|
|
+ var v = this.info.titleShowType != 'unvisible' && (this.info.titleShowType == 'always' || this.hovered)
|
|
|
this.titleElem.setVisible(v, 'hoveredVisi', 1)
|
|
|
//this.updateTitle()
|
|
|
}
|
|
@@ -1050,20 +999,14 @@ 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
|
|
|
- )
|
|
|
+ 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) {
|
|
|
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
|
|
|
- )
|
|
|
+ return window._settings.insideLookLimitDown - i < t && t < window._settings.insideLookLimitUp + i
|
|
|
},
|
|
|
|
|
|
pano => {
|
|
@@ -1123,9 +1066,7 @@ window.initHot = function (model) {
|
|
|
|
|
|
examine(options = {}) {
|
|
|
var openHot = this.info.link && this.info.actionType.openHot && !options.dontOpen
|
|
|
- var fastTran =
|
|
|
- !options.dontFastTran &&
|
|
|
- (this.info.actionType.fastTran || settings.hotFastTran || options.fastTran)
|
|
|
+ var fastTran = !options.dontFastTran && (this.info.actionType.fastTran || settings.hotFastTran || options.fastTran)
|
|
|
if (fastTran) {
|
|
|
//瞬间过渡 1到固定方位 2到和普通过渡一样的位置,也就是最适合的位置
|
|
|
let info = this.info.cameraData
|
|
@@ -1137,8 +1078,7 @@ window.initHot = function (model) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var needExamine =
|
|
|
- !fastTran && (options.examine || (!settings.dontExamHot && this.info.actionType.examine))
|
|
|
+ var needExamine = !fastTran && (options.examine || (!settings.dontExamHot && this.info.actionType.examine))
|
|
|
if (!openHot && !needExamine) return
|
|
|
|
|
|
if (openHot && this.info.linkType != 'common' && this.info.iframe && this.info.iframe[0]) {
|
|
@@ -1214,10 +1154,7 @@ window.initHot = function (model) {
|
|
|
if (s) {
|
|
|
var t = document.querySelector('#id1').contentWindow.document
|
|
|
t.querySelector('video') &&
|
|
|
- (t.querySelector('video').play(),
|
|
|
- !t.querySelector('video').paused &&
|
|
|
- t.querySelector('.playPause') &&
|
|
|
- t.querySelector('.playPause').classList.add('fa-pause')),
|
|
|
+ (t.querySelector('video').play(), !t.querySelector('video').paused && t.querySelector('.playPause') && t.querySelector('.playPause').classList.add('fa-pause')),
|
|
|
t.querySelector('audio') && t.querySelector('audio').play()
|
|
|
} else setTimeout(e, 300)
|
|
|
}, 800)
|
|
@@ -1266,10 +1203,7 @@ window.initHot = function (model) {
|
|
|
var f = new THREE.Matrix4().lookAt(c.position, h, new THREE.Vector3(0, 1, 0))
|
|
|
p.quaternion = new THREE.Quaternion().setFromRotationMatrix(f)
|
|
|
}
|
|
|
- ;(p.callback = done),
|
|
|
- (p.duration = options.duration || 1500),
|
|
|
- (p.mode = 'panorama'),
|
|
|
- (p.aimDuration = options.aimDuration)
|
|
|
+ ;(p.callback = done), (p.duration = options.duration || 1500), (p.mode = 'panorama'), (p.aimDuration = options.aimDuration)
|
|
|
player.flyToNewMode(p)
|
|
|
}
|
|
|
}
|
|
@@ -1549,18 +1483,8 @@ window.initHot = function (model) {
|
|
|
|
|
|
//Hot.loadWhenOutside = true
|
|
|
|
|
|
- hots1 = model.hotGroup.children.filter(
|
|
|
- e =>
|
|
|
- e.texType == 'photo' &&
|
|
|
- !e.photoHasRequestLoad &&
|
|
|
- (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id))
|
|
|
- )
|
|
|
- hots2 = model.hotGroup.children.filter(
|
|
|
- e =>
|
|
|
- e.info.objSrc &&
|
|
|
- !e.modelHasRequestLoad &&
|
|
|
- (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id))
|
|
|
- )
|
|
|
+ hots1 = model.hotGroup.children.filter(e => e.texType == 'photo' && !e.photoHasRequestLoad && (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id)))
|
|
|
+ hots2 = model.hotGroup.children.filter(e => e.info.objSrc && !e.modelHasRequestLoad && (!e.info.visiblePanos || e.info.visiblePanos.includes(player.currentPano.id)))
|
|
|
if (hots1.length + hots2.length == 0) {
|
|
|
hots1 = model.hotGroup.children.filter(e => e.texType == 'photo' && !e.photoHasRequestLoad)
|
|
|
hots2 = model.hotGroup.children.filter(e => e.info.objSrc && !e.modelHasRequestLoad)
|
|
@@ -1618,8 +1542,7 @@ window.initHot = function (model) {
|
|
|
originModelCount = hotGroup.children.filter(e => !!e.info.objSrc).length
|
|
|
if (originPhotoCount == 0) Hot.allPhotoLoaded = true
|
|
|
if (originModelCount == 0) Hot.allModelLoaded = true
|
|
|
- if (Hot.allModelLoaded && Hot.allPhotoLoaded)
|
|
|
- Hot.whenAllFileLoaded && Hot.whenAllFileLoaded() //所有加载完毕
|
|
|
+ if (Hot.allModelLoaded && Hot.allPhotoLoaded) Hot.whenAllFileLoaded && Hot.whenAllFileLoaded() //所有加载完毕
|
|
|
else {
|
|
|
Hot.load()
|
|
|
}
|
|
@@ -1676,6 +1599,11 @@ window.initHot = function (model) {
|
|
|
|
|
|
SoundManager.pause('hot', true) //自动播放被中断的音频 (bgm
|
|
|
|
|
|
+ const cad = document.querySelector('.cad')
|
|
|
+ if (cad) {
|
|
|
+ cad.style.visibility = cad.style.visibility === 'hidden' ? 'visible' : 'hidden'
|
|
|
+ }
|
|
|
+
|
|
|
return false
|
|
|
}
|
|
|
|
|
@@ -1718,12 +1646,7 @@ window.initHot = function (model) {
|
|
|
/* if(hot.texType == 'video' && hot.shouldPlay){
|
|
|
console.log(1)
|
|
|
} */
|
|
|
- if (
|
|
|
- !hot.clickToPlayInited &&
|
|
|
- hot.texType == 'video' &&
|
|
|
- !isVideoPlayed(hot.texMedia) &&
|
|
|
- hot.shouldPlay
|
|
|
- ) {
|
|
|
+ if (!hot.clickToPlayInited && hot.texType == 'video' && !isVideoPlayed(hot.texMedia) && hot.shouldPlay) {
|
|
|
//hot.update(player)
|
|
|
console.log({ str: 'try mobileAutoPlay ' + hot.sid, level: 1 })
|
|
|
hot.videoControl(true)
|
|
@@ -1780,9 +1703,7 @@ window.initHot = function (model) {
|
|
|
}
|
|
|
let filter = (type, max, list, playFun) => {
|
|
|
if (list.length < max) {
|
|
|
- list.forEach(hot =>
|
|
|
- type == 'video' ? hot.videoControl(true) : GifTexDeal.start(hot.animation)
|
|
|
- )
|
|
|
+ list.forEach(hot => (type == 'video' ? hot.videoControl(true) : GifTexDeal.start(hot.animation)))
|
|
|
} else {
|
|
|
let playerDir = player.getDirection()
|
|
|
let request = []
|
|
@@ -1811,17 +1732,11 @@ window.initHot = function (model) {
|
|
|
//面积因素
|
|
|
if (player.mode == 'panorama') {
|
|
|
var cornerPointInfo = hot.getCornerPoint() //仅支持漫游模式
|
|
|
- let area =
|
|
|
- (cornerPointInfo.diffLon * Math.pow(cornerPointInfo.diffLat, 0.5)) / 1000 //占据面积
|
|
|
+ let area = (cornerPointInfo.diffLon * Math.pow(cornerPointInfo.diffLat, 0.5)) / 1000 //占据面积
|
|
|
return area
|
|
|
} else {
|
|
|
let dis = player.position.distanceTo(hot.position)
|
|
|
- let size =
|
|
|
- hot
|
|
|
- .getBoundOri()
|
|
|
- .applyMatrix4(hot.matrixWorld)
|
|
|
- .size(new THREE.Vector3())
|
|
|
- .length() / 2
|
|
|
+ let size = hot.getBoundOri().applyMatrix4(hot.matrixWorld).size(new THREE.Vector3()).length() / 2
|
|
|
let score = Math.atan(size / Math.pow(dis, 1.2)) * 50 // 在镜头中所占fov angle 的一半 。 pow是因为实际感受还是尽量显示近处的
|
|
|
if (hot.plane) {
|
|
|
//考虑plane的方向,越倾斜分越低
|