blend
Generated Rust API reference for byte_engine.
byte_engine / animation / blend
Module blend
Allocation-free local-pose and blend-space utilities.
Contents
Quick Reference
| Item | Kind | Description |
|---|---|---|
BlendSpace1D | struct | The BlendSpace1D struct stores validated scalar sample positions for allocation-free weight evaluation. |
BlendTriangle | struct | The BlendTriangle struct identifies three sample indices forming one non-degenerate 2D blend region. |
BlendSpace2D | struct | The BlendSpace2D struct stores validated points and triangles for allocation-free directional blending. |
BlendError | enum | Errors returned when local poses cannot be blended. |
BlendSpaceError | enum | Errors returned when constructing or evaluating a blend space. |
blend_local_transform | fn | Blends two local transforms while preserving the shortest quaternion path. |
blend_local_pose | fn | Blends two complete local poses into caller-owned storage. |
blend_local_poses | fn | Blends any number of complete local poses with normalized non-negative weights. |
Structs
BlendSpace1D
struct BlendSpace1D {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/animation/blend.rs:92-94
The BlendSpace1D struct stores validated scalar sample positions for allocation-free weight evaluation.
Implementations
-
fn new(positions: impl Into<Vec<f32>>) -> Result<Self, BlendSpaceError>Related:
BlendSpaceErrorCreates a blend space with finite, strictly ascending sample positions.
Next, call
Self::write_weightsduring evaluation and pass the weights -
fn len(&self) -> usizeReturns the number of samples and weights required by
Self::write_weights. -
fn is_empty(&self) -> boolReturns whether the blend space contains no samples.
-
fn write_weights(&self, value: f32, output: &mut [f32]) -> Result<(), BlendSpaceError>Related:
BlendSpaceErrorWrites normalized weights for a scalar parameter, clamping outside the sample range.
Trait Implementations
impl ArchivePointee for BlendSpace1D
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BlendSpace1D
impl Clone for BlendSpace1D
-
fn clone(&self) -> BlendSpace1DRelated:
BlendSpace1D
impl Debug for BlendSpace1D
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for BlendSpace1D
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for BlendSpace1D
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for BlendSpace1D
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for BlendSpace1D
impl LayoutRaw for BlendSpace1D
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BlendSpace1D
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BlendSpace1D
-
fn eq(&self, other: &BlendSpace1D) -> boolRelated:
BlendSpace1D
impl Pointable for BlendSpace1D
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for BlendSpace1D
-
type Metadata = ()
impl Read for BlendSpace1D
impl StructuralPartialEq for BlendSpace1D
impl WithSubscriber for BlendSpace1D
BlendTriangle
struct BlendTriangle([usize; 3]);Defined in crates/byte-engine/src/animation/blend.rs:154-157
The BlendTriangle struct identifies three sample indices forming one non-degenerate 2D blend region.
Trait Implementations
impl ArchivePointee for BlendTriangle
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BlendTriangle
impl Clone for BlendTriangle
-
fn clone(&self) -> BlendTriangleRelated:
BlendTriangle
impl Copy for BlendTriangle
impl Debug for BlendTriangle
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for BlendTriangle
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for BlendTriangle
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for BlendTriangle
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for BlendTriangle
impl<K> Equivalent for BlendTriangle
-
fn equivalent(&self, key: &K) -> bool
impl Instrument for BlendTriangle
impl LayoutRaw for BlendTriangle
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BlendTriangle
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BlendTriangle
-
fn eq(&self, other: &BlendTriangle) -> boolRelated:
BlendTriangle
impl Pointable for BlendTriangle
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for BlendTriangle
-
type Metadata = ()
impl Read for BlendTriangle
impl StructuralPartialEq for BlendTriangle
impl WithSubscriber for BlendTriangle
BlendSpace2D
struct BlendSpace2D {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/animation/blend.rs:161-164
The BlendSpace2D struct stores validated points and triangles for allocation-free directional blending.
Implementations
-
fn new(positions: impl Into<Vec<[f32; 2]>>, triangles: impl Into<Vec<BlendTriangle>>) -> Result<Self, BlendSpaceError>Related:
BlendTriangle,BlendSpaceErrorCreates a triangulated blend space.
Triangles may share edges but must not be degenerate. Next, call
Self::write_weightsto find the containing triangle or the closestpoint on the triangulated boundary.
-
fn len(&self) -> usizeReturns the number of samples and weights required by
Self::write_weights. -
fn is_empty(&self) -> boolReturns whether the blend space contains no samples.
-
fn write_weights(&self, value: [f32; 2], output: &mut [f32]) -> Result<(), BlendSpaceError>Related:
BlendSpaceErrorWrites normalized weights for a 2D parameter without allocating.
Values outside the triangulated region clamp to the closest point on any
triangle, which provides stable behavior at directional blend-space edges.
Trait Implementations
impl ArchivePointee for BlendSpace2D
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BlendSpace2D
impl Clone for BlendSpace2D
-
fn clone(&self) -> BlendSpace2DRelated:
BlendSpace2D
impl Debug for BlendSpace2D
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for BlendSpace2D
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for BlendSpace2D
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for BlendSpace2D
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for BlendSpace2D
impl LayoutRaw for BlendSpace2D
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BlendSpace2D
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BlendSpace2D
-
fn eq(&self, other: &BlendSpace2D) -> boolRelated:
BlendSpace2D
impl Pointable for BlendSpace2D
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for BlendSpace2D
-
type Metadata = ()
impl Read for BlendSpace2D
impl StructuralPartialEq for BlendSpace2D
impl WithSubscriber for BlendSpace2D
Enums
BlendError
enum BlendError {
InputCount {
poses: usize,
weights: usize,
},
PoseLength {
expected: usize,
actual: usize,
},
InvalidWeight,
ZeroWeight,
}Defined in crates/byte-engine/src/animation/blend.rs:260-279
Errors returned when local poses cannot be blended.
Variants
-
InputCountThe pose and weight counts differ, or no poses were supplied.
-
PoseLengthAn input pose does not match the output node count.
-
InvalidWeightA weight is negative or non-finite.
-
ZeroWeightAll supplied weights are zero.
Trait Implementations
impl ArchivePointee for BlendError
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BlendError
impl Clone for BlendError
-
fn clone(&self) -> BlendErrorRelated:
BlendError
impl Copy for BlendError
impl Debug for BlendError
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for BlendError
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Downcast for BlendError
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for BlendError
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for BlendError
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for BlendError
impl<K> Equivalent for BlendError
-
fn equivalent(&self, key: &K) -> bool
impl Error for BlendError
impl Instrument for BlendError
impl LayoutRaw for BlendError
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BlendError
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BlendError
-
fn eq(&self, other: &BlendError) -> boolRelated:
BlendError
impl Pointable for BlendError
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for BlendError
-
type Metadata = ()
impl Read for BlendError
impl StructuralPartialEq for BlendError
impl ToString for BlendError
-
fn to_string(&self) -> String
impl WithSubscriber for BlendError
BlendSpaceError
enum BlendSpaceError {
NotEnoughSamples {
minimum: usize,
},
NonFiniteSample,
SamplesNotStrictlyAscending,
NoTriangles,
TriangleSampleOutOfRange {
triangle: usize,
},
DegenerateTriangle {
triangle: usize,
},
OutputLength {
expected: usize,
actual: usize,
},
NonFiniteParameter,
}Defined in crates/byte-engine/src/animation/blend.rs:308-339
Errors returned when constructing or evaluating a blend space.
Variants
-
NotEnoughSamplesThe blend space has fewer samples than its topology requires.
-
NonFiniteSampleA sample position contains a non-finite component.
-
SamplesNotStrictlyAscendingOne-dimensional sample positions are unsorted or duplicated.
-
NoTrianglesA two-dimensional blend space has no triangles.
-
TriangleSampleOutOfRangeA triangle references a sample outside the position list.
-
DegenerateTriangleA triangle uses repeated or collinear sample positions.
-
OutputLengthThe output slice cannot hold one weight per sample.
-
NonFiniteParameterThe evaluation parameter contains a non-finite component.
Trait Implementations
impl ArchivePointee for BlendSpaceError
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BlendSpaceError
impl Clone for BlendSpaceError
-
fn clone(&self) -> BlendSpaceErrorRelated:
BlendSpaceError
impl Copy for BlendSpaceError
impl Debug for BlendSpaceError
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for BlendSpaceError
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Downcast for BlendSpaceError
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for BlendSpaceError
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for BlendSpaceError
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for BlendSpaceError
impl<K> Equivalent for BlendSpaceError
-
fn equivalent(&self, key: &K) -> bool
impl Error for BlendSpaceError
impl Instrument for BlendSpaceError
impl LayoutRaw for BlendSpaceError
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BlendSpaceError
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BlendSpaceError
-
fn eq(&self, other: &BlendSpaceError) -> boolRelated:
BlendSpaceError
impl Pointable for BlendSpaceError
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for BlendSpaceError
-
type Metadata = ()
impl Read for BlendSpaceError
impl StructuralPartialEq for BlendSpaceError
impl ToString for BlendSpaceError
-
fn to_string(&self) -> String
impl WithSubscriber for BlendSpaceError
Functions
blend_local_transform
fn blend_local_transform(left: resource_management::resources::skeleton::LocalTransform, right: resource_management::resources::skeleton::LocalTransform, factor: f32) -> resource_management::resources::skeleton::LocalTransformDefined in crates/byte-engine/src/animation/blend.rs:8-15
Blends two local transforms while preserving the shortest quaternion path.
blend_local_pose
fn blend_local_pose(left: &[resource_management::resources::skeleton::LocalTransform], right: &[resource_management::resources::skeleton::LocalTransform], factor: f32, output: &mut [resource_management::resources::skeleton::LocalTransform]) -> Result<(), BlendError>Defined in crates/byte-engine/src/animation/blend.rs:18-29
Blends two complete local poses into caller-owned storage.
blend_local_poses
fn blend_local_poses(poses: &[&[resource_management::resources::skeleton::LocalTransform]], weights: &[f32], output: &mut [resource_management::resources::skeleton::LocalTransform]) -> Result<(), BlendError>Defined in crates/byte-engine/src/animation/blend.rs:35-88
Blends any number of complete local poses with normalized non-negative weights.
Quaternion components use the first positively weighted pose as their hemisphere reference. This keeps antipodal representations from cancelling.