perf(render3d): the sky light baked once at start, the terrain load in four steps, actor cull bounds by height
- sky_start_yaw: a game that turns the sky at boot sets it before r3d_init and the image-based light is baked once at that yaw; sky_set_yaw to a yaw already baked bakes nothing. - terrain_init_step: the height field and normals, the sun shadow, the materials, the patches and programs as separate steps; r3d_load_count is 8, so a loading bar moves through the terrain (half the start-up) instead of jumping over it. terrain_init runs the four in a row as before. - The per-cascade actor cull centres its sphere at half the model's height and sizes it by the larger of height and radius: centred at the radius, it dropped a head at a cascade's edge (11 px in town, found by the drawstats comparison). Lake was byte-identical before and after. OpenGL frames at the five viewpoints unchanged; the game's 59 self-tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
dcf6c55a4e
commit
00df8839e6
5 changed files with 52 additions and 16 deletions
|
|
@ -387,9 +387,21 @@ function terrain_load_textures() -> void {
|
|||
}
|
||||
|
||||
function terrain_init() -> void {
|
||||
terrain_generate()
|
||||
terrain_bake_shadow()
|
||||
terrain_load_textures()
|
||||
for i in 0 .. TERRAIN_INIT_STEPS { terrain_init_step(i) }
|
||||
}
|
||||
|
||||
# The terrain's start-up as steps a loading screen can show between, in terrain_init's order:
|
||||
# 0 the height field and its normals (and the read-back for placement), 1 the sun's height-field
|
||||
# shadow, 2 the ground's materials, 3 the patch tree and the terrain programs.
|
||||
const TERRAIN_INIT_STEPS: int = 4
|
||||
function terrain_init_step(i: int) -> void {
|
||||
if i == 0 { terrain_generate(); return }
|
||||
if i == 1 { terrain_bake_shadow(); return }
|
||||
if i == 2 { terrain_load_textures(); return }
|
||||
terrain_init_finish()
|
||||
}
|
||||
|
||||
function terrain_init_finish() -> void {
|
||||
cdlod_init()
|
||||
ter_wire = Os.has_env("R3D_WIRE")
|
||||
ter_force_far = Os.has_env("R3D_TFARONLY")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue