Update scene document version and import world settings utilities
This commit is contained in:
@@ -1,35 +1,14 @@
|
||||
import { DEFAULT_SUN_DIRECTION, type Vec3 } from "../core/vector";
|
||||
import type { Brush } from "./brushes";
|
||||
import type { EntityInstance } from "../entities/entity-instances";
|
||||
import { cloneMaterialRegistry, createStarterMaterialRegistry, type MaterialDef } from "../materials/starter-material-library";
|
||||
import { createDefaultWorldSettings, type WorldSettings } from "./world-settings";
|
||||
|
||||
export const SCENE_DOCUMENT_VERSION = 5 as const;
|
||||
export const SCENE_DOCUMENT_VERSION = 6 as const;
|
||||
export const FOUNDATION_SCENE_DOCUMENT_VERSION = 1 as const;
|
||||
export const BOX_BRUSH_SCENE_DOCUMENT_VERSION = 2 as const;
|
||||
export const FACE_MATERIALS_SCENE_DOCUMENT_VERSION = 3 as const;
|
||||
export const RUNNER_V1_SCENE_DOCUMENT_VERSION = 4 as const;
|
||||
|
||||
export interface WorldBackgroundSettings {
|
||||
mode: "solid";
|
||||
colorHex: string;
|
||||
}
|
||||
|
||||
export interface WorldAmbientLightSettings {
|
||||
colorHex: string;
|
||||
intensity: number;
|
||||
}
|
||||
|
||||
export interface WorldSunLightSettings {
|
||||
colorHex: string;
|
||||
intensity: number;
|
||||
direction: Vec3;
|
||||
}
|
||||
|
||||
export interface WorldSettings {
|
||||
background: WorldBackgroundSettings;
|
||||
ambientLight: WorldAmbientLightSettings;
|
||||
sunLight: WorldSunLightSettings;
|
||||
}
|
||||
export const FIRST_ROOM_POLISH_SCENE_DOCUMENT_VERSION = 5 as const;
|
||||
|
||||
export interface SceneDocument {
|
||||
version: typeof SCENE_DOCUMENT_VERSION;
|
||||
@@ -44,26 +23,6 @@ export interface SceneDocument {
|
||||
interactionLinks: Record<string, never>;
|
||||
}
|
||||
|
||||
export function createDefaultWorldSettings(): WorldSettings {
|
||||
return {
|
||||
background: {
|
||||
mode: "solid",
|
||||
colorHex: "#2f3947"
|
||||
},
|
||||
ambientLight: {
|
||||
colorHex: "#f7f1e8",
|
||||
intensity: 1
|
||||
},
|
||||
sunLight: {
|
||||
colorHex: "#fff1d5",
|
||||
intensity: 1.75,
|
||||
direction: {
|
||||
...DEFAULT_SUN_DIRECTION
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function createEmptySceneDocument(overrides: Partial<Pick<SceneDocument, "name" | "world" | "materials">> = {}): SceneDocument {
|
||||
return {
|
||||
version: SCENE_DOCUMENT_VERSION,
|
||||
@@ -78,3 +37,21 @@ export function createEmptySceneDocument(overrides: Partial<Pick<SceneDocument,
|
||||
interactionLinks: {}
|
||||
};
|
||||
}
|
||||
|
||||
export type {
|
||||
WorldAmbientLightSettings,
|
||||
WorldBackgroundMode,
|
||||
WorldBackgroundSettings,
|
||||
WorldSolidBackgroundSettings,
|
||||
WorldSunLightSettings,
|
||||
WorldVerticalGradientBackgroundSettings
|
||||
} from "./world-settings";
|
||||
|
||||
export {
|
||||
areWorldSettingsEqual,
|
||||
changeWorldBackgroundMode,
|
||||
cloneWorldBackgroundSettings,
|
||||
cloneWorldSettings,
|
||||
createDefaultWorldSettings,
|
||||
isHexColorString
|
||||
} from "./world-settings";
|
||||
|
||||
Reference in New Issue
Block a user