Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_solari/src/lib.rs
6595 views
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
//! ![`bevy_solari` logo](https://raw.githubusercontent.com/bevyengine/bevy/refs/heads/main/assets/branding/bevy_solari.svg)
8
9
extern crate alloc;
10
11
pub mod pathtracer;
12
pub mod realtime;
13
pub mod scene;
14
15
/// The solari prelude.
16
///
17
/// This includes the most common types in this crate, re-exported for your convenience.
18
pub mod prelude {
19
pub use super::SolariPlugins;
20
pub use crate::realtime::SolariLighting;
21
pub use crate::scene::RaytracingMesh3d;
22
}
23
24
use crate::realtime::SolariLightingPlugin;
25
use crate::scene::RaytracingScenePlugin;
26
use bevy_app::{PluginGroup, PluginGroupBuilder};
27
use 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.
39
pub struct SolariPlugins;
40
41
impl PluginGroup for SolariPlugins {
42
fn build(self) -> PluginGroupBuilder {
43
PluginGroupBuilder::start::<Self>()
44
.add(RaytracingScenePlugin)
45
.add(SolariLightingPlugin)
46
}
47
}
48
49
impl SolariPlugins {
50
/// [`WgpuFeatures`] required for these plugins to function.
51
pub fn required_wgpu_features() -> WgpuFeatures {
52
WgpuFeatures::EXPERIMENTAL_RAY_TRACING_ACCELERATION_STRUCTURE
53
| WgpuFeatures::EXPERIMENTAL_RAY_QUERY
54
| WgpuFeatures::BUFFER_BINDING_ARRAY
55
| WgpuFeatures::TEXTURE_BINDING_ARRAY
56
| WgpuFeatures::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
57
| WgpuFeatures::PARTIALLY_BOUND_BINDING_ARRAY
58
}
59
}
60
61