Refactor God Rays light synchronization using dominant celestial light input
This commit is contained in:
@@ -212,6 +212,7 @@ import {
|
|||||||
import { applyAdvancedRenderingPerspectiveCameraFar } from "../rendering/distance-fog-pass";
|
import { applyAdvancedRenderingPerspectiveCameraFar } from "../rendering/distance-fog-pass";
|
||||||
import {
|
import {
|
||||||
createScreenSpaceGodRaysLightSource,
|
createScreenSpaceGodRaysLightSource,
|
||||||
|
resolveDominantScreenSpaceGodRaysLightInput,
|
||||||
syncScreenSpaceGodRaysLightSource
|
syncScreenSpaceGodRaysLightSource
|
||||||
} from "../rendering/screen-space-god-rays";
|
} from "../rendering/screen-space-god-rays";
|
||||||
import {
|
import {
|
||||||
@@ -2093,10 +2094,6 @@ export class ViewportHost {
|
|||||||
displayedMoonLight
|
displayedMoonLight
|
||||||
);
|
);
|
||||||
this.currentCelestialShadowCaster = dominantCelestialLight?.key ?? null;
|
this.currentCelestialShadowCaster = dominantCelestialLight?.key ?? null;
|
||||||
syncScreenSpaceGodRaysLightSource(
|
|
||||||
this.godRaysLightSource,
|
|
||||||
dominantCelestialLight?.light ?? null
|
|
||||||
);
|
|
||||||
this.sunLight.color.set(displayedSunLight.colorHex);
|
this.sunLight.color.set(displayedSunLight.colorHex);
|
||||||
this.sunLight.intensity = displayedSunLight.intensity;
|
this.sunLight.intensity = displayedSunLight.intensity;
|
||||||
this.sunLight.position
|
this.sunLight.position
|
||||||
@@ -2135,6 +2132,7 @@ export class ViewportHost {
|
|||||||
this.lightVolumeGroup.visible = this.displayMode !== "wireframe";
|
this.lightVolumeGroup.visible = this.displayMode !== "wireframe";
|
||||||
|
|
||||||
if (this.displayMode !== "normal") {
|
if (this.displayMode !== "normal") {
|
||||||
|
syncScreenSpaceGodRaysLightSource(this.godRaysLightSource, null);
|
||||||
this.scene.background = null;
|
this.scene.background = null;
|
||||||
this.scene.environment = null;
|
this.scene.environment = null;
|
||||||
this.scene.environmentIntensity = 1;
|
this.scene.environmentIntensity = 1;
|
||||||
@@ -2177,13 +2175,39 @@ export class ViewportHost {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.worldBackgroundRenderer.update(
|
this.worldBackgroundRenderer.update(
|
||||||
displayedBackground,
|
displayedBackground,
|
||||||
backgroundTexture,
|
backgroundTexture,
|
||||||
backgroundOverlayState,
|
backgroundOverlayState,
|
||||||
celestialBodiesState,
|
celestialBodiesState,
|
||||||
shaderSkyState
|
shaderSkyState
|
||||||
);
|
);
|
||||||
|
const godRaysLightInput =
|
||||||
|
shaderSkyState !== null
|
||||||
|
? resolveDominantScreenSpaceGodRaysLightInput(
|
||||||
|
shaderSkyState.celestial.sunVisible
|
||||||
|
? {
|
||||||
|
colorHex: shaderSkyState.celestial.sunColorHex,
|
||||||
|
intensity: shaderSkyState.celestial.sunIntensity,
|
||||||
|
direction: shaderSkyState.celestial.sunDirection
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
shaderSkyState.celestial.moonVisible
|
||||||
|
? {
|
||||||
|
colorHex: shaderSkyState.celestial.moonColorHex,
|
||||||
|
intensity: shaderSkyState.celestial.moonIntensity,
|
||||||
|
direction: shaderSkyState.celestial.moonDirection
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
)
|
||||||
|
: resolveDominantScreenSpaceGodRaysLightInput(
|
||||||
|
celestialBodiesState.sun,
|
||||||
|
celestialBodiesState.moon
|
||||||
|
);
|
||||||
|
syncScreenSpaceGodRaysLightSource(
|
||||||
|
this.godRaysLightSource,
|
||||||
|
godRaysLightInput
|
||||||
|
);
|
||||||
const environmentState = resolveWorldEnvironmentState(
|
const environmentState = resolveWorldEnvironmentState(
|
||||||
displayedBackground,
|
displayedBackground,
|
||||||
backgroundTexture,
|
backgroundTexture,
|
||||||
|
|||||||
Reference in New Issue
Block a user