nx_gfx_iso.nx
buildroot/runtime/nx_gfx_iso.nx
about
nx_gfx_iso.nx -- Renders isometric diamond tiles with shaded gradients and dynamic lighting on a provided framebuffer.
dependencies 0 imports · 6 importers
imports: none
imported by: nx_gfx_bloom_gate.nxnx_gfx_iso_scene_gate.nxnx_gfx_scene_tex_gate.nxnx_gfx_tex_gate.nxnx_sprite_forge.nxnx_wasm_diablo.nx
structs
| none |
consts
| 2 | const K_MAGIC_374761393: i64 = 374761393 |
| 3 | const K_MAGIC_668265263: i64 = 668265263 |
| 4 | const K_MAGIC_1274126177: i64 = 1274126177 |
| 11 | const TW: i64 = 32 // tile width (iso diamond) |
| 12 | const TH: i64 = 16 // tile height (2:1) |
functions
| 14 | func gx_rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) } |
| 15 | func gx_cr(c: i64) -> i64 { return c & 255 } |
| 16 | func gx_cg(c: i64) -> i64 { return (c >> 8) & 255 } |
| 17 | func gx_cb(c: i64) -> i64 { return (c >> 16) & 255 } |
| 18 | func gx_cl8(v: i64) -> i64 { if v < 0 { return 0 } if v > 255 { return 255 } return v } |
| 21 | func gx_shade(c: i64, f: i64) -> i64 { return gx_rgb((gx_cr(c)*f)>>8, (gx_cg(c)*f)>>8, (gx_cb(c)*f)>>8) } |
| 23 | func gx_tint(c: i64, fr: i64, fg: i64, fb: i64) -> i64 { return gx_rgb(gx_cl8((gx_cr(c)*fr)>>8), gx_cl8((gx_cg(c)*fg)>>8), gx_cl8((gx_cb(c)*fb)>>8)) } |
| 25 | func gx_mix(c1: i64, c2: i64, t: i64) -> i64 |
| 32 | func gx_px(fb: *i64, W: i64, H: i64, x: i64, y: i64, c: i64) -> i64 |
| 36 | func gx_blend(fb: *i64, W: i64, H: i64, x: i64, y: i64, c: i64, a: i64) -> i64 |
| 41 | func gx_hspan(fb: *i64, W: i64, H: i64, x0: i64, x1: i64, y: i64, c: i64) -> i64 |
| 48 | func gx_fill(fb: *i64, W: i64, H: i64, c: i64) -> i64 { var p: i64 = 0; while p < W*H { fb[p] = c; p = p + 1 } return 0 } |
| 51 | func gx_isox(tx: i64, ty: i64, ox: i64) -> i64 { return ox + (tx - ty)*(TW/2) } |
| 52 | func gx_isoy(tx: i64, ty: i64, oy: i64) -> i64 { return oy + (tx + ty)*(TH/2) } |
| 55 | func gx_iso_tile(fb: *i64, W: i64, H: i64, cx: i64, sy: i64, col: i64) -> i64 |
| 66 | func gx_iso_tile_rim(fb: *i64, W: i64, H: i64, cx: i64, sy: i64, col: i64) -> i64 |
| 78 | func gx_hash(x: i64, y: i64) -> i64 |
| 86 | func gx_iso_tile_tex(fb: *i64, W: i64, H: i64, cx: i64, sy: i64, col: i64) -> i64 |
| 103 | func gx_iso_cube(fb: *i64, W: i64, H: i64, cx: i64, sy: i64, ht: i64, topcol: i64) -> i64 |
| 125 | func gx_isc_f(row: i64, g: i64) -> i64 { // vertical shade + grain + mortar course, clamped called by 1: gx_iso_cube_tex |
| 131 | func gx_iso_cube_tex(fb: *i64, W: i64, H: i64, cx: i64, sy: i64, ht: i64, topcol: i64) -> i64 |
| 154 | func gx_bloom(fb: *i64, W: i64, H: i64, thresh: i64, gain: i64) -> i64 |
| 193 | func gx_ellipse(fb: *i64, W: i64, H: i64, cx: i64, cy: i64, rx: i64, ry: i64, col: i64) -> i64 |
| 203 | func gx_ellipse_blend(fb: *i64, W: i64, H: i64, cx: i64, cy: i64, rx: i64, ry: i64, col: i64, a: i64) -> i64 |
| 215 | func gx_vgrad(fb: *i64, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64, ctop: i64, cbot: i64) -> i64 |
| 228 | func gx_sprite_humanoid(fb: *i64, W: i64, H: i64, fx: i64, fy: i64, bodycol: i64, skincol: i64, phase: i64) -> i64 called by 4: build_dungeonmainbuild_scenerender_impl calls 8: gx_rgbgx_shadegx_mixgx_ellipse_blendgx_vgradgx_px+2 |
| 273 | func gx_light_radial(fb: *i64, W: i64, H: i64, lx: i64, ly: i64, radius: i64, ambient: i64) -> i64 |
| 296 | func gx_light_add(fb: *i64, W: i64, H: i64, lx: i64, ly: i64, radius: i64, tint: i64) -> i64 |