improved water shader

This commit is contained in:
2024-09-08 01:42:13 -04:00
parent d58570f646
commit 0c81742f11
6 changed files with 141 additions and 11 deletions

View File

@@ -7,7 +7,7 @@ build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.14.0"
bevy = { version = "0.14.0", features = ["file_watcher"] }
bevy-inspector-egui = "0.25.0"
iyes_perf_ui = "0.3.0"
noise = "0.8.2"

View File

@@ -105,14 +105,15 @@ fn setup_materials(
) {
let water_material = water_materials.add(ExtendedMaterial {
base: StandardMaterial {
base_color: Color::srgba(0., 0.5, 1., 0.8),
base_color: Color::srgb(0., 0.878, 1.),
alpha_mode: AlphaMode::Blend,
..Default::default()
},
extension: WaterMaterial {
settings: WaterSettings {
offset: 0.5,
scale: 100.,
offset: -4.97,
scale: 1.,
deep_color: LinearRgba::rgb(0.0, 0.04, 0.085).into(),
..Default::default()
},
..default()

View File

@@ -15,7 +15,8 @@ pub struct WaterMaterial {
pub struct WaterSettings {
pub offset: f32,
pub scale: f32,
pub deep_color: Vec3,
pub f_power: f32,
pub deep_color: LinearRgba,
}
impl Default for WaterSettings {
@@ -23,7 +24,8 @@ impl Default for WaterSettings {
Self {
offset: 0.0,
scale: 1.0,
deep_color: Vec3::ZERO,
f_power: 2.0,
deep_color: default(),
}
}
}

View File

@@ -69,8 +69,8 @@ fn asset_reloaded(
let mut rebuild = false;
for event in asset_events.read() {
match event {
AssetEvent::Modified { id } => rebuild = true,
_ => todo!(),
AssetEvent::Modified {..}=> rebuild = true,
_ => (),
}
}
if rebuild {