geom
A triangle-soup builder. Every piece of the wreck — plating, rivet steps, porthole rings, chain links, rusticles, a porcelain cup — is appended into one growing vertex/index buffer and uploaded once with `renderer.mesh.create`, so a ship of a hundred thousand triangles is a handf…
geom
A triangle-soup builder. Every piece of the wreck — plating, rivet steps,
porthole rings, chain links, rusticles, a porcelain cup — is appended into one
growing vertex/index buffer and uploaded once with renderer.mesh.create, so a
ship of a hundred thousand triangles is a handful of draw calls.
local G = require("deadlight.wreck.geom")
local m = G.new()
G.box(m, { 0, 0, 0 }, { 2, 1, 4 })
G.tube(m, { 0, 0, 0 }, { 0, 1, 0 }, 3.0, 0.4, 0.25, 12, true)
local handle = G.upload(m)
Shapes. box / boxIn (axis-aligned, or in a frame), tube (a swept cone
with optional caps), sphere (with a squashY for a dome or a lens), torus,
quad (four world points, normal from the winding) and quadNV (four points
each carrying its own normal — what keeps a lofted hull smooth across a station
while its strake seams stay hard).
Frames. axisFrame(origin, forward, scale) builds an orthonormal basis
around a direction and at(frame, a, b, c) is a point in it, which is how a
fitting is placed against a hull surface whose normal is not an axis.
UVs are in PLATE UNITS, not 0..1. One unit of u is one strake and one
unit of v is one plate length, so the seam grooves and rivet rows in
deadlight.wreck.surfaces' plate texture land on the real seams of the real
plating. box's uvScale converts metres to those units for a fitting.
Positions are world-space metres in the wreck's own frame; the slice offsets
them by parenting the result under an anchor entity placed at the position
Film.ANCHORS names.
Scoped to this part · feeds back into the world's score.