deuxfleurs/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![doc = include_str!("../README.md")]
3//! # Controls
4//! Currently touch constrols are only barely working.
5//!
6//! * Left click: rotate shape
7//! * Right click: pan shape
8//! * Mouse wheel: zoom/dezoom
9//! * `Ctrl`+`+`: zoom UI
10//! * `Ctrl`+`-`: dezoom UI
11//! * `Ctrl`+`C`: save current camera state to clipboard
12//! * `Ctrl`+`V`: load camera state from clipboard
13
14/// Data associated to a shape which have their own renderer.
15/// Wether they are shown or not does not affect other data.
16pub mod attachment;
17mod camera;
18/// Data rendered directly onto the associated shape. Only
19/// one can be displayed at a time on the corresponding
20/// shape.
21pub mod data;
22mod obj_load;
23/// Picked element types
24pub mod picker;
25/// Point clouds structs and associated data/settings
26pub mod point_cloud;
27mod post_process;
28mod resources;
29mod sbv;
30mod screenshot;
31/// Segment lists structs and associated data/settings
32pub mod segment;
33mod settings;
34mod shader;
35mod shape;
36/// Triangular surfaces structs and associated data/settings
37pub mod surface;
38mod texture;
39/// General types for genericity in functions parameters.
40pub mod types;
41///  Custom Ui components for mesh loading
42pub mod ui;
43mod util;
44mod window;
45use crate::segment::DisplaySegment;
46use crate::surface::geometry::DisplaySurface;
47use crate::{camera::Camera, point_cloud::DisplayPointCloud};
48pub use egui;
49use indexmap::IndexMap;
50pub use resources::{load_mesh, load_mesh_blocking};
51pub use settings::Settings;
52pub use wgpu::Color;
53pub use window::{InitialState, RunningState};
54use window::{InnerBareState, State};
55
56/// Re exported types for visibility
57pub mod internal {
58    pub use crate::shape::{Shape, ShapeMut};
59    pub use crate::window::State;
60}
61
62/// First initialization of the app. The resulting [`InitialState`]
63/// can then be used to register geometries and data. It then has
64/// to be ran to be displayed.
65///
66/// Settings can also be parameterized by modifying [`get_settings_mut`]
67#[must_use]
68pub fn init() -> InitialState<impl FnMut(&mut egui::Ui, &mut RunningState)> {
69    State::new_inner(InnerBareState {
70        surfaces: IndexMap::new(),
71        clouds: IndexMap::new(),
72        segments: IndexMap::new(),
73        settings: Settings::default(),
74        callback: |_, _| {},
75        camera: Camera::new(1.),
76    })
77}