mirror of
https://gitee.com/ice-gl/icegl-three-vue-tres.git
synced 2025-04-05 06:22:43 +08:00
fix: 谷歌地图资源的展示
This commit is contained in:
parent
551339e9fd
commit
1718b54f64
@ -4,7 +4,7 @@
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2024-03-13 17:14:11
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-08-12 11:06:13
|
||||
* @LastEditTime: 2025-03-27 08:42:47
|
||||
-->
|
||||
<template>
|
||||
<div class="container circle" v-if="!hasFinishLoading">
|
||||
@ -29,6 +29,7 @@
|
||||
<script setup lang="ts">
|
||||
import { hasPlugin } from '@/common/utils'
|
||||
import { useProgress } from '@tresjs/cientos'
|
||||
import { Resource } from 'PLS/resourceManager'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -48,8 +49,8 @@ let hasFinishLoading = null as any
|
||||
|
||||
if (props.useResourceManager) {
|
||||
if (hasPlugin('resourceManager', '资源管理器插件')) {
|
||||
const modules = import.meta.glob('/src/plugins/resourceManager/index.js')
|
||||
const { Resource } = await modules['/src/plugins/resourceManager/index.js']()
|
||||
// const modules = import.meta.glob('/src/plugins/resourceManager/index.js')
|
||||
// const { Resource } = await modules['/src/plugins/resourceManager/index.js']()
|
||||
progress = Resource.progress
|
||||
hasFinishLoading = Resource.hasAllFinished
|
||||
}
|
||||
|
@ -1,3 +1,11 @@
|
||||
<!--
|
||||
* @Description:
|
||||
* @Version: 1.668
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2025-03-25 09:49:51
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2025-03-27 08:45:36
|
||||
-->
|
||||
<template>
|
||||
<TresGroup>
|
||||
<primitive :object="tiles.group" />
|
||||
@ -5,17 +13,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watchEffect, toRaw } from 'vue'
|
||||
import * as THREE from 'three'
|
||||
import { useTresContext, useRenderLoop } from '@tresjs/core'
|
||||
import { WGS84_ELLIPSOID, CAMERA_FRAME, GeoUtils, CameraTransitionManager, TilesRenderer, GlobeControls } from '3d-tiles-renderer'
|
||||
import { CameraTransitionManager, TilesRenderer, GlobeControls } from '3d-tiles-renderer'
|
||||
import {
|
||||
TilesFadePlugin,
|
||||
UpdateOnChangePlugin,
|
||||
TileCompressionPlugin,
|
||||
UnloadTilesPlugin,
|
||||
GLTFExtensionsPlugin,
|
||||
BatchedTilesPlugin,
|
||||
CesiumIonAuthPlugin,
|
||||
} from '3d-tiles-renderer/plugins'
|
||||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'
|
||||
@ -24,10 +29,10 @@ const assetId = '2275207'
|
||||
const accessToken =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhM2RlZDE0YS03NWNlLTQ2ZmItODFmZi0zMDQyZGMxZjdjNzQiLCJpZCI6NDYzMzQsImlhdCI6MTYxNjA1MjY2Nn0.3BRsxy7UmJgW0LemXo6cMsD7xwe7YvUDITeQ3RLxOHI'
|
||||
|
||||
const { camera, renderer, sizes, scene } = useTresContext()
|
||||
const { camera, renderer, sizes, scene } = useTresContext() as any
|
||||
|
||||
let transition = null as any
|
||||
let tiles = null as TilesRenderer
|
||||
let tiles = null as unknown as TilesRenderer
|
||||
let globeControls = null as any
|
||||
|
||||
function reinstantiateTiles() {
|
||||
@ -55,12 +60,12 @@ reinstantiateTiles()
|
||||
|
||||
tiles.setCamera(camera.value)
|
||||
tiles.setResolutionFromRenderer(camera.value, renderer.value)
|
||||
transition = new CameraTransitionManager(camera.value, null)
|
||||
transition = new CameraTransitionManager(camera.value, undefined)
|
||||
transition.perspectiveCamera.position.set(-3960140, 3689031, -3364162)
|
||||
transition.perspectiveCamera.lookAt(0, 0, 0)
|
||||
transition.autoSync = false
|
||||
transition.orthographicPositionalZoom = false
|
||||
globeControls = new GlobeControls(scene.value, transition.camera, renderer.value.domElement, null)
|
||||
globeControls = new GlobeControls(scene.value, transition.camera, renderer.value.domElement, undefined)
|
||||
globeControls.enableDamping = true
|
||||
globeControls.setTilesRenderer(tiles)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user