Skip to main content

PrimitiveMut

Struct PrimitiveMut 

Source
pub struct PrimitiveMut<'a>(/* private fields */);
Expand description

One primitive of a Mesh, edited in place: it reads as a Primitive and changes field by field (its streams, indices, topology and material), but never as a whole, so a primitive can’t be replaced by another or swapped with one, and the list keeps its count and order. Per-primitive components describe the primitive in its place; a pass that rebuilds the list uses crate::World::rebuild_primitives or crate::World::edit_mesh, which carry them along.

No slice to swap, sort or reverse:

ⓘ
let mut mesh = primase_core::Mesh::default();
mesh.primitives_mut().swap(0, 1);

and no primitive replaced by another:

ⓘ
let mut mesh = primase_core::Mesh::default();
let other = mesh.primitives()[0].clone();
*mesh.primitive_mut(0).unwrap() = other;

Implementations§

Source§

impl PrimitiveMut<'_>

Source

pub fn topology_mut(&mut self) -> &mut Topology

Source

pub fn streams_mut(&mut self) -> &mut BTreeMap<Semantic, Stream>

Source

pub fn indices_mut(&mut self) -> &mut Option<Vec<u32>>

Source

pub fn material_mut(&mut self) -> &mut Option<Entity>

Source

pub fn fields(&mut self) -> PrimitiveFields<'_>

Every field at once, for an edit that changes several (indices against the streams, say).

Methods from Deref<Target = Primitive>§

Source

pub fn positions(&self) -> Option<&[[f32; 3]]>

Source

pub fn vertex_count(&self) -> usize

Trait Implementations§

Source§

impl<'a> Debug for PrimitiveMut<'a>

Source§

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

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

impl Deref for PrimitiveMut<'_>

Source§

type Target = Primitive

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Primitive

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for PrimitiveMut<'a>

§

impl<'a> Forget for PrimitiveMut<'a>

§

impl<'a> Freeze for PrimitiveMut<'a>

§

impl<'a> RefUnwindSafe for PrimitiveMut<'a>

§

impl<'a> Send for PrimitiveMut<'a>

§

impl<'a> Sync for PrimitiveMut<'a>

§

impl<'a> Unpin for PrimitiveMut<'a>

§

impl<'a> UnsafeUnpin for PrimitiveMut<'a>

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.