diff options
Diffstat (limited to 'src/rtw')
| -rw-r--r-- | src/rtw/texture.zig | 7 |
1 files changed, 4 insertions, 3 deletions
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))); } }; |
