render3d: scratch the frame uses is made with the state, not on first use

Render3dState's cam_planes, gpu_u_tmp, q_scratch, ov_nine_buf, the caster test's four points,
ter_bw, ter_scr and water_saved default to their buffers (as ludic.anim's clip state does), so the
lazy starts in cam_planes_update, gpu_tmp, terrain_height_smooth, ter_scratch, the water pass and
gvk_startup_state go. q_euler makes its views of q_scratch once (guarded on the view now). Compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 16:30:17 +03:00
parent cd71da9330
commit deb7c0d0c0
7 changed files with 13 additions and 22 deletions

View file

@ -291,7 +291,6 @@ function terrain_height_fx(render3d_st: mut Render3dState, x: fixed, z: fixed) -
function terrain_height_smooth(render3d_st: mut Render3dState, x: float, z: float) -> float {
if render3d_st.ter_heights == null { return 0.0 }
if render3d_st.ter_h_scale == 0.0 { render3d_st.ter_h_scale = float(TERRAIN_RES) / float(render3d_st.TERRAIN_HALF * 2) }
if render3d_st.ter_bw == null { render3d_st.ter_bw = floats(8) }
let scale = render3d_st.ter_h_scale
let fx = (x - render3d_st.ter_ox + float(render3d_st.TERRAIN_HALF)) * scale - 0.5
let fz = (z - render3d_st.ter_oz + float(render3d_st.TERRAIN_HALF)) * scale - 0.5
@ -791,6 +790,5 @@ function terrain_reload(render3d_st: mut Render3dState, dem: string, emin: float
}
function ter_scratch(render3d_st: mut Render3dState) -> floats {
if render3d_st.ter_scr == null { render3d_st.ter_scr = floats(16) }
return render3d_st.ter_scr
}