1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! A procedural sky plugin for the [Bevy game engine](https://bevyengine.org/).
//!
//! Provides a framework for creating and using atmospheric models.
//!
//! ## "basic" Example
//! ```no_run
//! # use bevy::utils::default;
//! use bevy::prelude::*;
//! use bevy_atmosphere::prelude::*;
//!
//! fn main() {
//! App::new()
//! .add_plugins((DefaultPlugins, AtmospherePlugin))
//! .add_systems(Startup, setup)
//! .run();
//! }
//!
//! fn setup(mut commands: Commands) {
//! commands.spawn((Camera3dBundle::default(), AtmosphereCamera::default()));
//! }
//! ```
//!
//! How the sky is rendered is described by an [`Atmospheric`](crate::model::Atmospheric) model.
//! bevy_atmosphere provides a [collection of models to use](crate::collection), but you can [create your own as well](crate::model).
//!
//! To read and modify the atmospheric model, use the [`Atmosphere<T>`](crate::system_param::Atmosphere) and
//! [`AtmosphereMut<T>`](crate::system_param::AtmosphereMut) system params or
//! the [`AtmosphereModel`](struct@crate::model::AtmosphereModel) resource.
//! ```no_run
//! # use bevy::utils::default;
//! # use bevy::math::Vec3;
//! # use bevy::prelude::*;
//! # use bevy_atmosphere::prelude::*;
//! fn read_nishita(atmosphere: Atmosphere<Nishita>) {
//! let sun_position = atmosphere.sun_position;
//! println!("Sun is at {sun_position}");
//! }
//!
//! fn write_gradient(mut atmosphere: AtmosphereMut<Gradient>) {
//! atmosphere.horizon = LinearRgba::RED;
//! }
//!
//! fn check_model(atmosphere: Res<AtmosphereModel>) {
//! if let Some(nishita) = atmosphere.to_ref::<Nishita>() {
//! println!("Sun is at {}", nishita.sun_position);
//! } else {
//! println!("Model isn't Nishita");
//! }
//! }
//! # ;
//! ```
//!
//! Use the [`AtmosphereSettings`](crate::settings::AtmosphereSettings) resource to change how the sky is rendered.
//! ```no_run
//! # use bevy_atmosphere::settings::AtmosphereSettings;
//! # let _ =
//! AtmosphereSettings {
//! // changes the resolution (should be a multiple of 8)
//! resolution: 1024,
//! // turns off dithering
//! dithering: false,
//! }
//! # ;
//! ```
//!
//! To see more examples, view the ["examples"](https://github.com/JonahPlusPlus/bevy_atmosphere/tree/master/examples) directory.