Our own shim (native/shim/jph_shim.cpp) over Jolt built from the pinned tag with cross-platform determinism and no fp contraction: shapes as handles (box, sphere, capsule, cylinder, dome, offset, heightfield, mesh), still/kinematic/dynamic bodies by id with real removal, rays, top_at and push (what CharacterGround asks), overlaps, buoyancy against the PhysWater port, contacts recorded in C and drained as PHYS_HIT / PHYS_SPLASH facts. Fixed 1/60 steps, at most four a frame. Nine tests against the real library, including a pile run twice to the bit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
3.3 KiB
Text
32 lines
3.3 KiB
Text
# native.ludic - the shim's symbols (native/shim/jph_shim.cpp). A world and a shape are handles
|
|
# the package keeps; a body is an int id. None of this is exported.
|
|
extern function jph_world_new(max_bodies: int, threads: int) -> pointer = "jph_world_new"
|
|
extern function jph_world_free(w: pointer) -> void = "jph_world_free"
|
|
extern function jph_world_gravity(w: pointer, y: float) -> void = "jph_world_gravity"
|
|
extern function jph_world_step(w: pointer, dt: float, sub: int) -> int = "jph_world_step"
|
|
extern function jph_world_optimize(w: pointer) -> void = "jph_world_optimize"
|
|
extern function jph_world_bodies(w: pointer) -> int = "jph_world_bodies"
|
|
extern function jph_contacts_drain(w: pointer, ids: pointer, vals: pointer, cap: int) -> int = "jph_contacts_drain"
|
|
extern function jph_contacts_lost(w: pointer) -> int = "jph_contacts_lost"
|
|
extern function jph_shape_box(hx: float, hy: float, hz: float) -> pointer = "jph_shape_box"
|
|
extern function jph_shape_sphere(r: float) -> pointer = "jph_shape_sphere"
|
|
extern function jph_shape_capsule(half_h: float, r: float) -> pointer = "jph_shape_capsule"
|
|
extern function jph_shape_cylinder(half_h: float, r: float) -> pointer = "jph_shape_cylinder"
|
|
extern function jph_shape_dome(r: float, h: float) -> pointer = "jph_shape_dome"
|
|
extern function jph_shape_offset(s: pointer, x: float, y: float, z: float, yaw: float) -> pointer = "jph_shape_offset"
|
|
extern function jph_shape_heightfield(h: pointer, n: int, ox: float, oz: float, cell: float) -> pointer = "jph_shape_heightfield"
|
|
extern function jph_shape_mesh(v: pointer, nv: int, tri: pointer, nt: int) -> pointer = "jph_shape_mesh"
|
|
extern function jph_shape_free(s: pointer) -> void = "jph_shape_free"
|
|
extern function jph_body_add(w: pointer, s: pointer, x: float, y: float, z: float, yaw: float, motion: int, layer: int, mass: float, friction: float, bounce: float) -> int = "jph_body_add"
|
|
extern function jph_body_remove(w: pointer, id: int) -> void = "jph_body_remove"
|
|
extern function jph_body_read(w: pointer, id: int, out: pointer) -> int = "jph_body_read"
|
|
extern function jph_body_place(w: pointer, id: int, x: float, y: float, z: float, yaw: float) -> void = "jph_body_place"
|
|
extern function jph_body_impulse(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_impulse"
|
|
extern function jph_body_velocity(w: pointer, id: int, x: float, y: float, z: float) -> void = "jph_body_velocity"
|
|
extern function jph_body_target(w: pointer, id: int, x: float, y: float, z: float, yaw: float, dt: float) -> void = "jph_body_target"
|
|
extern function jph_body_awake(w: pointer, id: int) -> int = "jph_body_awake"
|
|
extern function jph_body_buoyancy(w: pointer, id: int, sy: float, nx: float, ny: float, nz: float, buoy: float, lin: float, ang: float, cx: float, cz: float, dt: float) -> int = "jph_body_buoyancy"
|
|
extern function jph_ray(w: pointer, ox: float, oy: float, oz: float, dx: float, dy: float, dz: float, mask: int, out: pointer) -> int = "jph_ray"
|
|
extern function jph_top_at(w: pointer, x: float, z: float, r: float, from_y: float, depth: float, mask: int) -> float = "jph_top_at"
|
|
extern function jph_overlap(w: pointer, x: float, y: float, z: float, r: float, mask: int, ids: pointer, cap: int) -> int = "jph_overlap"
|
|
extern function jph_push(w: pointer, x: float, z: float, r: float, y0: float, y1: float, mask: int, out: pointer) -> int = "jph_push"
|