Skip to content

Commit

Permalink
Merge pull request #36 from Sigma88/Development
Browse files Browse the repository at this point in the history
Sigma Dimensions v0.7.5
Sigma88 authored Apr 8, 2017
2 parents 44098ad + aaf0fcb commit 1e8a1fc
Showing 27 changed files with 66 additions and 10,612 deletions.
9 changes: 9 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
**v0.7.5**

- Fixed Atmosphere handling when using atmoTopLayer
- EVE clouds altitude now account for landscape
- Changed the way timewarp limits are resized
- Fixed PQSCity2 altitude resize
- Fixed KSC Water Tower Light resize


**v0.7.4**

- Fixed a bug that made atmoTopLayer apply multiple times
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
@OBJECT:HAS[~customResize[>0]]
{
@altitude *= #$@SigmaDimensions/Resize$
@altitude *= #$@SigmaDimensions/landscape$
@layerVolume:HAS[#size[*,*]]
{
@size[0] *= #$@SigmaDimensions/Atmosphere$
11 changes: 7 additions & 4 deletions GameData/Sigma/Dimensions/Configs/ReDimension/setDimensions.cfg
Original file line number Diff line number Diff line change
@@ -4,21 +4,24 @@
{
@Properties
{
@timewarpAltitudeLimits,0[*, ] *= #$../SigmaDimensions/Atmosphere$
@inverseRotThresholdAltitude *= #$../SigmaDimensions/Atmosphere$

@timewarpAltitudeLimits,0[*, ] *= #$../SigmaDimensions/atmoTopLayer$
@inverseRotThresholdAltitude *= #$../SigmaDimensions/atmoTopLayer$
}
}
@Body:HAS[!Atmosphere]
{
@Properties
{
@timewarpAltitudeLimits,0[*, ] *= #$../SigmaDimensions/Resize$
@inverseRotThresholdAltitude *= #$../SigmaDimensions/Resize$
}
}
@Body:HAS[@SigmaDimensions:HAS[#Resize[<1]]]
{
@Properties
{
@timewarpAltitudeLimits,0[*, ] *= #$../SigmaDimensions/Resize$
}
}
@Body,*
{
@Properties
2 changes: 1 addition & 1 deletion GameData/Sigma/Dimensions/Configs/Sigma-Dimensions.version
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
{
"MAJOR": 0,
"MINOR": 7,
"PATCH": 4,
"PATCH": 5,
"BUILD": 0
},
"KSP_VERSION":
Binary file modified GameData/Sigma/Dimensions/Plugins/SigmaDimensions.dll
Binary file not shown.
487 changes: 0 additions & 487 deletions [KittopiaExports]/Bop.cfg

This file was deleted.

362 changes: 0 additions & 362 deletions [KittopiaExports]/Dres.cfg

This file was deleted.

936 changes: 0 additions & 936 deletions [KittopiaExports]/Duna.cfg

This file was deleted.

638 changes: 0 additions & 638 deletions [KittopiaExports]/Eeloo.cfg

This file was deleted.

899 changes: 0 additions & 899 deletions [KittopiaExports]/Eve.cfg

This file was deleted.

407 changes: 0 additions & 407 deletions [KittopiaExports]/Gilly.cfg

This file was deleted.

454 changes: 0 additions & 454 deletions [KittopiaExports]/Ike.cfg

This file was deleted.

189 changes: 0 additions & 189 deletions [KittopiaExports]/Jool.cfg

This file was deleted.

1,793 changes: 0 additions & 1,793 deletions [KittopiaExports]/Kerbin.cfg

This file was deleted.

1,089 changes: 0 additions & 1,089 deletions [KittopiaExports]/Laythe.cfg

This file was deleted.

560 changes: 0 additions & 560 deletions [KittopiaExports]/Minmus.cfg

This file was deleted.

400 changes: 0 additions & 400 deletions [KittopiaExports]/Moho.cfg

This file was deleted.

612 changes: 0 additions & 612 deletions [KittopiaExports]/Mun.cfg

This file was deleted.

518 changes: 0 additions & 518 deletions [KittopiaExports]/Pol.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions [KittopiaExports]/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Kittopia Exports have been moved

## Find them here: https://github.com/Kopernicus/kittopia-dumps
186 changes: 0 additions & 186 deletions [KittopiaExports]/Sun.cfg

This file was deleted.

536 changes: 0 additions & 536 deletions [KittopiaExports]/Tylo.cfg

This file was deleted.

516 changes: 0 additions & 516 deletions [KittopiaExports]/Vall.cfg

This file was deleted.

Binary file modified [Source]/Distribution/SigmaDimensions.dll
Binary file not shown.
51 changes: 33 additions & 18 deletions [Source]/SigmaDimensions/AtmosphereTopLayer.cs
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ void FixPressure(FloatCurve curve, double topLayer)
double maxAltitude = list.Last()[0];

bool smoothEnd = list.Last()[1] == 0 && list.Count > 2;
double smoothRange = list.Last()[0] - list[list.Count - 2][0];

if (smoothEnd) list.RemoveAt(list.Count - 1);

if (topLayer > maxAltitude)
@@ -58,7 +58,7 @@ void FixPressure(FloatCurve curve, double topLayer)

if (smoothEnd)
{
Smooth(list, smoothRange);
Smooth(list);
}

curve.Load(WriteCurve(list));
@@ -92,7 +92,9 @@ void Extend(List<double[]> list, double topLayer)
{
newAltitude += dX;
double newPressure = getY(newAltitude, list.Last(), K);
double[] newKey = { newAltitude, newPressure };
double tangent = (newPressure - getY(newAltitude - dX * 0.01, list.Last(), K)) / (dX * 0.01);

double[] newKey = { newAltitude, newPressure, tangent, tangent };

if (newKey[1] < 0)
{
@@ -118,34 +120,47 @@ void Trim(List<double[]> list, double topLayer)

for (int i = list.Count; i > 0; i--)
{
if (list[i - 1][0] >= topLayer)
if (list[i - 2][0] < topLayer)
{
double dX = 0.01 * (lastKey[0] - list[i - 2][0]);
double dY = lastKey[1] - curve.Evaluate((float)(lastKey[0] - dX));
double tangent = dY / dX;

list.RemoveAt(i - 1);
}

list.Add(lastKey);
list.Add(new double[] { lastKey[0], lastKey[1], tangent, tangent });
break;
}
else
{
list.RemoveAt(i - 1);
}
}

// Debug
PrintCurve(list, "Trim");
}

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

double[] newKey = { smoothStart, curve.Evaluate((float)smoothStart) };
double[] lastKey = { topLayer, 0, 0, 0 };
for (int i = 0; i < list.Count; i++)
{
if (list[i][1] < minPressure)
minPressure = list[i][1];
if (list[i][1] > maxPressure)
maxPressure = list[i][1];
}

for (int i = list.Count; i > 0; i--)
for (int i = 0; i < list.Count; i++)
{
if (list[i - 1][0] >= smoothStart)
list.RemoveAt(i - 1);
list[i][1] = (list[i][1] - minPressure) * maxPressure / (maxPressure - minPressure);
}

list.Add(newKey);
list.Add(lastKey);
list.Last()[2] = 0;
list.Last()[3] = 0;

// Debug
PrintCurve(list, "Smooth");
13 changes: 8 additions & 5 deletions [Source]/SigmaDimensions/SigmaDimensions.cs
Original file line number Diff line number Diff line change
@@ -107,18 +107,21 @@ void City2Fixer(PQSCity2 pqs)

if (!pqs.snapToSurface)
{
// Offset = Distance from the center of the planet
// Offset = Distance from the radius of the planet

double groundLevel = body.pqsController.GetSurfaceHeight(pqs.PlanetRelativePosition) - body.Radius;
double fromRadius = pqs.alt - (body.Radius / resize);
double builtInOffset = fromRadius - groundLevel / (resize * landscape);

pqs.alt = body.Radius + groundLevel + builtInOffset * resizeBuildings;
if (body.ocean && groundLevel < 0)
{
groundLevel = 0;
}

double builtInOffset = pqs.alt - groundLevel / (resize * landscape);
pqs.alt = groundLevel + builtInOffset * resizeBuildings;
}
else
{
// Offset = Distance from the surface of the planet

pqs.snapHeightOffset *= resizeBuildings;
}
}
6 changes: 4 additions & 2 deletions [Source]/SigmaDimensions/SpaceCenterFixer.cs
Original file line number Diff line number Diff line change
@@ -34,11 +34,13 @@ void Update()
{
if (light == null)
{
light = Array.Find(GameObject.FindGameObjectsWithTag("KSC_Pad_Water_Tower"), o => o.name == "Spotlight")?.GetComponent<Light>();
light = Array.Find((Light[])FindObjectsOfType(typeof(Light)), o => o.name == "Spotlight" && o.tag == "KSC_Pad_Water_Tower");
}
else
{
light.range *= (float)(FlightGlobals.GetHomeBody().Has("resizeBuildings") ? FlightGlobals.GetHomeBody().Get<double>("resizeBuildings") : 1);
if (FlightGlobals.GetHomeBody().Has("resizeBuildings"))
light.range *= (float)(FlightGlobals.GetHomeBody().Get<double>("resizeBuildings"));

fixLight = false;
}
}

0 comments on commit 1e8a1fc

Please sign in to comment.