Skip to main content

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;
22/// Picked element types
23pub mod picker;
24/// Point clouds structs and associated data/settings
25pub mod point_cloud;
26mod post_process;
27mod resources;
28mod sbv;
29mod screenshot;
30/// Segment lists structs and associated data/settings
31pub mod segment;
32mod settings;
33mod shader;
34mod shape;
35/// Triangular surfaces structs and associated data/settings
36pub mod surface;
37mod texture;
38/// General types for genericity in functions parameters.
39pub mod types;
40///  Custom Ui components for mesh loading
41pub mod ui;
42mod util;
43mod window;
44use crate::segment::DisplaySegment;
45use crate::surface::geometry::DisplaySurface;
46use crate::{camera::Camera, point_cloud::DisplayPointCloud};
47pub use egui;
48use indexmap::IndexMap;
49pub use resources::{load_mesh, load_mesh_blocking};
50pub use settings::Settings;
51pub use wgpu::Color;
52pub use window::{InitialState, RunningState};
53use window::{InnerBareState, State};
54
55/// Re exported types for visibility
56pub mod internal {
57    pub use crate::shape::{Shape, ShapeMut};
58    pub use crate::window::State;
59}
60
61/// First initialization of the app. The resulting [`InitialState`]
62/// can then be used to register geometries and data. It then has
63/// to be ran to be displayed.
64///
65/// Settings can be obtained and modified using [`State::get_settings_mut`]
66#[must_use]
67pub fn init() -> InitialState {
68    #[cfg(feature = "profiling")]
69    tracy_client::Client::start();
70    State::new_inner(InnerBareState {
71        surfaces: IndexMap::new(),
72        clouds: IndexMap::new(),
73        segments: IndexMap::new(),
74        settings: Settings::default(),
75        camera: Camera::new(1.),
76    })
77}