/tg/ Station 13 - Modules - Types

modular_aphelion/modules/dirt/code/rasterise.dm

/datum/dirt_pixelsOne mask's pixels: a tone role and a thickness for each. Lists are indexed y * width + x + 1 in the reference generator's coordinates, as a /datum/dirt_surface's are: x from the left and y from the top, both from 0.
/proc/dirt_index_rangeReturns list(1, 2, ... count), made once for each count. You should NEVER modify it.
/proc/dirt_role_ranksReturns each role's rank, indexed by its DIRT_ROLE_* define: where masks or levels meet, the higher rank keeps the pixel. You should NEVER modify it.
/proc/dirt_neighbour_tableReturns each pixel's neighbours on a canvas, in the order the reference generator visits them: right, left, below, above, those off the canvas left out. Built once per canvas size. You should NEVER modify it.
/proc/dirt_surface_rowsReturns a surface's pixels grouped by limb and row, so a feature is weighed only on the rows it can reach: alist(limb = list(list(row, lowest h, highest h, indexes), ...)), rows from the top. Built once for each surface. You should NEVER modify it.
/proc/dirt_rasterise_aimedReturns mess aimed at a zone, drawn on one direction of a body: levels 1 to level, each from the deposit's same draws, merged by role rank with the later level winning a tie, then despeckled. A highlight, once drawn, stays: a later run beside it folded it in. The top level then breaks its flat edges, and keeps every pixel of level 3 as it was drawn, at its role or a darker one.
/proc/dirt_runs_apartReturns a level's features with the runs and drops this view leaves out taken out, and its run plan with them. In the plan's order, each run or drop stays only if it keeps DIRT_RUN_GAP px of skin from level 1's shot and from every one kept before it: side by side they filled into a sheet. The two hung from level 1's shot and drop always stay. Then each kept run's carry-on stays where it keeps as clear, and level 2's carry-on from the first drop where level 2 shows nothing new in the zone's main facing. The plan holds the top run level's set, so every level keeps the same ones.
/proc/dirt_level_showsReturns whether a level shows anything new on the body over level 1's shot: a pixel the kept runs and drops draw that level 1's doesn't, beside either. A lone one would go.
/proc/dirt_footprintReturns the pixels features draw on in one view before the raster's cleanups, as alist(index = TRUE): where any of them lies thick enough for film. A feature hidden in profile is left out there.
/proc/dirt_footprint_touchesReturns whether any of a footprint's pixels lies within DIRT_RUN_GAP px of another's, in both axes: no skin between.
/proc/dirt_rasterise_levelReturns one level of a deposit drawn on one direction of a body. The first feature, in list order, to lie thickest on a pixel picks its role. Nothing goes on an eye, the pixels beside it or a human mouth, and an eye's diagonals take film at most. Cloth draws its rim a role lighter, so a garment keeps its outline, though a contact point keeps its tone. Then bare legs streak, lone pixels go, and on skin nothing smaller than 2 px stays.
/proc/dirt_covering_thicknessReturns how thick a covering feature lies on a pixel: film at most on the outline, and in profile broken by noise on the outline and beside it, to nothing, haze or film. Highlights aren't broken.
/proc/dirt_skin_streaksStreaks bare legs in a mask rather than coating them, and returns it: a solid coat up a bare shin reads as boots. Body pixels more than 2.5 px up a leg mostly thin to film, in clumps about a limb wide. Each pixel is judged on its own, so the mask is changed where it is.
/proc/dirt_cleanupReturns a mask cleaned up: a lone film pixel goes, a lone core softens to body, and a pixel whose role none of its neighbours share takes the role three of them share. Flecks stay.
/proc/dirt_skin_rulesMakes a mask as skin takes goo, and returns it: no pixel without a neighbour, since a lone body dot reads as a mole and nothing smaller than 2 px stays. Goo keeps its core: flattened, it read as body paint.
/proc/dirt_despeckleReturns a mask without lone pixels, which read harshly: a lone film or haze pixel goes, and a lone body or core pixel becomes film with a haze ring where the surface reaches. A film or haze hole with three dark neighbours fills with body: it read as a chip or a scar. Glints and flecks are highlights and stay.
/proc/dirt_ragged_edgesBreaks a covering mask's flat edges, and returns it: no top or bottom edge runs flat along one row for more than 2 px. Cut level, a sheet read as clipped at a region, an apron, a back patch, a bib. At irregular spots along a flat stretch, film runs on 1 to 3 px below a bottom edge, or rises 1 px over a top edge. It only adds film, on bare skin or haze of the chest and the legs, so what's under it and the highlights stay. What's solid is read before anything is added, so the mask is changed where it is.
/proc/dirt_ragged_freeReturns whether a covering mask's flat edge may run on over a pixel: bare skin or haze on the surface, where the chest or a leg shows.
/proc/dirt_mergeReturns masks merged into one: on each pixel the thickest wins, by role rank and then thickness, and the first mask keeps a full tie. All the splats on one surface make one mask this way, oldest first. A splat below the top level leaves out each of its pieces that comes within DIRT_RUN_GAP px of an earlier splat's: piled on, splats filled into one sheet. A top-level splat keeps everything: it covers.
/proc/dirt_merge_with_partsReturns a surface's splats in one direction merged with the parts drawn under and over it. Each splat leaves out the pixels of the rounded parts on its zone (dirt_part_rounded()): straight streaks carried onto a breast read as blocks. Then each part drawn under the surface takes each splat on its zone in its own pixels (dirt_part_field()), merged in after the splats and keeping every piece, as a top-level splat does. A part drawn over the surface takes its share on itself, so its field isn't drawn here.
/proc/dirt_pieces_nearReturns TRUE on each pixel of a mask's pieces, 8-connected, that come within DIRT_RUN_GAP px of a taken pixel.