Patchier plants, wind swaying

This commit is contained in:
Joshua Barretto 2019-08-20 10:59:15 +01:00
parent 74c3eef352
commit 245c9af2e8
3 changed files with 11 additions and 4 deletions

View File

@ -19,6 +19,9 @@ const float SCALE = 1.0 / 11.0;
void main() {
f_pos = inst_pos + v_pos * SCALE;
// Wind waving
f_pos += vec3(sin(tick.x * 1.7 + inst_pos.y * 0.2), sin(tick.x * 1.3 + inst_pos.x * 0.2), 0) * sin(v_pos.z * 0.03) * 0.5;
f_norm = v_norm;
f_col = v_col * inst_col;

View File

@ -148,6 +148,7 @@ impl<'a> BlockGen<'a> {
//close_structures,
cave_xy,
cave_alt,
marble,
rock,
//cliffs,
cliff_hill,
@ -254,14 +255,15 @@ impl<'a> BlockGen<'a> {
BlockKind::Normal,
saturate_srgb(col, 0.45).map(|e| (e * 255.0) as u8),
))
} else if (wposf.z as f32) < height + 1.0
} else if (wposf.z as f32) < height + 0.9
&& (wposf.z as f32 > water_height + 3.0)
&& (chaos * 4096.0).fract() < 0.025
&& (chaos * 4096.0).fract() < 0.05
&& marble > 0.6
{
Some(Block::new(
if (height * 121.0).fract() < 0.25 {
if (height * 121.0).fract() < 0.15 {
BlockKind::Wheat
} else if (height * 121.0).fract() < 0.5 {
} else if (height * 121.0).fract() < 0.2 {
BlockKind::Flowers
} else {
BlockKind::LongGrass

View File

@ -359,6 +359,7 @@ impl<'a> Sampler for ColumnGen<'a> {
close_structures: self.gen_close_structures(wpos),
cave_xy,
cave_alt,
marble,
rock,
is_cliffs,
near_cliffs,
@ -384,6 +385,7 @@ pub struct ColumnSample<'a> {
pub close_structures: [Option<StructureData>; 9],
pub cave_xy: f32,
pub cave_alt: f32,
pub marble: f32,
pub rock: f32,
pub is_cliffs: bool,
pub near_cliffs: bool,