auto-git:
[change] tests/unit/world-background-renderer.test.ts
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
resolveWorldCelestialBodiesState,
|
resolveWorldCelestialBodiesState,
|
||||||
resolveWorldEnvironmentState
|
resolveWorldEnvironmentState
|
||||||
} from "../../src/rendering/world-background-renderer";
|
} from "../../src/rendering/world-background-renderer";
|
||||||
|
import type { WorldShaderSkyRenderState } from "../../src/rendering/world-shader-sky";
|
||||||
|
|
||||||
describe("resolveWorldEnvironmentState", () => {
|
describe("resolveWorldEnvironmentState", () => {
|
||||||
it("keeps the authored day environment when no night overlay is active", () => {
|
it("keeps the authored day environment when no night overlay is active", () => {
|
||||||
@@ -127,6 +128,50 @@ describe("resolveWorldEnvironmentState", () => {
|
|||||||
intensity: 0.35
|
intensity: 0.35
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("uses a shader-derived environment texture when shader mode is active", () => {
|
||||||
|
const world = createDefaultWorldSettings();
|
||||||
|
const shaderTexture = new Texture();
|
||||||
|
const shaderState = {
|
||||||
|
presetId: "defaultSky",
|
||||||
|
time: {
|
||||||
|
dayCount: 0,
|
||||||
|
timeOfDayHours: 12,
|
||||||
|
dayPhase: "day",
|
||||||
|
daylightFactor: 1,
|
||||||
|
twilightFactor: 0,
|
||||||
|
phaseWeights: {
|
||||||
|
day: 1,
|
||||||
|
dawn: 0,
|
||||||
|
dusk: 0,
|
||||||
|
night: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} as unknown as WorldShaderSkyRenderState;
|
||||||
|
const shaderEnvironmentTextureResolver = {
|
||||||
|
resolveEnvironmentTexture: vi.fn().mockReturnValue(shaderTexture)
|
||||||
|
};
|
||||||
|
world.background = {
|
||||||
|
mode: "shader"
|
||||||
|
};
|
||||||
|
|
||||||
|
const environment = resolveWorldEnvironmentState(
|
||||||
|
world.background,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
shaderState,
|
||||||
|
shaderEnvironmentTextureResolver
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
shaderEnvironmentTextureResolver.resolveEnvironmentTexture
|
||||||
|
).toHaveBeenCalledWith(shaderState);
|
||||||
|
expect(environment).toEqual({
|
||||||
|
texture: shaderTexture,
|
||||||
|
intensity: 1
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("resolveWorldCelestialBodiesState", () => {
|
describe("resolveWorldCelestialBodiesState", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user