`Gl.*` binds the whole OpenGL 4.1 core API — every entry point of the platform gl3.h with every GL_* constant, generated by `ludic-dev glgen` with per-call ABI thunks. Windowed builds get an NSOpenGLContext on the existing window at Retina resolution; headless builds render into an offscreen CGL context, so a program that uses Gl.* renders and screenshots identically under the test harness. It links gl.ll, the thunks and OpenGL.framework only when used; every other build stays byte-identical. packages/ludic.render3d is a physically based renderer written on that surface: HDRI image-based lighting, GPU-generated terrain with scanned PBR materials, CDLOD, cascaded shadows, glTF with skinning, instanced vegetation with impostors, procedural grass, water, SSAO, and an HDR pipeline with bloom, auto-exposure and ACES. It also carries this session's work on it: the terrain at half its cost (10.3 -> 5.4 ms of frame), the streaming hitch that got worse the longer you played, a resize that emptied the world, and the packaging that lets a game use the renderer from its own repository — `ludic assets`, the material manifest shipping with the package, and shader lookup falling back to the install root. See changes/ for each, with its numbers. The camping game that drove all of it has moved out to its own repository, Maroon Lake; examples/rendering/smooth.ludic stays as the renderer's example here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
585 B
GLSL
19 lines
585 B
GLSL
// depth-aware 4x4 blur of the ao (a) and indirect bounce (rgb)
|
|
in vec2 v_uv;
|
|
out vec4 o_color;
|
|
uniform sampler2D u_ao;
|
|
uniform sampler2D u_depth;
|
|
uniform vec2 u_texel;
|
|
void main() {
|
|
float cd = texture(u_depth, v_uv).r;
|
|
vec4 sum = vec4(0.0);
|
|
float wsum = 0.0;
|
|
for (int y = -2; y < 2; y++) for (int x = -2; x < 2; x++) {
|
|
vec2 o = vec2(float(x) + 0.5, float(y) + 0.5) * u_texel;
|
|
vec4 s = texture(u_ao, v_uv + o);
|
|
float sd = texture(u_depth, v_uv + o).r;
|
|
float w = exp(-abs(sd - cd) * 4000.0);
|
|
sum += s * w; wsum += w;
|
|
}
|
|
o_color = sum / max(wsum, 1e-4);
|
|
}
|