From 32ae719b009ec953b99393edbcb7dc9f5dcc784c Mon Sep 17 00:00:00 2001 From: como Date: Wed, 1 Apr 2026 16:07:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=A4=E5=8F=B0=E9=A3=8E?= =?UTF-8?q?=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OceanScene.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/OceanScene.js b/src/OceanScene.js index 022cd30..3555be3 100644 --- a/src/OceanScene.js +++ b/src/OceanScene.js @@ -56,7 +56,7 @@ export class OceanScene { this.fogLayers = []; this.horizonFog = null; this.skyHazeBand = null; - this.windTurbine = null; + this.windTurbines = []; this.rainAudioPool = []; this.rainAudioActiveIndex = 0; this.rainAudioIsPlaying = false; @@ -1509,15 +1509,24 @@ export class OceanScene { } async initWindTurbine() { - this.windTurbine = new OffshoreWindTurbineAsset({ - position: new THREE.Vector3(280, 0, -2350), - yaw: 0, - scale: 0.68, - rotorSpeed: 0.24 - }); - await this.windTurbine.load(); - this.windTurbine.addToScene(this.scene); - this.windTurbine.faceDirection(this.sun); + const turbineConfigs = [ + { position: new THREE.Vector3(280, 0, -2350), scale: 0.68, rotorSpeed: 0.24 }, + { position: new THREE.Vector3(-200, 0, -2900), scale: 0.54, rotorSpeed: 0.19 }, + { position: new THREE.Vector3(700, 0, -1850), scale: 0.62, rotorSpeed: 0.28 }, + ]; + + await Promise.all(turbineConfigs.map(async (config) => { + const turbine = new OffshoreWindTurbineAsset({ + position: config.position, + yaw: 0, + scale: config.scale, + rotorSpeed: config.rotorSpeed + }); + await turbine.load(); + turbine.addToScene(this.scene); + turbine.faceDirection(this.sun); + this.windTurbines.push(turbine); + })); } async initVegetation() { @@ -2325,9 +2334,9 @@ export class OceanScene { this.vegetationSystem.update(time); } - if (this.windTurbine) { - this.windTurbine.faceDirection(this.sun); - this.windTurbine.update(time, delta); + for (const turbine of this.windTurbines) { + turbine.faceDirection(this.sun); + turbine.update(time, delta); } if (this.lightningFlash > 0.001) {