Skip to content

Commit

Permalink
Update texture exporting API to 1.4.4
Browse files Browse the repository at this point in the history
StollD committed Jul 7, 2018
1 parent a510d46 commit 3e27e1b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Kopernicus/UI/PlanetTextureExporter.cs
Original file line number Diff line number Diff line change
@@ -76,12 +76,21 @@ public static IEnumerator UpdateTextures(CelestialBody celestialBody, TextureOpt
pqsVersion.SetupExternalRender();

// Get the mod building methods from the PQS
#if !KSP131
Action<PQS.VertexBuildData, Boolean> modOnVertexBuildHeight =
(Action<PQS.VertexBuildData, Boolean>) Delegate.CreateDelegate(
typeof(Action<PQS.VertexBuildData, Boolean>),
pqsVersion,
typeof(PQS).GetMethod("Mod_OnVertexBuildHeight",
BindingFlags.Instance | BindingFlags.NonPublic));
#else
Action<PQS.VertexBuildData> modOnVertexBuildHeight =
(Action<PQS.VertexBuildData>) Delegate.CreateDelegate(
typeof(Action<PQS.VertexBuildData>),
pqsVersion,
typeof(PQS).GetMethod("Mod_OnVertexBuildHeight",
BindingFlags.Instance | BindingFlags.NonPublic));
#endif
Action<PQS.VertexBuildData> modOnVertexBuild = (Action<PQS.VertexBuildData>) Delegate.CreateDelegate(
typeof(Action<PQS.VertexBuildData>),
pqsVersion,
@@ -135,7 +144,11 @@ public static IEnumerator UpdateTextures(CelestialBody celestialBody, TextureOpt
Double height = Double.MinValue;
if (options.ExportHeight)
{
#if !KSP131
modOnVertexBuildHeight(data, true);
#else
modOnVertexBuildHeight(data);
#endif

// Adjust the height
height = (data.vertHeight - pqsVersion.radius) * (1d / pqsVersion.mapMaxHeight);

0 comments on commit 3e27e1b

Please sign in to comment.