From f04424b40ed4d92601ea19c5dd9fbde09bb70a07 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Mon, 4 Jan 2021 00:28:04 +0000 Subject: [PATCH] Fixed clipping issues, faster generation --- world/src/layer/tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/world/src/layer/tree.rs b/world/src/layer/tree.rs index 5359aa1cdd..688e9a7453 100644 --- a/world/src/layer/tree.rs +++ b/world/src/layer/tree.rs @@ -203,7 +203,7 @@ impl ProceduralTree { let mut branches = Vec::new(); fn add_branches(branches: &mut Vec, rng: &mut impl Rng, start: Vec3, dir: Vec3, depth: usize) { - let branch_dir = (dir + Vec3::::new(rng.gen_range(-1.0, 1.0),rng.gen_range(-1.0, 1.0),rng.gen_range(-0.3, 1.0)).cross(dir).normalized() * 0.45 * (depth as f32 + 0.5)).normalized(); // I wish `vek` had a `Vec3::from_fn` + let branch_dir = (dir + Vec3::::zero().map(|_| rng.gen_range(-1.0, 1.0)).cross(dir).normalized() * 0.45 * (depth as f32 + 0.5)).normalized(); // I wish `vek` had a `Vec3::from_fn` let branch_len = 12.0 / (depth as f32 * 0.25 + 1.0); // Zipf, I guess let end = start + branch_dir * branch_len;