honeycomb_render/capture/
ecs_data.rsuse bevy::prelude::*;
use bevy::utils::HashMap;
use honeycomb_core::prelude::{DartIdType, EdgeIdType, FaceIdType, VertexIdType, VolumeIdType};
#[derive(Resource)]
pub struct MapVertices(pub Vec<Vec3>);
#[derive(Resource)]
pub struct FaceNormals(pub HashMap<FaceIdType, Vec<Vec3>>);
#[derive(Bundle, Clone)]
pub struct DartHeadBundle {
pub(crate) capture_id: CaptureId,
id: DartId,
vertex_id: VertexId,
edge_id: EdgeId,
pub(crate) face_id: FaceId,
pub(crate) dart_head: DartHead,
}
impl DartHeadBundle {
#[must_use = "Object unused after construction"]
pub fn new(
capture_id: usize,
id: DartIdType,
vertex_id: VertexIdType,
edge_id: EdgeIdType,
face_id: FaceIdType,
vertices: (usize, usize),
normals: (usize, usize),
) -> Self {
Self {
capture_id: CaptureId(capture_id),
id: DartId(id),
vertex_id: VertexId(vertex_id),
edge_id: EdgeId(edge_id),
face_id: FaceId(face_id),
dart_head: DartHead { vertices, normals },
}
}
}
#[derive(Bundle, Clone)]
pub struct DartBodyBundle {
pub(crate) capture_id: CaptureId,
id: DartId,
vertex_id: VertexId,
edge_id: EdgeId,
pub(crate) face_id: FaceId,
pub(crate) dart_body: DartBody,
}
impl DartBodyBundle {
#[must_use = "Object unused after construction"]
pub fn new(
capture_id: usize,
id: DartIdType,
vertex_id: VertexIdType,
edge_id: EdgeIdType,
face_id: FaceIdType,
vertices: (usize, usize),
normals: (usize, usize),
) -> Self {
Self {
capture_id: CaptureId(capture_id),
id: DartId(id),
vertex_id: VertexId(vertex_id),
edge_id: EdgeId(edge_id),
face_id: FaceId(face_id),
dart_body: DartBody { vertices, normals },
}
}
}
#[derive(Bundle, Clone)]
pub struct VertexBundle {
pub(crate) capture_id: CaptureId,
id: VertexId,
pub(crate) vertex: Vertex,
}
impl VertexBundle {
#[must_use = "Object unused after construction"]
pub fn new(capture_id: usize, id: VertexIdType, vertex: usize) -> Self {
Self {
capture_id: CaptureId(capture_id),
id: VertexId(id),
vertex: Vertex(vertex),
}
}
}
#[derive(Bundle, Clone)]
pub struct EdgeBundle {
pub(crate) capture_id: CaptureId,
id: EdgeId,
pub(crate) edge: Edge,
}
impl EdgeBundle {
#[must_use = "Object unused after construction"]
pub fn new(capture_id: usize, id: EdgeIdType, vertices: (usize, usize)) -> Self {
Self {
capture_id: CaptureId(capture_id),
id: EdgeId(id),
edge: Edge(vertices.0, vertices.1),
}
}
}
#[derive(Bundle, Clone)]
pub struct FaceBundle {
pub(crate) capture_id: CaptureId,
pub(crate) id: FaceId,
pub(crate) face: Face,
}
impl FaceBundle {
#[must_use = "Object unused after construction"]
pub fn new(capture_id: usize, id: FaceIdType, vertices: Vec<usize>) -> Self {
Self {
capture_id: CaptureId(capture_id),
id: FaceId(id),
face: Face(vertices),
}
}
}
#[derive(Component, Clone, PartialEq, Eq)]
pub struct CaptureId(pub usize);
#[derive(Component, Clone)]
pub struct DartId(pub DartIdType);
#[derive(Component, Clone)]
pub struct VertexId(pub VertexIdType);
#[derive(Component, Clone)]
pub struct EdgeId(pub EdgeIdType);
#[derive(Component, Clone)]
pub struct FaceId(pub FaceIdType);
#[derive(Component, Clone)]
pub struct VolumeId(pub VolumeIdType);
#[derive(Component, Clone)]
pub struct DartHead {
pub(crate) vertices: (usize, usize), pub(crate) normals: (usize, usize), }
#[derive(Component, Clone)]
pub struct DartBody {
pub(crate) vertices: (usize, usize), pub(crate) normals: (usize, usize), }
#[derive(Component, Clone)]
pub struct Beta(pub u8, pub usize, pub usize); #[derive(Component, Clone)]
pub struct Vertex(pub usize); #[derive(Component, Clone)]
pub struct Edge(pub usize, pub usize); #[derive(Component, Clone)]
pub struct Face(pub Vec<usize>); #[derive(Component, Clone)]
pub struct Volume;