Struct pasture_core::containers::PerAttributeVecPointStorage[][src]

pub struct PerAttributeVecPointStorage { /* fields omitted */ }

PointBuffer type that uses PerAttribute memory layout and Vec-based owning storage for point data

Implementations

impl PerAttributeVecPointStorage[src]

pub fn new(layout: PointLayout) -> Self[src]

Creates a new empty PerAttributeVecPointStorage with the given PointLayout

Examples

let layout = PointLayout::from_attributes(&[attributes::POSITION_3D]);
let storage = PerAttributeVecPointStorage::new(layout);

pub fn with_capacity(capacity: usize, layout: PointLayout) -> Self[src]

Creates a new PerAttributeVecPointStorage with enough capacity to store capacity points using the given PointLayout. Calling this method is similar to Vec::with_capacity: Internal memory is reserved but the len() is not affected.

Examples

let layout = PointLayout::from_attributes(&[attributes::POSITION_3D]);
let storage = PerAttributeVecPointStorage::with_capacity(16, layout);

pub fn push_point<T: PointType>(&mut self, point: T)[src]

Pushes a single point into the associated PerAttributeVecPointStorage.

Examples


#[repr(C)]
#[derive(PointType)]
struct MyPointType(#[pasture(BUILTIN_INTENSITY)] u16);

{
  let mut storage = PerAttributeVecPointStorage::new(MyPointType::layout());
  storage.push_point(MyPointType(42));
}

Panics

If the PointLayout of type T does not match the layout of the associated PerAttributeVecPointStorage.

pub fn push_points<T: PointType>(&mut self, points: &[T])[src]

Pushes a range of points into the associated PerAttributeVecPointStorage.

Examples


#[repr(C)]
#[derive(PointType)]
struct MyPointType(#[pasture(BUILTIN_INTENSITY)] u16);

{
  let mut storage = PerAttributeVecPointStorage::new(MyPointType::layout());
  storage.push_points(&[MyPointType(42), MyPointType(43)]);
}

Panics

If the PointLayout of type T does not match the layout of the associated PerAttributeVecPointStorage.

pub fn begin_push_attributes(&mut self) -> PerAttributeVecPointStoragePusher<'_>[src]

Create a builder for pushing attribute data into the associated PerAttributeVecPointStorage one by one

pub fn sort_by_attribute<T: PrimitiveType + Ord>(
    &mut self,
    attribute: &PointAttributeDefinition
)
[src]

Sorts all points in the associated PerAttributePointBuffer using the order of the PointType T.

Panics

If the PointLayout of T does not match the underlying layout

pub fn par_sort_by_attribute<T: PrimitiveType + Ord>(
    &mut self,
    attribute: &PointAttributeDefinition
)
[src]

Like sort_by_attribute, but sorts each attribute in parallel. Uses the rayon crate for parallelization

pub fn reserve(&mut self, additional_points: usize)[src]

Reserves space for at least additional_points additional points in the associated PerAttributeVecPointStorage

Trait Implementations

impl<T: PointType> From<&'_ [T]> for PerAttributeVecPointStorage[src]

impl<T: PointType> From<&'_ mut [T]> for PerAttributeVecPointStorage[src]

impl<T: PointType> From<Vec<T, Global>> for PerAttributeVecPointStorage[src]

impl<T: PointType> FromIterator<T> for PerAttributeVecPointStorage[src]

impl PerAttributePointBuffer for PerAttributeVecPointStorage[src]

impl<'p> PerAttributePointBufferMut<'p> for PerAttributeVecPointStorage[src]

impl PointBuffer for PerAttributeVecPointStorage[src]

impl PointBufferWriteable for PerAttributeVecPointStorage[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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