diff --git a/Cargo.toml b/Cargo.toml
index 0f5a64d..3608ec7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "bevy_atmosphere"
description = "A procedural sky plugin for bevy"
-version = "0.8.1"
+version = "0.9.0"
edition = "2021"
authors = ["JonahPlusPlus <33059163+JonahPlusPlus@users.noreply.github.com>"]
license = "MIT OR Apache-2.0"
@@ -11,7 +11,7 @@ repository = "https://github.com/JonahPlusPlus/bevy_atmosphere"
exclude = ["/assets/", "/examples/", "/.github/"]
[dependencies]
-bevy = { version = "0.12", default-features = false, features = [
+bevy = { version = "0.13", default-features = false, features = [
"bevy_asset",
"bevy_render",
"bevy_pbr",
@@ -20,8 +20,8 @@ bevy_atmosphere_macros = { path = "macros", version = "0.4" }
cfg-if = "1.0"
[dev-dependencies]
-bevy_spectator = "0.4"
-bevy = { version = "0.12", features = ["bevy_core_pipeline", "x11"] }
+bevy_spectator = "0.5"
+bevy = { version = "0.13", features = ["bevy_core_pipeline", "x11"] }
[features]
default = ["basic", "all_models"]
diff --git a/README.md b/README.md
index 15ce32e..6273e19 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,7 @@ For more information on the technicalities, you can check out the [technical doc
| bevy | bevy_atmosphere |
|------|-----------------|
+| 0.13 | 0.9 |
| 0.12 | 0.8 |
| 0.11 | 0.7 |
| 0.10 | 0.6 |
diff --git a/examples/cycle.rs b/examples/cycle.rs
index 191e298..ea9cbe4 100644
--- a/examples/cycle.rs
+++ b/examples/cycle.rs
@@ -1,4 +1,4 @@
-use bevy::prelude::*;
+use bevy::{pbr::light_consts::lux::AMBIENT_DAYLIGHT, prelude::*};
use bevy_atmosphere::prelude::*;
use bevy_spectator::{Spectator, SpectatorPlugin};
@@ -43,7 +43,7 @@ fn daylight_cycle(
if let Some((mut light_trans, mut directional)) = query.single_mut().into() {
light_trans.rotation = Quat::from_rotation_x(-t);
- directional.illuminance = t.sin().max(0.0).powf(2.0) * 100000.0;
+ directional.illuminance = t.sin().max(0.0).powf(2.0) * AMBIENT_DAYLIGHT;
}
}
}
@@ -64,14 +64,14 @@ fn setup_environment(
// Simple transform shape just for reference
commands.spawn(PbrBundle {
- mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
+ mesh: meshes.add(Cuboid::default()),
material: materials.add(StandardMaterial::from(Color::rgb(0.8, 0.8, 0.8))),
..Default::default()
});
// X axis
commands.spawn(PbrBundle {
- mesh: meshes.add(Mesh::from(shape::Cube { size: 0.5 })),
+ mesh: meshes.add(Cuboid::new(0.5, 0.5, 0.5)),
material: materials.add(StandardMaterial::from(Color::rgb(0.8, 0.0, 0.0))),
transform: Transform::from_xyz(1., 0., 0.),
..Default::default()
@@ -79,7 +79,7 @@ fn setup_environment(
// Y axis
commands.spawn(PbrBundle {
- mesh: meshes.add(Mesh::from(shape::Cube { size: 0.5 })),
+ mesh: meshes.add(Cuboid::new(0.5, 0.5, 0.5)),
material: materials.add(StandardMaterial::from(Color::rgb(0.0, 0.8, 0.0))),
transform: Transform::from_xyz(0., 1., 0.),
..Default::default()
@@ -87,7 +87,7 @@ fn setup_environment(
// Z axis
commands.spawn(PbrBundle {
- mesh: meshes.add(Mesh::from(shape::Cube { size: 0.5 })),
+ mesh: meshes.add(Cuboid::new(0.5, 0.5, 0.5)),
material: materials.add(StandardMaterial::from(Color::rgb(0.0, 0.0, 0.8))),
transform: Transform::from_xyz(0., 0., 1.),
..Default::default()
diff --git a/examples/detection.rs b/examples/detection.rs
index bf11659..18b858c 100644
--- a/examples/detection.rs
+++ b/examples/detection.rs
@@ -19,7 +19,7 @@ fn setup(mut commands: Commands) {
fn update(
mut commands: Commands,
- mouse: Res>,
+ mouse: Res>,
primary_camera_query: Query>,
) {
let Ok(primary_camera) = primary_camera_query.get_single() else {
diff --git a/examples/gradient.rs b/examples/gradient.rs
index 0246f27..736c897 100644
--- a/examples/gradient.rs
+++ b/examples/gradient.rs
@@ -20,67 +20,67 @@ fn setup(mut commands: Commands) {
));
}
-fn change_gradient(mut commands: Commands, keys: Res>) {
- if keys.just_pressed(KeyCode::Key1) {
+fn change_gradient(mut commands: Commands, keys: Res>) {
+ if keys.just_pressed(KeyCode::Digit1) {
info!("Changed to Atmosphere Preset 1 (Default Gradient)");
commands.insert_resource(AtmosphereModel::new(Gradient::default()));
- } else if keys.just_pressed(KeyCode::Key2) {
+ } else if keys.just_pressed(KeyCode::Digit2) {
info!("Changed to Atmosphere Preset 2 (Cotton Candy)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::rgb(1.0, 0.5, 0.75),
horizon: Color::WHITE,
sky: Color::rgb(0.5, 0.75, 1.0),
}));
- } else if keys.just_pressed(KeyCode::Key3) {
+ } else if keys.just_pressed(KeyCode::Digit3) {
info!("Changed to Atmosphere Preset 3 (80's Sunset)");
commands.insert_resource(AtmosphereModel::new(Gradient {
sky: Color::PURPLE,
horizon: Color::PINK,
ground: Color::ORANGE,
}));
- } else if keys.just_pressed(KeyCode::Key4) {
+ } else if keys.just_pressed(KeyCode::Digit4) {
info!("Changed to Atmosphere Preset 4 (Winter)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::rgb(0.0, 0.1, 0.2),
horizon: Color::rgb(0.3, 0.4, 0.5),
sky: Color::rgb(0.7, 0.8, 0.9),
}));
- } else if keys.just_pressed(KeyCode::Key5) {
+ } else if keys.just_pressed(KeyCode::Digit5) {
info!("Changed to Atmosphere Preset 5 (Nether)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::BLACK,
horizon: Color::rgb(0.2, 0.0, 0.0),
sky: Color::rgb(0.5, 0.1, 0.0),
}));
- } else if keys.just_pressed(KeyCode::Key6) {
+ } else if keys.just_pressed(KeyCode::Digit6) {
info!("Changed to Atmosphere Preset 6 (Golden)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::ORANGE_RED,
horizon: Color::ORANGE,
sky: Color::GOLD,
}));
- } else if keys.just_pressed(KeyCode::Key7) {
+ } else if keys.just_pressed(KeyCode::Digit7) {
info!("Changed to Atmosphere Preset 7 (Noir)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::BLACK,
horizon: Color::BLACK,
sky: Color::WHITE,
}));
- } else if keys.just_pressed(KeyCode::Key8) {
+ } else if keys.just_pressed(KeyCode::Digit8) {
info!("Changed to Atmosphere Preset 8 (Midnight)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::BLACK,
horizon: Color::BLACK,
sky: Color::MIDNIGHT_BLUE,
}));
- } else if keys.just_pressed(KeyCode::Key9) {
+ } else if keys.just_pressed(KeyCode::Digit9) {
info!("Changed to Atmosphere Preset 9 (Greenery)");
commands.insert_resource(AtmosphereModel::new(Gradient {
ground: Color::rgb(0.1, 0.2, 0.0),
horizon: Color::rgb(0.3, 0.4, 0.1),
sky: Color::rgb(0.6, 0.8, 0.2),
}));
- } else if keys.just_pressed(KeyCode::Key0) {
+ } else if keys.just_pressed(KeyCode::Digit0) {
info!("Reset Atmosphere to Default");
commands.remove_resource::();
}
diff --git a/examples/models.rs b/examples/models.rs
index 0deb0e9..6ec35d1 100644
--- a/examples/models.rs
+++ b/examples/models.rs
@@ -20,14 +20,14 @@ fn setup(mut commands: Commands) {
));
}
-fn change_model(mut commands: Commands, keys: Res>) {
- if keys.just_pressed(KeyCode::G) {
+fn change_model(mut commands: Commands, keys: Res>) {
+ if keys.just_pressed(KeyCode::KeyG) {
info!("Changed to Gradient atmosphere model");
commands.insert_resource(AtmosphereModel::new(Gradient::default()));
- } else if keys.just_pressed(KeyCode::N) {
+ } else if keys.just_pressed(KeyCode::KeyN) {
info!("Changed to Nishita atmosphere model");
commands.insert_resource(AtmosphereModel::new(Nishita::default()));
- } else if keys.just_pressed(KeyCode::Key0) {
+ } else if keys.just_pressed(KeyCode::Digit0) {
info!("Reset atmosphere model to default");
commands.remove_resource::();
}
diff --git a/examples/nishita.rs b/examples/nishita.rs
index 08c22bf..eb41bdb 100644
--- a/examples/nishita.rs
+++ b/examples/nishita.rs
@@ -19,46 +19,46 @@ fn setup(mut commands: Commands) {
));
}
-fn change_nishita(mut commands: Commands, keys: Res>) {
- if keys.just_pressed(KeyCode::Key1) {
+fn change_nishita(mut commands: Commands, keys: Res>) {
+ if keys.just_pressed(KeyCode::Digit1) {
info!("Changed to Atmosphere Preset 1 (Sunset)");
commands.insert_resource(AtmosphereModel::new(Nishita {
sun_position: Vec3::new(0., 0., -1.),
..default()
}));
- } else if keys.just_pressed(KeyCode::Key2) {
+ } else if keys.just_pressed(KeyCode::Digit2) {
info!("Changed to Atmosphere Preset 2 (Noir Sunset)");
commands.insert_resource(AtmosphereModel::new(Nishita {
sun_position: Vec3::new(0., 0., -1.),
rayleigh_coefficient: Vec3::new(1e-5, 1e-5, 1e-5),
..default()
}));
- } else if keys.just_pressed(KeyCode::Key3) {
+ } else if keys.just_pressed(KeyCode::Digit3) {
info!("Changed to Atmosphere Preset 3 (Magenta)");
commands.insert_resource(AtmosphereModel::new(Nishita {
rayleigh_coefficient: Vec3::new(2e-5, 1e-5, 2e-5),
..default()
}));
- } else if keys.just_pressed(KeyCode::Key4) {
+ } else if keys.just_pressed(KeyCode::Digit4) {
info!("Changed to Atmosphere Preset 4 (Strong Mie)");
commands.insert_resource(AtmosphereModel::new(Nishita {
mie_coefficient: 5e-5,
..default()
}));
- } else if keys.just_pressed(KeyCode::Key5) {
+ } else if keys.just_pressed(KeyCode::Digit5) {
info!("Changed to Atmosphere Preset 5 (Larger Scale)");
commands.insert_resource(AtmosphereModel::new(Nishita {
rayleigh_scale_height: 16e3,
mie_scale_height: 2.4e3,
..default()
}));
- } else if keys.just_pressed(KeyCode::Key6) {
+ } else if keys.just_pressed(KeyCode::Digit6) {
info!("Changed to Atmosphere Preset 6 (Weak Intensity)");
commands.insert_resource(AtmosphereModel::new(Nishita {
sun_intensity: 11.0,
..default()
}));
- } else if keys.just_pressed(KeyCode::Key7) {
+ } else if keys.just_pressed(KeyCode::Digit7) {
info!("Changed to Atmosphere Preset 7 (Half Radius)");
commands.insert_resource(AtmosphereModel::new(Nishita {
ray_origin: Vec3::new(0., 6372e3 / 2., 0.),
@@ -66,19 +66,19 @@ fn change_nishita(mut commands: Commands, keys: Res>) {
atmosphere_radius: 6471e3 / 2.,
..default()
}));
- } else if keys.just_pressed(KeyCode::Key8) {
+ } else if keys.just_pressed(KeyCode::Digit8) {
info!("Changed to Atmosphere Preset 8 (Sideways World)");
commands.insert_resource(AtmosphereModel::new(Nishita {
ray_origin: Vec3::new(6372e3, 0., 0.),
..default()
}));
- } else if keys.just_pressed(KeyCode::Key9) {
+ } else if keys.just_pressed(KeyCode::Digit9) {
info!("Changed to Atmosphere Preset 9 (Inverted Mie Direction)");
commands.insert_resource(AtmosphereModel::new(Nishita {
mie_direction: -0.758,
..default()
}));
- } else if keys.just_pressed(KeyCode::Key0) {
+ } else if keys.just_pressed(KeyCode::Digit0) {
info!("Reset Atmosphere to Default");
commands.remove_resource::();
}
diff --git a/examples/settings.rs b/examples/settings.rs
index d6e7158..36e049b 100644
--- a/examples/settings.rs
+++ b/examples/settings.rs
@@ -27,7 +27,7 @@ fn setup(mut commands: Commands) {
fn change_resolution(
mut commands: Commands,
settings: Option>,
- keys: Res>,
+ keys: Res>,
) {
if keys.just_pressed(KeyCode::Space) {
#[cfg(feature = "bevy/trace")]
@@ -43,25 +43,25 @@ fn change_resolution(
});
}
info!("Toggled dithering");
- } else if keys.just_pressed(KeyCode::Key1) {
+ } else if keys.just_pressed(KeyCode::Digit1) {
change(commands, settings, 8); // 8x8
- } else if keys.just_pressed(KeyCode::Key2) {
+ } else if keys.just_pressed(KeyCode::Digit2) {
change(commands, settings, 16); // 16x16
- } else if keys.just_pressed(KeyCode::Key3) {
+ } else if keys.just_pressed(KeyCode::Digit3) {
change(commands, settings, 32); // 32x32
- } else if keys.just_pressed(KeyCode::Key4) {
+ } else if keys.just_pressed(KeyCode::Digit4) {
change(commands, settings, 64); // 64x64
- } else if keys.just_pressed(KeyCode::Key5) {
+ } else if keys.just_pressed(KeyCode::Digit5) {
change(commands, settings, 128); // 128x128
- } else if keys.just_pressed(KeyCode::Key6) {
+ } else if keys.just_pressed(KeyCode::Digit6) {
change(commands, settings, 256); // 256x256
- } else if keys.just_pressed(KeyCode::Key7) {
+ } else if keys.just_pressed(KeyCode::Digit7) {
change(commands, settings, 512); // 512x512
- } else if keys.just_pressed(KeyCode::Key8) {
+ } else if keys.just_pressed(KeyCode::Digit8) {
change(commands, settings, 1024); // 1024x1024
- } else if keys.just_pressed(KeyCode::Key9) {
+ } else if keys.just_pressed(KeyCode::Digit9) {
change(commands, settings, 2048); // 2048x2048
- } else if keys.just_pressed(KeyCode::Key0) {
+ } else if keys.just_pressed(KeyCode::Digit0) {
commands.remove_resource::(); // Removes settings, goes back to defaults
info!("Removed AtmosphereSettings");
}
diff --git a/examples/splitscreen.rs b/examples/splitscreen.rs
index aba5e03..19065e7 100644
--- a/examples/splitscreen.rs
+++ b/examples/splitscreen.rs
@@ -2,7 +2,6 @@
//! Used to demonstrate how multiple skyboxes could be made for a local multiplayer game
use bevy::{
- core_pipeline::clear_color::ClearColorConfig,
prelude::*,
render::{camera::Viewport, view::RenderLayers},
window::WindowResized,
@@ -38,8 +37,8 @@ fn setup(
) {
// Plane
commands.spawn(PbrBundle {
- mesh: meshes.add(Mesh::from(shape::Plane::from_size(100.0))),
- material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
+ mesh: meshes.add(Plane3d::new(Vec3::Y).mesh().size(100.0, 100.0)),
+ material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
..default()
});
@@ -83,13 +82,11 @@ fn setup(
camera: Camera {
// Renders the right camera after the left camera, which has a default priority of 0
order: 1,
- ..default()
- },
- camera_3d: Camera3d {
// Don't clear on the second camera because the first camera already cleared the window
clear_color: ClearColorConfig::None,
..default()
},
+ camera_3d: Camera3d::default(),
..default()
},
RenderLayers::from_layers(&[0, 2]),
@@ -136,14 +133,14 @@ fn set_camera_viewports(
fn switch_camera(
mut settings: ResMut,
- keys: Res>,
+ keys: Res>,
left_camera: Query, Without)>,
right_camera: Query>,
) {
let left_camera = left_camera.single();
let right_camera = right_camera.single();
- if keys.just_pressed(KeyCode::E) {
+ if keys.just_pressed(KeyCode::KeyE) {
if let Some(spectator) = settings.active_spectator {
if spectator == left_camera {
settings.active_spectator = Some(right_camera);
diff --git a/macros/Cargo.toml b/macros/Cargo.toml
index e75e455..1052de2 100644
--- a/macros/Cargo.toml
+++ b/macros/Cargo.toml
@@ -14,8 +14,8 @@ exclude = ["/assets/", "/examples/", "/.github/"]
proc-macro = true
[dependencies]
-proc-macro-crate = "2.0"
-bevy_macro_utils = "0.12"
+proc-macro-crate = "3.1"
+bevy_macro_utils = "0.13"
syn = "2.0"
proc-macro2 = "1.0"
diff --git a/macros/src/model.rs b/macros/src/model.rs
index 2f6a46f..737080d 100644
--- a/macros/src/model.rs
+++ b/macros/src/model.rs
@@ -30,7 +30,7 @@ enum BindingState<'a> {
ident: &'a Ident,
},
OccupiedConvertedUniform,
- OccupiedMergableUniform {
+ OccupiedMergeableUniform {
uniform_fields: Vec<&'a syn::Field>,
},
}
@@ -142,7 +142,6 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
},
ShaderPathType::Internal(s) => quote! {
{
- use bevy::reflect::TypeUuid;
let handle: #asset_path::Handle = #asset_path::Handle::weak_from_u128(#id as u128);
let internal_handle = handle.clone();
@@ -199,7 +198,7 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
match &mut binding_states[binding_index as usize] {
value @ BindingState::Free => {
*value = match binding_type {
- BindingType::Uniform => BindingState::OccupiedMergableUniform {
+ BindingType::Uniform => BindingState::OccupiedMergeableUniform {
uniform_fields: vec![field],
},
_ => {
@@ -234,7 +233,7 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
format!("The '{field_name}' field cannot be assigned to binding {binding_index} because it is already occupied by a struct-level uniform binding at the same index.")
));
}
- BindingState::OccupiedMergableUniform { uniform_fields } => match binding_type {
+ BindingState::OccupiedMergeableUniform { uniform_fields } => match binding_type {
BindingType::Uniform => {
uniform_fields.push(field);
}
@@ -259,7 +258,7 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
} = get_texture_attrs(nested_meta_items)?;
let visibility =
- visibility.hygenic_quote("e! { #render_path::render_resource });
+ visibility.hygienic_quote("e! { #render_path::render_resource });
binding_impls.push(quote! {
#render_path::render_resource::OwnedBindingResource::TextureView({
@@ -292,7 +291,7 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
} = get_sampler_attrs(nested_meta_items)?;
let visibility =
- visibility.hygenic_quote("e! { #render_path::render_resource });
+ visibility.hygienic_quote("e! { #render_path::render_resource });
binding_impls.push(quote! {
#render_path::render_resource::OwnedBindingResource::Sampler({
@@ -323,7 +322,7 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
let mut field_struct_impls = Vec::new();
for (binding_index, binding_state) in binding_states.iter().enumerate() {
let binding_index = binding_index as u32;
- if let BindingState::OccupiedMergableUniform { uniform_fields } = binding_state {
+ if let BindingState::OccupiedMergeableUniform { uniform_fields } = binding_state {
let binding_vec_index = bind_group_entries.len();
bind_group_entries.push(quote! {
#render_path::render_resource::BindGroupEntry {
@@ -488,10 +487,10 @@ pub fn derive_atmospheric(ast: syn::DeriveInput) -> Result {
}
fn bind_group_layout(render_device: render_path::renderer::RenderDevice) -> #render_path::render_resource::BindGroupLayout {
- render_device.create_bind_group_layout(render_path::render_resource::BindGroupLayoutDescriptor {
- entries: &[#(#binding_layouts,)*],
- label: None,
- })
+ render_device.create_bind_group_layout(
+ "atmospheric_bind_group_layout",
+ &[#(#binding_layouts,)*],
+ )
}
}
}))
@@ -630,7 +629,7 @@ impl VisibilityFlags {
}
impl ShaderStageVisibility {
- fn hygenic_quote(&self, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
+ fn hygienic_quote(&self, path: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
match self {
ShaderStageVisibility::All => quote! { #path::ShaderStages::all() },
ShaderStageVisibility::None => quote! { #path::ShaderStages::NONE },
diff --git a/src/pipeline.rs b/src/pipeline.rs
index 10bbd29..8a41692 100644
--- a/src/pipeline.rs
+++ b/src/pipeline.rs
@@ -9,14 +9,14 @@ use bevy::{
prelude::*,
render::{
extract_resource::{ExtractResource, ExtractResourcePlugin},
- render_asset::RenderAssets,
- render_graph::{self, RenderGraph},
+ graph::CameraDriverLabel,
+ render_asset::{RenderAssetUsages, RenderAssets},
+ render_graph::{self, RenderGraph, RenderLabel},
render_resource::{
- BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutDescriptor,
- BindGroupLayoutEntry, BindingResource, BindingType, CachedPipelineState,
- ComputePassDescriptor, Extent3d, PipelineCache, ShaderStages, StorageTextureAccess,
- TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
- TextureView, TextureViewDescriptor, TextureViewDimension,
+ BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutEntry, BindingResource,
+ BindingType, CachedPipelineState, ComputePassDescriptor, Extent3d, PipelineCache,
+ ShaderStages, StorageTextureAccess, TextureAspect, TextureDescriptor, TextureDimension,
+ TextureFormat, TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension,
},
renderer::RenderDevice,
texture::FallbackImage,
@@ -30,8 +30,10 @@ use crate::{
skybox::{AtmosphereSkyBoxMaterial, SkyBoxMaterial},
};
-/// Name of the compute pipeline `render_graph::Node`.
-pub const NAME: &str = "bevy_atmosphere";
+/// Label of the compute pipeline `render_graph::Node`.
+#[derive(Debug, Hash, PartialEq, Eq, Clone, RenderLabel)]
+pub struct BevyAtmosphereLabel;
+
/// Size of the compute workgroups in the x and y axis.
///
/// Complete workgroup size is (8, 8, 6);
@@ -58,22 +60,20 @@ impl FromWorld for AtmosphereImageBindGroupLayout {
fn from_world(world: &mut World) -> Self {
let render_device = world.resource::();
- Self(
- render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
- label: Some("bevy_atmosphere_image_bind_group_layout"),
- entries: &[BindGroupLayoutEntry {
- // AtmosphereImage
- binding: 0,
- visibility: ShaderStages::COMPUTE,
- ty: BindingType::StorageTexture {
- access: StorageTextureAccess::WriteOnly,
- format: TextureFormat::Rgba16Float,
- view_dimension: TextureViewDimension::D2Array,
- },
- count: None,
- }],
- }),
- )
+ Self(render_device.create_bind_group_layout(
+ "bevy_atmosphere_image_bind_group_layout",
+ &[BindGroupLayoutEntry {
+ // AtmosphereImage
+ binding: 0,
+ visibility: ShaderStages::COMPUTE,
+ ty: BindingType::StorageTexture {
+ access: StorageTextureAccess::WriteOnly,
+ format: TextureFormat::Rgba16Float,
+ view_dimension: TextureViewDimension::D2Array,
+ },
+ count: None,
+ }],
+ ))
}
}
@@ -112,6 +112,7 @@ impl Plugin for AtmospherePipelinePlugin {
TextureDimension::D2,
&[0; 4 * 4],
TextureFormat::Rgba16Float,
+ RenderAssetUsages::default(),
);
image.texture_view_descriptor = Some(ATMOSPHERE_CUBE_TEXTURE_VIEW_DESCRIPTOR);
@@ -150,8 +151,8 @@ impl Plugin for AtmospherePipelinePlugin {
);
let mut render_graph = render_app.world.resource_mut::();
- render_graph.add_node(NAME, AtmosphereNode::default());
- render_graph.add_node_edge(NAME, bevy::render::main_graph::node::CAMERA_DRIVER);
+ render_graph.add_node(BevyAtmosphereLabel, AtmosphereNode::default());
+ render_graph.add_node_edge(BevyAtmosphereLabel, CameraDriverLabel);
}
}
@@ -500,6 +501,7 @@ impl render_graph::Node for AtmosphereNode {
let mut pass = render_context.command_encoder().begin_compute_pass(
&ComputePassDescriptor {
label: Some("atmosphere_pass"),
+ timestamp_writes: None,
},
);
diff --git a/src/shaders/skybox.wgsl b/src/shaders/skybox.wgsl
index 28c689a..46d4ded 100644
--- a/src/shaders/skybox.wgsl
+++ b/src/shaders/skybox.wgsl
@@ -12,9 +12,9 @@ fn dither(frag_coord: vec2) -> vec3 {
#import bevy_pbr::forward_io::VertexOutput
-@group(1) @binding(0)
+@group(2) @binding(0)
var sky_texture: texture_cube;
-@group(1) @binding(1)
+@group(2) @binding(1)
var sky_sampler: sampler;
@fragment
diff --git a/src/skybox.rs b/src/skybox.rs
index bd7e503..ce67dee 100644
--- a/src/skybox.rs
+++ b/src/skybox.rs
@@ -3,7 +3,7 @@
use bevy::{
pbr::{MaterialPipeline, MaterialPipelineKey},
prelude::*,
- reflect::{TypePath, TypeUuid},
+ reflect::TypePath,
render::{
mesh::{Indices, Mesh, MeshVertexBufferLayout, PrimitiveTopology},
render_resource::{AsBindGroup, RenderPipelineDescriptor, ShaderDefVal, ShaderRef},
@@ -19,8 +19,7 @@ pub const ATMOSPHERE_SKYBOX_SHADER_HANDLE: Handle =
Handle::weak_from_u128(4511926918914205353);
/// The `Material` that renders skyboxes.
-#[derive(AsBindGroup, TypeUuid, TypePath, Debug, Clone, Asset)]
-#[uuid = "b460ff90-0ee4-42df-875f-0a62ecd1301c"]
+#[derive(AsBindGroup, TypePath, Debug, Clone, Asset)]
#[bind_group_data(SkyBoxMaterialKey)]
pub struct SkyBoxMaterial {
/// [Handle] to the [AtmosphereImage](crate::pipeline::AtmosphereImage)
@@ -102,9 +101,8 @@ pub fn mesh(far: f32) -> Mesh {
let positions: Vec<_> = vertices.iter().map(|(p, _)| *p).collect();
let normals: Vec<_> = vertices.iter().map(|(_, n)| *n).collect();
- let mut mesh = Mesh::new(PrimitiveTopology::TriangleList);
- mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, positions);
- mesh.insert_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
- mesh.set_indices(Some(Indices::U16(indices.to_vec())));
- mesh
+ Mesh::new(PrimitiveTopology::TriangleList, Default::default())
+ .with_inserted_attribute(Mesh::ATTRIBUTE_POSITION, positions)
+ .with_inserted_attribute(Mesh::ATTRIBUTE_NORMAL, normals)
+ .with_inserted_indices(Indices::U16(indices.to_vec()))
}