mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
vary color, strength based on position, color on biome
This commit is contained in:
parent
6ddedecc05
commit
827006e7e0
@ -192,7 +192,7 @@ void main() {
|
||||
vec3(rand2 * 0.02, rand3 * 0.02, 1.0 + rand4 * 0.1)
|
||||
),
|
||||
vec3(linear_scale(0.5)),
|
||||
vec4(vec3(0.8, 0.8, 1) * 0.5, start_end(1.0, 0.0)),
|
||||
vec4(vec3(0.8, 0.8, 1) * 0.5 * (1.0 + rand0), start_end(1.0, 0.0)),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 0.5)
|
||||
);
|
||||
break;
|
||||
@ -203,7 +203,7 @@ void main() {
|
||||
vec3(rand2 * 0.02, rand3 * 0.02, 0.9 + rand4 * 0.1)
|
||||
),
|
||||
vec3(linear_scale(0.5)),
|
||||
vec4(vec3(0, 0, 0), start_end(1.0, 0.0)),
|
||||
vec4(vec3(0.8, 0.8, 1) * 0.5 * rand0, start_end(1.0, 0.0)),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 0.5)
|
||||
);
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::hud::CraftingTab;
|
||||
use common::terrain::{BlockKind, SpriteKind, TerrainChunk};
|
||||
use common::terrain::{BiomeKind, BlockKind, SpriteKind, TerrainChunk};
|
||||
use common_base::span;
|
||||
use rand::prelude::*;
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
@ -54,6 +54,60 @@ pub struct BlocksOfInterest {
|
||||
pub lights: Vec<(Vec3<i32>, u8)>,
|
||||
}
|
||||
|
||||
fn dryness(biome: BiomeKind) -> u8 {
|
||||
match biome {
|
||||
BiomeKind::Void => 0,
|
||||
BiomeKind::Lake => 0,
|
||||
BiomeKind::Ocean => 0,
|
||||
BiomeKind::Swamp => 10,
|
||||
BiomeKind::Jungle => 60,
|
||||
BiomeKind::Snowland => 60,
|
||||
BiomeKind::Desert => 100, // dry but dung
|
||||
BiomeKind::Mountain => 160,
|
||||
BiomeKind::Forest => 180,
|
||||
BiomeKind::Taiga => 180,
|
||||
BiomeKind::Grassland => 200,
|
||||
BiomeKind::Savannah => 240,
|
||||
}
|
||||
}
|
||||
|
||||
fn seed_from_pos(pos: Vec3<i32>) -> [u8; 32] {
|
||||
[
|
||||
pos.x as u8,
|
||||
(pos.x >> 8) as u8,
|
||||
(pos.x >> 16) as u8,
|
||||
(pos.x >> 24) as u8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
pos.y as u8,
|
||||
(pos.y >> 8) as u8,
|
||||
(pos.y >> 16) as u8,
|
||||
(pos.y >> 24) as u8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
pos.z as u8,
|
||||
(pos.z >> 8) as u8,
|
||||
(pos.z >> 16) as u8,
|
||||
(pos.z >> 24) as u8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
}
|
||||
|
||||
impl BlocksOfInterest {
|
||||
pub fn from_chunk(chunk: &TerrainChunk) -> Self {
|
||||
span!(_guard, "from_chunk", "BlocksOfInterest::from_chunk");
|
||||
@ -104,8 +158,13 @@ impl BlocksOfInterest {
|
||||
BlockKind::Snow | BlockKind::Ice if rng.gen_range(0..16) == 0 => snow.push(pos),
|
||||
_ => match block.get_sprite() {
|
||||
Some(SpriteKind::Ember) => {
|
||||
let mut rng2 = ChaCha8Rng::from_seed(seed_from_pos(pos));
|
||||
fires.push(pos);
|
||||
smokers.push(SmokeProperties::new(pos, 128, 128));
|
||||
smokers.push(SmokeProperties::new(
|
||||
pos,
|
||||
dryness(chunk.meta().biome()),
|
||||
rng2.gen_range(20..200),
|
||||
));
|
||||
},
|
||||
// Offset positions to account for block height.
|
||||
// TODO: Is this a good idea?
|
||||
|
Loading…
Reference in New Issue
Block a user