Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensures that out-of-bounds terrain does creates a gap with actual terrain #227

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GameRealisticMap.Arma3/GameEngine/GameConfigGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private string GetTerrainSynth(bool isIsland, ElevationOutOfBoundsData outOfBoun

private string Serialize(ElevationMinMax[] outOfBounds)
{
return string.Join(",", outOfBounds.Select(p => FormattableString.Invariant($"{{{p.Min},{p.Max}}}")));
return string.Join(",", outOfBounds.Select(p => FormattableString.Invariant($"{{{Math.Round(p.Min,2)},{Math.Round(p.Max,2)}}}")));
}

private string GenerateConfigCpp(IArma3MapConfig config, CitiesData cities)
Expand Down
6 changes: 3 additions & 3 deletions GameRealisticMap/ElevationModel/RawElevationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public RawElevationData Build(IBuildContext context)
}

// Out of bounds
var outOfBounds = GetOutOfBounds(context, source);
var outOfBounds = GetOutOfBounds(context, source, grid);

return new RawElevationData(grid, source.Credits, outOfBounds);
}

private ElevationMinMax[] GetOutOfBounds(IBuildContext context, RawElevationSource source)
private ElevationMinMax[] GetOutOfBounds(IBuildContext context, RawElevationSource source, ElevationGrid grid)
{
var outOfBounds = new ElevationMinMax[512];
using (var report = progress.CreateStep("OutOfBounds", 512))
Expand All @@ -71,7 +71,7 @@ private ElevationMinMax[] GetOutOfBounds(IBuildContext context, RawElevationSour
var boundary = GetBoundaryPoint(a, center);
var vector = Vector2.Normalize(boundary - center) * OutOfBoundsStep;
var pos = boundary;
var min = source.GetElevationNoMask(context.Area.TerrainPointToLatLng(new TerrainPoint(pos))); ;
var min = (double)grid.ElevationAt(new TerrainPoint(pos));
var max = min;
for (int i = 0; i < OutOfBoundsDistance; i += OutOfBoundsStep)
{
Expand Down
Loading