render3d + lab: bakes as PNGs, and impostors, the sky's light and the carpet read from their bakes

ludic.lab: lab_png_write / lab_png_write_from (raw 8-bit, 1-4 channels, stored deflate) in png_write.ludic,
importable alone with its own LabPngState; png_convert.ludic's previews of float textures (R32F min..max,
RG16F x255, HDR x/(1+x) + sRGB); lab_ppm_to_png on the same encoder.
render3d: bake_load.ludic - impostor_from_baked / impostor_source / impostor_refill (a fog re-open reads
the bake), sky_baked_in and sky_precompute trying the bake at the start yaw (sky_compute is the
convolution, and sky_ibl_bytes always uses it), carpet_from_baked / carpet_bytes / carpet_finish,
bake_part_count / _len / _off. Compile-only: nothing run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 19:10:06 +03:00
parent f79390838a
commit 6c690c5db6
15 changed files with 396 additions and 107 deletions

View file

@ -16,7 +16,11 @@ property Impostor {
model: Model, # what it was baked from, to bake it again (fog_impostors.ludic)
tw: int = 0,
th: int = 0,
flower: bool = false
flower: bool = false,
src_path: string = "", # its bake file, where the game names one (bake_load.ludic): what a fog opening reads
src_key: string = "",
src_version: int = 0,
src_ok: bool = false # its atlases came from that bake, so a re-open reads it rather than painting
}
property Layer {
model: Model,
@ -1230,14 +1234,18 @@ function carpet_bake__t(render3d_st: mut Render3dState, layers: []Layer, count:
gpu_fb_free(render3d_st, fbo)
gpu_rb_free(render3d_st, rb)
gpu_buffer_free(render3d_st, buf)
carpet_finish(render3d_st, tex)
gpu_check(render3d_st, "carpet bake")
return tex
}
# the carpet tile made ready to wear: repeat-wrapped and mipmapped (a bake's too, bake_load.ludic)
function carpet_finish(render3d_st: mut Render3dState, tex: int) -> void {
gpu_tex_bind(render3d_st, GPU_TEX2D, tex)
gpu_tex_param(render3d_st, GPU_TEX2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
gpu_tex_param(render3d_st, GPU_TEX2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
gpu_tex_param(render3d_st, GPU_TEX2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
gpu_tex_paramf(render3d_st, GPU_TEX2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, render3d_st.tex_anisotropy)
gpu_tex_mips(render3d_st, GPU_TEX2D)
gpu_check(render3d_st, "carpet bake")
return tex
}
# ---- another map at run time ------------------------------------------------------------