pub struct ChunkStreamingManager {
pub config: StreamingConfig,
pub stats: StreamingStats,
/* private fields */
}Expand description
The main terrain streaming manager.
Call update(viewer_pos) every frame to drive chunk loading/unloading.
Query height_at(world_x, world_z) for terrain height at any position.
Fields§
§config: StreamingConfig§stats: StreamingStatsImplementations§
Source§impl ChunkStreamingManager
impl ChunkStreamingManager
pub fn new(config: StreamingConfig) -> Self
Sourcepub fn update(&mut self, viewer_world_pos: [f32; 3])
pub fn update(&mut self, viewer_world_pos: [f32; 3])
Update the streaming system for the current frame.
viewer_world_pos is the viewer’s world-space position.
Sourcepub fn height_at(&mut self, world_x: f32, world_z: f32) -> Option<f32>
pub fn height_at(&mut self, world_x: f32, world_z: f32) -> Option<f32>
Query the terrain height at a world-space position.
Returns None if the chunk containing this position is not loaded.
Sourcepub fn mesh_for(&mut self, coord: ChunkCoord) -> Option<&[[f32; 3]]>
pub fn mesh_for(&mut self, coord: ChunkCoord) -> Option<&[[f32; 3]]>
Get the vertex data for a loaded chunk.
Sourcepub fn force_load(&mut self, coord: ChunkCoord)
pub fn force_load(&mut self, coord: ChunkCoord)
Force-load a chunk immediately (bypasses the queue).
Sourcepub fn get_chunk(&self, coord: ChunkCoord) -> Option<&TerrainChunkData>
pub fn get_chunk(&self, coord: ChunkCoord) -> Option<&TerrainChunkData>
Returns a reference to a loaded chunk, if present.
Sourcepub fn visible_coords(&self) -> Vec<ChunkCoord>
pub fn visible_coords(&self) -> Vec<ChunkCoord>
Returns all currently visible chunk coordinates.
Sourcepub fn chunk_state(&self, coord: ChunkCoord) -> ChunkState
pub fn chunk_state(&self, coord: ChunkCoord) -> ChunkState
Returns the state of a chunk.
Auto Trait Implementations§
impl Freeze for ChunkStreamingManager
impl RefUnwindSafe for ChunkStreamingManager
impl Send for ChunkStreamingManager
impl Sync for ChunkStreamingManager
impl Unpin for ChunkStreamingManager
impl UnsafeUnpin for ChunkStreamingManager
impl UnwindSafe for ChunkStreamingManager
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.