euv-core 0.57.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::*;

/// Material slot registry indexing every artistic, Freestyle, Matcap, Wireframe, Armature, and Shader Debug `PrincipledMaterial3D` inside `World3D`.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct JianlaiStyleMaterialIds {
    /// Ink-wash Xuan-paper ivory and cyan-jade robe material slot.
    #[get(type(copy))]
    pub(crate) ink_robe: u32,
    /// Dark sumi-ink trim, sash, and cloth boot material slot.
    #[get(type(copy))]
    pub(crate) ink_trim: u32,
    /// Carved celadon jade pendant and hairpin material slot.
    #[get(type(copy))]
    pub(crate) ink_jade: u32,
    /// Ancient gilded bronze handguard and scabbard accent slot.
    #[get(type(copy))]
    pub(crate) ink_bronze: u32,
    /// Folded ink-steel spirit blade with luminous cyan-gold runes slot.
    #[get(type(copy))]
    pub(crate) ink_blade: u32,
    /// Cinnabar vermilion lacquer pillar and sword tassel slot.
    #[get(type(copy))]
    pub(crate) ink_cinnabar: u32,
    /// Guilin blue-green ink-wash karst cliff terrain and peak spire slot.
    #[get(type(copy))]
    pub(crate) ink_cliff: u32,
    /// Carved Bagua blue-stone sword terrace slot.
    #[get(type(copy))]
    pub(crate) ink_terrace: u32,
    /// Dark glazed flying-eave pavilion roof tile slot.
    #[get(type(copy))]
    pub(crate) pavilion_roof: u32,
    /// Warm glowing palace paper lantern slot.
    #[get(type(copy))]
    pub(crate) lantern_glow: u32,
    /// Gnarled cliffside ink-pine bark slot.
    #[get(type(copy))]
    pub(crate) pine_bark: u32,
    /// Malachite ink-pine needle canopy slot.
    #[get(type(copy))]
    pub(crate) pine_needles: u32,
    /// Drifting Xuan-paper ink-cloud mist ribbon slot.
    #[get(type(copy))]
    pub(crate) ink_cloud: u32,
    /// Luminous golden-cinnabar Sky-Cleaving Sword Qi crescent wave slot.
    #[get(type(copy))]
    pub(crate) qi_gold: u32,
    /// Luminous cyan-jade sword-arc trail and halo glow slot.
    #[get(type(copy))]
    pub(crate) qi_cyan: u32,
    /// Unlit sumi-ink Freestyle inverted-hull silhouette outline slot.
    #[get(type(copy))]
    pub(crate) freestyle_ink: u32,
    /// Blender Solid Matcap / sculptor terracotta clay inspection slot.
    #[get(type(copy))]
    pub(crate) matcap_clay: u32,
    /// Topological wireframe edge cage slot.
    #[get(type(copy))]
    pub(crate) wireframe_edge: u32,
    /// Glowing octahedral Blender armature bone visualizer slot.
    #[get(type(copy))]
    pub(crate) bone_prism: u32,
    /// Shader Debug Pass: RGB surface normals visualization slot.
    #[get(type(copy))]
    pub(crate) debug_normals: u32,
    /// Shader Debug Pass: Roughness / Metallic diagnostic visualization slot.
    #[get(type(copy))]
    pub(crate) debug_rough_metal: u32,
    /// Shader Debug Pass: Camera depth gradient visualization slot.
    #[get(type(copy))]
    pub(crate) debug_depth: u32,
    /// Shader Debug Pass: High-contrast Xuan-paper white base for Freestyle Ink line-art pass.
    #[get(type(copy))]
    pub(crate) debug_freestyle_paper: u32,
}

/// Zero-lookup scene object, bone node, skin, and VFX handle table linking `JianlaiSceneController` directly to `World3D`.
#[derive(Clone, Data, Debug)]
pub struct JianlaiSceneHandles {
    /// Scene-graph node ID owning the skinned and morphed hero character mesh.
    #[get(type(copy))]
    pub(crate) hero_node_id: u32,
    /// `World3D::objects` index of the skinned hero character.
    #[get(type(copy))]
    pub(crate) hero_object_idx: usize,
    /// Optional `World3D::objects` index of the hero's Freestyle inverted-hull ink outline.
    #[get(type(copy))]
    pub(crate) hero_outline_obj_idx: Option<usize>,
    /// `World3D::skins` index of the 27-bone hero armature skin.
    #[get(type(copy))]
    pub(crate) hero_skin_idx: usize,
    /// Ordered `SceneGraph3D` node IDs for all 27 armature joints.
    #[get(type(copy))]
    pub(crate) bone_node_ids: [u32; JIANLAI_BONE_COUNT],
    /// Local rest translations for all 27 armature joints.
    #[get(type(copy))]
    pub(crate) bone_rest_translations: [Vec3; JIANLAI_BONE_COUNT],
    /// World-space rest bind positions for all 27 armature joints.
    #[get(type(copy))]
    pub(crate) bone_rest_world_positions: [Vec3; JIANLAI_BONE_COUNT],
    /// `World3D::objects` index of the hero's primary sculpted spirit sword.
    #[get(type(copy))]
    pub(crate) sword_obj_idx: usize,
    /// Optional `World3D::objects` index of the spirit sword's Freestyle ink outline.
    #[get(type(copy))]
    pub(crate) sword_outline_obj_idx: Option<usize>,
    /// `World3D::objects` index of the floating carved spirit sword scabbard.
    #[get(type(copy))]
    pub(crate) scabbard_obj_idx: usize,
    /// `World3D::objects` indices of the 18 orbiting flying swords in the Myriad Swords Return halo.
    pub(crate) myriad_sword_obj_indices: Vec<usize>,
    /// `World3D::objects` index of the colossal Sky-Cleaving crescent sword-qi energy wave.
    #[get(type(copy))]
    pub(crate) crescent_qi_obj_idx: usize,
    /// `World3D::objects` index of the expanding calligraphic ink-splash shockwave ring.
    #[get(type(copy))]
    pub(crate) shockwave_ring_obj_idx: usize,
    /// `World3D::objects` index of the dynamic sweeping cyan-ink sword-arc trail.
    #[get(type(copy))]
    pub(crate) sword_trail_obj_idx: usize,
    /// `World3D::objects` indices of the drifting Xuan-paper ink-cloud mist ribbons.
    pub(crate) cloud_ribbon_obj_indices: Vec<usize>,
    /// `World3D::objects` indices of the 26 octahedral Blender armature bone visualizer prisms.
    pub(crate) bone_prism_obj_indices: Vec<usize>,
    /// `World3D::objects` indices of topological wireframe inspection cages.
    pub(crate) wireframe_cage_obj_indices: Vec<usize>,
    /// `World3D::objects` indices of all inverted-hull Freestyle ink outline meshes.
    pub(crate) freestyle_outline_obj_indices: Vec<usize>,
    /// Canonical `(object_index, base_principled_material_id)` list for clean O(N) render-mode switching.
    pub(crate) scene_material_slots: Vec<(usize, u32)>,
    /// Total sculpted hero vertices.
    #[get(type(copy))]
    pub(crate) hero_vertices: usize,
    /// Total sculpted hero triangles.
    #[get(type(copy))]
    pub(crate) hero_triangles: usize,
    /// Total sculpted mountain cliff, pavilion, terrace, and pine stage triangles.
    #[get(type(copy))]
    pub(crate) stage_triangles: usize,
    /// Total triangles across hero, spirit swords, stage, and ultimate VFX meshes.
    #[get(type(copy))]
    pub(crate) total_triangles: usize,
}

/// Real-time Verlet cloth and ribbon physics solvers driving the hero's robes, sleeves, hair ribbons, and sword tassel.
#[derive(Clone, Data, Debug)]
pub struct JianlaiClothSim {
    /// PBD / Verlet 2D cloth grid simulating the flowing lower robe cloak and hem panels.
    pub(crate) robe_cloth: VerletClothSolver,
    /// PBD / Verlet 1D rope chain simulating the left inked hair ribbon.
    pub(crate) hair_ribbon_left: VerletRopeSolver,
    /// PBD / Verlet 1D rope chain simulating the right inked hair ribbon.
    pub(crate) hair_ribbon_right: VerletRopeSolver,
    /// PBD / Verlet 1D rope chain simulating the cinnabar sword pommel tassel.
    pub(crate) sword_tassel: VerletRopeSolver,
    /// Latest measured average cloth vertex displacement magnitude in meters.
    #[get(type(copy))]
    pub(crate) average_displacement_m: f32,
}

/// Live telemetry and diagnostic readout snapshot emitted by `JianlaiSceneController` for HUD and test verification.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct JianlaiRigMetrics {
    /// Total armature bones in the hero skeleton (`27`).
    #[get(type(copy))]
    pub(crate) bone_count: usize,
    /// Total sculpted vertices in the hero rigged mesh.
    #[get(type(copy))]
    pub(crate) hero_vertices: usize,
    /// Total sculpted triangles in the hero rigged mesh.
    #[get(type(copy))]
    pub(crate) hero_triangles: usize,
    /// Total sculpted triangles across the cliff, pavilion, terrace, and ink-pine stage.
    #[get(type(copy))]
    pub(crate) stage_triangles: usize,
    /// Total sculpted triangles across the entire Jianlai production scene.
    #[get(type(copy))]
    pub(crate) total_triangles: usize,
    /// Active NLA martial arts or ultimate action.
    #[get(type(copy))]
    pub(crate) active_action: JianlaiAction,
    /// Active Blender viewport render and inspection mode.
    #[get(type(copy))]
    pub(crate) render_mode: JianlaiRenderMode,
    /// Active shader debug visualization channel.
    #[get(type(copy))]
    pub(crate) debug_channel: JianlaiDebugChannel,
    /// Active skeletal skinning algorithm (`LinearBlend` vs `DualQuaternion`).
    #[get(type(copy))]
    pub(crate) skinning_mode: SkinningMode,
    /// Whether live Sword-Tip IK solving is active.
    #[get(type(copy))]
    pub(crate) ik_enabled: bool,
    /// Latest Sword-Tip IK residual distance error in meters.
    #[get(type(copy))]
    pub(crate) ik_error_m: f32,
    /// Latest Sword-Tip IK solver iterations executed.
    #[get(type(copy))]
    pub(crate) ik_iterations: usize,
    /// Whether Verlet robe and hair ribbon cloth physics is active.
    #[get(type(copy))]
    pub(crate) cloth_enabled: bool,
    /// Latest measured Verlet cloth displacement amplitude in meters.
    #[get(type(copy))]
    pub(crate) cloth_displacement_m: f32,
    /// Active Shape Key Battle Aura morph weight in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) morph_aura_weight: f32,
    /// Whether Freestyle inverted-hull calligraphy ink outlines are visible.
    #[get(type(copy))]
    pub(crate) freestyle_enabled: bool,
    /// Whether the 27-bone 3D octahedral armature bone visualizer overlay is visible.
    #[get(type(copy))]
    pub(crate) show_bones: bool,
    /// Active live Niagara 3D ink droplet and golden spark particle count.
    #[get(type(copy))]
    pub(crate) niagara_particles: usize,
    /// Number of orbiting flying spirit swords actively deployed in the halo array.
    #[get(type(copy))]
    pub(crate) flying_swords_active: usize,
    /// Normalized ultimate sword-qi charge intensity in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) ultimate_charge: f32,
    /// Decaying cinematic camera impact trauma in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) camera_trauma: f32,
    /// Current active NLA timeline cursor in seconds.
    #[get(type(copy))]
    pub(crate) timeline_secs: f32,
    /// Total duration of the active NLA clip in seconds.
    #[get(type(copy))]
    pub(crate) clip_duration_secs: f32,
}

/// Complete reusable runtime controller driving the sculpted Jianlai Ink-Wash Donghua scene inside `World3D`.
#[derive(Clone, Data, Debug)]
pub struct JianlaiSceneController {
    /// Pre-indexed scene object, bone node, skin, and VFX handles.
    pub(crate) handles: JianlaiSceneHandles,
    /// Pre-registered artistic and render-mode override `PrincipledMaterial3D` slots.
    #[get(type(copy))]
    pub(crate) materials: JianlaiStyleMaterialIds,
    /// Live Verlet robe cloth and hair/tassel ribbon physics simulation bundle.
    pub(crate) cloth_sim: JianlaiClothSim,
    /// Currently active NLA martial arts or ultimate action.
    #[get(type(copy))]
    pub(crate) active_action: JianlaiAction,
    /// Previously active action used for smooth crossfade blending.
    #[get(type(copy))]
    pub(crate) prev_action: JianlaiAction,
    /// Remaining crossfade transition time in seconds.
    #[get(type(copy))]
    pub(crate) crossfade_remaining_secs: f32,
    /// Currently active Blender render and inspection mode.
    #[get(type(copy))]
    pub(crate) render_mode: JianlaiRenderMode,
    /// Currently active shader debug pass channel.
    #[get(type(copy))]
    pub(crate) debug_channel: JianlaiDebugChannel,
    /// Active skeletal skinning mode (`LinearBlend` vs `DualQuaternion`).
    #[get(type(copy))]
    pub(crate) skinning_mode: SkinningMode,
    /// Whether live Sword-Tip IK (`IkSolver3D`) overrides the right arm chain.
    #[get(type(copy))]
    pub(crate) ik_enabled: bool,
    /// Whether live Verlet cloth and ribbon physics drives sleeves, hems, and hair ribbons.
    #[get(type(copy))]
    pub(crate) cloth_enabled: bool,
    /// Whether the 3D octahedral armature bone visualizer overlay is visible.
    #[get(type(copy))]
    pub(crate) show_bones: bool,
    /// Whether Freestyle inverted-hull dark calligraphy ink outlines are enabled.
    #[get(type(copy))]
    pub(crate) freestyle_enabled: bool,
    /// Active Shape Key morph weight (`SwordQi_BattleAura` & `Robe_WindBillow`) in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) morph_aura_weight: f32,
    /// Current playback timestamp inside the active action clip in seconds.
    #[get(type(copy))]
    pub(crate) action_time_secs: f32,
    /// Cumulative elapsed scene clock in seconds driving ambient mist, lanterns, and wind.
    #[get(type(copy))]
    pub(crate) total_time_secs: f32,
    /// Latest Sword-Tip IK residual error in meters.
    #[get(type(copy))]
    pub(crate) last_ik_error: f32,
    /// Latest Sword-Tip IK solver iteration count.
    #[get(type(copy))]
    pub(crate) last_ik_iterations: usize,
    /// Normalized ultimate sword-qi intensity in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) ultimate_charge: f32,
    /// Smoothly decaying cinematic camera punch trauma in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) camera_trauma: f32,
    /// Atmospheric physical sky solver configured for ink-wash misty peaks.
    pub(crate) sky: PhysicalSky3D,
    /// Volumetric cliff-abyss mist scattering volume used in Ink-Wash and Eevee modes.
    pub(crate) volumetric_fog: VolumetricFogVolume3D,
    /// Post-FX bloom, auto-exposure, and ink-wash color grading configuration.
    #[get(type(copy))]
    pub(crate) postfx_config: PostFxConfig3D,
}