better system for texture terrain.

This commit is contained in:
Troispoils 2024-03-01 21:56:18 +01:00
parent 3aa6b5bc83
commit 443b3a319d
9 changed files with 120 additions and 69 deletions

View file

@ -1,13 +1,19 @@
namespace LandblockExtraction.AtlasMaker;
using System.Numerics;
namespace LandblockExtraction.AtlasMaker;
public class SubTerrain {
public int terrainIndex { get; set; }
public float minPitch { get; set; }
public float maxPitch { get; set; }
public SubTerrain(int terrainIndex, float minPitch, float maxPitch) {
public Vector4 Color { get; set; }
public Vector4 farColor { get; set; }
public SubTerrain(int terrainIndex, float minPitch, float maxPitch, Vector4 color, Vector4 farcolor) {
this.terrainIndex = terrainIndex;
this.minPitch = minPitch;
this.maxPitch = maxPitch;
this.Color = color;
this.farColor = farcolor;
}
public bool MatchesPitch(float pitch) {
return pitch >= minPitch && pitch <= maxPitch;

View file

@ -11,12 +11,12 @@ public class Terrain {
subTerrains.Add(sousTerrain);
}
public int DetermineSubTerrain(float pitch) {
public SubTerrain DetermineSubTerrain(float pitch) {
foreach (var terrain in subTerrains) {
if (terrain.MatchesPitch(pitch)) {
return terrain.terrainIndex;
return terrain;
}
}
return terrainIndex;
return subTerrains.First();
}
}