render3d: a grass kind - the GPU blades' per-kind numbers are a GrassKind record the game hands over (grass_kind_set), not constants

GrassKind (grass_kind.ludic) carries what grass.ludic, grass_gpu.ludic, grass.vert, grass_cull.comp and
model.frag's BLADE path held as constants: the cell, s0 / d0 / radius, the row bands and rows, the blade
profile (neck, root, swell, tip, bend), the heights, clumps, widths and arch, where it grows (slope, snow,
the photograph's test), the root / tip / gone-to-seed colours, the far tufts, the root occlusion, the
roughness, the sheen and the wind. Its defaults are those constants exactly, so a game that sets nothing
draws as before. The shaders read them as u_gk_* (the cull as five more Params vec4s, 288 bytes);
grass_reset.comp writes each band's index count so a kind of other rows reaches the draw in order.
grass_quality holds the kind to a settings tier (never denser, never farther); R3D_GRASS_* still win.
grass_profile_w / _bend are the one profile, for the meshes and a game's preview. grass.mesh takes only
the cell: the rest of it is an older copy that already differs from grass.vert, left as it draws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 19:03:33 +03:00
parent d9a73d63bd
commit e908672034
25 changed files with 335 additions and 75 deletions

View file

@ -406,7 +406,10 @@ export state Render3dState {
grass_prog: int = 0
grass_mesh: Mesh = null
grass_on: bool = true
grass_wind: float = 0.0
grass_kind: GrassKind = null # the kind the blades are (grass_kind.ludic); its wind, sheen and shape
grass_cell: int = 4 # the kind's hash cell in metres (1, 2 or 4)
grass_q_s0: float = 0.0 # the settings' tier: no closer spacing than this (grass_quality)
grass_q_r: float = 0.0 # ... and no blades past this (0: the kind's own radius)
grass_s0: float = 0.0 # float bits: blade spacing at the camera (m)
grass_d0: float = 0.0 # the distance at which the spacing has doubled (m)
grass_radius: float = 0.0 # no blades past this (m)