From 483a0f2bdd186f7c39b50ddf4874128425dad52b Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 22 Apr 2026 16:23:26 +0200 Subject: [PATCH] auto-git: [change] tests/serialization/scene-document-json.test.ts [change] tests/unit/world-shader-sky.test.ts --- .../serialization/scene-document-json.test.ts | 35 +++++++++++++++++++ tests/unit/world-shader-sky.test.ts | 2 ++ 2 files changed, 37 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 943c2910..ca8d14b4 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -39,6 +39,7 @@ import { SCENE_TRANSITION_ENTITIES_SCENE_DOCUMENT_VERSION, SCENE_TRANSITION_SEQUENCE_EFFECTS_SCENE_DOCUMENT_VERSION, SCENE_DOCUMENT_VERSION, + SHADER_SKY_HORIZON_HEIGHT_SCENE_DOCUMENT_VERSION, SHADER_SKY_SCENE_DOCUMENT_VERSION, SPATIAL_AUDIO_SCENE_DOCUMENT_VERSION, STATIC_SIMPLE_MODEL_COLLIDERS_SCENE_DOCUMENT_VERSION, @@ -176,6 +177,40 @@ describe("scene document JSON", () => { expect(migratedDocument.world.shaderSky.horizonHeight).toBe(0); }); + it("migrates v72 scene documents by defaulting the shader sky star horizon offset", () => { + const document = createEmptySceneDocument({ + name: "Legacy Shader Star Horizon Scene" + }); + document.world.background = { + mode: "shader" + }; + document.world.shaderSky.stars.density = 0.72; + + const legacyDocument = JSON.parse( + serializeSceneDocument(document) + ) as Record; + legacyDocument.version = SHADER_SKY_HORIZON_HEIGHT_SCENE_DOCUMENT_VERSION; + delete ( + ( + ( + legacyDocument.world as { + shaderSky: { + stars: Record; + }; + } + ).shaderSky.stars + ) as Record + ).horizonFadeOffset; + + const migratedDocument = parseSceneDocumentJson( + JSON.stringify(legacyDocument) + ); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.world.shaderSky.stars.density).toBe(0.72); + expect(migratedDocument.world.shaderSky.stars.horizonFadeOffset).toBe(0); + }); + it("migrates pre-paint terrain documents by defaulting terrain layer data", () => { const legacyTerrainDocument = { ...createEmptySceneDocument({ diff --git a/tests/unit/world-shader-sky.test.ts b/tests/unit/world-shader-sky.test.ts index 76f4ca03..8bbfcf36 100644 --- a/tests/unit/world-shader-sky.test.ts +++ b/tests/unit/world-shader-sky.test.ts @@ -19,6 +19,7 @@ describe("resolveWorldShaderSkyRenderState", () => { world.shaderSky.dayTopColorHex = "#88ccff"; world.shaderSky.dayBottomColorHex = "#dff3ff"; world.shaderSky.horizonHeight = -0.08; + world.shaderSky.stars.horizonFadeOffset = 0.06; world.timeOfDay.dawn.background = { mode: "verticalGradient", topColorHex: "#ff8855", @@ -108,6 +109,7 @@ describe("resolveWorldShaderSkyRenderState", () => { expect(noonSky?.sky.topColorHex).toBe("#88ccff"); expect(noonSky?.sky.bottomColorHex).toBe("#dff3ff"); expect(noonSky?.sky.horizonHeight).toBe(-0.08); + expect(noonSky?.stars.horizonFadeOffset).toBe(0.06); expect(dawnSky?.sky.topColorHex).not.toBe(noonSky?.sky.topColorHex); expect(dawnSky?.sky.topColorHex).not.toBe(midnightSky?.sky.topColorHex); expect(midnightSky?.stars.visibility ?? 0).toBeGreaterThan(