MapGen: minor fix
This commit is contained in:
@@ -802,7 +802,7 @@ local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
|||||||
-- If the triangle is monochromatic (all peaks have the same color and,
|
-- If the triangle is monochromatic (all peaks have the same color and,
|
||||||
-- accordingly, the same noise), then there is no point in smoothing out the noise.
|
-- accordingly, the same noise), then there is no point in smoothing out the noise.
|
||||||
if triangleColor ~= nil then
|
if triangleColor ~= nil then
|
||||||
return layer:getNoiseByColor(category, triangleColor):get_2d({x = x, y = z})
|
return layer:getNoiseByColor(category, triangleColor):get_3d({x = x, y = 0, z = z})
|
||||||
end
|
end
|
||||||
|
|
||||||
local peak1 = triangle.p1
|
local peak1 = triangle.p1
|
||||||
@@ -821,15 +821,15 @@ local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
|||||||
-- ( peak1 * weight1 + peak2 * weight2 + peak3 * weight3) / totalWeight, when
|
-- ( peak1 * weight1 + peak2 * weight2 + peak3 * weight3) / totalWeight, when
|
||||||
-- totalWeight = weight1 + weight2 + weight3
|
-- totalWeight = weight1 + weight2 + weight3
|
||||||
local weight = calcWeight(triangle.h1, x, y, z)
|
local weight = calcWeight(triangle.h1, x, y, z)
|
||||||
noiseValue = noiseValue + noise1:get_2d({x = x, y = z}) * weight
|
noiseValue = noiseValue + noise1:get_3d({x = x, y = 0, z = z}) * weight
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
weight = calcWeight(triangle.h2, x, y, z)
|
weight = calcWeight(triangle.h2, x, y, z)
|
||||||
noiseValue = noiseValue + noise2:get_2d({x = x, y = z}) * weight
|
noiseValue = noiseValue + noise2:get_3d({x = x, y = 0, z = z}) * weight
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
weight = calcWeight(triangle.h3, x, y, z)
|
weight = calcWeight(triangle.h3, x, y, z)
|
||||||
noiseValue = noiseValue + noise3:get_2d({x = x, y = z}) * weight
|
noiseValue = noiseValue + noise3:get_3d({x = x, y = 0, z = z}) * weight
|
||||||
totalWeight = totalWeight + weight
|
totalWeight = totalWeight + weight
|
||||||
|
|
||||||
return (noiseValue / totalWeight)
|
return (noiseValue / totalWeight)
|
||||||
|
|||||||
Reference in New Issue
Block a user