bevy_solari/lib.rs
1#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
2
3//! Provides raytraced lighting.
4//!
5//! See [`SolariPlugins`] for more info.
6//!
7//! 
8
9extern crate alloc;
10
11pub mod pathtracer;
12pub mod realtime;
13pub mod scene;
14
15/// The solari prelude.
16///
17/// This includes the most common types in this crate, re-exported for your convenience.
18pub mod prelude {
19 pub use super::SolariPlugins;
20 pub use crate::realtime::SolariLighting;
21 pub use crate::scene::RaytracingMesh3d;
22}
23
24use crate::realtime::SolariLightingPlugin;
25use crate::scene::RaytracingScenePlugin;
26use bevy_app::{PluginGroup, PluginGroupBuilder};
27use bevy_render::settings::WgpuFeatures;
28
29/// An experimental set of plugins for raytraced lighting.
30///
31/// This plugin group provides:
32/// * [`SolariLightingPlugin`] - Raytraced direct and indirect lighting.
33/// * [`RaytracingScenePlugin`] - BLAS building, resource and lighting binding.
34///
35/// There's also:
36/// * [`pathtracer::PathtracingPlugin`] - A non-realtime pathtracer for validation purposes (not added by default).
37///
38/// To get started, add this plugin to your app, and then add `RaytracingMesh3d` and `MeshMaterial3d::<StandardMaterial>` to your entities.
39pub struct SolariPlugins;
40
41impl PluginGroup for SolariPlugins {
42 fn build(self) -> PluginGroupBuilder {
43 PluginGroupBuilder::start::<Self>()
44 .add(RaytracingScenePlugin)
45 .add(SolariLightingPlugin)
46 }
47}
48
49impl SolariPlugins {
50 /// [`WgpuFeatures`] required for these plugins to function.
51 pub fn required_wgpu_features() -> WgpuFeatures {
52 WgpuFeatures::EXPERIMENTAL_RAY_QUERY
53 | WgpuFeatures::BUFFER_BINDING_ARRAY
54 | WgpuFeatures::TEXTURE_BINDING_ARRAY
55 | WgpuFeatures::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
56 | WgpuFeatures::PARTIALLY_BOUND_BINDING_ARRAY
57 }
58}