From 686b8801e6848573d5b9f8bc45bc9ab86153452b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 23 Jan 2023 23:44:14 +0900 Subject: 5.3 --- src/rtw/perlin.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rtw/perlin.zig b/src/rtw/perlin.zig index 176be00..987ac52 100644 --- a/src/rtw/perlin.zig +++ b/src/rtw/perlin.zig @@ -35,6 +35,9 @@ pub const Perlin = struct { const u = p.x - @floor(p.x); const v = p.y - @floor(p.y); const w = p.z - @floor(p.z); + const u_ = u * u * (3 - 2 * u); + const v_ = v * v * (3 - 2 * v); + const w_ = w * w * (3 - 2 * w); const i = @floatToInt(i32, @floor(p.x)); const j = @floatToInt(i32, @floor(p.y)); @@ -56,7 +59,7 @@ pub const Perlin = struct { } } - return trilinearInterp(c, u, v, w); + return trilinearInterp(c, u_, v_, w_); } fn perlinGeneratePerm(rng: Random, p: []usize) void { -- cgit v1.2.3-70-g09d2