Skip to main content

DynamicNavmeshState

Struct DynamicNavmeshState 

Source
pub struct DynamicNavmeshState { /* private fields */ }
Expand description

Mutable availability overlay on a validated base Navmesh.

The base geometry is immutable. Disabled cells and portals form a subtractive overlay: Self::materialize emits a static Navmesh containing only enabled cells and portals (with remapped indices). This is not mesh carving or in-place prepared repair.

§Prepared staleness

Every successful Self::apply_update sets Self::prepared_stale. Callers that hold a PreparedNavmesh built from a prior snapshot must discard it and rebuild from a fresh materialization. Staleness clears only when a rebuild-backed helper (for example DynamicPreparedNavmeshQuery::run) marks the state rebuilt—not merely from calling Self::materialize.

Implementations§

Source§

impl DynamicNavmeshState

Source

pub fn new(base: Navmesh) -> Result<DynamicNavmeshState, DynamicNavmeshError>

Validates base (non-empty, passes Navmesh::validate) with all cells/portals enabled.

§Errors

Returns DynamicNavmeshError when the base is empty or invalid.

Source

pub fn with_disabled_availability( base: Navmesh, disabled_cells: impl IntoIterator<Item = String>, disabled_portals: impl IntoIterator<Item = DynamicNavmeshPortalKey>, ) -> Result<DynamicNavmeshState, DynamicNavmeshError>

Like Self::new, then seeds the disabled cell and portal sets without marking stale.

Use for fixture restore and cold start. Subsequent Self::apply_update calls still mark prepared data stale as usual.

§Errors

Returns DynamicNavmeshError when the base is invalid or a disabled id is unknown.

Source

pub fn base(&self) -> &Navmesh

Immutable base geometry (full cell/portal set, ignoring availability).

Source

pub fn disabled_cells(&self) -> &BTreeSet<String>

Stable cell ids currently excluded from materialization.

Source

pub fn disabled_portals(&self) -> &BTreeSet<DynamicNavmeshPortalKey>

Portal keys currently excluded from materialization.

Source

pub fn prepared_stale(&self) -> bool

Whether any availability change has not yet been followed by a prepared rebuild.

When true, any prepared snapshot derived before the last update must not be trusted.

Source

pub fn apply_update( &mut self, update: &DynamicNavmeshUpdate, ) -> Result<(), DynamicNavmeshError>

Applies one cell or portal availability change and marks prepared data stale.

Disabling a cell drops it from the next materialization. Disabling a portal drops connectivity between the two cell ids while leaving both cells present when enabled.

§Errors

Returns DynamicNavmeshError when an update references an unknown cell or portal.

Source

pub fn materialize(&self) -> Result<Navmesh, DynamicNavmeshError>

Builds a static Navmesh snapshot of currently enabled cells and portals.

Survivor cells keep their geometry and stable cell_ids but receive new dense indices. Portals between two surviving enabled cells are remapped; portals that touch a disabled cell or sit in the disabled-portal set are dropped. Does not clear Self::prepared_stale—callers must rebuild prepared structures separately. If every cell is disabled, the snapshot is empty and queries return NavmeshQueryResult::InvalidStart.

§Errors

Returns DynamicNavmeshError if the enabled subset does not form a valid navmesh.

Trait Implementations§

Source§

impl Clone for DynamicNavmeshState

Source§

fn clone(&self) -> DynamicNavmeshState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DynamicNavmeshState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DynamicNavmeshState

Source§

fn eq(&self, other: &DynamicNavmeshState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DynamicNavmeshState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool