Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zig-gamedev/znoise
Zig build package and bindings for https://github.com/Auburn/FastNoiseLite
https://github.com/zig-gamedev/znoise
bindings fastnoiselite gamedev noise-generator zig
Last synced: 9 days ago
JSON representation
Zig build package and bindings for https://github.com/Auburn/FastNoiseLite
- Host: GitHub
- URL: https://github.com/zig-gamedev/znoise
- Owner: zig-gamedev
- License: mit
- Created: 2024-11-03T23:25:49.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-05T21:51:10.000Z (about 2 months ago)
- Last Synced: 2024-11-11T08:23:55.916Z (about 2 months ago)
- Topics: bindings, fastnoiselite, gamedev, noise-generator, zig
- Language: C
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [znoise](https://github.com/zig-gamedev/znoise)
Zig build package and bindings for [FastNoiseLite](https://github.com/Auburn/FastNoiseLite)
## Getting started
Example `build.zig`:
```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:
```zig
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);
}
}
```