use bevy::prelude::*; use serde::{Serialize,Deserialize}; #[derive(Serialize,Deserialize)] pub struct Frame { pub tracks: std::collections::HashMap } #[derive(Serialize, Deserialize, Component, Debug)] pub struct Detection{ track_id: u64, l: f32, t: f32, w: f32, h: f32, conf: f32, state: u8, frame_nr: u64, det_class: u8, } impl Detection { fn to_point(&self) -> Vec2 { let x = self.l + self.w/2.; let y = self.t + self.h; Vec2::new(x, y) } } #[derive(Serialize, Deserialize, Component, Debug)] pub struct Track { pub track_id: u64, // nr: u32, pub history: Vec, // projected foot coordintes //Vec, // history pub predictor_history: Option>, // history pub predictions: Option>>, } // check: https://www.reddit.com/r/bevy/comments/y1km8n/how_to_link_components_in_bevy_or_am_i_too_oop/ #[derive(Serialize, Deserialize, Component)] pub struct PredictedTrajectory{ person: Entity, points: Vec, } // #[derive(Bundle)] // pub struct TrackBundle { // track: Track, // // label: TextBundle, // } // impl From for TrackBundle{ // fn from(track: Track) -> Self { // let name = track.track_id.to_string(); // TrackBundle{ // track: track, // // label: TextBundle{ // // text: Text::from_section(name, TextStyle::default()), // // transform: Transform::from_translation(250. * Vec3::Y), // // ..default() // // } // } // } // } // #[derive(Bundle)] // pub struct TrackBundle { // pub history: TrajectoryBundle, // pub time: Time, // } // #[derive(Bundle)] // pub struct TrajectoryBundle { // pub line: PolylineBundle // // pub trajectory: Trajectory, // } #[derive(Component)] pub struct Trajectory { pub points: Vec, } fn spawn_track() { } fn draw_tracks() { // evyr ææææááá }