From be44a085a6f0439a4f18477e0f55c706d935f46b Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 22 Apr 2026 14:00:53 +0200 Subject: [PATCH] auto-git: [change] src/runtime-three/runtime-host.ts --- src/runtime-three/runtime-host.ts | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index 9c15ec77..1977d3f7 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -1275,6 +1275,18 @@ export class RuntimeHost { this.applyShadowState(); } + private rebuildLightVolumes( + lightVolumes: RuntimeSceneDefinition["volumes"]["light"] + ) { + this.clearLightVolumes(); + + for (const lightVolume of lightVolumes) { + const renderObjects = this.createLightVolumeRuntimeObjects(lightVolume); + this.lightVolumeGroup.add(renderObjects.group); + this.lightVolumeObjects.set(lightVolume.brushId, renderObjects); + } + } + private createPointLightRuntimeObjects( pointLight: RuntimeLocalLightCollection["pointLights"][number] ): LocalLightRenderObjects { @@ -1300,6 +1312,48 @@ export class RuntimeHost { }; } + private createLightVolumeRuntimeObjects( + lightVolume: RuntimeSceneDefinition["volumes"]["light"][number] + ): LightVolumeRenderObjects { + const group = new Group(); + const lights: PointLight[] = []; + + group.position.set( + lightVolume.center.x, + lightVolume.center.y, + lightVolume.center.z + ); + group.rotation.set( + (lightVolume.rotationDegrees.x * Math.PI) / 180, + (lightVolume.rotationDegrees.y * Math.PI) / 180, + (lightVolume.rotationDegrees.z * Math.PI) / 180 + ); + group.visible = lightVolume.enabled; + + for (const derivedLight of lightVolume.lights) { + const light = new PointLight( + lightVolume.colorHex, + derivedLight.intensity, + derivedLight.distance, + derivedLight.decay + ); + light.castShadow = false; + light.shadow.autoUpdate = false; + light.position.set( + derivedLight.localPosition.x, + derivedLight.localPosition.y, + derivedLight.localPosition.z + ); + group.add(light); + lights.push(light); + } + + return { + group, + lights + }; + } + private createSpotLightRuntimeObjects( spotLight: RuntimeLocalLightCollection["spotLights"][number] ): LocalLightRenderObjects {