blockly3d/src/model/objectPrefabs/terrain.ts

19 lines
489 B
TypeScript

import type { Voxel } from "../../types";
export function terrainXZ(width: number, length: number): Voxel[] {
const vs = Array(width)
.fill(0)
.flatMap((_, x) =>
Array(length)
.fill(0)
.map((_, z) => ({
typeId: 'dirt',
position: [x - Math.floor(width / 2), 0, z - Math.floor(length / 2)],
color: 'green',
} as Voxel))
);
return vs;
}