game.arena.CrowdFigure — hand-sculpted low-poly hockey fans for the Stands crowd.
CrowdFigure.add(b, seat, idx, lod) appends one spectator to a game.arena.ArenaGeo
builder (with colours), in the encoding game.arena.shaders.fans animates:
uv.x = seat.k (facing index, 0..63) + seed (0..1)
uv.y = 0 for the body; 5 + drop (left arm) / 6 + drop (right arm), where drop
(0..0.98) is how far the vertex hangs below its shoulder.
colour.a < 0.5 marks a glossy part (helmets, foam fingers).
lod "near" (lower bowl, ~90-120 tris): lofted torso with a hem stripe, rounded
head, beanie with pompom, tube arms with hands, legs, foam fingers and signs.
lod "far" (upper bowl, ~36 tris): wedge torso, octahedron head, prism arms.
Back faces nobody in the rink can see (torso back, leg backs) are not built.
pickJersey(r: number) → void
| arg | type | description |
|---|
| r | number | |
frame(b: ?, s: ?, uvx: number) → void
The figure's local frame: +z faces the rink, +x is the spectator's left, y up
from the row floor. P transforms a local point/normal to the stand.
| arg | type | description |
|---|
| b | ? | |
| s | ? | |
| uvx | number | |
v(lx: number, ly: number, lz: number, nx: number, ny: number, nz: number, c: ?, uvy: number) → number
vertex: local position, local normal (unnormalised ok), colour, uv.y
| arg | type | description |
|---|
| lx | number | |
| ly | number | |
| lz | number | |
| nx | number | |
| ny | number | |
| nz | number | |
| c | ? | |
| uvy | number | |
t(i: number, j: number, k: number, P: ?, cx: number, cy: number, cz: number) → void
triangle wound to face away from the local point (cx, cy, cz)
| arg | type | description |
|---|
| i | number | |
| j | number | |
| k | number | |
| P | ? | |
| cx | number | |
| cy | number | |
| cz | number | |
pt(F: ?, x: number, y: number, z: number, nx: number, ny: number, nz: number, c: ?, uvy: number) → void
a local vertex record {x, y, z, index}
| arg | type | description |
|---|
| F | ? | |
| x | number | |
| y | number | |
| z | number | |
| nx | number | |
| ny | number | |
| nz | number | |
| c | ? | |
| uvy | number | |
loft(F: ?, ox: number, oz: number, ang: { number }, rings: ?, skip: number?, uvyOf: ?) → void
A closed-ish loft: rings of points around a vertical axis at angles `ang`
(radians, increasing; 0 = facing the rink). `skip` = index of the band
segment not built (the back). Each ring: { y, w, d, c, tilt, c2 }. A ring
with `c2` is a colour seam: the band below it ends in `c`, the band above
starts in `c2`, on split vertices so a hard edge survives mesh simplification.
Returns, per ring, the vertices the band ABOVE it starts from.
| arg | type | description |
|---|
| F | ? | |
| ox | number | |
| oz | number | |
| ang | { number } | |
| rings | ? | |
| skip | number? | |
| uvyOf | ? | |
cap(F: ?, row: ?, apex: ?, ox: number, oy: number, oz: number) → void
fan a ring to a single apex point
| arg | type | description |
|---|
| F | ? | |
| row | ? | |
| apex | ? | |
| ox | number | |
| oy | number | |
| oz | number | |
octa(F: ?, cx: number, cy: number, cz: number, rx: number, ry: number, rz: number, cTop: ?, cBody: ?, uvy: number, uvyTop: number?) → void
an octahedron (8 tris): hands, pompoms, the far head
| arg | type | description |
|---|
| F | ? | |
| cx | number | |
| cy | number | |
| cz | number | |
| rx | number | |
| ry | number | |
| rz | number | |
| cTop | ? | |
| cBody | ? | |
| uvy | number | |
| uvyTop | number? | |
add(b: ?, s: ?, idx: number, lod: string) → void
| arg | type | description |
|---|
| b | ? | |
| s | ? | |
| idx | number | |
| lod | string | |