pub struct FlowFieldGrid { /* private fields */ }Expand description
Integration and flow-vector grid enabling O(1) steering lookup for thousands of crowd units.
Implementations§
Source§impl FlowFieldGrid
Integration and flow-vector construction and O(1) lookup for FlowFieldGrid.
impl FlowFieldGrid
Integration and flow-vector construction and O(1) lookup for FlowFieldGrid.
Sourcepub fn set_cost(&mut self, coord: GridCoord, cost: u8)
pub fn set_cost(&mut self, coord: GridCoord, cost: u8)
Sets the traversal cost of coord (0 clamped to 1, 255 marks impassable).
§Arguments
GridCoord- Cell coordinate to modify.u8- Cost byte (1..=254walkable,255wall).
Sourcepub fn set_blocked(&mut self, coord: GridCoord, blocked: bool)
pub fn set_blocked(&mut self, coord: GridCoord, blocked: bool)
Marks coord as impassable (blocked == true) or normal cost 1 (blocked == false).
§Arguments
GridCoord- Cell coordinate to update.bool- Whether the cell is a solid obstacle.
Sourcepub fn build_for_goals(&mut self, goals: &[GridCoord])
pub fn build_for_goals(&mut self, goals: &[GridCoord])
Computes Dijkstra integration distances and smooth downhill flow vectors toward goals.
§Arguments
&[GridCoord]- One or more goal cell coordinates.
Sourcepub fn direction_at_cell(&self, coord: GridCoord) -> Vec2
pub fn direction_at_cell(&self, coord: GridCoord) -> Vec2
Sourcepub fn integration_at(&self, coord: GridCoord) -> u32
pub fn integration_at(&self, coord: GridCoord) -> u32
Sourcepub fn world_to_cell(&self, world_pos: Vec2) -> Option<GridCoord>
pub fn world_to_cell(&self, world_pos: Vec2) -> Option<GridCoord>
Sourcepub fn cell_center(&self, coord: GridCoord) -> Vec2
pub fn cell_center(&self, coord: GridCoord) -> Vec2
Source§impl FlowFieldGrid
Implements impl #impl_generics #name #ty_generics #where_clause.
impl FlowFieldGrid
Implements impl #impl_generics #name #ty_generics #where_clause.
pub fn get_width(&self) -> usize
pub fn get_mut_width(&mut self) -> &mut usize
pub fn set_width(&mut self, val: usize) -> &mut Self
pub fn get_height(&self) -> usize
pub fn get_mut_height(&mut self) -> &mut usize
pub fn set_height(&mut self, val: usize) -> &mut Self
pub fn get_cell_size(&self) -> f32
pub fn get_mut_cell_size(&mut self) -> &mut f32
pub fn set_cell_size(&mut self, val: f32) -> &mut Self
pub fn get_origin(&self) -> Vec2
pub fn get_mut_origin(&mut self) -> &mut Vec2
pub fn set_origin(&mut self, val: Vec2) -> &mut Self
pub fn get_costs(&self) -> &Vec<u8> ⓘ
pub fn get_mut_costs(&mut self) -> &mut Vec<u8> ⓘ
pub fn set_costs(&mut self, val: Vec<u8>) -> &mut Self
pub fn get_integration(&self) -> &Vec<u32>
pub fn get_mut_integration(&mut self) -> &mut Vec<u32>
pub fn set_integration(&mut self, val: Vec<u32>) -> &mut Self
pub fn get_flow_vectors(&self) -> &Vec<Vec2>
pub fn get_mut_flow_vectors(&mut self) -> &mut Vec<Vec2>
pub fn set_flow_vectors(&mut self, val: Vec<Vec2>) -> &mut Self
Trait Implementations§
Source§impl Clone for FlowFieldGrid
impl Clone for FlowFieldGrid
Auto Trait Implementations§
impl Forget for FlowFieldGrid
impl Freeze for FlowFieldGridwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<u32>: Freeze,
PhantomData<Vec2>: Freeze,
PhantomData<(u32, usize)>: Freeze,
impl Move for FlowFieldGrid
impl RefUnwindSafe for FlowFieldGrid
impl Send for FlowFieldGridwhere
RawVecInner: Send,
impl Sync for FlowFieldGridwhere
RawVecInner: Sync,
impl Unpin for FlowFieldGrid
impl UnsafeUnpin for FlowFieldGridwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
PhantomData<Vec2>: UnsafeUnpin,
PhantomData<(u32, usize)>: UnsafeUnpin,
impl UnwindSafe for FlowFieldGridwhere
RawVecInner: UnwindSafe,
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