添加agv
parent
2c9281be86
commit
2d2eab1069
@ -0,0 +1,84 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 10:18:29
|
||||
|
||||
newmtl wire_255024000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.0941 0.0000
|
||||
Kd 1.0000 0.0941 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_014014014
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0549 0.0549 0.0549
|
||||
Kd 0.0549 0.0549 0.0549
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl 07___Default
|
||||
Ns 30.0000
|
||||
Ni 1.5000
|
||||
d 0.4000
|
||||
Tr 0.6000
|
||||
Tf 0.4000 0.4000 0.4000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl wire_000147042
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0000 0.5765 0.1647
|
||||
Kd 0.0000 0.5765 0.1647
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255255255
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255000000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.0000 0.0000
|
||||
Kd 1.0000 0.0000 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_115115115
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.4510 0.4510 0.4510
|
||||
Kd 0.4510 0.4510 0.4510
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255192000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.7529 0.0000
|
||||
Kd 1.0000 0.7529 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,16 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# 创建的文件:15.07.2024 17:01:06
|
||||
|
||||
newmtl Material__25
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,26 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 17:02:11
|
||||
|
||||
newmtl Material__2467
|
||||
Kd 0.0784 0.0784 0.0784
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
||||
|
||||
newmtl wire_020020020
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0784 0.0784 0.0784
|
||||
Kd 0.0784 0.0784 0.0784
|
||||
Ks 0.3500 0.3500 0.3500
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 17:03:16
|
||||
|
||||
newmtl Material__39
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
||||
|
||||
newmtl wire_007007007
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0275 0.0275 0.0275
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl Material__38
|
||||
Kd 0.2235 0.2235 0.2235
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.6000
|
||||
Pm 0.2000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 17:04:58
|
||||
|
||||
newmtl Material__39
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
||||
|
||||
newmtl wire_007007007
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0275 0.0275 0.0275
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl Material__38
|
||||
Kd 0.2235 0.2235 0.2235
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.6000
|
||||
Pm 0.2000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 17:06:15
|
||||
|
||||
newmtl Material__39
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
||||
|
||||
newmtl wire_007007007
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0275 0.0275 0.0275
|
||||
Kd 0.0275 0.0275 0.0275
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl Material__38
|
||||
Kd 0.2235 0.2235 0.2235
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.6000
|
||||
Pm 0.2000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 10:20:16
|
||||
|
||||
newmtl wire_255024000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.0941 0.0000
|
||||
Kd 1.0000 0.0941 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_014014014
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0549 0.0549 0.0549
|
||||
Kd 0.0549 0.0549 0.0549
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl 07___Default
|
||||
Ns 30.0000
|
||||
Ni 1.5000
|
||||
d 0.4000
|
||||
Tr 0.6000
|
||||
Tf 0.4000 0.4000 0.4000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl wire_000147042
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.0000 0.5765 0.1647
|
||||
Kd 0.0000 0.5765 0.1647
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255255255
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255000000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.0000 0.0000
|
||||
Kd 1.0000 0.0000 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_115115115
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.4510 0.4510 0.4510
|
||||
Kd 0.4510 0.4510 0.4510
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_255192000
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 1.0000 0.7529 0.0000
|
||||
Kd 1.0000 0.7529 0.0000
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_047047047
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.1843 0.1843 0.1843
|
||||
Kd 0.1843 0.1843 0.1843
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl wire_200200200
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.7843 0.7843 0.7843
|
||||
Kd 0.7843 0.7843 0.7843
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl 05___Default
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 0.9000
|
||||
Tr 0.1000
|
||||
Tf 0.9000 0.9000 0.9000
|
||||
illum 2
|
||||
Ka 0.6510 0.8941 0.8980
|
||||
Kd 0.6510 0.8941 0.8980
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl wire_166228229
|
||||
Ns 32
|
||||
d 1
|
||||
Tr 0
|
||||
Tf 1 1 1
|
||||
illum 2
|
||||
Ka 0.6510 0.8941 0.8980
|
||||
Kd 0.6510 0.8941 0.8980
|
||||
Ks 0.3500 0.3500 0.3500
|
||||
|
||||
newmtl 01___Default
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 0.6000
|
||||
Tr 0.4000
|
||||
Tf 0.6000 0.6000 0.6000
|
||||
illum 2
|
||||
Ka 0.7843 0.7843 0.7843
|
||||
Kd 0.7843 0.7843 0.7843
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl 06___Default
|
||||
Ns 30.0000
|
||||
Ni 1.5000
|
||||
d 0.6000
|
||||
Tr 0.4000
|
||||
Tf 0.6000 0.6000 0.6000
|
||||
illum 2
|
||||
Ka 0.5000 0.5000 0.5000
|
||||
Kd 0.5000 0.5000 0.5000
|
||||
Ks 0.0000 0.0000 0.0000
|
||||
Ke 0.0000 0.0000 0.0000
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware
|
||||
# ´´½¨µÄÎļþ:15.07.2024 10:21:49
|
||||
|
||||
newmtl Material__2464
|
||||
Kd 0.7529 0.7529 0.7529
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
||||
|
||||
newmtl Material__2465
|
||||
Kd 0.9686 1.0000 0.5294
|
||||
Ks 1.0000 1.0000 1.0000
|
||||
Tr 0.0000
|
||||
d 1.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
Pr 0.0000
|
||||
Pm 0.0000
|
||||
Pc 0.0000
|
||||
Pcr 0.0000
|
||||
Ni 1.5200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
illum 2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
|
||||
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
|
||||
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
||||
import * as THREE from 'three'
|
||||
import { camera, renderer, scene, tishengjiLocation } from '@/views/board/model/setThree'
|
||||
|
||||
let floor3AGVGroup
|
||||
let floor3AGV
|
||||
let floor3AGVData = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
rotate: 0
|
||||
}
|
||||
let floor3Data = {
|
||||
x: 100,
|
||||
y: 100
|
||||
}
|
||||
let floor4AGVGroup
|
||||
let floor5CCAGVGroup
|
||||
let floor5BFAGVGroup
|
||||
let floor5CTUGroup
|
||||
let floor4AGV
|
||||
let floor5CCAGV
|
||||
let floor5BFAGV
|
||||
let floor5CTU
|
||||
|
||||
const getFloor5BFAGV = () => {
|
||||
let mtlLoader = new MTLLoader()
|
||||
mtlLoader.load(`/model/beifushiAGV005/beifushiAGV005.mtl`,
|
||||
materials => {
|
||||
materials.preload()
|
||||
let loader = new OBJLoader()
|
||||
loader.setMaterials(materials)
|
||||
loader.load(
|
||||
`/model/beifushiAGV005/beifushiAGV005.obj`,
|
||||
object => {
|
||||
console.log(object)
|
||||
object.children[0].geometry.computeBoundingBox()
|
||||
let axis = new THREE.Vector3()
|
||||
axis.addVectors(object.children[0].geometry.boundingBox.min, object.children[0].geometry.boundingBox.max)
|
||||
axis.multiplyScalar(0.5)
|
||||
axis.applyMatrix4(object.children[0].matrixWorld)
|
||||
console.log(axis)
|
||||
|
||||
floor3AGVGroup = new THREE.Group()
|
||||
console.log(object)
|
||||
floor3AGVGroup.add(object)
|
||||
axis.z += 11.6
|
||||
// floor3AGVGroup.position.set(0, 0, 0);
|
||||
// const offset = axis.clone().sub(new THREE.Vector3(0, 0, 0));
|
||||
floor3AGVGroup.position.set(axis.x, axis.y, axis.z)
|
||||
object.position.set(-axis.x, -axis.y, -axis.z)
|
||||
scene.add(floor3AGVGroup)
|
||||
|
||||
object.name = 'tishengji_tuopan'
|
||||
// scene.add(object)
|
||||
|
||||
floor3AGV = object
|
||||
// 更新渲染器
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
getFloor5BFAGV()
|
||||
|
||||
const floor3AGVAnimation = (newLocation = 0, time = 2000) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
})
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
if (floor3AGVGroup) {
|
||||
floor3AGVGroup.rotateY(90 * (Math.PI / 180))
|
||||
}
|
||||
}, 1000)
|
||||
setInterval(() => {
|
||||
if (floor3AGVGroup) {
|
||||
// floor3AGVGroup.position.x -= 0.1
|
||||
}
|
||||
}, 16)
|
@ -0,0 +1,197 @@
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
||||
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer'
|
||||
import * as TWEEN from '@tweenjs/tween.js'
|
||||
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
|
||||
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
||||
|
||||
let isAnimation = false
|
||||
let animationLine = []
|
||||
let keyidongModel
|
||||
let tuopanModel
|
||||
const scene = new THREE.Scene()
|
||||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000000000)
|
||||
const renderer = new THREE.WebGLRenderer({
|
||||
antialias: true
|
||||
})
|
||||
const controls = new OrbitControls(camera, renderer.domElement)
|
||||
const pointLight = new THREE.PointLight(0xffffff, 1) //光源颜色 光照强度
|
||||
const ambient = new THREE.AmbientLight(0xffffff, 1)
|
||||
const light = new THREE.DirectionalLight(0xffffff, 1)
|
||||
const labelRenderer = new CSS2DRenderer()
|
||||
let raycaster = new THREE.Raycaster()
|
||||
// 创建一个二维空间的向量用于存储鼠标点击的屏幕位置
|
||||
let mouse = new THREE.Vector2()
|
||||
|
||||
|
||||
|
||||
|
||||
scene.background = new THREE.Color(0x000000)
|
||||
camera.position.set(-435, 940, -1377)
|
||||
camera.updateProjectionMatrix()
|
||||
renderer.setSize(window.innerWidth, window.innerHeight)
|
||||
controls.target = new THREE.Vector3(-433, 300, -217)
|
||||
controls.update()
|
||||
pointLight.decay = 0.0 //设置光源不随距离衰减 默认2.0
|
||||
pointLight.position.set(66, 66, 66) // 点光源位置
|
||||
pointLight.castShadow = true
|
||||
scene.add(pointLight)
|
||||
scene.add(ambient)
|
||||
light.position.set(66, 66, 66)
|
||||
light.target.position.set(0, 0, 0)
|
||||
scene.add(light)
|
||||
labelRenderer.setSize(window.innerWidth, window.innerHeight)
|
||||
labelRenderer.domElement.style.position = 'absolute'
|
||||
labelRenderer.domElement.style.top = '0'
|
||||
labelRenderer.domElement.style.pointerEvents = 'none'
|
||||
document.body.appendChild(labelRenderer.domElement)
|
||||
|
||||
|
||||
function getModelById(id) {
|
||||
// 遍历场景中的所有对象
|
||||
const objects = scene.children.filter(obj => obj.type === 'Group' || obj.type === 'Object3D')
|
||||
for (const obj of objects) {
|
||||
if (obj.id === id) {
|
||||
// 返回匹配ID的模型
|
||||
return obj
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// 监听鼠标点击事件
|
||||
document.addEventListener('dblclick', function(event) {
|
||||
// 将鼠标位置转换为二维向量
|
||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1
|
||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1
|
||||
|
||||
// 使用鼠标的位置和相机进行raycasting
|
||||
raycaster.setFromCamera(mouse, camera)
|
||||
|
||||
// 计算物体和鼠标点的交点
|
||||
let intersects = raycaster.intersectObjects(scene.children)
|
||||
|
||||
// 如果有交点
|
||||
if (intersects.length > 0) {
|
||||
let obj = intersects[0]
|
||||
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()
|
||||
}).start()
|
||||
camera.position.set((intersects[0].point.x + 0), (intersects[0].point.y + 500), (intersects[0].point.z - 500))
|
||||
camera.updateProjectionMatrix()
|
||||
controls.target = new THREE.Vector3(intersects[0].point.x, intersects[0].point.y, intersects[0].point.z)
|
||||
controls.update()
|
||||
|
||||
renderer.render(scene, camera)
|
||||
}
|
||||
}, false)
|
||||
|
||||
|
||||
const animation = async() => {
|
||||
try {
|
||||
if (animationLine.length > 0) {
|
||||
await animationLine[0]()
|
||||
animationLine.shift()
|
||||
if (animationLine.length > 0) {
|
||||
animation(animationLine)
|
||||
} else {
|
||||
isAnimation = false
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
function animate() {
|
||||
if (animationLine.length > 0 && isAnimation === false) {
|
||||
console.log('动画')
|
||||
isAnimation = true
|
||||
animation(animationLine)
|
||||
}
|
||||
requestAnimationFrame(animate)
|
||||
TWEEN.update()
|
||||
renderer.render(scene, camera)
|
||||
labelRenderer.render(scene, camera)
|
||||
}
|
||||
|
||||
animate()
|
||||
|
||||
let a = 0
|
||||
|
||||
const loadF = (e) => {
|
||||
e.forEach(v => {
|
||||
let mtlLoader = new MTLLoader()
|
||||
mtlLoader.load(`/model/${v}/${v}.mtl`,
|
||||
materials => {
|
||||
materials.preload()
|
||||
let loader = new OBJLoader()
|
||||
loader.setMaterials(materials)
|
||||
loader.load(
|
||||
`/model/${v}/${v}.obj`,
|
||||
object => {
|
||||
object.name = v
|
||||
scene.add(object)
|
||||
|
||||
if (v === 'tishengji_keyidongbufen') {
|
||||
keyidongModel = object
|
||||
}
|
||||
if (v === 'tishengji_tuopan') {
|
||||
tuopanModel = object
|
||||
}
|
||||
// 更新渲染器
|
||||
renderer.render(scene, camera)
|
||||
},
|
||||
xhr => {
|
||||
if ((xhr.loaded / xhr.total * 100) === 100) {
|
||||
a += 1
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let tuopanInishengji = true
|
||||
let storeyHeight = {
|
||||
1: 0,
|
||||
2: 261.9,
|
||||
3: 411.4,
|
||||
4: 561.1,
|
||||
5: 710.8
|
||||
}
|
||||
let storeyWidth = {
|
||||
1: -100,
|
||||
2: -100,
|
||||
3: -100,
|
||||
4: -130,
|
||||
5: -60
|
||||
}
|
||||
let tishengjiLocation = {
|
||||
floor: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
}
|
||||
let tuopanLocation = {
|
||||
floor: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
}
|
||||
|
||||
export {
|
||||
keyidongModel,
|
||||
tuopanModel,
|
||||
scene,
|
||||
camera,
|
||||
renderer,
|
||||
loadF,
|
||||
animationLine,
|
||||
labelRenderer,
|
||||
tuopanInishengji,
|
||||
storeyHeight,
|
||||
storeyWidth,
|
||||
tuopanLocation,
|
||||
tishengjiLocation
|
||||
}
|
Loading…
Reference in New Issue