pub struct PositionStreamWriter {
pub channels: PositionStreamChannels,
}Expand description
Packs the position vertex stream: the compressed position and, when the stream declares them, the joint indices and weights that deform it.
Joints and weights share the position’s stream, so a skinned mesh’s draw
names one buffer for all three channels. Positions are compressed against
the mesh’s bounding box exactly as compress_positions does; the joint
pair arrives already in its stored widths and is copied through.
Fields§
§channels: PositionStreamChannelsThe channels this stream writes.
Implementations§
Source§impl PositionStreamWriter
impl PositionStreamWriter
Sourcepub fn uncompressed_position(&self) -> bool
pub fn uncompressed_position(&self) -> bool
Whether the position is written full precision rather than compressed
to Snorm16x4. A planar position is full precision too, only two
components wide.
Sourcepub fn planar_position(&self) -> bool
pub fn planar_position(&self) -> bool
Whether the position is written as two components rather than three, with the third read as zero.
Sourcepub fn byte_len(&self, vertex_count: usize) -> usize
pub fn byte_len(&self, vertex_count: usize) -> usize
Bytes one vertex_count-long stream occupies.
Sourcepub fn write(
&self,
positions: &[[f32; 3]],
joints: impl ExactSizeIterator<Item = CompressedJoints>,
weights: impl ExactSizeIterator<Item = CompressedWeights>,
metadata: &mut MeshMetadata,
out: WriteOnly<'_, [u8]>,
)
pub fn write( &self, positions: &[[f32; 3]], joints: impl ExactSizeIterator<Item = CompressedJoints>, weights: impl ExactSizeIterator<Item = CompressedWeights>, metadata: &mut MeshMetadata, out: WriteOnly<'_, [u8]>, )
Compress the raw positions and write the interleaved result, together
with the already compressed joint pair, into out — which must be
exactly Self::byte_len(vertex_count) bytes.
metadata receives the bounding box the position compression derives,
exactly as compress_positions would.
joints and weights are taken as their stored widths, because that
is what the stream stores; float weights can be quantized with
compress_weights first. They arrive as iterators so a caller can
compress its weights lazily as the stream is packed, without collecting
them first. A stream that declares no joints ignores both.
§Panics
If a declared channel’s iterator is shorter than the positions, if the
two lengths disagree, or if out is not exactly one stream long.
Trait Implementations§
Source§impl Clone for PositionStreamWriter
impl Clone for PositionStreamWriter
impl Copy for PositionStreamWriter
Source§impl Debug for PositionStreamWriter
impl Debug for PositionStreamWriter
impl Eq for PositionStreamWriter
Source§impl Hash for PositionStreamWriter
impl Hash for PositionStreamWriter
Source§impl PartialEq for PositionStreamWriter
impl PartialEq for PositionStreamWriter
impl StructuralPartialEq for PositionStreamWriter
Auto Trait Implementations§
impl Forget for PositionStreamWriter
impl Freeze for PositionStreamWriter
impl RefUnwindSafe for PositionStreamWriter
impl Send for PositionStreamWriter
impl Sync for PositionStreamWriter
impl Unpin for PositionStreamWriter
impl UnsafeUnpin for PositionStreamWriter
impl UnwindSafe for PositionStreamWriter
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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