From 4c6f67712f731f8132c157e087e827507b7bebb7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 23 Jan 2023 23:47:11 +0900 Subject: 5.4 --- src/rtw/texture.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/rtw') diff --git a/src/rtw/texture.zig b/src/rtw/texture.zig index 63b8f46..cf2b08b 100644 --- a/src/rtw/texture.zig +++ b/src/rtw/texture.zig @@ -29,8 +29,8 @@ pub const Texture = union(TextureTag) { ) }; } - pub fn makeNoise(rng: Random) Texture { - return .{ .noise = .{ .perlin = Perlin.init(rng) } }; + pub fn makeNoise(scale: f64, rng: Random) Texture { + return .{ .noise = .{ .perlin = Perlin.init(rng), .scale = scale } }; } pub fn value(tx: Texture, u: f64, v: f64, p: Vec3) Color { @@ -83,10 +83,11 @@ pub const CheckerTexture = struct { pub const NoiseTexture = struct { perlin: Perlin, + scale: f64, fn value(tx: NoiseTexture, u: f64, v: f64, p: Vec3) Color { _ = u; _ = v; - return rgb(1, 1, 1).mul(tx.perlin.noise(p)); + return rgb(1, 1, 1).mul(tx.perlin.noise(p.mul(tx.scale))); } }; -- cgit v1.2.3-70-g09d2