Commit f319ed41

f319ed41b554Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified

Description

fix: ao_render Plane.intersect negation (d = 0.0 - expr)

Work around [email protected](@n) type inference issue where the unary minus result was assigned to an int variable (losing the float value). Use 0.0 - expr instead to force float context.

Rendering is now correct when GC is disabled. With GC enabled, the program crashes due to temporary Vec/Ray/Isect objects being collected during the inner loops of ambient_occlusion. This is a known GC limitation with programs that allocate many short-lived objects in tight loops without explicit GC roots.

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Details

Commit
f319ed41b554
Parent
0086b90789bf

test/bm_ao_render.rbmodifiedView file

@@ -116,7 +116,7 @@
116116 end
117117
118118 def intersect(ray, isect)
119- d = [email protected](@n)
119+ d = 0.0 - @p.vdot(@n)
120120 v = ray.dir.vdot(@n)
121121 v0 = v
122122 if v < 0.0