pub struct LodThresholds {
pub r_near: f64,
pub r_mid: f64,
pub mid_mip_levels: Option<u32>,
pub mid_mip_scan_dist: Option<i32>,
}Expand description
Per-grid LOD picker configuration: world-distance thresholds for tier dispatch + optional Mid-tier render overrides.
Tier dispatch (centre-to-centre distance d):
All thresholds default to f64::INFINITY via Default /
Self::always_near, so a freshly-constructed crate::Grid
always lands on Lod::Near — the S5-and-earlier byte-stable
behaviour. Callers that want real LOD opt in by writing a
non-default value into crate::Grid::lod_thresholds.
NaN thresholds are treated as “always Lod::Far” because
every d <= NaN comparison is false. No assert — callers
shouldn’t be passing NaN and we don’t want runtime cost in a
per-frame per-grid hot path.
§S6.1 — Mid-tier mip overrides
When the picker returns Lod::Mid, Self::mid_mip_levels
and Self::mid_mip_scan_dist (if Some) override the
corresponding roxlap_core::opticast::OpticastSettings fields
for that grid’s render. The intent: force coarser-mip rendering
at Mid distance to recover performance, using the existing R4.5
multi-mip infrastructure with no new rasterizer code.
Semantics:
mid_mip_levels = Some(n)— clampOpticastSettings.mip_levelstonfor this grid.nis then further clamped to[1, settings.mip_levels]at the call site.mid_mip_scan_dist = Some(d)— setOpticastSettings.mip_scan_disttomin(settings.mip_scan_dist, d). The renderer floorsmip_scan_distat 4 internally; smaller values transition to coarser mips closer to the camera, biasing the whole frame toward higher mips.- Both
None⇒ Mid path renders identically to Near (graceful degrade — callers can opt into the Mid plumbing without committing to a mip override). crate::Grid::mip_levels_overridecontinues to apply on top as a global per-grid cap regardless of tier (the ship anti-beam workaround is preserved at all LOD tiers).
Fields§
§r_near: f64Maximum world-distance at which the grid renders at
Lod::Near. Grids closer than this are full voxel.
r_mid: f64Maximum world-distance at which the grid renders at
Lod::Mid. Beyond r_mid the grid uses Lod::Far.
Must satisfy r_mid >= r_near for monotonic tier dispatch;
not enforced (an inverted pair just means the Lod::Mid
band is empty).
mid_mip_levels: Option<u32>S6.1 — OpticastSettings.mip_levels override applied only
when the picker returns Lod::Mid. None ⇒ Mid uses the
caller’s settings.mip_levels unchanged (graceful degrade
to Near-equivalent behaviour). See struct doc for semantics.
mid_mip_scan_dist: Option<i32>S6.1 — OpticastSettings.mip_scan_dist override applied
only when the picker returns Lod::Mid. None ⇒ Mid uses
the caller’s value unchanged. Smaller values bias the grid
toward coarser mips earlier in the ray walk (floor of 4
inside the renderer).
Implementations§
Source§impl LodThresholds
impl LodThresholds
Sourcepub const fn always_near() -> Self
pub const fn always_near() -> Self
Always-Near thresholds. Both distance fields set to
f64::INFINITY; the picker can never enter the Mid/Far
branches. Mid-tier mip overrides set to None (irrelevant
since Mid is never selected). Use as the byte-identical
default during the S6.0..S6.3 staged rollout.
Sourcepub fn from_radius(bounding_radius: f64) -> Self
pub fn from_radius(bounding_radius: f64) -> Self
Derived distance thresholds from the grid’s bounding-sphere radius (PORTING-SCENE.md § S6):
r_near = bounding_radius— Near while the camera is inside the bounding sphere.r_mid = 10 * bounding_radius— Mid up to ~10× radius, Far beyond.mid_mip_levels/mid_mip_scan_dist⇒None(Mid degrades to Near; opt in viaSelf::from_radius_with_mid_mip).
A 0.0 (or negative) bounding radius collapses both
thresholds to zero; the picker returns Lod::Far for any
non-zero distance. That’s correct: an empty grid has no
near range.
Sourcepub fn from_radius_with_mid_mip(
bounding_radius: f64,
mid_mip_levels: u32,
mid_mip_scan_dist: i32,
) -> Self
pub fn from_radius_with_mid_mip( bounding_radius: f64, mid_mip_levels: u32, mid_mip_scan_dist: i32, ) -> Self
Self::from_radius + an explicit Mid-tier mip override
pair. Convenience for S6.1 consumers that want Mid LOD wired
without hand-constructing the struct.
Typical values for a mip_levels = 4, mip_scan_dist = 128
world: mid_mip_levels = 4, mid_mip_scan_dist = 16. The
reduced scan distance biases the Mid grid into coarser mips
across the whole frame.
Trait Implementations§
Source§impl Clone for LodThresholds
impl Clone for LodThresholds
Source§fn clone(&self) -> LodThresholds
fn clone(&self) -> LodThresholds
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LodThresholds
impl Debug for LodThresholds
Source§impl Default for LodThresholds
impl Default for LodThresholds
Source§impl PartialEq for LodThresholds
impl PartialEq for LodThresholds
Source§fn eq(&self, other: &LodThresholds) -> bool
fn eq(&self, other: &LodThresholds) -> bool
self and other values to be equal, and is used by ==.impl Copy for LodThresholds
impl StructuralPartialEq for LodThresholds
Auto Trait Implementations§
impl Freeze for LodThresholds
impl RefUnwindSafe for LodThresholds
impl Send for LodThresholds
impl Sync for LodThresholds
impl Unpin for LodThresholds
impl UnsafeUnpin for LodThresholds
impl UnwindSafe for LodThresholds
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more