aboutsummaryrefslogtreecommitdiff
path: root/src/texture/perlin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/texture/perlin.rs')
-rw-r--r--src/texture/perlin.rs19
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);
}
}
}