From 8b8adcc1b89f35286105ac01c800e8d741c7fd5e Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Tue, 22 Jun 2021 14:04:58 +0100 Subject: [PATCH] More block particles, changes ore vein colour --- assets/world/style/colors.ron | 2 +- common/net/src/msg/compression.rs | 5 +++ common/src/terrain/block.rs | 66 ++++++++++++++-------------- voxygen/src/mesh/terrain.rs | 15 ++++--- voxygen/src/scene/terrain/watcher.rs | 7 ++- world/src/layer/mod.rs | 4 +- 6 files changed, 56 insertions(+), 43 deletions(-) diff --git a/assets/world/style/colors.ron b/assets/world/style/colors.ron index 78e282b410..805098f127 100644 --- a/assets/world/style/colors.ron +++ b/assets/world/style/colors.ron @@ -65,7 +65,7 @@ dirt: (69, 48, 15), scaffold: (195, 190, 212), lava: (184, 39, 0), - vein: (222, 140, 39), + vein: (61, 229, 198), ), site: ( castle: (), diff --git a/common/net/src/msg/compression.rs b/common/net/src/msg/compression.rs index e14fec9986..f488982f60 100644 --- a/common/net/src/msg/compression.rs +++ b/common/net/src/msg/compression.rs @@ -604,6 +604,11 @@ impl VoxelImageDecoding for TriPngEncoding Rgb { + r: 61, + g: 229, + b: 198, + }, Grass => Rgb { r: 51, g: 160, diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index f05974e088..6d7b793899 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -36,7 +36,7 @@ make_case_elim!( // being *very* fast). Rock = 0x10, WeakRock = 0x11, // Explodable - Lava = 0x12, + Lava = 0x12, // TODO: Reevaluate whether this should be in the rock section GlowingRock = 0x13, // 0x12 <= x < 0x20 is reserved for future rocks Grass = 0x20, // Note: *not* the same as grass sprites @@ -166,38 +166,40 @@ impl Block { #[inline] pub fn get_glow(&self) -> Option { - if matches!(self.kind, BlockKind::Lava | BlockKind::GlowingRock) { - return Some(24); - } - match self.get_sprite()? { - SpriteKind::StreetLamp | SpriteKind::StreetLampTall => Some(24), - SpriteKind::Ember => Some(20), - SpriteKind::WallLamp - | SpriteKind::WallLampSmall - | SpriteKind::WallSconce - | SpriteKind::FireBowlGround - | SpriteKind::Orb => Some(16), - SpriteKind::Velorite | SpriteKind::VeloriteFrag | SpriteKind::CeilingMushroom => { - Some(6) + match self.kind() { + BlockKind::Lava => Some(24), + BlockKind::GlowingRock => Some(12), + _ => match self.get_sprite()? { + SpriteKind::StreetLamp | SpriteKind::StreetLampTall => Some(24), + SpriteKind::Ember => Some(20), + SpriteKind::WallLamp + | SpriteKind::WallLampSmall + | SpriteKind::WallSconce + | SpriteKind::FireBowlGround + | SpriteKind::Orb => Some(16), + SpriteKind::Velorite + | SpriteKind::VeloriteFrag + | SpriteKind::Cauldron + | SpriteKind::CeilingMushroom => Some(6), + SpriteKind::CaveMushroom + | SpriteKind::CookingPot + | SpriteKind::CrystalHigh + | SpriteKind::CrystalLow => Some(10), + SpriteKind::Amethyst + | SpriteKind::Ruby + | SpriteKind::Sapphire + | SpriteKind::Diamond + | SpriteKind::Emerald + | SpriteKind::Topaz + | SpriteKind::AmethystSmall + | SpriteKind::TopazSmall + | SpriteKind::DiamondSmall + | SpriteKind::RubySmall + | SpriteKind::EmeraldSmall + | SpriteKind::SapphireSmall => Some(3), + SpriteKind::Lantern => Some(24), + _ => None, }, - SpriteKind::CaveMushroom - | SpriteKind::CookingPot - | SpriteKind::CrystalHigh - | SpriteKind::CrystalLow => Some(10), - SpriteKind::Amethyst - | SpriteKind::Ruby - | SpriteKind::Sapphire - | SpriteKind::Diamond - | SpriteKind::Emerald - | SpriteKind::Topaz - | SpriteKind::AmethystSmall - | SpriteKind::TopazSmall - | SpriteKind::DiamondSmall - | SpriteKind::RubySmall - | SpriteKind::EmeraldSmall - | SpriteKind::SapphireSmall => Some(3), - SpriteKind::Lantern => Some(24), - _ => None, } } diff --git a/voxygen/src/mesh/terrain.rs b/voxygen/src/mesh/terrain.rs index faff76a791..90fc6c0db8 100644 --- a/voxygen/src/mesh/terrain.rs +++ b/voxygen/src/mesh/terrain.rs @@ -1,4 +1,4 @@ -#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch +#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch use crate::{ mesh::{ @@ -461,11 +461,12 @@ fn should_draw_greedy( ) -> Option<(bool, FaceKind)> { let from = flat_get(pos - delta); let to = flat_get(pos); - let from_opaque = from.is_opaque(); - if from_opaque == to.is_opaque() { + // Don't use `is_opaque`, because it actually refers to light transmission + let from_filled = from.is_filled(); + if from_filled == to.is_filled() { // Check the interface of liquid and non-tangible non-liquid (e.g. air). let from_liquid = from.is_liquid(); - if from_liquid == to.is_liquid() || from.is_opaque() || to.is_opaque() { + if from_liquid == to.is_liquid() || from.is_filled() || to.is_filled() { None } else { // While liquid is not culled, we still try to keep a consistent orientation as @@ -474,11 +475,11 @@ fn should_draw_greedy( Some((from_liquid, FaceKind::Fluid)) } } else { - // If going from transparent to opaque, backward facing; otherwise, forward + // If going from unfilled to filled, backward facing; otherwise, forward // facing. Also, if either from or to is fluid, set the meta accordingly. Some(( - from_opaque, - FaceKind::Opaque(if from_opaque { + from_filled, + FaceKind::Opaque(if from_filled { to.is_liquid() } else { from.is_liquid() diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 5544ca9c03..f28236cc71 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -89,6 +89,9 @@ impl BlocksOfInterest { { river.push(pos) }, + BlockKind::Lava if thread_rng().gen_range(0..5) == 0 => { + fires.push(pos + Vec3::unit_z()) + }, BlockKind::Snow if thread_rng().gen_range(0..16) == 0 => snow.push(pos), _ => match block.get_sprite() { Some(SpriteKind::Ember) => { @@ -100,7 +103,7 @@ impl BlocksOfInterest { Some(SpriteKind::StreetLamp) => fire_bowls.push(pos + Vec3::unit_z() * 2), Some(SpriteKind::FireBowlGround) => fire_bowls.push(pos + Vec3::unit_z()), Some(SpriteKind::StreetLampTall) => { - fire_bowls.push(pos + Vec3::unit_z() * 4) + fire_bowls.push(pos + Vec3::unit_z() * 3); }, Some(SpriteKind::WallSconce) => fire_bowls.push(pos + Vec3::unit_z()), Some(SpriteKind::Beehive) => beehives.push(pos), @@ -134,12 +137,14 @@ impl BlocksOfInterest { interactables.push((pos, Interaction::Craft(CraftingTab::All))) }, Some(SpriteKind::Cauldron) => { + fires.push(pos); interactables.push((pos, Interaction::Craft(CraftingTab::Potion))) }, Some(SpriteKind::Anvil) => { interactables.push((pos, Interaction::Craft(CraftingTab::Weapon))) }, Some(SpriteKind::CookingPot) => { + fires.push(pos); interactables.push((pos, Interaction::Craft(CraftingTab::Food))) }, _ => {}, diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index f7c687b94e..fc85e49c1d 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -253,7 +253,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) { canvas.set( Vec3::new(wpos2d.x, wpos2d.y, z), Block::new( - BlockKind::WeakRock, + BlockKind::GlowingRock, noisy_color(info.index().colors.layer.vein.into(), 16), ), ); @@ -265,7 +265,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) { canvas.set( Vec3::new(wpos2d.x, wpos2d.y, z), Block::new( - BlockKind::WeakRock, + BlockKind::GlowingRock, noisy_color(info.index().colors.layer.vein.into(), 16), ), );