@@ -48,6 +48,7 @@
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import * as THREE from 'three'
|
||||
import { GLTFLoader, type GLTF } from 'three/addons/loaders/GLTFLoader.js'
|
||||
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'
|
||||
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'
|
||||
import FloorSwitcher from './FloorSwitcher.vue'
|
||||
import type {
|
||||
@@ -194,6 +195,7 @@ let camera: THREE.PerspectiveCamera | null = null
|
||||
let renderer: THREE.WebGLRenderer | null = null
|
||||
let controls: OrbitControls | null = null
|
||||
let loader: GLTFLoader | null = null
|
||||
let dracoLoader: DRACOLoader | null = null
|
||||
let activeModel: THREE.Object3D | null = null
|
||||
let poiGroup: THREE.Group | null = null
|
||||
let routeGroup: THREE.Group | null = null
|
||||
@@ -682,6 +684,9 @@ const initThree = async () => {
|
||||
syncControlInteractionOptions()
|
||||
|
||||
loader = new GLTFLoader()
|
||||
dracoLoader = new DRACOLoader()
|
||||
dracoLoader.setDecoderPath('/static/three/draco/')
|
||||
loader.setDRACOLoader(dracoLoader)
|
||||
poiGroup = new THREE.Group()
|
||||
poiGroup.name = 'GuideModelPOI'
|
||||
scene.add(poiGroup)
|
||||
@@ -2298,6 +2303,8 @@ const disposeScene = () => {
|
||||
scene = null
|
||||
camera = null
|
||||
loader = null
|
||||
dracoLoader?.dispose()
|
||||
dracoLoader = null
|
||||
poiGroup = null
|
||||
routeGroup = null
|
||||
|
||||
@@ -2321,6 +2328,7 @@ defineExpose({
|
||||
queueTargetFocus(request)
|
||||
},
|
||||
clearSelection: clearMapSelection,
|
||||
clearRoute: clearRoutePreview,
|
||||
clearNavigation: () => clearMapSelection(false),
|
||||
disableAutoSwitchTemporarily
|
||||
})
|
||||
@@ -2346,6 +2354,12 @@ watch(() => [props.routePreview, props.showRoute], () => {
|
||||
deep: true
|
||||
})
|
||||
|
||||
watch(() => props.initialView, (newView) => {
|
||||
if (newView === 'floor' || newView === 'multi') {
|
||||
activeView.value = newView
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
init3DScene()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user