@thai-kit/level-schema
v0.2.3
Published
The extras payloads a thaikit level GLB carries, as zod schemas. Shared by the editor, the server, the bake and the runtime.
Maintainers
Readme
@thai-kit/level-schema
The extras payloads a thaikit level
GLB carries, as zod schemas. Shared by the editor, the server,
the bake and the runtime, so all four agree on one contract.
A level is an ordinary glTF 2.0 file. Everything it needs that glTF cannot say —
which pack an object came from, whether it is static, the moon's shadow
settings, the cell size — rides in extras, and this package is the contract for
those payloads.
npm i @thai-kit/level-schemaTwo GLBs use it:
- the editable project (
levels/<id>/level.glb) —scene.extras.thaikitLevelplus per-nodeextras.tk, validated byLevelExtrasandNodeExtras; - the baked export —
scene.extras.thaikitManifest, validated byManifestExtras. This one is independent of thaikit and is what@thai-kit/level-runtimereads.
import { ManifestExtras, faceFromFilename, resolveNadirFade } from '@thai-kit/level-schema';
const manifest = ManifestExtras.parse(scene.extras.thaikitManifest);Also exports the cube-map face conventions (CUBE_FACES, CUBE_FACE_ALIASES,
faceFromFilename) — note front is -Z and back is +Z, three's own
convention — and resolveNadirFade(), the single source of the sky's horizon
fade so a preview and a bake cannot drift apart.
MIT.
