1#![warn(clippy::pedantic)]
17#![warn(missing_docs)]
18#![allow(clippy::module_name_repetitions)]
20#![allow(clippy::cast_possible_truncation)]
21#![allow(clippy::cast_sign_loss)]
22#![allow(clippy::cast_precision_loss)]
23#![allow(clippy::similar_names)]
24#![allow(clippy::must_use_candidate)]
25#![allow(clippy::needless_pass_by_value)] mod gui;
30mod import_map;
31mod options;
32mod render_map;
33mod scene;
34
35use bevy::prelude::*;
40use honeycomb_core::cmap::CMap2;
41use honeycomb_core::geometry::CoordsFloat;
42
43pub fn render_2d_map<T: CoordsFloat>(cmap: CMap2<T>) {
45 let mut app = App::new();
46 app.insert_resource(resources::Map(cmap));
47 app.init_gizmo_group::<resources::DartGizmos>()
48 .init_gizmo_group::<resources::VertexGizmos>()
49 .init_gizmo_group::<resources::EdgeGizmos>();
50 app.add_systems(Startup, import_map::extract_data_from_map::<T>);
51 app.insert_resource(Msaa::Sample4)
53 .insert_resource(ClearColor(Color::srgb(0.9, 0.9, 0.9)));
54 app.add_plugins(DefaultPlugins)
56 .add_plugins(plugins::OptionsPlugin)
57 .add_plugins(plugins::GuiPlugin)
58 .add_plugins(plugins::ScenePlugin);
59
60 app.run();
61}
62
63pub mod plugins {
67 pub use crate::gui::GuiPlugin;
68 pub use crate::options::OptionsPlugin;
69 pub use crate::scene::ScenePlugin;
70}
71
72pub mod bundles {
74 pub use crate::import_map::{DartBundle, EdgeBundle, FaceBundle, VertexBundle};
75}
76
77pub mod components {
79 pub use crate::import_map::{
80 Beta, Dart, DartId, Edge, EdgeId, Face, FaceId, Vertex, VertexId, Volume, VolumeId,
81 };
82}
83
84pub mod resources {
86 pub use crate::gui::WindowVisible;
87 pub use crate::import_map::{FaceNormals, Map, MapVertices, VolumeNormals};
88 pub use crate::options::{
89 DartHeadMul, DartRenderColor, DartShrink, DartWidth, EdgeRenderColor, EdgeWidth,
90 FaceRenderColor, FaceShrink, VertexRenderColor, VertexWidth, VolumeRenderColor,
91 VolumeShrink,
92 };
93 pub use crate::render_map::{DartGizmos, EdgeGizmos, FaceGizmos, VertexGizmos};
94}
95
96pub mod systems {
98 pub use crate::gui::{draw_inspected_data, draw_options};
99 pub use crate::import_map::extract_data_from_map;
100 pub use crate::render_map::{
101 render_dart_enabled, render_darts, render_edge_enabled, render_edges, render_face_enabled,
102 render_faces, render_vertex_enabled, render_vertices,
103 };
104}