pub struct WorldPartitionGrid {
pub cell_size: f32,
pub cells: HashMap<CellCoord, WorldCell>,
pub spatial_hash: HashMap<u64, CellCoord>,
pub origin: Vec3,
pub active_radius_cells: i32,
}Fields§
§cell_size: f32§cells: HashMap<CellCoord, WorldCell>§spatial_hash: HashMap<u64, CellCoord>§origin: Vec3§active_radius_cells: i32Implementations§
Source§impl WorldPartitionGrid
impl WorldPartitionGrid
pub fn new(cell_size: f32, origin: Vec3) -> Self
pub fn world_to_cell(&self, pos: Vec3) -> CellCoord
pub fn cell_to_world_center(&self, coord: CellCoord) -> Vec3
pub fn get_or_create_cell(&mut self, coord: CellCoord) -> &mut WorldCell
pub fn get_cells_in_radius(&self, center: Vec3, radius: f32) -> Vec<CellCoord>
pub fn register_object(&mut self, object_id: u64, pos: Vec3)
pub fn unregister_object(&mut self, object_id: u64)
pub fn query_objects_in_radius(&self, pos: Vec3, radius: f32) -> Vec<u64>
pub fn optimize_cell_size(&self, level_count: usize, world_size: f32) -> f32
pub fn compute_total_memory_mb(&self) -> f32
pub fn get_neighbor_cells(&self, coord: CellCoord) -> Vec<&WorldCell>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorldPartitionGrid
impl RefUnwindSafe for WorldPartitionGrid
impl Send for WorldPartitionGrid
impl Sync for WorldPartitionGrid
impl Unpin for WorldPartitionGrid
impl UnsafeUnpin for WorldPartitionGrid
impl UnwindSafe for WorldPartitionGrid
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.