pub struct StreamingManager {
pub config: TerrainConfig,
pub cache: ChunkCache,
pub load_queue: LoadQueue,
pub lod_scheduler: LodScheduler,
pub prefetcher: Prefetcher,
pub visibility: VisibilitySet,
pub stats: StreamingStats,
/* private fields */
}Expand description
Top-level coordinator for terrain chunk streaming.
Uses a thread pool for generation, an LRU cache, a priority load queue, a LOD scheduler, and a prefetcher to manage the full chunk lifecycle.
Fields§
§config: TerrainConfig§cache: ChunkCache§load_queue: LoadQueue§lod_scheduler: LodScheduler§prefetcher: Prefetcher§visibility: VisibilitySet§stats: StreamingStatsImplementations§
Source§impl StreamingManager
impl StreamingManager
pub fn new(config: TerrainConfig) -> Self
Sourcepub fn new_synchronous(config: TerrainConfig) -> Self
pub fn new_synchronous(config: TerrainConfig) -> Self
Create without a thread pool (synchronous generation for testing).
Sourcepub fn update(&mut self, camera_pos: Vec3)
pub fn update(&mut self, camera_pos: Vec3)
Update the streaming system with a new camera position. Call once per frame.
Sourcepub fn get_chunk(&mut self, coord: ChunkCoord) -> Option<&TerrainChunk>
pub fn get_chunk(&mut self, coord: ChunkCoord) -> Option<&TerrainChunk>
Get a chunk by coordinate. Returns None if not yet loaded.
Sourcepub fn force_load(&mut self, coord: ChunkCoord) -> &TerrainChunk
pub fn force_load(&mut self, coord: ChunkCoord) -> &TerrainChunk
Force-load a chunk synchronously (blocks until generated).
Sourcepub fn sample_height_world(&mut self, world_x: f32, world_z: f32) -> f32
pub fn sample_height_world(&mut self, world_x: f32, world_z: f32) -> f32
Sample height at world coordinates (interpolates between chunks if needed).
pub fn stats(&self) -> &StreamingStats
pub fn visible_chunk_count(&self) -> usize
pub fn cache_size(&self) -> usize
pub fn in_flight_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for StreamingManager
impl !RefUnwindSafe for StreamingManager
impl Send for StreamingManager
impl Sync for StreamingManager
impl Unpin for StreamingManager
impl UnsafeUnpin for StreamingManager
impl !UnwindSafe for StreamingManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.