convert submodules to normal folders for now

This commit is contained in:
catangent 2025-04-09 20:00:20 +01:00
parent 389e934900
commit ed1e0ecb6b
1041 changed files with 572002 additions and 13 deletions

1
znoise

@ -1 +0,0 @@
Subproject commit a52da9babfe6d14a0b3e3bfcaabb2907cc2c4e3b

36
znoise/.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: ci
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
cancel-in-progress: true
jobs:
lint-and-build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Read .zig-version
id: zigversion
uses: juliangruber/read-file-action@v1
with:
path: ./.zigversion
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ steps.zigversion.outputs.content }}
- name: Check format
continue-on-error: true
run: zig fmt --check .
- name: Build and run tests
run: zig build test

6
znoise/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# Ignore some special directories
.zig-cache
zig-out
# Ignore some special OS files
*.DS_Store

1
znoise/.zigversion Normal file
View file

@ -0,0 +1 @@
0.14.0-dev.1911+3bf89f55c

22
znoise/LICENSE Normal file
View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2022 Michal Ziulek
Copyright (c) 2024 zig-gamedev contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

58
znoise/README.md Normal file
View file

@ -0,0 +1,58 @@
# [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);
}
}
```

36
znoise/build.zig Normal file
View file

@ -0,0 +1,36 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
_ = b.addModule("root", .{
.root_source_file = b.path("src/znoise.zig"),
});
const fnl = b.addStaticLibrary(.{
.name = "FastNoiseLite",
.target = target,
.optimize = optimize,
});
fnl.linkLibC();
fnl.addIncludePath(b.path("libs/FastNoiseLite"));
fnl.addCSourceFile(.{
.file = b.path("libs/FastNoiseLite/FastNoiseLite.c"),
.flags = &.{ "-std=c99", "-fno-sanitize=undefined" },
});
b.installArtifact(fnl);
const test_step = b.step("test", "Run znoise tests");
const tests = b.addTest(.{
.name = "znoise-tests",
.root_source_file = b.path("src/znoise.zig"),
.target = target,
.optimize = optimize,
});
tests.linkLibrary(fnl);
b.installArtifact(tests);
test_step.dependOn(&b.addRunArtifact(tests).step);
}

12
znoise/build.zig.zon Normal file
View file

@ -0,0 +1,12 @@
.{
.name = "znoise",
.version = "0.3.0-dev",
.paths = .{
"build.zig",
"build.zig.zon",
"libs",
"src",
"README.md",
"LICENSE",
},
}

View file

@ -0,0 +1,2 @@
#define FNL_IMPL
#include "FastNoiseLite.h"

File diff suppressed because it is too large Load diff

86
znoise/src/znoise.zig Normal file
View file

@ -0,0 +1,86 @@
// znoise - Zig bindings for FastNoiseLite
pub const FnlGenerator = extern struct {
seed: i32 = 1337,
frequency: f32 = 0.01,
noise_type: NoiseType = .opensimplex2,
rotation_type3: RotationType3 = .none,
fractal_type: FractalType = .none,
octaves: i32 = 3,
lacunarity: f32 = 2.0,
gain: f32 = 0.5,
weighted_strength: f32 = 0.0,
ping_pong_strength: f32 = 2.0,
cellular_distance_func: CellularDistanceFunc = .euclideansq,
cellular_return_type: CellularReturnType = .distance,
cellular_jitter_mod: f32 = 1.0,
domain_warp_type: DomainWarpType = .opensimplex2,
domain_warp_amp: f32 = 1.0,
pub const NoiseType = enum(c_int) {
opensimplex2,
opensimplex2s,
cellular,
perlin,
value_cubic,
value,
};
pub const RotationType3 = enum(c_int) {
none,
improve_xy_planes,
improve_xz_planes,
};
pub const FractalType = enum(c_int) {
none,
fbm,
ridged,
pingpong,
domain_warp_progressive,
domain_warp_independent,
};
pub const CellularDistanceFunc = enum(c_int) {
euclidean,
euclideansq,
manhattan,
hybrid,
};
pub const CellularReturnType = enum(c_int) {
cellvalue,
distance,
distance2,
distance2add,
distance2sub,
distance2mul,
distance2div,
};
pub const DomainWarpType = enum(c_int) {
opensimplex2,
opensimplex2_reduced,
basicgrid,
};
pub const noise2 = fnlGetNoise2D;
extern fn fnlGetNoise2D(gen: *const FnlGenerator, x: f32, y: f32) f32;
pub const noise3 = fnlGetNoise3D;
extern fn fnlGetNoise3D(gen: *const FnlGenerator, x: f32, y: f32, z: f32) f32;
pub const domainWarp2 = fnlDomainWarp2D;
extern fn fnlDomainWarp2D(gen: *const FnlGenerator, x: *f32, y: *f32) void;
pub const domainWarp3 = fnlDomainWarp3D;
extern fn fnlDomainWarp3D(gen: *const FnlGenerator, x: *f32, y: *f32, z: *f32) void;
};
test "znoise.basic" {
const gen = FnlGenerator{ .fractal_type = .fbm };
const n2 = gen.noise2(0.1, 0.2);
const n3 = gen.noise3(1.0, 2.0, 3.0);
_ = n2;
_ = n3;
}