Skip to content

Commit

Permalink
Fix noiseReduction calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vort committed Jan 27, 2017
1 parent 6cdd027 commit 6db037d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions TileMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ private void Load(int tileIndexX, int tileIndexY)
long tileIndex = ((long)tileIndexY << 32) + tileIndexX;
if (!tiles.ContainsKey(tileIndex))
{
bool fileExists = true;
string[] fileList = null;
string foundFileName = null;
string fileNameBase = tileIndexX + "_" + tileIndexY + "_" + Zoom;
if (Directory.Exists(cacheDir))
if (Config.Data.enableCaching)
{
fileList = Directory.GetFiles(cacheDir, fileNameBase + ".*");
if (fileList.Length == 0)
fileExists = false;
if (Directory.Exists(cacheDir))
{
string[] fileList = Directory.GetFiles(cacheDir, fileNameBase + ".*");
if (fileList.Length != 0)
foundFileName = fileList[0];
}
}
else
fileExists = false;

byte[] data;
if (Config.Data.enableCaching && fileExists)
data = File.ReadAllBytes(fileList[0]);
if (foundFileName != null)
data = File.ReadAllBytes(foundFileName);
else
{
data = imageSource.GetTile(tileIndexX, tileIndexY, Zoom);
Expand Down
3 changes: 2 additions & 1 deletion Tracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ public Tracer()
}
});

int integrateSamples = (int)(riverWidthPx * Config.Data.noiseReduction);
int integrateSamples = (int)(riverWidthPx *
Config.Data.resamplingFactor * Config.Data.noiseReduction);
if (integrateSamples % 2 == 0)
integrateSamples++;
anglesGrid = Integrate(anglesGrid, integrateSamples);
Expand Down

0 comments on commit 6db037d

Please sign in to comment.