This file builds what is on the stage. It is compiled with the docs and imported by this page, so what you read is what runs.
import { createScene, type ExternalSpace } from "@klorad/api/world";
/** Where the site is on Earth; the tileset's root transform places its neighbourhood 120 m east and 40 m north of it. */
export const SITE_ORIGIN = { lat: 40.66, lon: 22.865, height: 8 };
/** The neighbourhood, a 3D Tiles 1.1 tileset streamed as context: never turned into Scene Objects. */
export const neighbourhood: readonly ExternalSpace[] = [{ id: "neighbourhood", provider: "3d-tiles", ref: "/tiles/northgate/tileset.json" }];
/** A logistics park's office and gatehouse; the building beside them comes from the tileset. */
export function createTilesDemo() {
const scene = createScene({ name: "Northgate with its neighbourhood", coordinateSystem: { origin: SITE_ORIGIN } });
scene.add({ id: "office", name: "Operations office", position: { east: 0, north: -35 }, geometry: { kind: "box", width: 20, depth: 14, height: 9 }, properties: { kind: "building" } });
scene.add({ id: "gatehouse", name: "Gatehouse", position: { east: 0, north: -75 }, geometry: { kind: "box", width: 6, depth: 4, height: 3 }, properties: { kind: "building" } });
scene.add({ id: "warehouse", name: "Warehouse A", position: { east: 40, north: 10 }, geometry: { kind: "box", width: 50, depth: 30, height: 12 }, properties: { kind: "building" } });
return { scene };
}