From 8143b6188aef23ca1bf979e4106e35015ab35f9a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 13 Jul 2022 21:14:57 -0700 Subject: [PATCH] configurable heightmap resolution --- NewHorizons/External/Modules/HeightMapModule.cs | 12 ++++++++++-- NewHorizons/Handlers/PlanetCreationHandler.cs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NewHorizons/External/Modules/HeightMapModule.cs b/NewHorizons/External/Modules/HeightMapModule.cs index 4a40603f..089e1279 100644 --- a/NewHorizons/External/Modules/HeightMapModule.cs +++ b/NewHorizons/External/Modules/HeightMapModule.cs @@ -1,6 +1,7 @@ -using System.ComponentModel.DataAnnotations; -using NewHorizons.Utility; +using NewHorizons.Utility; using Newtonsoft.Json; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; namespace NewHorizons.External.Modules { @@ -31,5 +32,12 @@ namespace NewHorizons.External.Modules /// Relative filepath to the texture used for the terrain. /// public string textureMap; + + /// + /// Resolution of the heightmap. + /// Higher values means more detail but also more memory/cpu/gpu usage. + /// + [Range(0, int.MaxValue)] [DefaultValue(51)] + public int resolution = 51; } } \ No newline at end of file diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 00f5ced8..c5486a38 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -466,7 +466,7 @@ namespace NewHorizons.Handlers if (body.Config.HeightMap != null) { - HeightMapBuilder.Make(go, sector, body.Config.HeightMap, body.Mod, 51); + HeightMapBuilder.Make(go, sector, body.Config.HeightMap, body.Mod, body.Config.HeightMap.resolution); } if (body.Config.ProcGen != null)