code wiki / (root) / nx_scene_render.nx

nx_scene_render.nx

buildroot/runtime/nx_scene_render.nx

12143 B295 linesdepth 7pulls 9 transitivereach 1 importersview sourcekind librarytopic scene
docsdependenciesstructsconstsfunctions

about

nx_scene_render.nx -- render ONE (SceneWorld, SceneEntity) pair under any style (exceed-ladder R0; pairs with nx_scene_contract.nx). Side-elevation view: the camera slice is the entity's anchor row. Each screen column maps to a world cell; ground height -> screen row; terrain filled below, sky above; the synthetic human stands ON the ground at the anchor (insertion is physical, not a paste). Style law (from the contract): the SAME entity + world render under all four styles; only the named tables change the art: REALISTIC -- continuous elevation gradient + slope shading ANIME -- 5 cel bands, saturated, bright sky, eye dots CARTOON -- 3 flat bands, dark outline around figure and band edges VN -- sunset-gradient backdrop, terrain as far silhouette, portrait-scale sprite with eyes Tier 0: nx_scene_quickstart(world_seed, human_seed, style, path) -- one call -> a P6 PPM scene on disk. license_tier: ORIGINAL

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_tier.nx nx_scene_contract.nx nx_ppm_writer.nx nx_scene_render.nx nx_scene_contract_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_scene_contract.nxnx_ppm_writer.nx

imported by: nx_scene_contract_test.nx

structs

none

consts

25const NX_MAGIC_65536: i64 = 65536
26const NX_MAGIC_1024: i64 = 1024
27const NX_MAGIC_999999: i64 = 999999
28const NX_MAGIC_4096: i64 = 4096
31const NX_SCN_W: nx_int = 256
32const NX_SCN_H: nx_int = 192
33const NX_SCN_GROUND_BASE: nx_int = 160 // screen row of elevation 0
34const NX_SCN_ELEV_SCALE_Q10: nx_int = 24 // px per Q10 elevation unit, /1024
37const NX_SCN_RENDER_BUDGET_MS: nx_int = 200
124const NX_SCN_OUTLINE_RGB: nx_int = 0x1A1A1A

functions

40func _scn_px(fb: *u8, x: nx_int, y: nx_int, rgb: nx_int) -> nx_int
52func _scn_rect(fb: *u8, x0: nx_int, y0: nx_int, rw: nx_int, rh: nx_int, rgb: nx_int) -> nx_int
called by 1: _scn_entity calls 1: _scn_px
65func _scn_disc(fb: *u8, cx: nx_int, cy: nx_int, r: nx_int, rgb: nx_int) -> nx_int
called by 1: _scn_entity calls 1: _scn_px
82func _scn_lerp_rgb(a: nx_int, b: nx_int, t_q10: nx_int) -> nx_int
99func _scn_sky_top(style: nx_int) -> nx_int
called by 1: _scn_terrain
105func _scn_sky_bottom(style: nx_int) -> nx_int
called by 1: _scn_terrain
111func _scn_ground_low(style: nx_int) -> nx_int
115func _scn_ground_high(style: nx_int) -> nx_int
119func _scn_band_color(style: nx_int, band: nx_int, n_bands: nx_int) -> nx_int
128func _scn_ground_row(h_q10: nx_int) -> nx_int
135func _scn_terrain(fb: *u8, land: *Landscape, slice_y: nx_int, style: nx_int) -> nx_int
200func _scn_entity(fb: *u8, land: *Landscape, e: *i64, style: nx_int) -> nx_int
268func nx_scene_render(sw: *i64, e: *i64, fb: *u8) -> nx_int
277func nx_scene_quickstart(world_seed: nx_int, human_seed: nx_int,