dirt_surface 
One direction of a body's dirt surface. Dirt lies on limbs, not on the screen: every pixel of the body and of a margin round it maps to a limb, an angle round that limb (theta) and a height along it (h), so a mark keeps its place on the body as the mob turns.
- theta: degrees round the limb, 0 at the body's front, 90 its right side, 180 its back and -90 its left.
- h: 0 at the limb's lowest row, 1 at its highest.
Per-pixel lists are indexed y * width + x + 1, in the reference generator's coordinates: x from the left and y from the top, both from 0. That pixel is (x + 1, height - y) in an icon.
Vars | |
| band_built | Whether outline_band() has marked DIRT_PIXEL_BAND, which waits until it's asked for. |
|---|---|
| direction | The direction it's seen from. |
| eye_soft | alist(index = TRUE) on an eye's diagonals, which take film at most. |
| face_guard | Where nothing may be drawn: alist(index = DIRT_GUARD_EYE) on an eye and the pixels beside it, DIRT_GUARD_MOUTH on a human mouth. A few pixels, so it keeps only those. |
| flags_of | Each pixel's flags, one number, or null off the surface: its limb (DIRT_PIXEL_LIMB()), its zone (DIRT_PIXEL_ZONE(): the body zone whose image shows there, dirt_zone_owners()'s, or none off the body), and the marks DIRT_PIXEL_RIM, DIRT_PIXEL_OUTLINE and DIRT_PIXEL_BAND. |
| height_of | Each pixel's h, from -0.2 to 1.2: the margin runs past the limbs' ends. |
| limb_row_pixels | Its pixels by limb and row, from dirt_surface_rows(), or null until they're asked for. |
| limb_rows | alist(limb = alist(row = list(leftmost column, rightmost column))): each row a limb's sprites cover, hidden parts included. |
| outline_built | Whether outline() has marked DIRT_PIXEL_OUTLINE, which waits until it's asked for. |
| theta_of | Each pixel's theta, from -180 up to 180. |
Procs | |
| New | Builds one direction of a body's surface from the sprites it draws. |
| find_rim | Marks the rim (DIRT_PIXEL_RIM): the silhouette's edge, body pixels with a side off the body or off the canvas, and the margin's first ring. Each leg's lowest row is its sole and stays off it. The body's pixels off the rim are its interior. |
| guard_face | Guards the face: nothing on an eye or the pixels beside it, film at most on its diagonals, and nothing on a human mouth, whose pixels are the human head sprite's. |
| map_body | Returns each body pixel's limb: its zone's, except below the belt, where the torso's pixels go to the legs. Facing south or north they split down the middle; in profile they go to the near leg. Each body pixel's zone goes in its flags. |
| measure_rows | Finds the rows each limb covers and its span in each, from its zones' whole sprites, the torso's only above the belt. A leg also spans the torso pixels it took below the belt, in the rows its own sprite misses. |
| outline | Marks DIRT_PIXEL_OUTLINE on the body pixels a covering coat fades at: the silhouette's edge, and where the head, an arm or a hand meets another zone. The legs' meeting with the chest stays off it: a film line there read as a waistband. Marked once. |
| outline_band | Marks DIRT_PIXEL_BAND on the outline and the pixels beside it, where a covering coat breaks in profile: whole, it ran the torso's height as one band. Marked once. |
| pixel_index | Returns a pixel's index in the per-pixel lists, or null off the canvas. |
| place_pixels | Places each pixel of the body and its margin on its limb, from the limb's span in the nearest row it covers, the upper one on a tie. Theta is the angle whose sine is how far the pixel sits from the span's middle, as a fraction of its half width, turned to the direction; h runs from the limb's lowest row, 0, to its highest, 1. |
| spread_margin | Returns each pixel's limb with the margin added: DIRT_SURFACE_MARGIN rings round the body, each margin pixel taking the limb of the first pixel of the ring before it to reach it. A ring is reached from in row-major order, each pixel trying right, left, down and up, as the reference generator does, so a margin pixel between two limbs goes the same way. |
| widen_row | Widens a limb's span in one row to take in a column. |
Var Details
band_built 
Whether outline_band() has marked DIRT_PIXEL_BAND, which waits until it's asked for.
direction 
The direction it's seen from.
eye_soft 
alist(index = TRUE) on an eye's diagonals, which take film at most.
face_guard 
Where nothing may be drawn: alist(index = DIRT_GUARD_EYE) on an eye and the pixels beside it, DIRT_GUARD_MOUTH on a human mouth. A few pixels, so it keeps only those.
flags_of 
Each pixel's flags, one number, or null off the surface: its limb (DIRT_PIXEL_LIMB()), its zone (DIRT_PIXEL_ZONE(): the body zone whose image shows there, dirt_zone_owners()'s, or none off the body), and the marks DIRT_PIXEL_RIM, DIRT_PIXEL_OUTLINE and DIRT_PIXEL_BAND.
height_of 
Each pixel's h, from -0.2 to 1.2: the margin runs past the limbs' ends.
limb_row_pixels 
Its pixels by limb and row, from dirt_surface_rows(), or null until they're asked for.
limb_rows 
alist(limb = alist(row = list(leftmost column, rightmost column))): each row a limb's sprites cover, hidden parts included.
outline_built 
Whether outline() has marked DIRT_PIXEL_OUTLINE, which waits until it's asked for.
theta_of 
Each pixel's theta, from -180 up to 180.
Proc Details
New
Builds one direction of a body's surface from the sprites it draws.
Arguments:
- direction: The direction it's seen from.
- masks: Each drawn zone's sprite pixels, from dirt_zone_pixels().
- owners: The zone each pixel shows, from dirt_zone_owners().
- eyes: The eye sprites' pixels, or null for a body without eyes.
- human_head: Whether the head is a human's, whose mouth is guarded.
find_rim
Marks the rim (DIRT_PIXEL_RIM): the silhouette's edge, body pixels with a side off the body or off the canvas, and the margin's first ring. Each leg's lowest row is its sole and stays off it. The body's pixels off the rim are its interior.
Arguments:
- limbs: Each body pixel's limb, from map_body().
- distances: Each pixel's ring, from spread_margin().
guard_face
Guards the face: nothing on an eye or the pixels beside it, film at most on its diagonals, and nothing on a human mouth, whose pixels are the human head sprite's.
Arguments:
- eyes: The eye sprites' pixels, or null for a body without eyes.
- human_head: Whether the head is a human's.
map_body
Returns each body pixel's limb: its zone's, except below the belt, where the torso's pixels go to the legs. Facing south or north they split down the middle; in profile they go to the near leg. Each body pixel's zone goes in its flags.
Arguments:
- owners: The zone each pixel shows, from dirt_zone_owners().
measure_rows
Finds the rows each limb covers and its span in each, from its zones' whole sprites, the torso's only above the belt. A leg also spans the torso pixels it took below the belt, in the rows its own sprite misses.
Arguments:
- masks: Each drawn zone's sprite pixels, from dirt_zone_pixels().
- limbs: Each body pixel's limb, from map_body().
outline
Marks DIRT_PIXEL_OUTLINE on the body pixels a covering coat fades at: the silhouette's edge, and where the head, an arm or a hand meets another zone. The legs' meeting with the chest stays off it: a film line there read as a waistband. Marked once.
outline_band
Marks DIRT_PIXEL_BAND on the outline and the pixels beside it, where a covering coat breaks in profile: whole, it ran the torso's height as one band. Marked once.
pixel_index
Returns a pixel's index in the per-pixel lists, or null off the canvas.
Arguments:
- column, row: The pixel, from the left and from the top, from 0.
place_pixels
Places each pixel of the body and its margin on its limb, from the limb's span in the nearest row it covers, the upper one on a tie. Theta is the angle whose sine is how far the pixel sits from the span's middle, as a fraction of its half width, turned to the direction; h runs from the limb's lowest row, 0, to its highest, 1.
Arguments:
- spread: Each pixel's limb, the margin included, from spread_margin().
spread_margin
Returns each pixel's limb with the margin added: DIRT_SURFACE_MARGIN rings round the body, each margin pixel taking the limb of the first pixel of the ring before it to reach it. A ring is reached from in row-major order, each pixel trying right, left, down and up, as the reference generator does, so a margin pixel between two limbs goes the same way.
Arguments:
- limbs: Each body pixel's limb, from map_body().
- distances: Filled with each pixel's ring: 0 on the body, then 1 to DIRT_SURFACE_MARGIN.
widen_row
Widens a limb's span in one row to take in a column.
Arguments:
- spans: alist(limb = alist(row = list(leftmost column, rightmost column))).
- limb: The limb.
- row, column: The pixel.