feat(lang): functions are values (L2), and render3d takes its scene as callbacks
fn(int, float) -> bool is a type, fn name is any top-level function's value, and a call through a local, a global, a record field, a slice element, a parameter or a result of a function type is an indirect call; two function types mix only when equal, a call checks its argument count, and a value may be null (examples/functions/values.ludic). Job.parallel_for keeps its worker check. render3d's scene is registered rather than required by name: r3d_on_draw, r3d_on_casters and r3d_on_stream_fill (hooks.ludic). The two rendering examples register theirs - and had defined scene_draw_casters with no parameter while the renderer passed one, which nothing checked. render3d declares numbers float itself; smooth.ludic is converted to floats and returns when r3d_init fails instead of running on into a segfault. Noise.* check their argument count (a call one short crashed the compiler). selfhost-build says why it failed. The migration tool reads a declared float as evidence. Seed regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dc75a5a5ab
commit
0c73287e35
23 changed files with 71430 additions and 68575 deletions
|
|
@ -15,7 +15,7 @@ program Reload {
|
|||
# (the parser's g_uses_gl), so even a check that draws nothing presents its frame.
|
||||
# render3d calls back into the program for what stands on the terrain
|
||||
function scene_draw() -> void { scatter_draw() }
|
||||
function scene_draw_casters() -> void { scatter_draw_casters(shadow_cascade_vp(sh_cascade)) }
|
||||
function scene_draw_casters(light_vp: floats) -> void { scatter_draw_casters(light_vp) }
|
||||
# no streamed cover here, but stream.ludic names the generator, so every program supplies one
|
||||
function stream_fill(s: Stream, cx: int, cz: int, band: int) -> void { }
|
||||
|
||||
|
|
@ -39,9 +39,15 @@ program Reload {
|
|||
|
||||
handler Boot phase Start {
|
||||
spawn Anchor {}
|
||||
r3d_on_draw(fn scene_draw)
|
||||
r3d_on_casters(fn scene_draw_casters)
|
||||
r3d_on_stream_fill(fn stream_fill)
|
||||
TERRAIN_HALF = 1000
|
||||
ter_smooth = true
|
||||
if not r3d_init(640, 360, "Reload") { quit() }
|
||||
if not r3d_init(640, 360, "Reload") {
|
||||
quit()
|
||||
return
|
||||
}
|
||||
cam_set(F_ZERO, fi(80), fi(300), fi(180), f_neg(fi(10)))
|
||||
water_init(fl(4.0), F_ZERO, F_ZERO, fi(200), fi(200))
|
||||
populate()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue