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::*;

/// Live state tracking one intersection traffic signal's three animated emissive lenses.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct TrafficSignalUnit3D {
    /// Owning scene object index for the upper crimson-red lens.
    #[get(type(copy))]
    pub(crate) red_obj_idx: usize,
    /// Owning scene object index for the middle amber-gold lens.
    #[get(type(copy))]
    pub(crate) amber_obj_idx: usize,
    /// Owning scene object index for the lower emerald-green lens.
    #[get(type(copy))]
    pub(crate) green_obj_idx: usize,
    /// Time offset in seconds staggering orthogonal intersection signal timing.
    #[get(type(copy))]
    pub(crate) phase_offset_secs: f32,
    /// Most recently applied traffic signal phase.
    #[get(type(copy))]
    pub(crate) active_phase: TrafficLightPhase3D,
}

/// Live animation state for a drifting 3D volumetric cumulus cloud cluster.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct CumulusCloudInstance3D {
    /// Owning dynamic scene object index inside `World3D::objects`.
    #[get(type(copy))]
    pub(crate) object_index: usize,
    /// Current world-space position wrapped cleanly inside map ground bounds.
    #[get(type(copy))]
    pub(crate) position: Vec3,
    /// Steady trade-wind horizontal drift velocity in meters per second.
    #[get(type(copy))]
    pub(crate) drift_velocity: Vec3,
    /// Base non-uniform scale `(sx, sy, sz)` of this cloud cluster.
    #[get(type(copy))]
    pub(crate) base_scale: Vec3,
    /// Horizontal orientation yaw in radians.
    #[get(type(copy))]
    pub(crate) yaw_rad: f32,
    /// Buoyancy oscillation phase offset in radians.
    #[get(type(copy))]
    pub(crate) bob_phase: f32,
}

/// Live articulated state for a soaring, flapping 3D flocking bird driven by `BoidsFlockSolver`.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct FlockingBirdInstance3D {
    /// Corresponding agent index inside `CityEcosystemState3D::bird_flock`.
    #[get(type(copy))]
    pub(crate) boid_index: usize,
    /// Owning dynamic scene object index for the streamlined bird body mesh.
    #[get(type(copy))]
    pub(crate) body_obj_idx: usize,
    /// Owning dynamic scene object index for the articulated left wing mesh.
    #[get(type(copy))]
    pub(crate) left_wing_obj_idx: usize,
    /// Owning dynamic scene object index for the articulated right wing mesh.
    #[get(type(copy))]
    pub(crate) right_wing_obj_idx: usize,
    /// Wingbeat frequency in cycles per second.
    #[get(type(copy))]
    pub(crate) flap_hz: f32,
    /// Wingbeat phase offset in radians.
    #[get(type(copy))]
    pub(crate) flap_phase: f32,
    /// Uniform scale factor differentiating larger seagulls from agile swifts.
    #[get(type(copy))]
    pub(crate) scale: f32,
}

/// Live gentle wind-sway state for a dynamic riverbank reed or ornamental flora accent.
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct WindSwayProp3D {
    /// Owning dynamic scene object index inside `World3D::objects`.
    #[get(type(copy))]
    pub(crate) object_index: usize,
    /// Anchored world-space base position.
    #[get(type(copy))]
    pub(crate) base_position: Vec3,
    /// Anchored Y-axis yaw orientation in radians.
    #[get(type(copy))]
    pub(crate) base_yaw_rad: f32,
    /// Anchored non-uniform scale.
    #[get(type(copy))]
    pub(crate) base_scale: Vec3,
    /// Phase offset in radians staggering breeze waves across the riverbank.
    #[get(type(copy))]
    pub(crate) sway_phase: f32,
    /// Maximum wind tilt amplitude in radians.
    #[get(type(copy))]
    pub(crate) sway_amplitude: f32,
}

/// Aggregated inventory telemetry summarizing populated city ecosystem, street furniture, and perimeter skyline counts.
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct CityEcosystemSummary3D {
    /// Number of dense perimeter and horizon skyline buildings placed.
    #[get(type(copy))]
    pub(crate) perimeter_building_count: usize,
    /// Number of rolling green coastal horizon hills placed.
    #[get(type(copy))]
    pub(crate) coastal_hill_count: usize,
    /// Number of live cycling traffic light assemblies placed.
    #[get(type(copy))]
    pub(crate) traffic_light_count: usize,
    /// Number of overhead highway directional gantries placed.
    #[get(type(copy))]
    pub(crate) directional_gantry_count: usize,
    /// Number of roadside traffic and wayfinding signs placed.
    #[get(type(copy))]
    pub(crate) roadside_sign_count: usize,
    /// Number of sidewalk trash cans, benches, bollards, hydrants, bus shelters, and promenade lamps placed.
    #[get(type(copy))]
    pub(crate) street_furniture_count: usize,
    /// Number of drifting volumetric 3D cumulus cloud clusters placed.
    #[get(type(copy))]
    pub(crate) cumulus_cloud_count: usize,
    /// Number of articulated `BoidsFlockSolver`-driven flocking birds placed.
    #[get(type(copy))]
    pub(crate) flocking_bird_count: usize,
    /// Number of sculpted river bridge assemblies and embankments placed.
    #[get(type(copy))]
    pub(crate) river_structure_count: usize,
    /// Number of animated shimmering river surface ribbons placed.
    #[get(type(copy))]
    pub(crate) river_water_ribbon_count: usize,
    /// Number of distinct multi-species 3D trees added (Oak, Cypress, Willow, Cherry Blossom, Pine).
    #[get(type(copy))]
    pub(crate) tree_count: usize,
    /// Number of distinct botanical tree species instantiated in the city (including Coastal Palms).
    #[get(type(copy))]
    pub(crate) distinct_tree_species_count: usize,
    /// Number of layered shrubs and manicured boxwood hedges placed.
    #[get(type(copy))]
    pub(crate) shrub_and_hedge_count: usize,
    /// Number of multi-color flowerbeds placed.
    #[get(type(copy))]
    pub(crate) flowerbed_count: usize,
    /// Number of riverside reeds, smooth boulders, and tufted grass clumps placed.
    #[get(type(copy))]
    pub(crate) ground_flora_and_boulder_count: usize,
}

/// Persistent per-world state driving zero-allocation live animation of traffic signals, drifting clouds, `BoidsFlockSolver` birds, river shimmer, and wind sway.
#[derive(Clone, Data, Debug)]
pub struct CityEcosystemState3D {
    /// Whether `populate_city_ecosystem_and_furniture` has already populated this world.
    #[get(type(copy))]
    pub(crate) populated: bool,
    /// Live cycling intersection traffic signal assemblies.
    pub(crate) traffic_signals: Vec<TrafficSignalUnit3D>,
    /// Drifting volumetric 3D cumulus cloud clusters.
    pub(crate) clouds: Vec<CumulusCloudInstance3D>,
    /// Cohesive 3D bird flocking solver accelerated by `SpatialHashGrid3D`.
    pub(crate) bird_flock: BoidsFlockSolver,
    /// Articulated flapping 3D bird scene handles aligned 1:1 with `bird_flock.agents`.
    pub(crate) birds: Vec<FlockingBirdInstance3D>,
    /// Gentle wind-swaying riverbank reeds and foliage accents.
    pub(crate) wind_sway_props: Vec<WindSwayProp3D>,
    /// Dynamic shimmering river surface ribbon object indices.
    pub(crate) river_water_objects: Vec<usize>,
    /// Populated object count summary for deterministic verification and telemetry.
    #[get(type(copy))]
    pub(crate) summary: CityEcosystemSummary3D,
}

/// Registered prototype mesh identifiers reused heavily across city ecosystem and furniture instances.
#[derive(Clone, Copy, Data, Debug, Default)]
pub(crate) struct CityEcoMeshKit3D {
    /// Traffic light pole and mast arm mesh identifier.
    #[get(type(copy))]
    pub(crate) traffic_pole: usize,
    /// Dynamic traffic light emissive lens mesh identifier.
    #[get(type(copy))]
    pub(crate) traffic_lens: usize,
    /// Highway directional gantry vertical support leg mesh identifier.
    #[get(type(copy))]
    pub(crate) gantry_leg: usize,
    /// Highway directional gantry overhead signboard mesh identifier.
    #[get(type(copy))]
    pub(crate) gantry_sign: usize,
    /// Octagonal STOP sign mesh identifier.
    #[get(type(copy))]
    pub(crate) sign_stop: usize,
    /// Yellow diamond crosswalk sign mesh identifier.
    #[get(type(copy))]
    pub(crate) sign_crosswalk: usize,
    /// Rectangular white speed-limit sign mesh identifier.
    #[get(type(copy))]
    pub(crate) sign_speed: usize,
    /// Green avenue and park wayfinding sign mesh identifier.
    #[get(type(copy))]
    pub(crate) sign_wayfinding: usize,
    /// Metallic urban trash and recycling bin mesh identifier.
    #[get(type(copy))]
    pub(crate) trash_bin: usize,
    /// Wooden-slat park bench mesh identifier.
    #[get(type(copy))]
    pub(crate) park_bench: usize,
    /// Steel sidewalk bollard mesh identifier.
    #[get(type(copy))]
    pub(crate) bollard: usize,
    /// Sculpted red fire hydrant mesh identifier.
    #[get(type(copy))]
    pub(crate) fire_hydrant: usize,
    /// Glass-and-steel transit bus shelter mesh identifier.
    #[get(type(copy))]
    pub(crate) bus_shelter: usize,
    /// Dual-arm park and promenade streetlamp mesh identifier.
    #[get(type(copy))]
    pub(crate) promenade_lamp: usize,
    /// Arched river bridge parapet and steel truss rib mesh identifier.
    #[get(type(copy))]
    pub(crate) bridge_parapet: usize,
    /// Elevated arched pedestrian footbridge mesh identifier.
    #[get(type(copy))]
    pub(crate) footbridge: usize,
    /// Stepped mossy stone river embankment block mesh identifier.
    #[get(type(copy))]
    pub(crate) river_embankment: usize,
    /// Shimmering animated river surface accent ribbon mesh identifier.
    #[get(type(copy))]
    pub(crate) river_ribbon: usize,
    /// Mid-rise brick residential block mesh identifier.
    #[get(type(copy))]
    pub(crate) midrise_brick: usize,
    /// Terraced limestone commercial block mesh identifier.
    #[get(type(copy))]
    pub(crate) terrace_stone: usize,
    /// Distant rolling green coastal hill mesh identifier.
    #[get(type(copy))]
    pub(crate) coastal_hill: usize,
    /// Broad-leaf oak canopy tree mesh identifier.
    #[get(type(copy))]
    pub(crate) tree_oak: usize,
    /// Slender dark-emerald Italian cypress tree mesh identifier.
    #[get(type(copy))]
    pub(crate) tree_cypress: usize,
    /// Graceful weeping willow tree mesh identifier.
    #[get(type(copy))]
    pub(crate) tree_willow: usize,
    /// Ornamental pink cherry-blossom tree mesh identifier.
    #[get(type(copy))]
    pub(crate) tree_cherry: usize,
    /// Layered coastal conifer pine tree mesh identifier.
    #[get(type(copy))]
    pub(crate) tree_pine: usize,
    /// Rounded multi-lobe garden shrub mesh identifier.
    #[get(type(copy))]
    pub(crate) shrub: usize,
    /// Manicured boxwood hedge planter mesh identifier.
    #[get(type(copy))]
    pub(crate) boxwood_hedge: usize,
    /// Multi-blossom urban flowerbed mesh identifier.
    #[get(type(copy))]
    pub(crate) flowerbed: usize,
    /// Riverside tufted cattail reed cluster mesh identifier.
    #[get(type(copy))]
    pub(crate) river_reeds: usize,
    /// Smooth mossy granite river boulder mesh identifier.
    #[get(type(copy))]
    pub(crate) river_boulder: usize,
    /// Organic tufted meadow grass clump mesh identifier.
    #[get(type(copy))]
    pub(crate) grass_clump: usize,
    /// Large multi-lobe volumetric cumulus cloud cluster mesh identifier.
    #[get(type(copy))]
    pub(crate) cloud_large: usize,
    /// Compact fair-weather cumulus cloud puff cluster mesh identifier.
    #[get(type(copy))]
    pub(crate) cloud_puff: usize,
    /// Soaring seagull and city bird fuselage body mesh identifier.
    #[get(type(copy))]
    pub(crate) bird_body: usize,
    /// Curved articulated left bird wing mesh identifier.
    #[get(type(copy))]
    pub(crate) bird_wing_left: usize,
    /// Curved articulated right bird wing mesh identifier.
    #[get(type(copy))]
    pub(crate) bird_wing_right: usize,
}

/// Spatial occupancy tracker enforcing mathematically zero static 3D AABB overlaps and clear vehicle corridors during city population.
#[derive(Clone, Data, Debug, Default)]
pub(crate) struct CityOccupancyTracker3D {
    /// Cached world-space AABBs of every static solid object currently placed in the world.
    pub(crate) occupied_boxes: Vec<AxisAlignedBox3D>,
    /// Horizontal ground bounds `(min_x, max_x, min_z, max_z)` kept strictly enforced for all spawned objects.
    #[get(type(copy))]
    pub(crate) ground_bounds: (f32, f32, f32, f32),
}