pub struct FluidDelta {
pub frame: u64,
pub base_frame: u64,
pub changed_indices: Vec<u32>,
pub positions: Vec<Vec3Fix>,
pub velocities: Vec<Vec3Fix>,
pub checksum: u64,
}Expand description
Delta-compressed fluid state update
Only contains particles that have changed significantly since the last snapshot.
Fields§
§frame: u64Frame number
base_frame: u64Base frame this delta is relative to
changed_indices: Vec<u32>Changed particle indices
positions: Vec<Vec3Fix>New positions for changed particles
velocities: Vec<Vec3Fix>New velocities for changed particles
checksum: u64Full state checksum (for validation)
Implementations§
Source§impl FluidDelta
impl FluidDelta
Sourcepub fn compute(
old_positions: &[Vec3Fix],
old_velocities: &[Vec3Fix],
new_positions: &[Vec3Fix],
new_velocities: &[Vec3Fix],
threshold: Fix128,
base_frame: u64,
new_frame: u64,
) -> Self
pub fn compute( old_positions: &[Vec3Fix], old_velocities: &[Vec3Fix], new_positions: &[Vec3Fix], new_velocities: &[Vec3Fix], threshold: Fix128, base_frame: u64, new_frame: u64, ) -> Self
Compute delta between two states
Sourcepub fn apply(
&self,
base_positions: &mut [Vec3Fix],
base_velocities: &mut [Vec3Fix],
)
pub fn apply( &self, base_positions: &mut [Vec3Fix], base_velocities: &mut [Vec3Fix], )
Apply delta to base state
Both base slices are bounds-checked before either one is written: a
base_velocities shorter than base_positions used to panic on the
velocity write after base_positions[i] had already been
overwritten, leaving the pair in a half-updated state for whichever
particle triggered it.
Sourcepub fn changed_count(&self) -> usize
pub fn changed_count(&self) -> usize
Number of changed particles
Sourcepub fn compression_ratio(&self, total_particles: usize) -> f32
pub fn compression_ratio(&self, total_particles: usize) -> f32
Compression ratio (1.0 = no compression, 0.0 = perfect)
Trait Implementations§
Source§impl Clone for FluidDelta
impl Clone for FluidDelta
Auto Trait Implementations§
impl Freeze for FluidDelta
impl RefUnwindSafe for FluidDelta
impl Send for FluidDelta
impl Sync for FluidDelta
impl Unpin for FluidDelta
impl UnsafeUnpin for FluidDelta
impl UnwindSafe for FluidDelta
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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