Reworked lights, removed background, fixed colors, v1.2.0

This commit is contained in:
Nicola Sovic
2022-04-06 21:48:08 +02:00
parent f472ff1449
commit 9ad62b8b79
3 changed files with 104 additions and 190 deletions

View File

@@ -62,15 +62,11 @@ public class NoiseGenerator
}
float modifier = highestValue - lowestValue;
if (lowestValue < 0)
{
lowestValue = lowestValue * -1;
}
colors = new Color32[samples.Length];
for (int i = 0; i < samples.Length; i++)
{
colors[i] = Color32.Lerp(low, high, (samples[i] * modifier) + lowestValue);
colors[i] = Color32.Lerp(low, high, (1 / modifier) * (samples[i] - lowestValue));
}
for (int i = 0; i < samples.Length; i++)
@@ -105,7 +101,7 @@ public class NoiseGenerator
{
float xCord = tile.GetComponent<Tile>().getPosition().x + vertices[i].x / (vertices.Length - 1) * 10;
float yCord = tile.GetComponent<Tile>().getPosition().z + vertices[i].z / (vertices.Length - 1) * 10;
float sample = Mathf.PerlinNoise(xCord, yCord);
float sample = Mathf.PerlinNoise(xCord, yCord) - 0.1f * rand.Next(0, 6);
samples[i] = sample;
}
}
@@ -163,8 +159,8 @@ public class NoiseGenerator
Vector3[] vertices = mesh.vertices;
float[] samples = calculateBasicSamples(tile);
int randX = rand.Next(-4, 5);
int randZ = rand.Next(-4, 5);
int randX = rand.Next(-3, 4);
int randZ = rand.Next(-3, 4);
for (int i = -1; i < 2; i++)
{