From 1edee02788f467b3eac49d52f72ed9c372c1e7ff Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 31 Jan 2021 14:09:50 +0000 Subject: [PATCH] sync --- common/src/terrain/structure.rs | 3 --- world/src/layer/mod.rs | 2 +- world/src/layer/tree.rs | 12 ++++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/common/src/terrain/structure.rs b/common/src/terrain/structure.rs index bde3411439..4a9867474a 100644 --- a/common/src/terrain/structure.rs +++ b/common/src/terrain/structure.rs @@ -46,7 +46,6 @@ pub struct Structure { struct BaseStructure { vol: Dyna, - empty: StructureBlock, default_kind: BlockKind, } @@ -167,13 +166,11 @@ impl assets::Compound for BaseStructure { Ok(BaseStructure { vol, - empty: StructureBlock::None, default_kind: BlockKind::Misc, }) } else { Ok(BaseStructure { vol: Dyna::filled(Vec3::zero(), StructureBlock::None, ()), - empty: StructureBlock::None, default_kind: BlockKind::Misc, }) } diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index c0b0f42a64..b5c8a603ba 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -6,7 +6,7 @@ pub use self::{scatter::apply_scatter_to, tree::apply_trees_to}; use crate::{ column::ColumnSample, - util::{FastNoise, FastNoise2d, RandomField, Sampler}, + util::{FastNoise, RandomField, Sampler}, Canvas, IndexRef, }; use common::{ diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index 71e13880d8..d130cbf8a4 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -283,7 +283,7 @@ impl ProceduralTree { // Our trunk starts at the origin... Vec3::zero(), // ...and has a roughly upward direction - Vec3::new(rng.gen_range(-1.0, 1.0), rng.gen_range(-1.0, 1.0), 5.0).normalized(), + Vec3::new(rng.gen_range(-1.0..1.0), rng.gen_range(-1.0..1.0), 5.0).normalized(), config.trunk_len, config.trunk_radius, 0, @@ -313,7 +313,7 @@ impl ProceduralTree { let line = LineSegment3 { start, end }; let wood_radius = branch_radius; let leaf_radius = if depth == config.max_depth { - rng.gen_range(config.leaf_radius.start, config.leaf_radius.end) + rng.gen_range(config.leaf_radius.clone()) } else { 0.0 }; @@ -327,12 +327,12 @@ impl ProceduralTree { let mut child_idx = None; // Don't add child branches if we're already enough layers into the tree if depth < config.max_depth { - let x_axis = dir.cross(Vec3::::zero().map(|_| rng.gen_range(-1.0, 1.0))).normalized(); + let x_axis = dir.cross(Vec3::::zero().map(|_| rng.gen_range(-1.0..1.0))).normalized(); let y_axis = dir.cross(x_axis).normalized(); - let screw_shift = rng.gen_range(0.0, f32::consts::TAU); + let screw_shift = rng.gen_range(0.0..f32::consts::TAU); for i in 0..config.splits { - let dist = Lerp::lerp(i as f32 / (config.splits - 1) as f32, rng.gen_range(0.0, 1.0), config.proportionality); + let dist = Lerp::lerp(i as f32 / (config.splits - 1) as f32, rng.gen_range(0.0..1.0), config.proportionality); const PHI: f32 = 0.618; const RAD_PER_BRANCH: f32 = f32::consts::TAU * PHI; @@ -347,7 +347,7 @@ impl ProceduralTree { start, end, split_factor, - ) + Lerp::lerp(Vec3::::zero().map(|_| rng.gen_range(-1.0, 1.0)), screw, config.proportionality); + ) + Lerp::lerp(Vec3::::zero().map(|_| rng.gen_range(-1.0..1.0)), screw, config.proportionality); // Start the branch at the closest point to the target let branch_start = line.projected_point(tgt); // Now, interpolate between the target direction and the parent branch's direction to find a direction