|
|
@ -6,7 +6,7 @@
|
|
|
|
<Demo/>
|
|
|
|
<Demo/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="position:absolute;top: 0;left: 0;">
|
|
|
|
<div style="position:absolute;top: 0;left: 0;">
|
|
|
|
<el-input-number v-model="num" @change="handleChange" :step="0.1" label="描述文字"></el-input-number>
|
|
|
|
<!-- <el-input-number v-model="num" @change="handleChange" :step="0.1" label="描述文字"></el-input-number>-->
|
|
|
|
<el-select v-model="floor" placeholder="去几楼" @change="toFloor">
|
|
|
|
<el-select v-model="floor" placeholder="去几楼" @change="toFloor">
|
|
|
|
<el-option
|
|
|
|
<el-option
|
|
|
|
label="1楼"
|
|
|
|
label="1楼"
|
|
|
@ -53,47 +53,36 @@ import { CSS2DObject, CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRe
|
|
|
|
import Demo from '@/components/model/demo.vue'
|
|
|
|
import Demo from '@/components/model/demo.vue'
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
|
|
|
|
tuopanInishengji,
|
|
|
|
storeyHeight,
|
|
|
|
storeyHeight,
|
|
|
|
storeyWidth,
|
|
|
|
storeyWidth,
|
|
|
|
tishengjiLocation,
|
|
|
|
|
|
|
|
tuopanLocation,
|
|
|
|
|
|
|
|
tishengjiAnimation,
|
|
|
|
tishengjiAnimation,
|
|
|
|
tuopanXAnimation,
|
|
|
|
tuopanXAnimation,
|
|
|
|
tuopanYAnimation,
|
|
|
|
tuopanYAnimation,
|
|
|
|
tuopanAnimation
|
|
|
|
tuopanLocation
|
|
|
|
} from './animation'
|
|
|
|
} from './animation'
|
|
|
|
|
|
|
|
|
|
|
|
let keyidongModel = null
|
|
|
|
let keyidongModel = null
|
|
|
|
let tuopanModel = null
|
|
|
|
let tuopanModel = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let isAnimation = false
|
|
|
|
let animationLine = []
|
|
|
|
let animationLine = []
|
|
|
|
|
|
|
|
|
|
|
|
const animation = async(funs) => {
|
|
|
|
const animation = async() => {
|
|
|
|
if (funs.length > 0) {
|
|
|
|
try {
|
|
|
|
await funs[0]()
|
|
|
|
if (animationLine.length > 0) {
|
|
|
|
funs.shift()
|
|
|
|
await animationLine[0]()
|
|
|
|
return animation(funs)
|
|
|
|
animationLine.shift()
|
|
|
|
}
|
|
|
|
if (animationLine.length > 0) {
|
|
|
|
}
|
|
|
|
animation(animationLine)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
const tishengjiToFloor = (floor) => {
|
|
|
|
isAnimation = false
|
|
|
|
return tishengjiAnimation(keyidongModel, tishengjiLocation.y, storeyHeight[floor], 2000)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const tuopanReset = async() => {
|
|
|
|
} catch (e) {
|
|
|
|
await tuopanXAnimation(tuopanModel, tuopanLocation.x, 0, 2000)
|
|
|
|
console.log(e)
|
|
|
|
console.log(321321312)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const tuopanToFloor = (floor) => {
|
|
|
|
|
|
|
|
return tuopanYAnimation(tuopanModel, tuopanLocation.y, storeyHeight[floor], 2000)
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
|
|
tuopanXAnimation(tuopanModel, tuopanLocation.x, 0, 20)
|
|
|
|
|
|
|
|
tuopanYAnimation(tuopanModel, tuopanLocation.y, storeyHeight[floor], 2000)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const tuopanOut = async(floor) => {
|
|
|
|
|
|
|
|
await tuopanXAnimation(tuopanModel, tuopanLocation.x, storeyWidth[floor], 2000)
|
|
|
|
|
|
|
|
console.log(321321312)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scene = new THREE.Scene()
|
|
|
|
const scene = new THREE.Scene()
|
|
|
|
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
|
|
|
|
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
|
|
|
@ -104,8 +93,7 @@ export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
num: -60,
|
|
|
|
num: -60,
|
|
|
|
floor: 0,
|
|
|
|
floor: 0
|
|
|
|
tuopanInishengji: true
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
@ -167,14 +155,13 @@ export default {
|
|
|
|
xhr => {
|
|
|
|
xhr => {
|
|
|
|
if ((xhr.loaded / xhr.total * 100) === 100) {
|
|
|
|
if ((xhr.loaded / xhr.total * 100) === 100) {
|
|
|
|
a += 1
|
|
|
|
a += 1
|
|
|
|
console.log(a)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loadF(['AGVchongdianzhuang002', 'AGVchongdianzhuang003', 'changfang002', 'changfang003', 'quanzidongchaibaojizhaungpeixian003', 'tishengji', 'tishengji_keyidongbufen', 'tishengji_tuopan'])
|
|
|
|
loadF(['tishengji', 'AGVchongdianzhuang002', 'AGVchongdianzhuang003', 'changfang002', 'changfang003', 'quanzidongchaibaojizhaungpeixian003', 'tishengji_keyidongbufen', 'tishengji_tuopan'])
|
|
|
|
|
|
|
|
|
|
|
|
const labelRenderer = new CSS2DRenderer()
|
|
|
|
const labelRenderer = new CSS2DRenderer()
|
|
|
|
labelRenderer.setSize(window.innerWidth, window.innerHeight)
|
|
|
|
labelRenderer.setSize(window.innerWidth, window.innerHeight)
|
|
|
@ -222,7 +209,6 @@ export default {
|
|
|
|
// 如果有交点
|
|
|
|
// 如果有交点
|
|
|
|
if (intersects.length > 0) {
|
|
|
|
if (intersects.length > 0) {
|
|
|
|
let obj = intersects[0]
|
|
|
|
let obj = intersects[0]
|
|
|
|
console.log(obj)
|
|
|
|
|
|
|
|
new TWEEN.Tween(camera.position).to(new THREE.Vector3((intersects[0].point.x + 0), (intersects[0].point.y + 500), (intersects[0].point.z - 500)), 500).onUpdate(() => {
|
|
|
|
new TWEEN.Tween(camera.position).to(new THREE.Vector3((intersects[0].point.x + 0), (intersects[0].point.y + 500), (intersects[0].point.z - 500)), 500).onUpdate(() => {
|
|
|
|
camera.updateProjectionMatrix()
|
|
|
|
camera.updateProjectionMatrix()
|
|
|
|
}).start()
|
|
|
|
}).start()
|
|
|
@ -237,11 +223,15 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
// 渲染循环
|
|
|
|
// 渲染循环
|
|
|
|
function animate() {
|
|
|
|
function animate() {
|
|
|
|
|
|
|
|
if (animationLine.length > 0 && isAnimation === false) {
|
|
|
|
|
|
|
|
console.log('动画')
|
|
|
|
|
|
|
|
isAnimation = true
|
|
|
|
|
|
|
|
animation(animationLine)
|
|
|
|
|
|
|
|
}
|
|
|
|
requestAnimationFrame(animate)
|
|
|
|
requestAnimationFrame(animate)
|
|
|
|
TWEEN.update()
|
|
|
|
TWEEN.update()
|
|
|
|
if (keyidongModel) {
|
|
|
|
if (keyidongModel) {
|
|
|
|
// keyidongModel.position.y += 0.1;
|
|
|
|
// keyidongModel.position.y += 0.1;
|
|
|
|
// console.log( keyidongModel)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tuopanModel) {
|
|
|
|
if (tuopanModel) {
|
|
|
|
// tuopanModel.position.y += 0.1;
|
|
|
|
// tuopanModel.position.y += 0.1;
|
|
|
@ -251,7 +241,6 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
setInterval(() => {
|
|
|
|
// console.log(camera)
|
|
|
|
|
|
|
|
}, 1000 * 10)
|
|
|
|
}, 1000 * 10)
|
|
|
|
|
|
|
|
|
|
|
|
animate()
|
|
|
|
animate()
|
|
|
@ -259,37 +248,24 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
handleChange() {
|
|
|
|
handleChange() {
|
|
|
|
tuopanModel.position.x = this.num
|
|
|
|
// tuopanModel.position.x = this.num
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
toFloor(e) {
|
|
|
|
toFloor(e) {
|
|
|
|
// tishengjiToFloor(e)
|
|
|
|
animationLine.push(() => {
|
|
|
|
tishengjiLocation.floor = e
|
|
|
|
console.log(321323)
|
|
|
|
// tishengjiLocation.y = storeyHeight[e]
|
|
|
|
console.log(tuopanInishengji)
|
|
|
|
if (this.tuopanInishengji) {
|
|
|
|
if (tuopanInishengji) {
|
|
|
|
// tuopanToFloor(e)
|
|
|
|
return Promise.all([tishengjiAnimation(keyidongModel, e, storeyHeight[e]), tuopanYAnimation(tuopanModel, e, storeyHeight[e])])
|
|
|
|
tuopanLocation.floor = e
|
|
|
|
} else {
|
|
|
|
// tuopanLocation.y = storeyHeight[e]
|
|
|
|
animationLine.push(() => tishengjiAnimation(keyidongModel, e, storeyHeight[e]))
|
|
|
|
animationLine.push(() => Promise.all([tishengjiToFloor(e), tuopanToFloor(e)]))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
})
|
|
|
|
animationLine.push(() => Promise.all([tishengjiToFloor(e)]))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (animationLine.length === 1) {
|
|
|
|
|
|
|
|
console.log(animationLine[0])
|
|
|
|
|
|
|
|
animation(animationLine)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tuopanReset() {
|
|
|
|
tuopanReset() {
|
|
|
|
if (tishengjiLocation.floor === tuopanLocation.floor) {
|
|
|
|
animationLine.push(() => tuopanXAnimation(tuopanModel, 0))
|
|
|
|
tuopanReset()
|
|
|
|
|
|
|
|
tuopanLocation.x = 0
|
|
|
|
|
|
|
|
this.tuopanInishengji = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tuopanOut() {
|
|
|
|
tuopanOut() {
|
|
|
|
tuopanOut(this.floor)
|
|
|
|
animationLine.push(() => tuopanXAnimation(tuopanModel, storeyWidth[tuopanLocation.floor]))
|
|
|
|
tuopanLocation.x = storeyWidth[this.floor]
|
|
|
|
|
|
|
|
this.tuopanInishengji = false
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
removetuopan() {
|
|
|
|
removetuopan() {
|
|
|
|
scene.remove(tuopanModel)
|
|
|
|
scene.remove(tuopanModel)
|
|
|
|