From 45fafbcd4b41a5388ece377c4e051b5846407288 Mon Sep 17 00:00:00 2001 From: lamp Date: Sun, 21 Jan 2024 17:03:07 +0000 Subject: fmt and tidy --- src/texture/perlin.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/texture/perlin.rs') diff --git a/src/texture/perlin.rs b/src/texture/perlin.rs index 43d8f64..a796a43 100644 --- a/src/texture/perlin.rs +++ b/src/texture/perlin.rs @@ -1,4 +1,4 @@ -use crate::vec3::{Vec3, Point3}; +use crate::vec3::{Point3, Vec3}; const POINT_COUNT: usize = 256; @@ -55,7 +55,8 @@ impl Perlin { ^ self.perm_z.get(((k + dk as i32) & 255) as usize).unwrap()) as usize, ) - .unwrap().clone(); + .unwrap() + .clone(); } } } @@ -73,11 +74,15 @@ impl Perlin { let i_f = i as f64; let j_f = j as f64; let k_f = k as f64; - let weight_v = Vec3 { x: u - i_f, y: v - j_f, z: w - k_f }; - accum += (i_f * uu + (1.0 - i_f) * (1.0 - uu)) * - (j_f * vv + (1.0 - j_f) * (1.0 - vv)) * - (k_f * ww + (1.0 - k_f) * (1.0 - ww)) * - c[i][j][k].dot(&weight_v); + let weight_v = Vec3 { + x: u - i_f, + y: v - j_f, + z: w - k_f, + }; + accum += (i_f * uu + (1.0 - i_f) * (1.0 - uu)) + * (j_f * vv + (1.0 - j_f) * (1.0 - vv)) + * (k_f * ww + (1.0 - k_f) * (1.0 - ww)) + * c[i][j][k].dot(&weight_v); } } } -- cgit v1.2.3