Skip to content

Commit d593c10

Browse files
committed
Automatic merge of T1.5.1-925-g1c557094e and 19 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #799 at 1a70945: Consolidated wind simulation - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 3ca0eb1: Blueprint/train car operations UI window - Pull request #885 at 0a956f5: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #903 at 7af1f91: Downloading route content (Github, zip) - Pull request #912 at f7b85e4: New Triple Valve Features Vol. 2 - Pull request #919 at 26cc6a8: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #923 at cc1b5b6: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements - Pull request #925 at e3b1688: Fix brakeshoe force bug - Pull request #927 at 7bce293: AI Train Power Supply/Lights Fix - Pull request #929 at a406a69: Add support for common circuit breaker variants - Pull request #930 at 42398f4: Further enhancements for duplex locoomotive - Pull request #932 at 9bdb074: Changed matrix's to matrices
21 parents 07a773b + 1c55709 + 3539862 + 1a70945 + d00beb9 + f92de76 + 3ca0eb1 + 0a956f5 + 6c0785b + 1f5ba4c + 5866028 + 7af1f91 + f7b85e4 + 26cc6a8 + cc1b5b6 + 6c2c3cd + e3b1688 + 7bce293 + a406a69 + 42398f4 + 9bdb074 commit d593c10

File tree

21 files changed

+793
-595
lines changed

21 files changed

+793
-595
lines changed

Source/ORTS.Common/Conversions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ public static class FormatStrings
576576
public static string kN = Catalog.GetString("kN");
577577
public static string lbf = Catalog.GetString("lbf");
578578
public static string klbf = Catalog.GetString("klbf");
579+
public static string deg = Catalog.GetString("°");
579580

580581
/// <summary>
581582
/// Formatted unlocalized speed string, used in reports and logs.
@@ -838,6 +839,11 @@ public static string FormatAirFlow(float flowM3pS, bool isMetric)
838839
return String.Format(CultureInfo.CurrentCulture, "{0:F0} {1}", flow, isMetric ? lps : cfm);
839840
}
840841

842+
public static string FormatAngleDeg(float angleDeg)
843+
{
844+
return String.Format(CultureInfo.CurrentCulture, "{0:F0} {1}", angleDeg, deg);
845+
}
846+
841847
/// <summary>
842848
/// Converts duration in floating-point seconds to whole hours, minutes and seconds (rounded down).
843849
/// </summary>

Source/ORTS.Settings/UserSettings.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,6 @@ public enum DirectXFeature
319319
public bool AdhesionProportionalToWeather { get; set; }
320320
[Default(false)]
321321
public bool NoForcedRedAtStationStops { get; set; }
322-
[Default(100)]
323-
public int PrecipitationBoxHeight { get; set; }
324-
[Default(500)]
325-
public int PrecipitationBoxWidth { get; set; }
326-
[Default(500)]
327-
public int PrecipitationBoxLength { get; set; }
328322
[Default(false)]
329323
public bool CorrectQuestionableBrakingParams { get; set; }
330324
[Default(false)]

Source/Orts.Simulation/Simulation/AIs/AITrain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ public void AIUpdate(float elapsedClockSeconds, double clockTime, bool preUpdate
713713

714714
if (Cars[0] is MSTSLocomotive leadingLoco)
715715
{
716-
var isRainingOrSnowing = Simulator.Weather.PricipitationIntensityPPSPM2 > 0;
716+
var isRainingOrSnowing = Simulator.Weather.PrecipitationIntensityPPSPM2 > 0;
717717
if (leadingLoco.Wiper && !isRainingOrSnowing)
718718
leadingLoco.SignalEvent(Event.WiperOff);
719719
else if (!leadingLoco.Wiper && isRainingOrSnowing)

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,42 +2200,41 @@ public virtual void physicsUpdate(float elapsedClockSeconds)
22002200
public void UpdateWindComponents()
22012201
{
22022202
// Gets wind direction and speed, and determines HUD display values for the train as a whole.
2203-
//These will be representative of the train whilst it is on a straight track, but each wagon will vary when going around a curve.
2203+
// These will be representative of the train whilst it is on a straight track, but each wagon will vary when going around a curve.
22042204
// Note both train and wind direction will be positive between 0 (north) and 180 (south) through east, and negative between 0 (north) and 180 (south) through west
22052205
// Wind and train direction to be converted to an angle between 0 and 360 deg.
2206-
// Calculate Wind speed and direction, and train direction
2207-
// Update the value of the Wind Speed and Direction for the train
2208-
PhysicsWindDirectionDeg = MathHelper.ToDegrees(Simulator.Weather.WindDirection);
2209-
PhysicsWindSpeedMpS = Simulator.Weather.WindSpeed;
2210-
float TrainSpeedMpS = Math.Abs(SpeedMpS);
2211-
2212-
// If a westerly direction (ie -ve) convert to an angle between 0 and 360
2213-
if (PhysicsWindDirectionDeg < 0)
2214-
PhysicsWindDirectionDeg += 360;
2215-
2216-
if (PhysicsTrainLocoDirectionDeg < 0)
2217-
PhysicsTrainLocoDirectionDeg += 360;
2218-
2219-
// calculate angle between train and eind direction
2220-
if (PhysicsWindDirectionDeg > PhysicsTrainLocoDirectionDeg)
2221-
ResultantWindComponentDeg = PhysicsWindDirectionDeg - PhysicsTrainLocoDirectionDeg;
2222-
else if (PhysicsTrainLocoDirectionDeg > PhysicsWindDirectionDeg)
2223-
ResultantWindComponentDeg = PhysicsTrainLocoDirectionDeg - PhysicsWindDirectionDeg;
2224-
else
2225-
ResultantWindComponentDeg = 0.0f;
2226-
2227-
// Correct wind direction if it is greater then 360 deg, then correct to a value less then 360
2228-
if (Math.Abs(ResultantWindComponentDeg) > 360)
2229-
ResultantWindComponentDeg = ResultantWindComponentDeg - 360.0f;
2206+
// Calculate Wind speed and direction, and train direction
2207+
// Update the value of the Wind Speed and Direction for the train
2208+
PhysicsWindDirectionDeg = MathHelper.ToDegrees(Simulator.Weather.WindInstantaneousDirectionRad);
2209+
PhysicsWindSpeedMpS = Simulator.Weather.WindInstantaneousSpeedMpS;
2210+
var speedMpS = Math.Abs(SpeedMpS);
2211+
2212+
// If a westerly direction (ie -ve) convert to an angle between 0 and 360
2213+
if (PhysicsWindDirectionDeg < 0)
2214+
PhysicsWindDirectionDeg += 360;
2215+
2216+
if (PhysicsTrainLocoDirectionDeg < 0)
2217+
PhysicsTrainLocoDirectionDeg += 360;
2218+
2219+
// Calculate angle between train and wind direction
2220+
if (PhysicsWindDirectionDeg > PhysicsTrainLocoDirectionDeg)
2221+
ResultantWindComponentDeg = PhysicsWindDirectionDeg - PhysicsTrainLocoDirectionDeg;
2222+
else if (PhysicsTrainLocoDirectionDeg > PhysicsWindDirectionDeg)
2223+
ResultantWindComponentDeg = PhysicsTrainLocoDirectionDeg - PhysicsWindDirectionDeg;
2224+
else
2225+
ResultantWindComponentDeg = 0.0f;
22302226

2231-
// Wind angle should be kept between 0 and 180 the formulas do not cope with angles > 180. If angle > 180, denotes wind of "other" side of train
2232-
if (ResultantWindComponentDeg > 180)
2233-
ResultantWindComponentDeg = 360 - ResultantWindComponentDeg;
2227+
// Correct wind direction if it is greater then 360 deg, then correct to a value less then 360
2228+
if (Math.Abs(ResultantWindComponentDeg) > 360)
2229+
ResultantWindComponentDeg = ResultantWindComponentDeg - 360.0f;
22342230

2235-
float WindAngleRad = MathHelper.ToRadians(ResultantWindComponentDeg);
2231+
// Wind angle should be kept between 0 and 180 the formulas do not cope with angles > 180. If angle > 180, denotes wind of "other" side of train
2232+
if (ResultantWindComponentDeg > 180)
2233+
ResultantWindComponentDeg = 360 - ResultantWindComponentDeg;
22362234

2237-
WindResultantSpeedMpS = (float)Math.Sqrt(TrainSpeedMpS * TrainSpeedMpS + PhysicsWindSpeedMpS * PhysicsWindSpeedMpS + 2.0f * TrainSpeedMpS * PhysicsWindSpeedMpS * (float)Math.Cos(WindAngleRad));
2238-
}
2235+
var windAngleRad = MathHelper.ToRadians(ResultantWindComponentDeg);
2236+
WindResultantSpeedMpS = (float)Math.Sqrt(speedMpS * speedMpS + PhysicsWindSpeedMpS * PhysicsWindSpeedMpS + 2.0f * speedMpS * PhysicsWindSpeedMpS * (float)Math.Cos(windAngleRad));
2237+
}
22392238

22402239

22412240
//================================================================================================//

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,7 +3234,7 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
32343234
{
32353235
var fogBaseFrictionCoefficientFactor = 1.0f;
32363236
var pricBaseFrictionCoefficientFactor = 1.0f;
3237-
float pric = Simulator.Weather.PricipitationIntensityPPSPM2 * 1000;
3237+
float pric = Simulator.Weather.PrecipitationIntensityPPSPM2 * 1000;
32383238
// precipitation will calculate a base coefficient value between 60% (light rain) and 90% (heavy rain) - this will be a factor that is used to adjust the base value
32393239
// assume linear value between upper and lower precipitation values. Limits are set in the weather module, ie Rain = 0.01ppm (10) and Snow = 0.005ppm (5)
32403240
float precGrad = (0.2f - 0) / (10f - 5f);
@@ -3250,7 +3250,7 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
32503250
}
32513251

32523252
// Adjust adhesion for impact of fog - default = 20000m = 20km
3253-
float fog = Simulator.Weather.FogDistance;
3253+
float fog = Simulator.Weather.VisibilityM;
32543254
if (fog < 20000) // as fog thickens then decrease adhesion
32553255
{
32563256
fogBaseFrictionCoefficientFactor = Math.Min((fog * 2.75e-4f + 0.6f), 1.0f); // If fog is less then 2km then it will impact friction, decrease adhesion to 60% (same as light rain transition)

0 commit comments

Comments
 (0)