game.shared.geo — procedural geometry for Banana 2077.
Every curved thing in the game (the banana hero, the floppy baton, the
fruit-and-veg gang, the gold peel megatowers) is built from these few
generators, because the scene has no imported models. Each builder returns a
plain MeshGeometry table ({ positions, normals, uvs, indices }, flat arrays,
0-based indices, counter-clockwise front faces) that `G.mesh` uploads as a
runtime mesh or `G.asset` writes as a durable `.mesh` asset.
spline(pts: { { number } }, n: number) → void
Uniform Catmull-Rom through `pts` (each an array of numbers), n+1 samples.
| arg | type | description |
|---|
| pts | { { number } } | |
| n | number | |
grid(P: { { { number } } }, opts: any?) → void
A grid surface. P[row][col] = {x,y,z}; columns wrap around unless opts.open
(an open sheet: a jacket, a lapel, a ribbon). Rows whose ring has collapsed
to a point are poles and take the axial normal.
| arg | type | description |
|---|
| P | { { { number } } } | |
| opts | any? | |
ringCentroid(i: ?) → void
lathe(profile: { { number } }, rows: number, cols: number, opts: any?) → void
Surface of revolution around +Y. `profile` = control points {radius, y}
(smoothed with Catmull-Rom into `rows` rings). opts.radial(theta, t) scales
the radius per angle (ridges, lobes); opts.sx / opts.sz squash the section;
opts.offset(t) -> {dx, dz} bends the axis.
| arg | type | description |
|---|
| profile | { { number } } | |
| rows | number | |
| cols | number | |
| opts | any? | |
tube(path: { { number } }, radii: { { number } }, rows: number, cols: number, opts: any?) → void
A tube swept along a smooth path. `path` = 3D control points, `radii` =
control values {r} along it (r = 0 closes an end into a pole). Frames are
parallel-transported from opts.up. opts.radial(theta, t) shapes the section,
opts.sx / opts.sy squash it along the frame's normal / binormal.
| arg | type | description |
|---|
| path | { { number } } | |
| radii | { { number } } | |
| rows | number | |
| cols | number | |
| opts | any? | |
blob(rx: number, ry: number, rz: number, rows: number, cols: number, e: number?) → void
Rounded-box-ish blob: an ellipsoid with a superellipse exponent (e < 1 squarer).
| arg | type | description |
|---|
| rx | number | |
| ry | number | |
| rz | number | |
| rows | number | |
| cols | number | |
| e | number? | |
xform(g: any, opts: any) → void
Apply an affine change to geometry: opts.scale {sx,sy,sz}, opts.rot quat
{x,y,z,w}, opts.pos {x,y,z} — in that order.
| arg | type | description |
|---|
| g | any | |
| opts | any | |
rot(x: ?, y: ?, z: ?) → void
| arg | type | description |
|---|
| x | ? | |
| y | ? | |
| z | ? | |
merge(list: { any }) → void
Concatenate geometries into one.
| arg | type | description |
|---|
| list | { any } | |
qMul(a: { number }, b: { number }) → void
Quaternions as {x, y, z, w}.
| arg | type | description |
|---|
| a | { number } | |
| b | { number } | |
qInv(q: { number }) → void
| arg | type | description |
|---|
| q | { number } | |
qRot(q: { number }, v: { number }) → void
| arg | type | description |
|---|
| q | { number } | |
| v | { number } | |
qAxis(axis: { number }, angle: number) → void
| arg | type | description |
|---|
| axis | { number } | |
| angle | number | |
qFromTo(a: { number }, b: { number }) → void
Shortest rotation taking unit vector a onto unit vector b.
| arg | type | description |
|---|
| a | { number } | |
| b | { number } | |
qBasis(X: { number }, Y: { number }, Z: { number }) → void
Rotation whose local X/Y/Z axes land on the given orthonormal world axes.
| arg | type | description |
|---|
| X | { number } | |
| Y | { number } | |
| Z | { number } | |
qLook(Yaxis: { number }, zHint: { number }) → void
Orthonormal frame from a primary axis Y and a hint for Z.
| arg | type | description |
|---|
| Yaxis | { number } | |
| zHint | { number } | |
qSlerp(a: { number }, b: { number }, t: number) → void
| arg | type | description |
|---|
| a | { number } | |
| b | { number } | |
| t | number | |
mesh(g: any, key: string?) → void
| arg | type | description |
|---|
| g | any | |
| key | string? | |
asset(name: string, g: any, folder: string) → void
Durable mesh asset at /zero/source/<folder>/<name>.mesh (edit mode bake).
| arg | type | description |
|---|
| name | string | |
| g | any | |
| folder | string | |