From 50905aebfe748f6e0268efcf9229c6a3dd9bf2fd Mon Sep 17 00:00:00 2001 From: Syniis Date: Tue, 27 Feb 2024 18:12:36 +0100 Subject: [PATCH] Mushroom spore particles --- .cargo/config | 2 +- assets/voxygen/shaders/particle-vert.glsl | 13 +++++++++++++ voxygen/src/render/pipelines/particle.rs | 1 + voxygen/src/scene/particle.rs | 8 ++++++++ voxygen/src/scene/terrain/watcher.rs | 6 ++++++ world/src/layer/cave.rs | 18 ++++++++++++------ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.cargo/config b/.cargo/config index 87d684cbbf..e78c87c91f 100644 --- a/.cargo/config +++ b/.cargo/config @@ -25,7 +25,7 @@ tracy-server-debuginfo = "run --bin veloren-server-cli --features tracy,simd --p tracy-server-releasedebuginfo = "run --bin veloren-server-cli --features tracy,simd --profile releasedebuginfo" tracy-test-server = "run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow" # voxygen -test-voxygen = "run --bin veloren-voxygen --no-default-features --features simd,egui-ui,shaderc-from-source" +test-voxygen = "run --bin veloren-voxygen --no-default-features --features simd,egui-ui,shaderc-from-source,hot-reloading" tracy-voxygen = "run --bin veloren-voxygen --no-default-features --features tracy,simd,egui-ui,shaderc-from-source --profile no_overflow" dbg-voxygen = "run --bin veloren-voxygen --profile debuginfo" # misc diff --git a/assets/voxygen/shaders/particle-vert.glsl b/assets/voxygen/shaders/particle-vert.glsl index 1eb5b25819..9cd475eae1 100644 --- a/assets/voxygen/shaders/particle-vert.glsl +++ b/assets/voxygen/shaders/particle-vert.glsl @@ -96,6 +96,7 @@ const int PHOENIX_BEAM = 56; const int PHOENIX_BUILD_UP_AIM = 57; const int CLAY_SHRAPNEL = 58; const int AIRFLOW = 59; +const int SPORE = 60; // meters per second squared (acceleration) const float earth_gravity = 9.807; @@ -1016,6 +1017,18 @@ void main() { spin_in_axis(perp_axis, asin(inst_dir.z / length(inst_dir)) + PI / 2.0) ); break; + case SPORE: + f_reflect = 0.0; + attr = Attr( + linear_motion( + vec3(0), + vec3(0, 0, -1.1) + ) + vec3(sin((lifetime + rand9 * 0.1) * 0.5) * 3.0, sin((lifetime+ rand8 * 0.1) * 0.5) * 3.0, sin(lifetime * 0.5) * 1.5), + vec3(0.4 + 0.4 * abs(sin(lifetime))), + vec4(vec3(0.8, 6.0 + rand6 * 1.75, 7.5 + (1.75 + rand5 * 0.5)), 1), + spin_in_axis(vec3(rand1, rand2, rand3), rand4 * 1.5 + lifetime) + ); + break; default: attr = Attr( linear_motion( diff --git a/voxygen/src/render/pipelines/particle.rs b/voxygen/src/render/pipelines/particle.rs index 9fd14f365f..cecd1fe823 100644 --- a/voxygen/src/render/pipelines/particle.rs +++ b/voxygen/src/render/pipelines/particle.rs @@ -111,6 +111,7 @@ pub enum ParticleMode { PhoenixBuildUpAim = 57, ClayShrapnel = 58, Airflow = 59, + Spore = 60, } impl ParticleMode { diff --git a/voxygen/src/scene/particle.rs b/voxygen/src/scene/particle.rs index 498f9cc1bd..f24f7b76f9 100644 --- a/voxygen/src/scene/particle.rs +++ b/voxygen/src/scene/particle.rs @@ -2186,6 +2186,14 @@ impl ParticleMgr { mode: ParticleMode::PortalFizz, cond: |_| true, }, + BlockParticles { + blocks: |boi| BlockParticleSlice::Positions(&boi.spores), + range: 4, + rate: 0.055, + lifetime: 20.0, + mode: ParticleMode::Spore, + cond: |_| true, + }, ]; let ecs = scene_data.state.ecs(); diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 8a4080274f..1dcd37a369 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -49,6 +49,7 @@ pub struct BlocksOfInterest { pub flowers: Vec>, pub fire_bowls: Vec>, pub snow: Vec>, + pub spores: Vec>, //This is so crickets stay in place and don't randomly change sounds pub cricket1: Vec>, pub cricket2: Vec>, @@ -97,6 +98,7 @@ impl BlocksOfInterest { let mut cricket3 = Vec::new(); let mut frogs = Vec::new(); let mut one_way_walls = Vec::new(); + let mut spores = Vec::new(); let mut rng = ChaCha8Rng::from_seed(thread_rng().gen()); @@ -138,6 +140,7 @@ impl BlocksOfInterest { lavapool.push(pos) } }, + BlockKind::GlowingMushroom if rng.gen_range(0..8) == 0 => spores.push(pos), BlockKind::Snow | BlockKind::Ice if rng.gen_range(0..16) == 0 => snow.push(pos), _ => { if let Some(sprite) = block.get_sprite() { @@ -225,6 +228,8 @@ impl BlocksOfInterest { SpriteKind::Sign | SpriteKind::HangingSign => { interactables.push((pos, Interaction::Read)) }, + SpriteKind::MycelBlue => spores.push(pos), + SpriteKind::Mold => spores.push(pos), _ => {}, } } @@ -268,6 +273,7 @@ impl BlocksOfInterest { flowers, fire_bowls, snow, + spores, cricket1, cricket2, cricket3, diff --git a/world/src/layer/cave.rs b/world/src/layer/cave.rs index 578764bff6..a7ce750ff9 100644 --- a/world/src/layer/cave.rs +++ b/world/src/layer/cave.rs @@ -1216,20 +1216,26 @@ fn write_column( BlockKind::Sand } else if rand.chance(wpos, biome.leafy) { BlockKind::ArtLeaves + } else if ceiling_cover > 0.0 { + BlockKind::Rock } else { BlockKind::WeakRock }, stalactite.map(|e| e as u8), ) } else if z < ceiling && z >= ceiling_drip { - let color = if biome.mushroom > 0.9 { - Rgb::new(10, 70, 148) + if biome.mushroom > 0.9 { + let block = if rand.chance(wpos2d.with_z(89), 0.05) { + BlockKind::GlowingMushroom + } else { + BlockKind::GlowingWeakRock + }; + Block::new(block, Rgb::new(10, 70, 148)) } else if biome.icy > 0.9 { - Rgb::new(120, 140, 255) + Block::new(BlockKind::GlowingWeakRock, Rgb::new(120, 140, 255)) } else { - Rgb::new(80, 100, 150) - }; - Block::new(BlockKind::GlowingRock, color) + Block::new(BlockKind::WeakRock, Rgb::new(80, 100, 150)) + } } else if z >= base && z < floor && !void_below && !sky_above { let (net_col, total) = [ (