Skip to main content

concinnity_core/gfx/
pose_scratch.rs

1//! Reusable per-target scratch buffers for the pose sampling chain.
2
3use alloc::vec::Vec;
4
5use crate::gfx::transform::Mat4;
6
7/// Reusable buffers for the per-frame pose sampling chain (sample, blend, IK,
8/// skinning). Each animated target owns one; the buffers reach steady-state
9/// capacity on the first sampled frame and are reused in place after that, so
10/// steady-state sampling performs no heap allocation.
11#[derive(Debug, Default)]
12pub struct PoseScratch {
13    /// Primary local-pose accumulator. Holds the finished blended pose.
14    pub locals: Vec<Mat4>,
15    /// Secondary local-pose buffer (a transition's outgoing pose, or the
16    /// world-matrix scratch an IK solve composes through).
17    pub aux: Vec<Mat4>,
18    /// Per-clip sample buffer fed into the weighted blend.
19    pub clip: Vec<Mat4>,
20    /// Per-member blend weights, or a clip's sampled morph weights.
21    pub weights: Vec<f32>,
22    /// Morph-weight accumulator for a weighted multi-clip blend.
23    pub morph: Vec<f32>,
24}