code wiki / (root) / nx_isosurf.nx

nx_isosurf.nx

buildroot/runtime/nx_isosurf.nx

7166 B144 linesdepth 3pulls 4 transitivereach 15 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_isosurf.nx -- ★F0 UNIFY implicit + explicit (from the graphics foundation census): a SURFACE-NETS polygonizer that turns a signed-distance FIELD into a real TRIANGLE MESH. This is the bridge that lets us MESH THE BEING (or any SDF): sample the SDF on a grid, place one vertex per surface-straddling cell (averaged edge crossings), connect the 4 cells around every sign-changing grid edge into a quad. Per-vertex normals come from the SDF GRADIENT (so smooth Gouraud shading is winding-independent). Fills the nx_trimesh buffers -> render with the existing rasterizer. license_tier: ORIGINAL

dependencies 2 imports · 15 importers

nx_syscalls.nx nx_trimesh.nx nx_isosurf.nx nx_arousal_mesh.nx nx_being_showcase.nx nx_bodyatlas_mesh_gate.nx nx_engine_lod_gate.nx nx_engine_scene_gate.nx nx_gltf_anim_gate.nx nx_gltf_mesh_gate.nx nx_gltf_scene_gate.nx nx_hands_gate.nx nx_isosurf_gate.nx

diagram shows first 10 each side; +0 more imports, +5 more importers in the complete lists below.

imports: nx_syscalls.nxnx_trimesh.nx

imported by: nx_arousal_mesh.nxnx_being_showcase.nxnx_bodyatlas_mesh_gate.nxnx_engine_lod_gate.nxnx_engine_scene_gate.nxnx_gltf_anim_gate.nxnx_gltf_mesh_gate.nxnx_gltf_scene_gate.nxnx_hands_gate.nxnx_isosurf_gate.nxnx_phong_gate.nxnx_retarget_emit.nxnx_retarget_showcase.nxnx_skullsdf.nxnx_texture_gate.nx

structs

none

consts

8const K_MAGIC_1024: i64 = 1024
9const K_MAGIC_4096: i64 = 4096

functions

11func iso_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x+1)/2; while y < x { x=y; y=(x+v/x)/2 } return x }
called by 1: surface_nets
15func surface_nets(grid: *i64, GX: i64, GY: i64, GZ: i64, ox: i64, oy: i64, oz: i64, cell: i64, iso: i64, col: i64) -> i64