euv-core 0.56.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Extracted per-mesh intermediate payload retaining raw vertex group influences before armature binding.
#[derive(Clone, Data, Debug)]
pub(crate) struct BlendExtractedMesh {
    /// Built indexed `Mesh3D` in Euv Y-up space with smooth normals, Lengyel tangents, and morph targets.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) mesh: Mesh3D,
    /// Per-final-vertex source Blender vertex index for remapping deform weights cleanly.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) corner_to_src_vert: Vec<u32>,
    /// Raw Blender per-source-vertex `(def_nr, weight)` influence lists.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) raw_deform_weights: Vec<Vec<(u32, f32)>>,
    /// Ordered shape key names matching `mesh.morph_targets`.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) shape_key_names: Vec<String>,
    /// Initial shape key weights (`KeyBlock.curval`).
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) shape_key_weights: Vec<f32>,
}

/// Extracted armature bone hierarchy and joint-to-node lookup map.
#[derive(Clone, Data, Debug, Default)]
pub(crate) struct BlendExtractedArmature {
    /// Index of the created `ImportedSkin3D` inside `ImportedScene3D::skins`.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) skin_index: u32,
    /// Map from Blender bone name to skin joint index (`0..joints.len()`).
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) bone_name_to_joint: HashMap<String, u16>,
}

/// Single parsed FCurve channel holding frame-value keyframe pairs for one property lane.
#[derive(Clone, Data, Debug, Default)]
pub(crate) struct BlendParsedFCurve {
    /// Blender RNA data path (`"location"`, `"pose.bones[\"Hip\"].rotation_quaternion"`, etc.).
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) rna_path: String,
    /// Scalar lane index (`0..4`).
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) array_index: usize,
    /// Keyframe `(time_seconds, value)` pairs sorted by timestamp.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) keyframes: Vec<(f32, f32)>,
}

/// Decoded Blender `Object` staging record before final hierarchy assembly.
#[derive(Clone, Data, Debug)]
pub(crate) struct BlendObjectStage {
    /// Original `old_address` of the `OB` block.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) old_address: u64,
    /// Clean Blender object name.
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) name: String,
    /// Blender object type discriminant (`OB_MESH`, `OB_CAMERA`, `OB_LAMP`, `OB_ARMATURE`, etc.).
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) ob_type: i32,
    /// Optional parent `Object` `old_address`.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) parent_addr: u64,
    /// Referenced data block `old_address` (`Mesh`, `Camera`, `Light`, `bArmature`).
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) data_addr: u64,
    /// World-space matrix in Blender Z-up coordinates.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) world_mat_blend: Mat4,
    /// Whether the object is visible in viewport.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) visible: bool,
    /// Ordered vertex group names (`Object.defbase` / `Mesh.vertex_group_names`).
    #[get(pub(crate))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) vertex_groups: Vec<String>,
    /// Optional action `old_address` bound via `Object.adt -> AnimData.action`.
    #[get(pub(crate), type(copy))]
    #[set(pub(crate))]
    #[get_mut(skip)]
    pub(crate) action_addr: u64,
}

/// Mutable accumulator collecting bone hierarchy nodes, inverse bind matrices, and name indices for one armature.
#[derive(Clone, Debug, Default)]
pub(crate) struct BlendArmatureAccumulator {
    /// Ordered joint scene node indices.
    pub(crate) joints: Vec<u32>,
    /// Inverse bind matrices aligned with `joints`.
    pub(crate) inverse_bind_matrices: Vec<Mat4>,
    /// Bone name to skin joint index lookup.
    pub(crate) bone_name_to_joint: HashMap<String, u16>,
    /// Bone name to scene node index lookup.
    pub(crate) bone_name_to_node: HashMap<String, u32>,
}

/// Grouped FCurve track associating one scalar lane or morph index with sorted `(time_sec, value)` keyframes.
#[derive(Clone, Debug)]
pub(crate) struct BlendLaneTrack {
    /// Scalar lane index (`0..=3`) or morph target index.
    pub(crate) lane: usize,
    /// Sorted `(time_sec, value)` keyframes.
    pub(crate) keyframes: Vec<(f32, f32)>,
}