retrofire_core/lib.rs
1//! ```text
2//! ______
3//! ___ /´ ____/\
4//! __ ______ _____ / /\_ _ ______ _____ __ / /_/___/\ __ _____ ______
5//! ==/ ´ ____/ __ \ ____/ ´ ____/ __ ` __ ___, /==/ ´ ___/ __ \
6//! ==/ /´=/ ______/ /==/ /´=/ /==/ /=/ /=/ /==/ /´=/ ______/\
7//! ==/ /==/ /____/ /__/ /==/ /__/ /=/ /=/ /__/ /==/ /______\/
8//! ==/___/ ==\_______/\______/__/ ==\________,´_/ /==\______/__/ ==\________/\
9//! ==\___\/ ==\______\/\_____\__\/ ==\______/_____,´ /==\_____\___\/==\_______\/
10//! \_____\,´
11//! ```
12//!
13//! Core functionality of the `retrofire` project.
14//!
15//! Includes a math library with vectors, matrices, colors, and angles; basic
16//! geometry primitives; a software 3D renderer with customizable shaders;
17//! with more to come.
18//!
19//! # Crate features
20//!
21//! * `std`:
22//! Makes available items requiring I/O, timekeeping, or any floating-point
23//! functions not included in `core`. In particular this means trigonometric
24//! and transcendental functions.
25//!
26//! If this feature is disabled, the crate only depends on `alloc`.
27//!
28//! * `libm`:
29//! Provides software implementations of floating-point functions via the
30//! [libm](https://crates.io/crates/libm) crate.
31//!
32//! * `micromath`:
33//! Provides fast approximate implementations of floating-point functions
34//! via the [micromath](https://crates.io/crates/micromath) crate.
35//!
36//! All features are disabled by default.
37
38#![no_std]
39
40#[cfg(feature = "std")]
41extern crate std;
42
43// TODO make alloc optional
44extern crate alloc;
45extern crate core;
46
47pub mod geom;
48pub mod math;
49pub mod render;
50pub mod util;
51
52/// Prelude module exporting many frequently used items.
53pub mod prelude {
54 #[cfg(feature = "fp")]
55 pub use crate::math::mat::{rotate_x, rotate_y, rotate_z};
56 pub use crate::math::{
57 angle::{degs, rads, turns, Angle},
58 color::{hsl, hsla, rgb, rgba, Color3, Color3f, Color4, Color4f},
59 mat::{
60 perspective, scale, translate, viewport, Mat3x3, Mat4x4, Matrix,
61 },
62 rand::Distrib,
63 space::{Affine, Linear},
64 vary::{lerp, Vary},
65 vec::{splat, vec2, vec3, Vec2, Vec2i, Vec2u, Vec3, Vec3i, Vector},
66 };
67
68 pub use crate::geom::{vertex, Mesh, Normal2, Normal3, Tri, Vertex};
69
70 pub use crate::render::{raster::Frag, shader::Shader};
71
72 pub use crate::util::buf::{
73 AsMutSlice2, AsSlice2, Buf2, MutSlice2, Slice2,
74 };
75}