Skip to content

Commit

Permalink
Merge pull request #37 from Sigma88/Development
Browse files Browse the repository at this point in the history
Sigma Dimensions v0.7.6
  • Loading branch information
Sigma88 committed Apr 30, 2017
2 parents 1e8a1fc + 7cec5e5 commit bcc89d5
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Changelog.txt
@@ -1,3 +1,10 @@
**v0.7.6**

- Tweaked Atmosphere resize when using atmoTopLayer
- Fixed LandControl resize
- Fixed PQS levels for oceans on very small planets


**v0.7.5**

- Fixed Atmosphere handling when using atmoTopLayer
Expand Down
Expand Up @@ -105,11 +105,13 @@
{
&alterApparentHeight = 100
&alterRealHeight = 100
&minimumRealHeight = 0.100000001490116
}
%Class[Frost]
{
&alterApparentHeight = 0
&alterRealHeight = 0
&minimumRealHeight = 0.100000001490116
}
#Class[Badlands] {}
#Class[Craters] {}
Expand Down
Expand Up @@ -57,6 +57,7 @@
{
&alterApparentHeight = 100
&alterRealHeight = 10
&minimumRealHeight = 20
}
}
}
Expand Down
Expand Up @@ -52,6 +52,7 @@
{
&alterApparentHeight = 100
&alterRealHeight = 10
&minimumRealHeight = 20
}
}
}
Expand Down
Expand Up @@ -91,9 +91,11 @@
// Resize
@alterApparentHeight *= #$../../../../../SigmaDimensions/Resize$
@alterRealHeight *= #$../../../../../SigmaDimensions/Resize$
@minimumRealHeight *= #$../../../../../SigmaDimensions/Resize$
// landscape
@alterApparentHeight *= #$../../../../../SigmaDimensions/landscape$
@alterRealHeight *= #$../../../../../SigmaDimensions/landscape$
@minimumRealHeight *= #$../../../../../SigmaDimensions/landscape$
}
}
@scatters,*
Expand Down
Expand Up @@ -7,5 +7,10 @@
%minLevel = 1
%maxLevel = 2
}
@Ocean
{
%minLevel = 1
%maxLevel = 2
}
}
}
2 changes: 1 addition & 1 deletion GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version
Expand Up @@ -13,7 +13,7 @@
{
"MAJOR": 0,
"MINOR": 7,
"PATCH": 5,
"PATCH": 6,
"BUILD": 0
},
"KSP_VERSION":
Expand Down
Binary file modified GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion GameData/Sigma/Dimensions/README.txt
Expand Up @@ -133,7 +133,7 @@ The height of the atmosphere aesthetics is multiplied by this parameter.

- Can be set to any positive number.

Atmosphere depth is multiplied by this parameter. Atmosphere curves are extended/trimmed accordingly.
Atmosphere height is multiplied by this parameter. Atmosphere curves are extended/trimmed accordingly.

---

Expand Down
Binary file modified [Source]/Distribution/SigmaDimensions.dll
Binary file not shown.
22 changes: 19 additions & 3 deletions [Source]/SigmaDimensions/AtmosphereTopLayer.cs
Expand Up @@ -23,7 +23,7 @@ void Start()
Normalize(body, body.atmosphereDepth);

double topLayer = body.Get<double>("atmoTopLayer") * body.atmosphereDepth;
FixPressure(body.atmospherePressureCurve, topLayer);
FixPressure(body, topLayer);
QuickFix(body.atmosphereTemperatureCurve, topLayer);
QuickFix(body.atmosphereTemperatureSunMultCurve, topLayer);
FixMaxAltitude(body, topLayer);
Expand All @@ -35,9 +35,13 @@ void Start()
}
}

void FixPressure(FloatCurve curve, double topLayer)
void FixPressure(CelestialBody body, double topLayer)
{
List<double[]> list = ReadCurve(curve); /* Avoid Bad Curves ==> */ if (list.Count < 2) { UnityEngine.Debug.Log("SigmaLog: This pressure curve has " + (list.Count == 0 ? "no keys" : "just one key") + ". I don't know what you expect me to do with that."); return; }
FloatCurve curve = body.atmospherePressureCurve;
List<double[]> list = ReadCurve(curve);

/* Remove ISP FIX ==> */ if (body.transform.name == "Kerbin" && list.Count > 0) { list.RemoveAt(0); }
/* Avoid Bad Curves ==> */ if (list.Count < 2) { UnityEngine.Debug.Log("SigmaLog: This pressure curve has " + (list.Count == 0 ? "no keys" : "just one key") + ". I don't know what you expect me to do with that."); return; }

double maxAltitude = list.Last()[0];

Expand All @@ -61,6 +65,8 @@ void FixPressure(FloatCurve curve, double topLayer)
Smooth(list);
}

/* Restore ISP FIX ==> */ if (body.transform.name == "Kerbin") { list.Insert(0, new[] { 0, 101.325, 0, 0, }); }

curve.Load(WriteCurve(list));
}

Expand Down Expand Up @@ -143,6 +149,8 @@ void Trim(List<double[]> list, double topLayer)

void Smooth(List<double[]> list)
{
FloatCurve curve = new FloatCurve();
curve.Load(WriteCurve(list));
double minPressure = list.First()[1];
double maxPressure = list.First()[1];

Expand All @@ -157,6 +165,14 @@ void Smooth(List<double[]> list)
for (int i = 0; i < list.Count; i++)
{
list[i][1] = (list[i][1] - minPressure) * maxPressure / (maxPressure - minPressure);

if (i > 0)
{
double dX = 0.01 * (list[i][0] - list[i - 1][0]);
double dY = list[i][1] - ((curve.Evaluate((float)(list[i][0] - dX)) - minPressure) * maxPressure / (maxPressure - minPressure));
list[i][2] = dY / dX;
list[i][3] = dY / dX;
}
}

list.Last()[2] = 0;
Expand Down

0 comments on commit bcc89d5

Please sign in to comment.