Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Kopernicus/Kopernicus
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3e27e1b4b2f4
Choose a base ref
...
head repository: Kopernicus/Kopernicus
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 009e24f1ee1a
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Jul 20, 2018

  1. Copy the full SHA
    a8703f6 View commit details
  2. Trying to fix normal maps

    StollD committed Jul 20, 2018
    Copy the full SHA
    1fc93d8 View commit details
  3. Copy the full SHA
    009e24f View commit details
Showing with 7 additions and 92 deletions.
  1. +0 −67 Makefile
  2. +0 −17 README.tpl
  3. +2 −2 src/Kopernicus/UI/PlanetTextureExporter.cs
  4. +1 −2 src/Kopernicus/UI/Tools.cs
  5. +4 −4 src/Kopernicus/Utility.cs
67 changes: 0 additions & 67 deletions Makefile

This file was deleted.

17 changes: 0 additions & 17 deletions README.tpl
Original file line number Diff line number Diff line change
@@ -34,20 +34,3 @@ Instructions
Examples
----------
Selectively copy folders inside of [KopernicusExamples/](https://github.com/Kopernicus/KopernicusExamples/) into a GameData/KopernicusExamples/ folder. There are a number of examples of how to use Kopernicus.

Information
-----------
Coming Soon

Compiling
----------
To compile Kopernicus you need to add the following assemblies from your KSP_Data/Managed folder into the toplevel directory of the repository:

* Assembly-CSharp.dll
* Assembly-CSharp-firstpass.dll
* KSPUtil.dll
* ModularFlightIntegrator.dll
* UnityEngine.dll
* UnityEngine.UI.dll

After that you can compile the .sln file with VS, MonoDevelop or other build tools. If you have Linux experience you can use Makefiles too, however, you will need Microsofts Roslyn compiler for it.
4 changes: 2 additions & 2 deletions src/Kopernicus/UI/PlanetTextureExporter.cs
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ public static IEnumerator UpdateTextures(CelestialBody celestialBody, TextureOpt
}

// Serialize the maps to disk
String name = "KittopiaTech/PluginData/" + celestialBody.transform.name + "/";
String name = "KittopiaTech/PluginData/" + celestialBody.transform.name + "/" + DateTime.Now.ToString("s") + "/";
String path = KSPUtil.ApplicationRootPath + "/GameData/" + name;
Directory.CreateDirectory(path);

@@ -235,7 +235,7 @@ public static IEnumerator UpdateTextures(CelestialBody celestialBody, TextureOpt
if (options.ExportNormal)
{
// Bump to Normal Map
Texture2D normalMap = Utility.BumpToNormalMap(heightMap, pqsVersion.radius, options.NormalStrength);
Texture2D normalMap = Utility.BumpToNormalMap(heightMap, pqsVersion, options.NormalStrength);
yield return null;

if (options.SaveToDisk)
3 changes: 1 addition & 2 deletions src/Kopernicus/UI/Tools.cs
Original file line number Diff line number Diff line change
@@ -115,8 +115,7 @@ public static ConfigType GetConfigType(Type memberType)

if (configTypes == null || !configTypes.Any())
{
Debug.Log(memberType);
throw new InvalidOperationException("Member needs to have a parsable type.");
throw new InvalidOperationException("Member needs to have a parsable type: " + memberType);
}

return configTypes[0].Type;
8 changes: 4 additions & 4 deletions src/Kopernicus/Utility.cs
Original file line number Diff line number Diff line change
@@ -775,9 +775,9 @@ public static Mesh DeserializeMesh(String path)
}

// Credit goes to Sigma88.
public static Texture2D BumpToNormalMap(Texture2D source, Double radius, Single strength)
public static Texture2D BumpToNormalMap(Texture2D source, PQS pqs, Single strength)
{
double dS = radius * 2 * Math.PI / source.width;
double dS = pqs.radius * 2 * Math.PI / source.width;

if (!(strength > 0)) strength = 1;

@@ -798,8 +798,8 @@ public static Texture2D BumpToNormalMap(Texture2D source, Double radius, Single
int yN = by - 1;
int yP = by + 1;

float dX = source.GetPixel(xP, by).r - source.GetPixel(xN, by).r;
float dY = source.GetPixel(bx, yP).r - source.GetPixel(bx, yN).r;
double dX = (source.GetPixel(xP, by).r - source.GetPixel(xN, by).r) * pqs.radiusDelta;
double dY = (source.GetPixel(bx, yP).r - source.GetPixel(bx, yN).r) * pqs.radiusDelta;

double slopeX = (1 + dX / Math.Pow(dX * dX + dS * dS, 0.5) * strength) / 2;
double slopeY = (1 - dY / Math.Pow(dY * dY + dS * dS, 0.5) * strength) / 2;