Adds test case to resolve dominant god rays light source

This commit is contained in:
2026-04-28 14:17:30 +02:00
parent 44631249a6
commit a1837a27b2
2 changed files with 31 additions and 1 deletions

View File

@@ -160,6 +160,7 @@ import {
GOD_RAYS_SOURCE_MASK_RADII,
createScreenSpaceGodRaysLightSource,
projectScreenSpaceGodRaysLight,
resolveDominantScreenSpaceGodRaysLightInput,
resolveGodRaysParameters,
resolveGodRaysSourceMask,
syncScreenSpaceGodRaysLightSource
@@ -409,6 +410,35 @@ describe("god rays parameters", () => {
});
});
it("uses only rendered celestial bodies as god rays sources", () => {
const visibleSun = {
colorHex: "#ffd8aa",
intensity: 1.1,
direction: {
x: 0.1,
y: 0.15,
z: -0.98
}
};
const hiddenMoon = {
colorHex: "#ccd8ff",
intensity: 2.4,
direction: {
x: -0.2,
y: 0.1,
z: -0.9
}
};
expect(
resolveDominantScreenSpaceGodRaysLightInput(visibleSun, null)
).toBe(visibleSun);
expect(
resolveDominantScreenSpaceGodRaysLightInput(visibleSun, hiddenMoon)
).toBe(hiddenMoon);
expect(resolveDominantScreenSpaceGodRaysLightInput(null, null)).toBeNull();
});
it("projects the celestial light direction and rejects behind-camera lights", () => {
const camera = new PerspectiveCamera(60, 1, 0.1, 1000);