Log inGet started
World

First Light: Crowfeet

Branchmain
Branchesmain
Commit0f27cfd84c

README.md

game.crow.shapes

The geometry the Old Crow is built out of. Arrays in, arrays out — nothing here touches the scene, and everything is deterministic from a seed, so the same bird is built on every peer and in the browser.

One builder does all of it. Every part of a bird is a cross-section swept along a curve — the barrel of the body, the ball of the head, the hooked cone of a beak, the tapered blade of a primary, a toe, a claw — so sweep takes a list of STATIONS (a point on the curve plus the two radii of the section standing there) and returns closed geometry with normals and UVs. A flat section is a feather; a round one is a limb.

local S = require("game.crow.shapes")

local head = S.lobe { length = 0.245, height = 0.205, width = 0.19, ruffle = 0.035, density = 33 }
local claw = S.horn { length = 0.046, radius = 0.010, curve = 0.024, taper = 0.82 }
local vane = S.feather { length = 0.30, width = 0.135, camber = 0.02, notch = 0.02 }

local foot = S.merge {
    { geom = claw, pos = { 0.01, 0, 0 }, rot = { 0, -32, -10 } },
    { geom = claw, pos = { 0.01, 0, 0 }, rot = { 0, 34, -10 } },
}
entity.component.add("Model", { model = S.toMesh(foot), material = someMaterial })
  • sweep(stations, opts) — the primitive. A station with both radii at zero closes the shape, which is how a shape gets its ends with no cap seam.
  • lobe / feather / horn — named shapes over sweep.
  • merge(parts) — welds several geometries into one with a transform each, so a wing's six primaries or a foot's four toes cost one draw. A part scaled negatively on one axis is a MIRROR, and merge reverses its winding to match.
  • toMesh(geom) — uploads it and hands back the mesh handle a Model takes.
  • maxProjectedY(geom, degrees) — the highest a part reaches once rotated, which is how a height derived from the anatomy replaces a measured constant.

UVs are in world units, not 0..1. Every builder takes a density in pattern cells per world unit and writes the UVs in those units, so one material draws the same physical size of feather on a head and on a tail feather, and a part that is resized does not change how big its feathers look.

Owned by the crow slice. See /zero/source/design/spec.md.