12345678910111213141516171819202122232425(* Claude Code
*
* Copyright (C) 2026 Yoann Padioleau
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License
* (LGPL) as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*)(* See Zbuffer.mli *)(* the depths row by row, pixel (x, y) at y * width + x *)typet={width:int;depth:floatarray}letcreate~(width:int)~(height:int):t={width;depth=Array.make(width*height)infinity}letclear(t:t):unit=Array.fillt.depth0(Array.lengtht.depth)infinitylettest_and_set(t:t)~(x:int)~(y:int)(z:float):bool=letidx=(y*t.width)+xinifz<Array.unsafe_gett.depthidxthenbeginArray.unsafe_sett.depthidxz;trueendelsefalse