Skip to main content

graphics/
lib.rs

1#![allow(mixed_script_confusables)] // Theta in meshes
2#![allow(clippy::too_many_arguments)]
3
4//! A 3D rendering engine for rust programs, with GUI integration
5//!
6//! This library is a framework for building PC applications that have 3D graphics, and a GUI. It uses
7//! the [WGPU toolkit](https://wgpu.rs/) with Vulkan backend, and [EGUI](https://docs.rs/egui/latest/egui/).
8//! It works on Windows, Linux, and Mac.
9//!
10//! This is intended as a general-purpose 3D visualization tool.
11//! Example use cases including wave-function analysis, n-body simulations, and protein structure viewing.
12//! It's also been used to visualize UAS attitude in preflight software. Its goals are to be intuitive and flexible.
13
14#[cfg(feature = "app_utils")]
15pub mod app_utils;
16mod camera;
17mod gauss;
18mod graphics;
19mod gui;
20mod input;
21pub mod lighting;
22mod meshes;
23mod system;
24mod text_overlay;
25mod texture;
26mod types;
27mod window;
28
29pub use camera::Camera;
30pub use gauss::Gaussian;
31pub use graphics::{EntityUpdate, FWD_VEC, RIGHT_VEC, UP_VEC};
32pub use input::{InputsCommanded, adjust_camera_free, arc_rotation};
33pub use lighting::{LightType, Lighting, PointLight};
34pub use system::run;
35pub use text_overlay::TextOverlay;
36pub use types::{
37    ControlScheme, EngineUpdates, Entity, GraphicsSettings, InputSettings, Mesh, Scene,
38    ScrollBehavior, UiLayoutSides, UiLayoutTopBottom, UiSettings, Vertex,
39};
40// Re-export winit DeviceEvents for use in the API; this prevents the calling
41// lib from needing to use winit as a dependency directly.
42// todo: the equiv for mouse events too. And in the future, Gamepad events.
43pub use winit::{
44    self,
45    event::{self, DeviceEvent, ElementState, WindowEvent},
46};
47
48// A helper macro. Not intended for use outside of this crate.
49#[macro_export]
50macro_rules! copy_ne {
51    ($dest:expr, $src:expr, $range:expr) => {{ $dest[$range].copy_from_slice(&$src.to_ne_bytes()) }};
52}