Add types, constants, and normalization functions for terrain grid resize directions
This commit is contained in:
@@ -38,6 +38,9 @@ export interface Terrain {
|
|||||||
foliageBlockerMask: TerrainFoliageBlockerMask;
|
foliageBlockerMask: TerrainFoliageBlockerMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TerrainGridResizeDirectionX = "east" | "west";
|
||||||
|
export type TerrainGridResizeDirectionZ = "north" | "south";
|
||||||
|
|
||||||
export interface TerrainHeightPatchEntry {
|
export interface TerrainHeightPatchEntry {
|
||||||
index: number;
|
index: number;
|
||||||
before: number;
|
before: number;
|
||||||
@@ -87,6 +90,10 @@ export const TERRAIN_LAYER_COUNT = 4;
|
|||||||
export const MIN_TERRAIN_LAYER_COUNT = 1;
|
export const MIN_TERRAIN_LAYER_COUNT = 1;
|
||||||
export const MAX_TERRAIN_LAYER_COUNT = 8;
|
export const MAX_TERRAIN_LAYER_COUNT = 8;
|
||||||
export const TERRAIN_SHADER_LAYER_COUNT = 8;
|
export const TERRAIN_SHADER_LAYER_COUNT = 8;
|
||||||
|
export const DEFAULT_TERRAIN_GRID_RESIZE_DIRECTION_X: TerrainGridResizeDirectionX =
|
||||||
|
"east";
|
||||||
|
export const DEFAULT_TERRAIN_GRID_RESIZE_DIRECTION_Z: TerrainGridResizeDirectionZ =
|
||||||
|
"north";
|
||||||
export const DEFAULT_TERRAIN_LAYER_MATERIAL_IDS = [
|
export const DEFAULT_TERRAIN_LAYER_MATERIAL_IDS = [
|
||||||
"patchy_grass_ground_250x250",
|
"patchy_grass_ground_250x250",
|
||||||
"patchy_weedy_dirt_ground_300x300",
|
"patchy_weedy_dirt_ground_300x300",
|
||||||
@@ -158,6 +165,34 @@ export function normalizeTerrainCellSize(value: number): number {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeTerrainGridResizeDirectionX(
|
||||||
|
value: TerrainGridResizeDirectionX | undefined
|
||||||
|
): TerrainGridResizeDirectionX {
|
||||||
|
if (value === undefined) {
|
||||||
|
return DEFAULT_TERRAIN_GRID_RESIZE_DIRECTION_X;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== "east" && value !== "west") {
|
||||||
|
throw new Error("Terrain X resize direction must be east or west.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeTerrainGridResizeDirectionZ(
|
||||||
|
value: TerrainGridResizeDirectionZ | undefined
|
||||||
|
): TerrainGridResizeDirectionZ {
|
||||||
|
if (value === undefined) {
|
||||||
|
return DEFAULT_TERRAIN_GRID_RESIZE_DIRECTION_Z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== "north" && value !== "south") {
|
||||||
|
throw new Error("Terrain Z resize direction must be north or south.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeTerrainLayerMaterialId(
|
function normalizeTerrainLayerMaterialId(
|
||||||
value: string | null | undefined,
|
value: string | null | undefined,
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
Reference in New Issue
Block a user