Skip to content

Commit 6db037d

Browse files
committed
Fix noiseReduction calculations
1 parent 6cdd027 commit 6db037d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

TileMap.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ private void Load(int tileIndexX, int tileIndexY)
5050
long tileIndex = ((long)tileIndexY << 32) + tileIndexX;
5151
if (!tiles.ContainsKey(tileIndex))
5252
{
53-
bool fileExists = true;
54-
string[] fileList = null;
53+
string foundFileName = null;
5554
string fileNameBase = tileIndexX + "_" + tileIndexY + "_" + Zoom;
56-
if (Directory.Exists(cacheDir))
55+
if (Config.Data.enableCaching)
5756
{
58-
fileList = Directory.GetFiles(cacheDir, fileNameBase + ".*");
59-
if (fileList.Length == 0)
60-
fileExists = false;
57+
if (Directory.Exists(cacheDir))
58+
{
59+
string[] fileList = Directory.GetFiles(cacheDir, fileNameBase + ".*");
60+
if (fileList.Length != 0)
61+
foundFileName = fileList[0];
62+
}
6163
}
62-
else
63-
fileExists = false;
6464

6565
byte[] data;
66-
if (Config.Data.enableCaching && fileExists)
67-
data = File.ReadAllBytes(fileList[0]);
66+
if (foundFileName != null)
67+
data = File.ReadAllBytes(foundFileName);
6868
else
6969
{
7070
data = imageSource.GetTile(tileIndexX, tileIndexY, Zoom);

Tracer.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ public Tracer()
200200
}
201201
});
202202

203-
int integrateSamples = (int)(riverWidthPx * Config.Data.noiseReduction);
203+
int integrateSamples = (int)(riverWidthPx *
204+
Config.Data.resamplingFactor * Config.Data.noiseReduction);
204205
if (integrateSamples % 2 == 0)
205206
integrateSamples++;
206207
anglesGrid = Integrate(anglesGrid, integrateSamples);

0 commit comments

Comments
 (0)