Struct ToroidalGroundCoverClipmap
#[repr(C)]pub struct ToroidalGroundCoverClipmap {
pub cells: [EcotopePatch; 1024],
pub center_world_x: f32,
pub center_world_z: f32,
pub cell_size_m: f32,
}Expand description
Zero-allocation toroidal clipmap buffer centered on the moving camera.
Fields§
§cells: [EcotopePatch; 1024]§center_world_x: f32Center world coordinate X
center_world_z: f32Center world coordinate Z
cell_size_m: f32Physical cell size in meters (e.g. 2.0m per patch)
Implementations§
§impl ToroidalGroundCoverClipmap
impl ToroidalGroundCoverClipmap
pub const fn new( center_x: f32, center_z: f32, cell_size_m: f32, ) -> ToroidalGroundCoverClipmap
pub fn cell_index_at(&self, grid_x: i32, grid_z: i32) -> usize
pub fn cell_index_at(&self, grid_x: i32, grid_z: i32) -> usize
Evaluates toroidal index in 0..TOROIDAL_TOTAL_CELLS using modulo addressing.
pub fn update_camera_position(&mut self, cam_x: f32, cam_z: f32)
pub fn update_camera_position(&mut self, cam_x: f32, cam_z: f32)
Translates the toroidal clipmap center without buffer re-allocation.
pub fn inject_trample(
&mut self,
world_x: f32,
world_z: f32,
dir_x: f32,
dir_z: f32,
matted_ratio: f32,
)
pub fn inject_trample( &mut self, world_x: f32, world_z: f32, dir_x: f32, dir_z: f32, matted_ratio: f32, )
Injects a vehicle wheel or character boot trample deformation into the nearest cell.
pub fn evaluate_lod(&self, distance_m: f32) -> GroundCoverLod
pub fn evaluate_lod(&self, distance_m: f32) -> GroundCoverLod
Maps distance from camera in meters to the optimal continuous LOD level.
pub fn evaluate_sggx_fiber_direction(&self, patch: &EcotopePatch) -> [f32; 3]
pub fn evaluate_sggx_fiber_direction(&self, patch: &EcotopePatch) -> [f32; 3]
Evaluates SGGX 3D normal orientation vector for distant LOD 3 microflake BRDF.
When turgor is high, grass stands vertically ($[0, 1, 0]$), producing velvet grazing sheen. When trampled or wilted, the fiber tangent collapses horizontally.
pub fn clamp_blade_density(
&self,
distance_m: f32,
viewport_width_px: u32,
viewport_height_px: u32,
) -> u32
pub fn clamp_blade_density( &self, distance_m: f32, viewport_width_px: u32, viewport_height_px: u32, ) -> u32
Megapixel Governor: Computes allowable blade count for a tile to avoid sub-pixel overdraw.
Limits spawned vertices across the viewport to $\le 1.5\times$ total viewport pixels.
Trait Implementations§
§impl Clone for ToroidalGroundCoverClipmap
impl Clone for ToroidalGroundCoverClipmap
§fn clone(&self) -> ToroidalGroundCoverClipmap
fn clone(&self) -> ToroidalGroundCoverClipmap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more