Geo renderer improvements

This commit is contained in:
2026-11-21 19:24:09 -03:00
parent 717d2cb766
commit 4bdf5203d4
6 changed files with 141 additions and 18 deletions
+20 -2
View File
@@ -506,11 +506,29 @@ const fluid_schema = z.object({
export type FluidJson = z.infer<typeof fluid_schema>;
// a box from origin to origin + size, textured like minecraft's box uv: see the renderer's FACES
const uv_pair = z.tuple([z.number(), z.number()]);
// where one face of a cube is in the texture, from uv to uv + uv_size. a negative size flips it
const face_uv = z.object({ uv: uv_pair, uv_size: uv_pair });
// a cube's faces, by the way they face. one that isn't here isn't drawn
const face_uvs = z.object({
north: face_uv.optional(),
east: face_uv.optional(),
south: face_uv.optional(),
west: face_uv.optional(),
up: face_uv.optional(),
down: face_uv.optional(),
});
export type FaceUvs = z.infer<typeof face_uvs>;
// a box from origin to origin + size. its uv is either [u, v], where a box's texture starts laid out like minecraft's
// box uv (see the renderer's FACES), or where each face is
const entity_cube = z.object({
origin: vec3,
size: vec3,
uv: z.tuple([z.number(), z.number()], "must be [u, v], per face uvs aren't supported"),
uv: z.union([uv_pair, face_uvs]),
// grows the box this many pixels each way without moving its texture
inflate: z.number().optional(),
// what rotation turns the box around, inside its bone