Skip to content

Commit

Permalink
Automatic merge of T1.5.1-684-gc6e0de1c4 and 9 pull requests
Browse files Browse the repository at this point in the history
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 67014b7: Dispatcher window improvements
- Pull request #874 at f8dbeab: Dynamic brake controller refactoring
- Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs
- Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder
- Pull request #878 at 89a0f99: Implement Polach Adhesion
- Pull request #882 at e92be5a: Blueprint/train car operations UI window
- Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
  • Loading branch information
openrails-bot committed Oct 28, 2023
11 parents 046b292 + c6e0de1 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + 89a0f99 + e92be5a + aac4d3f commit 1b1fab5
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -875,27 +875,29 @@ void Integrate(float elapsedClockSeconds)
if (elapsedClockSeconds <= 0) return;
double prevSpeedMpS = AxleSpeedMpS;

var upperSubStepStartingLimit = 120;
var upperSubStepLimit = upperSubStepStartingLimit;
var lowerSubStepLimit = 1;
float upperSubStepStartingLimit = 120;
float tempupperSubStepLimit = upperSubStepStartingLimit;
float lowerSubStepLimit = 1;

var screenFrameUpperLimit = 60;
var screenFrameLowerLimit = 40;
float screenFrameUpperLimit = 60;
float screenFrameLowerLimit = 40;

// Reduces the number of substeps if screen FPS drops
if (ScreenFrameRate >= screenFrameUpperLimit)
if ( (int)ScreenFrameRate >= screenFrameUpperLimit) // Screen FPS > 60, hold substeps @ maximum value
{
upperSubStepLimit = upperSubStepStartingLimit;
tempupperSubStepLimit = upperSubStepStartingLimit;
}
else if (ScreenFrameRate < screenFrameLowerLimit)
else if ((int)ScreenFrameRate < screenFrameLowerLimit) // Screen FPS < 40, hold substeps @ minimum value
{
upperSubStepLimit = upperSubStepStartingLimit * (screenFrameLowerLimit / screenFrameUpperLimit);
tempupperSubStepLimit = upperSubStepStartingLimit * (screenFrameLowerLimit / screenFrameUpperLimit);
}
else
{
upperSubStepLimit = (int) ((ScreenFrameRate / 60) * upperSubStepStartingLimit);
tempupperSubStepLimit = (int) ((ScreenFrameRate / 60) * upperSubStepStartingLimit);
}

var upperSubStepLimit = tempupperSubStepLimit;

// use straight line graph approximation to increase substeps as slipspeed increases towards the threshold speed point
// Points are 1 = (0, upperLimit) and 2 = (threshold, lowerLimit)
var AdhesGrad = ((upperSubStepLimit - lowerSubStepLimit) / (WheelSlipThresholdMpS - 0));
Expand Down Expand Up @@ -933,10 +935,10 @@ void Integrate(float elapsedClockSeconds)
}

if (NumOfSubstepsPS < lowerSubStepLimit)
NumOfSubstepsPS = lowerSubStepLimit;
NumOfSubstepsPS = (int)lowerSubStepLimit;

if (NumOfSubstepsPS > upperSubStepLimit)
NumOfSubstepsPS = upperSubStepLimit;
NumOfSubstepsPS = (int)upperSubStepLimit;

double dt = elapsedClockSeconds / NumOfSubstepsPS;
double hdt = dt / 2;
Expand Down

0 comments on commit 1b1fab5

Please sign in to comment.