From 390189e11622af58c6a3bce581e2a29960a92f8f Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sat, 22 Nov 2025 06:44:22 +0100 Subject: [PATCH] Feature: higher flames from stage torches --- party-cathedral/src/scene/stage-torches.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/party-cathedral/src/scene/stage-torches.js b/party-cathedral/src/scene/stage-torches.js index 614bbdf..d6573f5 100644 --- a/party-cathedral/src/scene/stage-torches.js +++ b/party-cathedral/src/scene/stage-torches.js @@ -4,6 +4,8 @@ import { SceneFeature } from './SceneFeature.js'; import sceneFeatureManager from './SceneFeatureManager.js'; import sparkTextureUrl from '/textures/spark.png'; +const lightPositionBaseY = 1.2; + export class StageTorches extends SceneFeature { constructor() { super(); @@ -48,7 +50,7 @@ export class StageTorches extends SceneFeature { // --- Point Light --- const pointLight = new THREE.PointLight(0xffaa44, 2.5, 8); - pointLight.position.y = 1.2; + pointLight.position.y = lightPositionBaseY; pointLight.castShadow = true; pointLight.shadow.mapSize.width = 128; pointLight.shadow.mapSize.height = 128; @@ -88,29 +90,32 @@ export class StageTorches extends SceneFeature { this.torches.forEach(torch => { let measurePulse = 0; if (state.music) { - measurePulse = state.music.measurePulse * 2.0; // Make flames jump higher + measurePulse = state.music.measurePulse * 4.0; // Make flames jump higher } // --- Animate Particles --- const positions = torch.particles.geometry.attributes.position.array; + let averageY = 0; for (let i = 0; i < torch.particleData.length; i++) { const data = torch.particleData[i]; data.life -= deltaTime; - const yVelocity = data.velocity.y + measurePulse; - + const yVelocity = data.velocity.y; if (data.life <= 0) { // Reset particle positions[i * 3] = 0; positions[i * 3 + 1] = 1; positions[i * 3 + 2] = 0; data.life = Math.random() * 1.0; + data.velocity.y = Math.random() * 1.5 + measurePulse; } else { // Update position positions[i * 3] += data.velocity.x * deltaTime; positions[i * 3 + 1] += yVelocity * deltaTime; positions[i * 3 + 2] += data.velocity.z * deltaTime; } + averageY += positions[i * 3 + 1]; } + averageY = averageY / positions.length; torch.particles.geometry.attributes.position.needsUpdate = true; // --- Flicker Light --- @@ -122,6 +127,7 @@ export class StageTorches extends SceneFeature { } torch.light.intensity = baseIntensity + flicker + beatPulse; + torch.light.position.y = lightPositionBaseY + averageY; }); } }