Zig build package and bindings for https://github.com/Auburn/FastNoiseLite
  • C 96.5%
  • Zig 3.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-23 17:39:47 +01:00
.github/workflows Bump min zig ver to 0.16.0 to avoid issue on macOS 2026-10-23 17:39:47 +01:00
libs/FastNoiseLite files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-03 23:26:20 +00:00
src files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-03 23:26:20 +00:00
.gitignore files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-03 23:26:20 +00:00
build.zig - Fixup usage of deprecated std.Build APIs (#3) 2026-01-04 14:23:04 +00:00
build.zig.zon Bump min zig ver to 0.16.0 to avoid issue on macOS 2026-10-23 17:39:47 +01:00
LICENSE files from monorepo @ 14e6258901c6fb47ae598705682837ef6c298e60 2024-11-03 23:26:20 +00:00
README.md Update README.md 2024-11-03 23:33:24 +00:00

znoise

Zig build package and bindings for FastNoiseLite

Getting started

Example build.zig:

pub fn build(b: *std.Build) void {
    const exe = b.addExecutable(.{ ... });

    const znoise = b.dependency("znoise", .{});
    exe.root_module.addImport("znoise", znoise.module("root"));
    exe.linkLibrary(znoise.artifact("FastNoiseLite"));
}

Now in your code you may import and use znoise:

const znoise = @import("znoise");

pub fn main() !void {
    ...
    {
        const gen = znoise.FnlGenerator{};
        const n2 = gen.noise2(0.1, 0.2);
        const n3 = gen.noise3(1.0, 2.0, 3.0);

        var x: f32 = 1.0;
        var y: f32 = 2.0;
        var z: f32 = 3.0;
        gen.domainWarp3(&x, &y, &z);
    }

    {
        const gen = znoise.FnlGenerator{
            .seed = 1337,
            .frequency = 0.01,
            .noise_type = .opensimplex2,
            .rotation_type3 = .none,
            .fractal_type = .none,
            .octaves = 3,
            .lacunarity = 2.0,
            .gain = 0.5,
            .weighted_strength = 0.0,
            .ping_pong_strength = 2.0,
            .cellular_distance_func = .euclideansq,
            .cellular_return_type = .distance,
            .cellular_jitter_mod = 1.0,
            .domain_warp_type = .opensimplex2,
            .domain_warp_amp = 1.0,
        };
        const n = gen.noise2(0.1, 0.2);
    }
}