Skip to main content

Module render

Module render 

Source
Expand description

A curved koi colored from its languages on a chosen body, with Classic shading and transparent surroundings.

The body and fins follow sampled curves, with shading that follows the body surface and fin rays that follow each fin’s direction. The head widens from a round nose along a gentle slant, and short pixel whiskers angle forward from the snout. Contribution totals set the size through crate::koi::calculate_growth_fraction, and growth slows as the fish matures. Young koi have a rounder head, larger eyes, a slimmer body, and short rounded fins, and grow into the adult shape by crate::koi::YOUNG_SHAPE_CONTRIBUTIONS. After crate::koi::ADULT_CONTRIBUTIONS the body keeps lengthening, broadens slightly, and its fins and tail lengthen; the maximum form keeps its anatomy at higher totals. Quiet days alone do not change the base anatomy. The pose and framing account for the body and fins.

Every growth level shares one square native canvas of FRAME_WIDTH_PIXELS by FRAME_HEIGHT_PIXELS, which the encoders in crate::output scale up exactly. Anatomical proportions live here; pigments, bodies, and palettes in crate::coat; streak mark strengths in crate::markings; poses in crate::motion.

Structs§

KoiFrame
A renderer-owned, fixed-size frame with row-major RGBA pixels.

Constants§

FRAME_HEIGHT_PIXELS
Height of the native canvas; the canvas is square.
FRAME_WIDTH_PIXELS
Width of the native canvas every koi is drawn on, at every growth level.

Functions§

render_koi
Render the koi in a centered, fixed swimming pose, colored from its languages on the caller’s chosen body. Contribution totals set its size and how far its colors have come in. The account seed places patches in body coordinates, so growth does not reroll the pattern. Streak marks follow the development’s streaks as of its observation date. Identical inputs produce identical pixels without I/O, clock reads, or input mutation.
render_swim_frame
Render one frame of a behavior’s seamless loop, colored like render_koi, in the pose motion::calculate_swim_pose gives; frame numbers wrap around the loop of motion::frame_count(behavior) frames. Laps circle the frame center, and longer koi swim a tighter lap so every size fits. A hovering loop is framed once, centered on the koi’s sweep, and its drift shrinks only as far as the largest koi need to stay inside. The view never follows the fins, so it never shakes. Under water the koi turns toward water blue and partly drops out, more with depth. Identical inputs produce identical pixels without I/O, clock reads, or input mutation.