mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 190103. configurable reflections refresh rate, resolution based point light size, ai master controller logic enhancement, minor event diagnostic enhancement, minor bug fixes
This commit is contained in:
19
Driver.cpp
19
Driver.cpp
@@ -2885,10 +2885,12 @@ bool TController::IncSpeed()
|
||||
if( usefieldshunting ) {
|
||||
// to dać bocznik
|
||||
// engage the shuntfield only if there's sufficient power margin to draw from
|
||||
auto const sufficientpowermargin { fVoltage - useseriesmodevoltage > ( IsHeavyCargoTrain ? 100.0 : 50.0 ) };
|
||||
|
||||
OK = (
|
||||
fVoltage > useseriesmodevoltage + 0.0125 * mvControlling->EnginePowerSource.CollectorParameters.MaxV ?
|
||||
sufficientpowermargin ?
|
||||
mvControlling->IncScndCtrl( 1 ) :
|
||||
false );
|
||||
true );
|
||||
}
|
||||
else {
|
||||
// jeśli ustawiony bocznik to bocznik na zero po chamsku
|
||||
@@ -2896,10 +2898,12 @@ bool TController::IncSpeed()
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
}
|
||||
// kręcimy nastawnik jazdy
|
||||
auto const sufficientpowermargin { fVoltage - useseriesmodevoltage > ( IsHeavyCargoTrain ? 80.0 : 40.0 ) };
|
||||
|
||||
OK = (
|
||||
mvControlling->DelayCtrlFlag ?
|
||||
true :
|
||||
mvControlling->IncMainCtrl( 1 ) );
|
||||
( sufficientpowermargin && ( false == mvControlling->DelayCtrlFlag ) ) ?
|
||||
mvControlling->IncMainCtrl( 1 ) :
|
||||
true );
|
||||
// czekaj na 1 pozycji, zanim się nie włączą liniowe
|
||||
if( true == mvControlling->StLinFlag ) {
|
||||
iDrivigFlags |= moveIncSpeed;
|
||||
@@ -4008,7 +4012,10 @@ TController::UpdateSituation(double dt) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if( fVoltage < 0.75 * mvControlling->EnginePowerSource.CollectorParameters.MaxV ) {
|
||||
|
||||
auto const useseriesmodevoltage { mvControlling->EnginePowerSource.CollectorParameters.MaxV * ( IsHeavyCargoTrain ? 0.70 : 0.80 ) };
|
||||
|
||||
if( fVoltage <= useseriesmodevoltage ) {
|
||||
// if the power station is heavily burdened try to reduce the load
|
||||
switch( mvControlling->EngineType ) {
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ basic_event::event_conditions::test() const {
|
||||
match_value_2,
|
||||
flags );
|
||||
|
||||
std::string comparisonlog = "Test: MemCompare - ";
|
||||
std::string comparisonlog = "Test: MemCompare - " + cell->name() + " - ";
|
||||
|
||||
comparisonlog +=
|
||||
"[" + cell->Text() + "]"
|
||||
|
||||
@@ -384,6 +384,14 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
Parser.getTokens();
|
||||
Parser >> ResourceMove;
|
||||
}
|
||||
else if( token == "gfx.reflections.framerate" ) {
|
||||
|
||||
auto const updatespersecond { std::abs( Parser.getToken<double>() ) };
|
||||
ReflectionUpdatesPerSecond = (
|
||||
updatespersecond > 0 ?
|
||||
1000 / std::min( 30.0, updatespersecond ) :
|
||||
0 );
|
||||
}
|
||||
else if (token == "timespeed")
|
||||
{
|
||||
// przyspieszenie czasu, zmienna do testów
|
||||
|
||||
@@ -115,6 +115,7 @@ struct global_settings {
|
||||
float depth{ 250.f };
|
||||
float distance{ 500.f }; // no longer used
|
||||
} shadowtune;
|
||||
int ReflectionUpdatesPerSecond{ static_cast<int>( 1000 / ( 1.0 / 300.0 ) ) };
|
||||
bool bUseVBO{ true }; // czy jest VBO w karcie graficznej (czy użyć)
|
||||
float AnisotropicFiltering{ 8.f }; // requested level of anisotropic filtering. TODO: move it to renderer object
|
||||
float FieldOfView{ 45.f }; // vertical field of view for the camera. TODO: move it to the renderer
|
||||
|
||||
@@ -1003,13 +1003,6 @@ public:
|
||||
TRotation Rot { 0.0, 0.0, 0.0 };
|
||||
std::string Name; /*nazwa wlasna*/
|
||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||
enum hvcoupler {
|
||||
current = 0,
|
||||
voltage
|
||||
};
|
||||
#endif
|
||||
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
|
||||
int SoundFlag = 0; /*!o patrz stale sound_ */
|
||||
double DistCounter = 0.0; /*! licznik kilometrow */
|
||||
|
||||
@@ -316,12 +316,6 @@ ActiveCab( Cab )
|
||||
Couplers[b].DmaxC = 0.1;
|
||||
Couplers[b].FmaxC = 1000.0;
|
||||
}
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
HVCouplers[ side ][ hvcoupler::voltage ] = 0.0;
|
||||
}
|
||||
#endif
|
||||
for( int b = 0; b < 3; ++b ) {
|
||||
BrakeCylMult[ b ] = 0.0;
|
||||
}
|
||||
@@ -816,13 +810,20 @@ void TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
&& ( EngineType != TEngineType::WheelsDriven )
|
||||
&& ( NominalBatteryVoltage > 0 ) ) {
|
||||
|
||||
// HACK: allow to draw power also from adjacent converter, applicable for EMUs
|
||||
// TODO: expand power cables system to include low voltage power transfers
|
||||
auto const converteractive{ (
|
||||
( ConverterFlag )
|
||||
|| ( ( ( Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && Couplers[ side::front ].Connected->ConverterFlag )
|
||||
|| ( ( ( Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && Couplers[ side::rear ].Connected->ConverterFlag ) ) };
|
||||
|
||||
if ((NominalBatteryVoltage / BatteryVoltage < 1.22) && Battery)
|
||||
{ // 110V
|
||||
if (!ConverterFlag)
|
||||
if (!converteractive)
|
||||
sn1 = (dt * 2.0); // szybki spadek do ok 90V
|
||||
else
|
||||
sn1 = 0;
|
||||
if (ConverterFlag)
|
||||
if (converteractive)
|
||||
sn2 = -(dt * 2.0); // szybki wzrost do 110V
|
||||
else
|
||||
sn2 = 0;
|
||||
@@ -846,7 +847,7 @@ void TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
sn1 = (dt * 0.0046);
|
||||
else
|
||||
sn1 = 0;
|
||||
if (ConverterFlag)
|
||||
if (converteractive)
|
||||
sn2 = -(dt * 50); // szybki wzrost do 110V
|
||||
else
|
||||
sn2 = 0;
|
||||
@@ -1120,33 +1121,18 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
Couplers[ side ].Connected->HVCouplers[ Couplers[ side ].ConnectedNr ][ hvcoupler::voltage ] - HVCouplers[ side ][ hvcoupler::current ] * 0.02 );
|
||||
#else
|
||||
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
|
||||
Couplers[ oppositeside ].power_high.voltage =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
connectedcoupler.power_high.voltage - Couplers[ side ].power_high.current * 0.02 );
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] = std::abs( hvc ) - HVCouplers[ side ][ hvcoupler::current ] * 0.02;
|
||||
#else
|
||||
Couplers[ oppositeside ].power_high.voltage = std::abs( hvc ) - Couplers[ side ].power_high.current * 0.02;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
hvc = HVCouplers[ side::front ][ hvcoupler::voltage ] + HVCouplers[ side::rear ][ hvcoupler::voltage ];
|
||||
#else
|
||||
hvc = Couplers[ side::front ].power_high.voltage + Couplers[ side::rear ].power_high.voltage;
|
||||
#endif
|
||||
|
||||
if( std::abs( PantFrontVolt ) + std::abs( PantRearVolt ) < 1.0 ) {
|
||||
// bez napiecia...
|
||||
@@ -1160,29 +1146,17 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
auto const oppositeside = ( Couplers[side].ConnectedNr == side::front ? side::rear : side::front );
|
||||
HVCouplers[ side ][ hvcoupler::current ] =
|
||||
Couplers[side].Connected->HVCouplers[oppositeside][hvcoupler::current] +
|
||||
Itot * HVCouplers[side][hvcoupler::voltage] / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#else
|
||||
auto const &connectedsothercoupler =
|
||||
auto const &connectedcoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
Couplers[ side ].power_high.current =
|
||||
connectedsothercoupler.power_high.current
|
||||
connectedcoupler.power_high.current
|
||||
+ Itot * Couplers[ side ].power_high.voltage / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
// pierwszy pojazd
|
||||
HVCouplers[side][hvcoupler::current] = Itot * HVCouplers[side][hvcoupler::voltage] / hvc;
|
||||
#else
|
||||
Couplers[ side ].power_high.current = Itot * Couplers[ side ].power_high.voltage / hvc;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1196,19 +1170,13 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
auto const oppositeside = ( Couplers[ side ].ConnectedNr == side::front ? side::rear : side::front );
|
||||
TotalCurrent += Couplers[ side ].Connected->HVCouplers[ oppositeside ][ hvcoupler::current ];
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
#else
|
||||
auto const &connectedsothercoupler =
|
||||
auto const &connectedcoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
TotalCurrent += connectedsothercoupler.power_high.current;
|
||||
TotalCurrent += connectedcoupler.power_high.current;
|
||||
Couplers[ side ].power_high.current = 0.0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4007,11 +3975,9 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer)
|
||||
Voltage =
|
||||
std::max(
|
||||
RunningTraction.TractionVoltage,
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
std::max( HVCouplers[side::front][hvcoupler::voltage], HVCouplers[side::rear][hvcoupler::voltage] ) );
|
||||
#else
|
||||
std::max( Couplers[ side::front ].power_high.voltage, Couplers[ side::rear ].power_high.voltage ) );
|
||||
#endif
|
||||
std::max(
|
||||
Couplers[ side::front ].power_high.voltage,
|
||||
Couplers[ side::rear ].power_high.voltage ) );
|
||||
}
|
||||
else {
|
||||
Voltage = 0;
|
||||
@@ -7023,16 +6989,6 @@ std::string TMoverParameters::EngineDescription(int what) const
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::GetTrainsetVoltage(void)
|
||||
{//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
return std::max(
|
||||
HVCouplers[ side::front ][ hvcoupler::voltage ],
|
||||
HVCouplers[ side::rear ][ hvcoupler::voltage ] );
|
||||
#else
|
||||
/*
|
||||
return std::max(
|
||||
Couplers[ side::front ].power_high.voltage,
|
||||
Couplers[ side::rear ].power_high.voltage );
|
||||
*/
|
||||
return std::max(
|
||||
( ( ( Couplers[side::front].Connected )
|
||||
&& ( ( Couplers[ side::front ].CouplingFlag & ctrain_power )
|
||||
@@ -7046,7 +7002,6 @@ double TMoverParameters::GetTrainsetVoltage(void)
|
||||
&& ( Couplers[ side::rear ].CouplingFlag & ctrain_heating ) ) ) ) ?
|
||||
Couplers[ side::rear ].Connected->Couplers[ Couplers[ side::rear ].ConnectedNr ].power_high.voltage :
|
||||
0.0 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
@@ -550,7 +550,7 @@ PyObject *TTrain::GetTrainState() {
|
||||
PyDict_SetItemString( dict, "train_enginetype", PyGetString( timetable->LocSeries.c_str() ) );
|
||||
PyDict_SetItemString( dict, "train_engineload", PyGetFloat( timetable->LocLoad ) );
|
||||
|
||||
PyDict_SetItemString( dict, "train_stationindex", PyGetInt( driver->StationIndex() ) );
|
||||
PyDict_SetItemString( dict, "train_stationindex", PyGetInt( driver->iStationStart ) );
|
||||
auto const stationcount { driver->StationCount() };
|
||||
PyDict_SetItemString( dict, "train_stationcount", PyGetInt( stationcount ) );
|
||||
if( stationcount > 0 ) {
|
||||
@@ -5009,8 +5009,10 @@ bool TTrain::Update( double const Deltatime )
|
||||
iUnits[i] = iUnitNo;
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.length() - 1];
|
||||
asCarName[i] = p->name();
|
||||
bPants[iUnitNo - 1][0] = (bPants[iUnitNo - 1][0] || p->MoverParameters->PantFrontUp);
|
||||
bPants[iUnitNo - 1][1] = (bPants[iUnitNo - 1][1] || p->MoverParameters->PantRearUp);
|
||||
if( p->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector ) {
|
||||
bPants[iUnitNo - 1][side::front] = ( bPants[iUnitNo - 1][side::front] || p->MoverParameters->PantFrontUp );
|
||||
bPants[iUnitNo - 1][side::rear] = ( bPants[iUnitNo - 1][side::rear] || p->MoverParameters->PantRearUp );
|
||||
}
|
||||
bComp[iUnitNo - 1][0] = (bComp[iUnitNo - 1][0] || p->MoverParameters->CompressorAllow || (p->MoverParameters->CompressorStart == start_t::automatic));
|
||||
bSlip[i] = p->MoverParameters->SlippingWheels;
|
||||
if (p->MoverParameters->CompressorSpeed > 0.00001)
|
||||
|
||||
15
renderer.cpp
15
renderer.cpp
@@ -789,9 +789,15 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
|
||||
bool
|
||||
opengl_renderer::Render_reflections() {
|
||||
|
||||
if( Global.ReflectionUpdatesPerSecond == 0 ) { return false; }
|
||||
|
||||
auto const &time = simulation::Time.data();
|
||||
auto const timestamp = time.wDay * 24 * 60 + time.wHour * 60 + time.wMinute;
|
||||
if( ( timestamp - m_environmentupdatetime < 5 )
|
||||
auto const timestamp =
|
||||
time.wMilliseconds
|
||||
+ time.wSecond * 1000
|
||||
+ time.wMinute * 1000 * 60
|
||||
+ time.wHour * 1000 * 60 * 60;
|
||||
if( ( timestamp - m_environmentupdatetime < Global.ReflectionUpdatesPerSecond )
|
||||
&& ( glm::length( m_renderpass.camera.position() - m_environmentupdatelocation ) < 1000.0 ) ) {
|
||||
// run update every 5+ mins of simulation time, or at least 1km from the last location
|
||||
return false;
|
||||
@@ -2578,6 +2584,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
// we're capping how much effect the distance attenuation can have, otherwise the lights get too tiny at regular distances
|
||||
float const distancefactor { std::max( 0.5f, ( Submodel->fSquareMaxDist - TSubModel::fSquareDist ) / Submodel->fSquareMaxDist ) };
|
||||
auto const pointsize { std::max( 3.f, 5.f * distancefactor * anglefactor ) };
|
||||
auto const resolutionratio { Global.iWindowHeight / 1080.f };
|
||||
// additionally reduce light strength for farther sources in rain or snow
|
||||
if( Global.Overcast > 0.75f ) {
|
||||
float const precipitationfactor{
|
||||
@@ -2621,7 +2628,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
clamp<float>( Global.fFogEnd / 2000, 0.f, 1.f ) )
|
||||
* std::max( 1.f, Global.Overcast ) };
|
||||
|
||||
::glPointSize( pointsize * fogfactor );
|
||||
::glPointSize( pointsize * resolutionratio * fogfactor );
|
||||
::glColor4f(
|
||||
lightcolor[ 0 ],
|
||||
lightcolor[ 1 ],
|
||||
@@ -2631,7 +2638,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
m_geometry.draw( Submodel->m_geometry );
|
||||
::glDepthMask( GL_TRUE );
|
||||
}
|
||||
::glPointSize( pointsize );
|
||||
::glPointSize( pointsize * resolutionratio );
|
||||
::glColor4f(
|
||||
lightcolor[ 0 ],
|
||||
lightcolor[ 1 ],
|
||||
|
||||
@@ -168,7 +168,7 @@ init() {
|
||||
"Nastawnik: %2d+%d %c%s",
|
||||
" Predkosc: %d km/h (limit %d km/h%s)%s",
|
||||
", nowy limit: %d km/h za %.1f km",
|
||||
" Pochylenie: %.1f%%%%",
|
||||
" Nachylenie: %.1f%%%%",
|
||||
"Hamulce: %4.1f+%-2.0f%c%s",
|
||||
" Cisnienie: %.2f kPa (przewod glowny: %.2f kPa)",
|
||||
"!CZUWAK! ",
|
||||
|
||||
Reference in New Issue
Block a user