luminance_front/
lib.rs

1//! [luminance], but with a backend type picked at compile-time.
2//!
3//! This crate re-exports _aliases_ to all [luminance] types, methods, and any kind of symbols
4//! requiring a backend type variable (typically written `B`) by selecting the proper type based on
5//! the platform you target and/or feature flags. Selection is done mainly automatically in the
6//! `Cargo.toml` file, and can customize on a per-target basis which backend you want to select.
7//!
8//! > Important note: the existence of this crate was made a need so that people who don’t care
9//! > about genericity can start using [luminance] without having to worry about backend
10//! > implementations. It’s the case for people writing small binaries, “final” graphics libraries
11//! > and/or 2D/3D/animation engines, etc. If you are writing a [luminance] middleware, please
12//! > stick to the [luminance] crate and its polymorphic types.
13//!
14//! Some symbols are re-exported even though they are not polymorphic in a backend type variable in
15//! [luminance]. That is only for convenience purposes.
16//!
17//! # Documentation
18//!
19//! Because this crate re-exports the content of [luminance], you are strongly advised to go read
20//! the documentation on [luminance]. Documentation will not be duplicated here.
21//!
22//! # How to setup
23//!
24//! For a starter experience, you have nothing specific to do: simply add `luminance-front` as a
25//! direct dependency and you should be good to go:
26//!
27//! ```ignore
28//! [dependencies]
29//! luminance-front = "…"
30//! ```
31//!
32//! This will select a _default_ backend implementation for the target you currently compile for.
33//! See the list of features below for further information.
34//!
35//! To switch target to use, you are advised to either put a `.cargo/config` file in a directory
36//! inside your project, or compile with the `--target` option.
37//!
38//! The default setup will provide a default implementation that should work great on as
39//! many machines as possible for all supported targets. If for some reason you want to pick another
40//! implementation (for instance an older version of WebGL, OpenGL or an experimental, more modern
41//! implementation), you will have to use specific platform features, such as `"gl33"`.
42//!
43//! ```ignore
44//! [dependencies]
45//! luminance-front = { version = "…", no-default-features = true, features = ["gl33", "webgl2"] }
46//! ```
47//!
48//! As you can see, you can specify features for different targets at the same time. Target
49//! features are checked in the `lib.rs`, so it’s possible to define both OpenGL and WebGL
50//! features at the same time. The current target will narrow down which one to use.
51//!
52//! ## List of features
53//!
54//! - _Default_: `["gl33", "webgl2"]`.
55//! - **OpenGL**:
56//!   - `"gl33"`: OpenGL 3.3 implementation.
57//! - **WebGL 2**:
58//!   - `"webgl2"`: WebGL 2 implementation.
59//!
60//! [luminance]: https://crates.io/crates/luminance
61
62pub mod context;
63pub mod framebuffer;
64pub mod pipeline;
65pub mod query;
66pub mod render_gate;
67pub mod shader;
68pub mod shading_gate;
69pub mod tess;
70pub mod tess_gate;
71pub mod texture;
72
73// re-export
74pub use luminance::blending;
75pub use luminance::depth_stencil;
76pub use luminance::face_culling;
77pub use luminance::pixel;
78pub use luminance::render_state;
79pub use luminance::scissor;
80pub use luminance::vertex;
81
82// select the backend type
83
84#[cfg(all(feature = "gl33", not(target_family = "wasm")))]
85pub type Backend = luminance_gl::GL33;
86
87#[cfg(all(feature = "webgl2", target_family = "wasm"))]
88pub type Backend = luminance_webgl::webgl2::WebGL2;