mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 00:29:19 +02:00
minor bug fixes
This commit is contained in:
@@ -1408,9 +1408,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
|
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
|
||||||
continue; // i tyle wystarczy
|
continue; // i tyle wystarczy
|
||||||
}
|
}
|
||||||
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno
|
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno dotyczyć samochodów?)
|
||||||
// dotyczyć samochodów?)
|
a = (v > 0.0 ?
|
||||||
a = (v == 0.0 ? -1.0 : fAcc); // ruszanie albo hamowanie
|
fAcc :
|
||||||
|
mvOccupied->Vel < 0.01 ?
|
||||||
|
0.0 : // already standing still so no need to bother with brakes
|
||||||
|
-2.0 ); // ruszanie albo hamowanie
|
||||||
|
|
||||||
if ((a < fAcc) && (v == std::min(v, fNext))) {
|
if ((a < fAcc) && (v == std::min(v, fNext))) {
|
||||||
// mniejsze przyspieszenie to mniejsza możliwość rozpędzenia się albo konieczność hamowania
|
// mniejsze przyspieszenie to mniejsza możliwość rozpędzenia się albo konieczność hamowania
|
||||||
|
|||||||
@@ -1003,10 +1003,8 @@ transcripts_panel::update() {
|
|||||||
text_lines.clear();
|
text_lines.clear();
|
||||||
|
|
||||||
for( auto const &transcript : ui::Transcripts.aLines ) {
|
for( auto const &transcript : ui::Transcripts.aLines ) {
|
||||||
if( Global.fTimeAngleDeg >= transcript.fShow ) {
|
if( Global.fTimeAngleDeg + ( transcript.fShow - Global.fTimeAngleDeg > 180 ? 360 : 0 ) < transcript.fShow ) { continue; }
|
||||||
// NOTE: legacy transcript lines use | as new line mark
|
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
|
||||||
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,17 @@ world_environment::update() {
|
|||||||
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
|
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
|
||||||
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
|
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
|
||||||
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
||||||
|
|
||||||
|
// ...update skydome to match the current sun position as well...
|
||||||
|
// twilight factor can be reset later down, so we do it here while it's still reflecting state of the sun
|
||||||
|
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
|
||||||
|
m_skydome.SetTurbidity(
|
||||||
|
2.f
|
||||||
|
+ clamp( Global.Overcast, 0.f, 1.f )
|
||||||
|
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
|
||||||
|
m_skydome.SetOvercastFactor( Global.Overcast );
|
||||||
|
m_skydome.Update( m_sun.getDirection() );
|
||||||
|
|
||||||
float keylightintensity;
|
float keylightintensity;
|
||||||
glm::vec3 keylightcolor;
|
glm::vec3 keylightcolor;
|
||||||
if( moonlightlevel > sunlightlevel ) {
|
if( moonlightlevel > sunlightlevel ) {
|
||||||
@@ -117,14 +128,6 @@ world_environment::update() {
|
|||||||
glm::vec3( 235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f ),
|
glm::vec3( 235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f ),
|
||||||
duskfactor );
|
duskfactor );
|
||||||
}
|
}
|
||||||
// ...update skydome to match the current sun position as well...
|
|
||||||
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
|
|
||||||
m_skydome.SetTurbidity(
|
|
||||||
2.f
|
|
||||||
+ clamp( Global.Overcast, 0.f, 1.f )
|
|
||||||
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
|
|
||||||
m_skydome.SetOvercastFactor( Global.Overcast );
|
|
||||||
m_skydome.Update( m_sun.getDirection() );
|
|
||||||
// ...retrieve current sky colour and brightness...
|
// ...retrieve current sky colour and brightness...
|
||||||
auto const skydomecolour = m_skydome.GetAverageColor();
|
auto const skydomecolour = m_skydome.GetAverageColor();
|
||||||
auto const skydomehsv = colors::RGBtoHSV( skydomecolour );
|
auto const skydomehsv = colors::RGBtoHSV( skydomecolour );
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ TTranscripts::AddLine( std::string const &txt, float show, float hide, bool it )
|
|||||||
|
|
||||||
if( show == hide ) { return; } // komentarz jest ignorowany
|
if( show == hide ) { return; } // komentarz jest ignorowany
|
||||||
|
|
||||||
|
// TODO: replace the timeangledeg mess with regular time points math
|
||||||
show = Global.fTimeAngleDeg + show / 240.0; // jeśli doba to 360, to 1s będzie równe 1/240
|
show = Global.fTimeAngleDeg + show / 240.0; // jeśli doba to 360, to 1s będzie równe 1/240
|
||||||
hide = Global.fTimeAngleDeg + hide / 240.0;
|
hide = Global.fTimeAngleDeg + hide / 240.0;
|
||||||
|
|
||||||
TTranscript transcript;
|
TTranscript transcript;
|
||||||
transcript.asText = txt;
|
transcript.asText = ExchangeCharInString( txt, '|', ' ' ); // NOTE: legacy transcript lines use | as new line mark
|
||||||
transcript.fShow = show;
|
transcript.fShow = show;
|
||||||
transcript.fHide = hide;
|
transcript.fHide = hide;
|
||||||
transcript.bItalic = it;
|
transcript.bItalic = it;
|
||||||
@@ -64,12 +65,25 @@ TTranscripts::Add( std::string const &txt, bool backgorund ) {
|
|||||||
void
|
void
|
||||||
TTranscripts::Update() {
|
TTranscripts::Update() {
|
||||||
|
|
||||||
|
// HACK: detect day change
|
||||||
|
if( fRefreshTime - Global.fTimeAngleDeg > 180 ) {
|
||||||
|
fRefreshTime -= 360;
|
||||||
|
}
|
||||||
|
|
||||||
if( Global.fTimeAngleDeg < fRefreshTime ) { return; } // nie czas jeszcze na zmiany
|
if( Global.fTimeAngleDeg < fRefreshTime ) { return; } // nie czas jeszcze na zmiany
|
||||||
|
|
||||||
while( ( false == aLines.empty() )
|
// remove expired lines
|
||||||
&& ( Global.fTimeAngleDeg >= aLines.front().fHide ) ) {
|
while( false == aLines.empty() ) {
|
||||||
// remove expired lines
|
// HACK: detect day change
|
||||||
aLines.pop_front();
|
if( aLines.front().fHide - Global.fTimeAngleDeg > 180 ) {
|
||||||
|
aLines.front().fShow -= 360;
|
||||||
|
aLines.front().fHide -= 360;
|
||||||
|
}
|
||||||
|
if( Global.fTimeAngleDeg <= aLines.front().fHide ) {
|
||||||
|
// no expired lines yet
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
aLines.pop_front(); // this line expired, discard it and start anew with the next one
|
||||||
}
|
}
|
||||||
// update next refresh time
|
// update next refresh time
|
||||||
if( false == aLines.empty() ) { fRefreshTime = aLines.front().fHide; }
|
if( false == aLines.empty() ) { fRefreshTime = aLines.front().fHide; }
|
||||||
|
|||||||
Reference in New Issue
Block a user