Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Zig/fastnoise.zig
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ pub fn Noise(comptime Float: type) type {
const gain: Float = @abs(self.gain);
var amp = gain;
var amp_fractal: Float = 1.0;
for (0..self.octaves) |_| {
for (1..self.octaves) |_| {
amp_fractal += amp;
amp *= gain;
}
Expand Down Expand Up @@ -682,15 +682,15 @@ pub fn Noise(comptime Float: type) type {
// Domain Warp Single Wrapper

fn domainWarpSingle2D(state: *const State, x: *Float, y: *Float) void {
const amp = state.domain_warp_amp * state.calculateFractalBounding();
const amp = state.domain_warp_amp;
var xs: Float = x.*;
var ys: Float = y.*;
state.transformDomainWarpCoordinate2D(&xs, &ys);
state.doSingleDomainWarp2D(state.seed, amp, state.frequency, xs, ys, x, y);
}

fn domainWarpSingle3D(state: *const State, x: *Float, y: *Float, z: *Float) void {
const amp = state.domain_warp_amp * state.calculateFractalBounding();
const amp = state.domain_warp_amp;
var xs: Float = x.*;
var ys: Float = y.*;
var zs: Float = z.*;
Expand Down Expand Up @@ -733,8 +733,8 @@ pub fn Noise(comptime Float: type) type {
var xs: Float = x.*;
var ys: Float = y.*;
state.transformDomainWarpCoordinate2D(&xs, &ys);
const amp = state.domain_warp_amp * state.calculateFractalBounding();
const freq = state.frequency;
var amp = state.domain_warp_amp * state.calculateFractalBounding();
var freq = state.frequency;
for (0..state.octaves) |i| {
state.doSingleDomainWarp2D(state.seed + @as(i32, @intCast(i)), amp, freq, xs, ys, x, y);
amp *= state.gain;
Expand All @@ -747,8 +747,8 @@ pub fn Noise(comptime Float: type) type {
var ys: Float = y.*;
var zs: Float = z.*;
state.transformDomainWarpCoordinate3D(&xs, &ys, &zs);
const amp = state.domain_warp_amp * state.calculateFractalBounding();
const freq = state.frequency;
var amp = state.domain_warp_amp * state.calculateFractalBounding();
var freq = state.frequency;
for (0..state.octaves) |i| {
state.doSingleDomainWarp3D(state.seed + @as(i32, @intCast(i)), amp, freq, xs, ys, zs, x, y, z);
amp *= state.gain;
Expand Down