diff options
author | lamp | 2024-01-21 17:03:07 +0000 |
---|---|---|
committer | lamp | 2024-01-21 17:03:07 +0000 |
commit | 45fafbcd4b41a5388ece377c4e051b5846407288 (patch) | |
tree | 2192c471ca3b47671f0906e27f6f6088f40b3d8a /src/texture/perlin.rs | |
parent | 89a5c9a8a0cdf627cda0e31da454f83ca21315ce (diff) |
fmt and tidy
Diffstat (limited to 'src/texture/perlin.rs')
-rw-r--r-- | src/texture/perlin.rs | 19 |
1 files changed, 12 insertions, 7 deletions
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); } } } |