From 7d8fabb5feddf7d2daffd2452781c515d2eb13cd Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 17 四月 2024 15:34:52 +0800 Subject: [PATCH] Merge branch 'dev-threejs' --- src/views/screen/components/screen-map-three/experience/index.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/src/views/screen/components/screen-map-three/experience/index.js b/src/views/screen/components/screen-map-three/experience/index.js new file mode 100644 index 0000000..edc482f --- /dev/null +++ b/src/views/screen/components/screen-map-three/experience/index.js @@ -0,0 +1,45 @@ +import { Scene, GridHelper,AxesHelper } from 'three'; +import Stats from "three/examples/jsm/libs/stats.module"; + +import World from "./world/world"; +import Camera from "./camera"; +import Renderer from "./renderer"; + +// 宸ュ叿绫� +import Sizes from "./utils/sizes"; +import Time from "./utils/time"; + +export default class Experience { + constructor(canvas) { + this.canvas = canvas; + this.sizes = new Sizes(); + this.time = new Time(); + this.scene = new Scene(); + this.camera = new Camera(this); + this.renderer = new Renderer(this); + this.world = new World(this); + + // const size = 200; + // const divisions = 200; + + // const gridHelper = new GridHelper(size, divisions); + // this.scene.add(gridHelper); + + this.stats = new Stats(); + document.querySelector('.map-container').appendChild(this.stats.dom); + + + + // 甯� + this.time.on('tick', () => { + this.update(); + }); + } + + update() { + this.camera.update(); + this.world.update(); + this.renderer.update(); + this.stats.update(); + } +} \ No newline at end of file -- Gitblit v1.8.0