mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
ignore negative noise arguments
This commit is contained in:
parent
e09eb41cc7
commit
6b090e20c1
1 changed files with 4 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ local function sample_noise(x)
|
|||
end
|
||||
|
||||
function math.noise(x, octaves)
|
||||
x = math.abs(x)
|
||||
octaves = octaves or 1
|
||||
local value = 0.0
|
||||
local mul = 1.0
|
||||
|
|
@ -81,6 +82,9 @@ local function rand_2d(x, y)
|
|||
end
|
||||
|
||||
local function sample_noise2d(x, y)
|
||||
x = math.abs(x)
|
||||
y = math.abs(y)
|
||||
|
||||
local x0 = math.floor(x)
|
||||
local y0 = math.floor(y)
|
||||
local x1 = x0 + 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue