diff --git a/packages/frontend-misskey-world-engine/src/envs/lobby.ts b/packages/frontend-misskey-world-engine/src/envs/lobby.ts index 02e1fc9073..7ffb6ee6e4 100644 --- a/packages/frontend-misskey-world-engine/src/envs/lobby.ts +++ b/packages/frontend-misskey-world-engine/src/envs/lobby.ts @@ -31,7 +31,7 @@ export class LobbyEnvManager extends WorldEnvManager { public async load() { this.engine.camera.position = new BABYLON.Vector3(cm(0), cm(250), cm(3000)); - this.skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: cm(30000) }, this.engine.scene); + this.skybox = BABYLON.MeshBuilder.CreateBox('skybox', { size: cm(50000) }, this.engine.scene); this.skyboxMat = new BABYLON.StandardMaterial('skyboxMat', this.engine.scene); this.skyboxMat.backFaceCulling = false; this.skyboxMat.disableLighting = true; @@ -60,6 +60,7 @@ export class LobbyEnvManager extends WorldEnvManager { this.meshes[0].scaling = this.meshes[0].scaling.scale(WORLD_SCALE); this.meshes[0].rotationQuaternion = null; this.meshes[0].rotation = new BABYLON.Vector3(0, 0, 0); + this.meshes[0].bakeCurrentTransformIntoVertices(); for (const mesh of this.meshes) { if (['__COLLISION__'].some(name => mesh.name.includes(name))) continue; @@ -91,6 +92,10 @@ export class LobbyEnvManager extends WorldEnvManager { ]); objet.animations = [anim]; this.engine.scene.beginAnimation(objet, 0, 5000, true); + + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([objet, ...objet.getChildMeshes()], false); + }); } { @@ -105,6 +110,10 @@ export class LobbyEnvManager extends WorldEnvManager { ]); ring.animations = [anim]; this.engine.scene.beginAnimation(ring, 0, 5000, true); + + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([ring, ...ring.getChildMeshes()], false); + }); } { @@ -130,6 +139,10 @@ export class LobbyEnvManager extends WorldEnvManager { messageRing.animations = [anim]; this.engine.scene.beginAnimation(messageRing, 0, 10000, true); + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([messageRing, ...messageRing.getChildMeshes()], false); + }); + const texts = [ 'Wellcome to Misskey World!', 'Enjoy your stay!', @@ -172,6 +185,10 @@ export class LobbyEnvManager extends WorldEnvManager { messageRing.animations = [anim]; this.engine.scene.beginAnimation(messageRing, 0, 10000, true); + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([messageRing, ...messageRing.getChildMeshes()], false); + }); + this.timer.setInterval(() => { text.write(Date.now().toString()); }, 10); @@ -198,6 +215,10 @@ export class LobbyEnvManager extends WorldEnvManager { messageRing.animations = [anim]; this.engine.scene.beginAnimation(messageRing, 0, 10000, true); + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([messageRing, ...messageRing.getChildMeshes()], false); + }); + this.timer.setInterval(() => { const now = new Date(); const hours = now.getHours().toString().padStart(2, '0'); @@ -228,6 +249,10 @@ export class LobbyEnvManager extends WorldEnvManager { messageRing.animations = [anim]; this.engine.scene.beginAnimation(messageRing, 0, 10000, true); + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([messageRing, ...messageRing.getChildMeshes()], false); + }); + this.timer.setInterval(() => { const now = new Date(); const years = now.getFullYear().toString(); @@ -260,6 +285,10 @@ export class LobbyEnvManager extends WorldEnvManager { ]); sphereRoot.animations = [anim]; this.engine.scene.beginAnimation(sphereRoot, 0, speed, true); + + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([...sphereRoot.getChildMeshes()], false); + }); } for (let i = 0; i < 64; i++) { @@ -285,6 +314,10 @@ export class LobbyEnvManager extends WorldEnvManager { ]); sphereRoot.animations = [anim]; this.engine.scene.beginAnimation(sphereRoot, 0, speed, true); + + this.engine.scene.onAfterAnimationsObservable.add(() => { + this.engine.sr.updateMesh([...sphereRoot.getChildMeshes()], false); + }); } //const sphere = BABYLON.MeshBuilder.CreateSphere('', { diameter: cm(10) }, this.engine.scene); @@ -368,7 +401,7 @@ export class LobbyEnvManager extends WorldEnvManager { if (tex == null) return; const srcAspect = tex.getSize().width / tex.getSize().height; const targetAspect = 16 / 9; - updateUv(srcAspect, targetAspect, 'cover'); + updateUv(srcAspect, targetAspect, 'cover', 0); } }); }, 3000); @@ -397,6 +430,8 @@ export class LobbyEnvManager extends WorldEnvManager { ps.preWarmCycles = Math.random() * 1000; ps.start(); + this.engine.sr.fixParticleSystem(ps); + this.registerMeshes(this.meshes); }