16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 20:59:19 +02:00

build 210330. minor bug fixes

This commit is contained in:
tmj-fstate
2021-03-30 18:06:24 +02:00
parent 195b7cb17b
commit 893e7e9c44
13 changed files with 118 additions and 47 deletions

View File

@@ -2064,10 +2064,6 @@ void TController::Activation()
} }
if (pVehicle != initialvehicle) if (pVehicle != initialvehicle)
{ // jeśli zmieniony został pojazd prowadzony { // jeśli zmieniony został pojazd prowadzony
auto *train { simulation::Trains.find( initialvehicle->name() ) };
if( train ) {
train->MoveToVehicle( pVehicle );
}
ControllingSet(); // utworzenie połączenia do sterowanego pojazdu (może się zmienić) - silnikowy dla EZT ControllingSet(); // utworzenie połączenia do sterowanego pojazdu (może się zmienić) - silnikowy dla EZT
if( ( mvOccupied->BrakeCtrlPosNo > 0 ) if( ( mvOccupied->BrakeCtrlPosNo > 0 )
&& ( ( mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic ) && ( ( mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic )
@@ -2089,13 +2085,20 @@ void TController::Activation()
mvOccupied->CabOccupied = iDirection; // aktywacja kabiny w prowadzonym pojeżdzie (silnikowy może być odwrotnie?) mvOccupied->CabOccupied = iDirection; // aktywacja kabiny w prowadzonym pojeżdzie (silnikowy może być odwrotnie?)
mvOccupied->CabActivisation(); // uruchomienie kabin w członach mvOccupied->CabActivisation(); // uruchomienie kabin w członach
DirectionForward(true); // nawrotnik do przodu DirectionForward(true); // nawrotnik do przodu
mvOccupied->SpringBrakeActivate( initialspringbrakestate );
/* /*
// NOTE: this won't restore local brake if the vehicle has integrated local brake control // NOTE: this won't restore local brake if the vehicle has integrated local brake control
// TBD, TODO: fix or let the ai activate the brake again as part of its standard logic? // TBD, TODO: fix or let the ai activate the brake again as part of its standard logic?
if (initiallocalbrakelevel > 0.0) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!) if (initiallocalbrakelevel > 0.0) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!)
mvOccupied->LocalBrakePosA = initiallocalbrakelevel; // zahamuj jak wcześniej mvOccupied->LocalBrakePosA = initiallocalbrakelevel; // zahamuj jak wcześniej
*/ */
mvOccupied->SpringBrakeActivate( initialspringbrakestate ); if( pVehicle != initialvehicle ) {
auto *train { simulation::Trains.find( initialvehicle->name() ) };
if( train ) {
train->MoveToVehicle( pVehicle );
}
}
CheckVehicles(); // sprawdzenie składu, AI zapali światła CheckVehicles(); // sprawdzenie składu, AI zapali światła
TableClear(); // resetowanie tabelki skanowania torów TableClear(); // resetowanie tabelki skanowania torów
} }
@@ -6745,10 +6748,42 @@ TController::UpdateConnect() {
} }
} }
int
TController::unit_count( int const Threshold ) const {
auto *vehicle { pVehicle };
auto unitcount { 1 };
do {
auto const decoupledend{ ( vehicle->DirectionGet() > 0 ? // numer sprzęgu od strony czoła składu
end::rear :
end::front ) };
auto const coupling { vehicle->MoverParameters->Couplers[ decoupledend ].CouplingFlag };
if( coupling == coupling::faux ) {
break;
}
// jeżeli sprzęg zablokowany to liczymy człony jako jeden
if( ( coupling & coupling::permanent ) == 0 ) {
++unitcount;
}
vehicle = vehicle->Next();
} while( unitcount < Threshold );
return unitcount;
}
void void
TController::UpdateDisconnect() { TController::UpdateDisconnect() {
if( iVehicleCount >= 0 ) { if( iVehicleCount >= 0 ) {
// early test for human drivers, who might disregard the proper procedure, or perform it before they receive the order to
if( false == AIControllFlag ) {
// iVehicleCount = 0 means the consist should be reduced to (1) leading unit, thus we increase our test values by 1
if( unit_count( iVehicleCount + 2 ) <= iVehicleCount + 1 ) {
iVehicleCount = -2; // odczepiono, co było do odczepienia
return; // we'll wrap up the procedure on the next update beat
}
}
// regular uncoupling procedure, performed by ai and naively expected from the human drivers
// 3rd stage: change direction, compress buffers and uncouple // 3rd stage: change direction, compress buffers and uncouple
if( iDirection != iDirectionOrder ) { if( iDirection != iDirectionOrder ) {
cue_action( locale::string::driver_hint_mastercontrollersetreverserunlock ); cue_action( locale::string::driver_hint_mastercontrollersetreverserunlock );
@@ -6814,6 +6849,10 @@ TController::UpdateDisconnect() {
} }
// 2nd stage: apply consist brakes and change direction // 2nd stage: apply consist brakes and change direction
if( ( iDrivigFlags & movePress ) == 0 ) { if( ( iDrivigFlags & movePress ) == 0 ) {
// store initial consist direction
if( !iDirectionBackup ) {
iDirectionBackup = iDirection;
}
if( false == IsConsistBraked ) { if( false == IsConsistBraked ) {
WriteLog( "Uncoupling [" + mvOccupied->Name + "]: applying consist brakes..." ); WriteLog( "Uncoupling [" + mvOccupied->Name + "]: applying consist brakes..." );
cue_action( locale::string::driver_hint_trainbrakeapply ); cue_action( locale::string::driver_hint_trainbrakeapply );
@@ -6834,22 +6873,26 @@ TController::UpdateDisconnect() {
} // odczepianie } // odczepianie
if( iVehicleCount < 0 ) { if( iVehicleCount < 0 ) {
// 4th stage: restore initial direction // 4th stage: restore initial direction
if( ( iDrivigFlags & movePress ) != 0 ) { if( iDirectionBackup ) {
if( eStopReason == stopNone ) { // HACK: use current speed limit to discern whether we're entering this stage for the first time iDirectionOrder = iDirectionBackup.value();
iDirectionBackup.reset();
}
if( iDirection != iDirectionOrder ) {
WriteLog( "Uncoupling [" + mvOccupied->Name + "]: second direction change" ); WriteLog( "Uncoupling [" + mvOccupied->Name + "]: second direction change" );
iDirectionOrder = -iDirection;
cue_action( locale::string::driver_hint_mastercontrollersetreverserunlock ); cue_action( locale::string::driver_hint_mastercontrollersetreverserunlock );
cue_action( locale::string::driver_hint_directionother ); // zmiana kierunku jazdy na właściwy cue_action( locale::string::driver_hint_directionother ); // zmiana kierunku jazdy na właściwy
} }
// 5th stage: clean up and move on to next order
if( iDirection == iDirectionOrder ) { if( iDirection == iDirectionOrder ) {
iDrivigFlags &= ~movePress; // koniec dociskania iDrivigFlags &= ~movePress; // koniec dociskania
while( ( OrderCurrentGet() & Disconnect ) != 0 ) {
JumpToNextOrder(); // zmieni światła JumpToNextOrder(); // zmieni światła
}
TableClear(); // skanowanie od nowa TableClear(); // skanowanie od nowa
iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed ruszeniem iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed ruszeniem
} }
} }
} }
}
void void
TController::handle_engine() { TController::handle_engine() {

View File

@@ -317,6 +317,7 @@ private:
void check_departure(); void check_departure();
void UpdateConnect(); void UpdateConnect();
void UpdateDisconnect(); void UpdateDisconnect();
int unit_count( int const Threshold ) const;
void UpdateChangeDirection(); void UpdateChangeDirection();
void UpdateLooseShunt(); void UpdateLooseShunt();
void UpdateObeyTrain(); void UpdateObeyTrain();
@@ -381,6 +382,7 @@ private:
double SwitchClearDist { 0.0 }; // distance to point after farthest detected switch double SwitchClearDist { 0.0 }; // distance to point after farthest detected switch
int iDirection = 0; // kierunek jazdy względem sprzęgów pojazdu, w którym siedzi AI (1=przód,-1=tył) int iDirection = 0; // kierunek jazdy względem sprzęgów pojazdu, w którym siedzi AI (1=przód,-1=tył)
int iDirectionOrder = 0; //żadany kierunek jazdy (służy do zmiany kierunku) int iDirectionOrder = 0; //żadany kierunek jazdy (służy do zmiany kierunku)
std::optional<int> iDirectionBackup; // consist direction to be restored after coupling/uncoupling and similar direction-changing operations
int iVehicleCount = -2; // wartość neutralna // ilość pojazdów do odłączenia albo zabrania ze składu (-1=wszystkie) int iVehicleCount = -2; // wartość neutralna // ilość pojazdów do odłączenia albo zabrania ze składu (-1=wszystkie)
int iCoupler = 0; // maska sprzęgu, jaką należy użyć przy łączeniu (po osiągnięciu trybu Connect), 0 gdy jazda bez łączenia int iCoupler = 0; // maska sprzęgu, jaką należy użyć przy łączeniu (po osiągnięciu trybu Connect), 0 gdy jazda bez łączenia
int iDriverFailCount = 0; // licznik błędów AI int iDriverFailCount = 0; // licznik błędów AI

View File

@@ -178,7 +178,7 @@ global_settings::ConfigParse(cParser &Parser) {
// selected device for audio renderer // selected device for audio renderer
Parser.getTokens(); Parser.getTokens();
Parser >> PausedVolume; Parser >> PausedVolume;
EnvironmentAmbientVolume = clamp( EnvironmentAmbientVolume, 0.f, 1.f ); PausedVolume = clamp( PausedVolume, 0.f, 1.f );
} }
// else if (str==AnsiString("renderalpha")) //McZapkie-1312302 - dwuprzebiegowe renderowanie // else if (str==AnsiString("renderalpha")) //McZapkie-1312302 - dwuprzebiegowe renderowanie
// bRenderAlpha=(GetNextSymbol().LowerCase()==AnsiString("yes")); // bRenderAlpha=(GetNextSymbol().LowerCase()==AnsiString("yes"));

View File

@@ -235,6 +235,9 @@ struct global_settings {
std::optional<std::pair<std::string, std::string>> network_client; std::optional<std::pair<std::string, std::string>> network_client;
double desync = 0.0; double desync = 0.0;
float m_skysaturationcorrection{ 1.65f };
float m_skyhuecorrection{ 0.5f };
// methods // methods
void LoadIniFile( std::string asFileName ); void LoadIniFile( std::string asFileName );
void ConfigParse( cParser &parser ); void ConfigParse( cParser &parser );

View File

@@ -1152,7 +1152,7 @@ void TTrain::OnCommand_tempomattoggle( TTrain *Train, command_data const &Comman
if( Command.action == GLFW_REPEAT ) { return; } if( Command.action == GLFW_REPEAT ) { return; }
if( Train->ggScndCtrlButton.type() == TGaugeType::push ) { if( Train->ggScndCtrlButton.is_push() ) {
// impulse switch // impulse switch
if( Command.action == GLFW_RELEASE ) { if( Command.action == GLFW_RELEASE ) {
// just move the button(s) back to default position // just move the button(s) back to default position
@@ -2565,8 +2565,8 @@ void TTrain::change_pantograph_selection( int const Change ) {
auto const preset { presets[ selection ] - '0' }; auto const preset { presets[ selection ] - '0' };
auto const swapends { cab_to_end() != end::front }; auto const swapends { cab_to_end() != end::front };
// check desired states for both pantographs; value: whether the pantograph should be raised // check desired states for both pantographs; value: whether the pantograph should be raised
auto const frontstate { preset & ( swapends ? 1 : 2 ) }; auto const frontstate { preset & ( swapends ? 2 : 1 ) };
auto const rearstate { preset & ( swapends ? 2 : 1 ) }; auto const rearstate { preset & ( swapends ? 1 : 2 ) };
// potentially adjust pantograph valves // potentially adjust pantograph valves
mvOccupied->OperatePantographValve( end::front, ( frontstate ? operation_t::enable : operation_t::disable ) ); mvOccupied->OperatePantographValve( end::front, ( frontstate ? operation_t::enable : operation_t::disable ) );
mvOccupied->OperatePantographValve( end::rear, ( rearstate ? operation_t::enable : operation_t::disable ) ); mvOccupied->OperatePantographValve( end::rear, ( rearstate ? operation_t::enable : operation_t::disable ) );
@@ -7027,6 +7027,11 @@ bool TTrain::Update( double const Deltatime )
dsbNastawnikBocz ); dsbNastawnikBocz );
ggScndCtrl.Update(); ggScndCtrl.Update();
} }
if( ggScndCtrlButton.is_toggle() ) {
ggScndCtrlButton.UpdateValue(
( ( mvControlled->ScndCtrlPos > 0 ) ? 1.f : 0.f ),
dsbSwitch );
}
ggScndCtrlButton.Update( lowvoltagepower ); ggScndCtrlButton.Update( lowvoltagepower );
ggScndCtrlOffButton.Update( lowvoltagepower ); ggScndCtrlOffButton.Update( lowvoltagepower );
ggDistanceCounterButton.Update(); ggDistanceCounterButton.Update();
@@ -8393,20 +8398,18 @@ TTrain::MoveToVehicle(TDynamicObject *target) {
if( Dynamic()->Mechanik ) { if( Dynamic()->Mechanik ) {
Dynamic()->Mechanik->MoveTo( target ); Dynamic()->Mechanik->MoveTo( target );
}
DynamicSet(target);
Occupied()->LimPipePress = Occupied()->PipePress;
Occupied()->CabActivisation( true ); // załączenie rozrządu (wirtualne kabiny)
Dynamic()->MechInside = true;
if( Dynamic()->Mechanik ) {
Dynamic()->Controller = Dynamic()->Mechanik->AIControllFlag; Dynamic()->Controller = Dynamic()->Mechanik->AIControllFlag;
Dynamic()->Mechanik->DirectionChange(); Dynamic()->Mechanik->DirectionChange();
} }
else { else {
Dynamic()->Controller = Humandriver; Dynamic()->Controller = Humandriver;
} }
Dynamic()->MechInside = true;
DynamicSet(target);
Occupied()->LimPipePress = Occupied()->PipePress;
Occupied()->CabActivisation( true ); // załączenie rozrządu (wirtualne kabiny)
} else { } else {
Dynamic()->bDisplayCab = false; Dynamic()->bDisplayCab = false;
Dynamic()->ABuSetModelShake( {} ); Dynamic()->ABuSetModelShake( {} );

View File

@@ -1010,7 +1010,7 @@ TController::cue_action( locale::string const Action, float const Actionparamete
hint( hint(
Action, Action,
[this](float const Parameter) -> bool { [this](float const Parameter) -> bool {
return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->DepartureSignal == true ) || mvOccupied->Vel > 5.0 ); } ); return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->Doors.has_autowarning == true ) || ( mvOccupied->DepartureSignal == true ) || mvOccupied->Vel > 5.0 ); } );
break; break;
} }
case locale::string::driver_hint_departuresignaloff: { case locale::string::driver_hint_departuresignaloff: {
@@ -1021,7 +1021,7 @@ TController::cue_action( locale::string const Action, float const Actionparamete
hint( hint(
Action, Action,
[this](float const Parameter) -> bool { [this](float const Parameter) -> bool {
return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->DepartureSignal == false ) ); } ); return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->Doors.has_autowarning == true ) || ( mvOccupied->DepartureSignal == false ) ); } );
break; break;
} }
// consist doors // consist doors

View File

@@ -527,6 +527,9 @@ drivermouse_input::default_bindings() {
{ "tempomat_sw:", { { "tempomat_sw:", {
user_command::tempomattoggle, user_command::tempomattoggle,
user_command::none } }, user_command::none } },
{ "tempomatoff_sw:", {
user_command::tempomattoggle,
user_command::none } },
{ "dirkey:", { { "dirkey:", {
user_command::reverserincrease, user_command::reverserincrease,
user_command::reverserdecrease } }, user_command::reverserdecrease } },

View File

@@ -1420,6 +1420,17 @@ debug_panel::render_section_settings() {
ImGui::PopStyleColor(); ImGui::PopStyleColor();
// reflection fidelity // reflection fidelity
ImGui::SliderInt( ( to_string( Global.reflectiontune.fidelity ) + "###reflectionfidelity" ).c_str(), &Global.reflectiontune.fidelity, 0, 2, "Reflection fidelity" ); ImGui::SliderInt( ( to_string( Global.reflectiontune.fidelity ) + "###reflectionfidelity" ).c_str(), &Global.reflectiontune.fidelity, 0, 2, "Reflection fidelity" );
if( DebugModeFlag ) {
// sky sliders
{
ImGui::SliderFloat(
( to_string( Global.m_skysaturationcorrection, 2, 5 ) + "###skysaturation" ).c_str(), &Global.m_skysaturationcorrection, 0.0f, 3.0f, "Sky saturation" );
}
{
ImGui::SliderFloat(
( to_string( Global.m_skyhuecorrection, 2, 5 ) + "###skyhue" ).c_str(), &Global.m_skyhuecorrection, 0.0f, 1.0f, "Sky hue correction" );
}
}
ImGui::PushStyleColor( ImGuiCol_Text, { Global.UITextColor.r, Global.UITextColor.g, Global.UITextColor.b, Global.UITextColor.a } ); ImGui::PushStyleColor( ImGuiCol_Text, { Global.UITextColor.r, Global.UITextColor.g, Global.UITextColor.b, Global.UITextColor.a } );
ImGui::TextUnformatted( "Sound" ); ImGui::TextUnformatted( "Sound" );

View File

@@ -401,7 +401,12 @@ bool opengl33_renderer::init_viewport(viewport_config &vp)
vp.main_texv = std::make_unique<opengl_texture>(); vp.main_texv = std::make_unique<opengl_texture>();
vp.main_texv->alloc_rendertarget(Global.gfx_postfx_motionblur_format, GL_RG, vp.width, vp.height); vp.main_texv->alloc_rendertarget(Global.gfx_postfx_motionblur_format, GL_RG, vp.width, vp.height);
vp.main_fb->attach(*vp.main_texv, GL_COLOR_ATTACHMENT1); vp.main_fb->attach(*vp.main_texv, GL_COLOR_ATTACHMENT1);
vp.main_fb->setup_drawing(2);
vp.main_texd = std::make_unique<opengl_texture>();
vp.main_texd->alloc_rendertarget( Global.gfx_format_depth, GL_DEPTH_COMPONENT, vp.width, vp.height, 1, 1, GL_CLAMP_TO_EDGE );
vp.main_fb->attach( *vp.main_texd, GL_DEPTH_ATTACHMENT );
vp.main_fb->setup_drawing(1);
WriteLog("motion blur enabled"); WriteLog("motion blur enabled");
} }
@@ -782,15 +787,18 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
if (Global.gfx_postfx_motionblur_enabled) if (Global.gfx_postfx_motionblur_enabled)
{ {
gl::program::unbind(); gl::program::unbind();
vp.main_fb->clear(GL_COLOR_BUFFER_BIT); vp.main_fb->clear(GL_COLOR_BUFFER_BIT);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0); vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT1); vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT1);
vp.msaa_fb->blit_to(vp.main_fb.get(), vp.width, vp.height, GL_DEPTH_BUFFER_BIT, GL_DEPTH_ATTACHMENT);
vp.main_fb->setup_drawing(1); // restore draw buffers after blit operation
model_ubs.param[0].x = m_framerate / (1.0 / Global.gfx_postfx_motionblur_shutter); model_ubs.param[0].x = m_framerate / (1.0 / Global.gfx_postfx_motionblur_shutter);
model_ubo->update(model_ubs); model_ubo->update(model_ubs);
m_pfx_motionblur->apply({vp.main_tex.get(), vp.main_texv.get()}, vp.main2_fb.get());
vp.main_fb->setup_drawing(1); // restore draw buffers after blit operation m_pfx_motionblur->apply({vp.main_tex.get(), vp.main_texv.get(), vp.main_texd.get()}, vp.main2_fb.get());
} }
else else
{ {
@@ -804,7 +812,6 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
glViewport(0, 0, target_size.x, target_size.y); glViewport(0, 0, target_size.x, target_size.y);
if( Global.gfx_postfx_chromaticaberration_enabled ) { if( Global.gfx_postfx_chromaticaberration_enabled ) {
// NOTE: for some unexplained reason need this setup_drawing() call here for the tonemapping effects to show up on the main_tex?
m_pfx_tonemapping->apply( *vp.main2_tex, vp.main_fb.get() ); m_pfx_tonemapping->apply( *vp.main2_tex, vp.main_fb.get() );
m_pfx_chromaticaberration->apply( *vp.main_tex, nullptr ); m_pfx_chromaticaberration->apply( *vp.main_tex, nullptr );
} }

View File

@@ -208,6 +208,7 @@ class opengl33_renderer : public gfx_renderer {
std::unique_ptr<gl::framebuffer> main_fb; std::unique_ptr<gl::framebuffer> main_fb;
std::unique_ptr<opengl_texture> main_texv; std::unique_ptr<opengl_texture> main_texv;
std::unique_ptr<opengl_texture> main_tex; std::unique_ptr<opengl_texture> main_tex;
std::unique_ptr<opengl_texture> main_texd;
std::unique_ptr<gl::framebuffer> main2_fb; std::unique_ptr<gl::framebuffer> main2_fb;
std::unique_ptr<opengl_texture> main2_tex; std::unique_ptr<opengl_texture> main2_tex;

View File

@@ -174,7 +174,7 @@ world_environment::update() {
// update the fog. setting it to match the average colour of the sky dome is cheap // update the fog. setting it to match the average colour of the sky dome is cheap
// but quite effective way to make the distant items blend with background better // but quite effective way to make the distant items blend with background better
Global.FogColor = Global.FogColor =
interpolate( m_skydome.GetAverageColor(), m_skydome.GetAverageHorizonColor(), 0.33f ) interpolate( m_skydome.GetAverageColor(), m_skydome.GetAverageHorizonColor(), 0.25f )
* clamp<float>( Global.fLuminance, 0.25f, 1.f ); * clamp<float>( Global.fLuminance, 0.25f, 1.f );
// weather-related simulation factors // weather-related simulation factors

View File

@@ -268,10 +268,10 @@ void CSkyDome::RebuildColors() {
colorconverter.z = 0.85f + ( colorconverter.z - 0.85f ) * 0.35f; colorconverter.z = 0.85f + ( colorconverter.z - 0.85f ) * 0.35f;
} }
colorconverter.y = clamp( colorconverter.y * 1.15f, 0.0f, 1.0f ); colorconverter.y = clamp( colorconverter.y * Global.m_skysaturationcorrection, 0.0f, 1.0f );
// desaturate sky colour, based on overcast level // desaturate sky colour, based on overcast level
if( colorconverter.y > 0.0f ) { if( colorconverter.y > 0.0f ) {
colorconverter.y *= ( 1.0f - m_overcast ); colorconverter.y *= ( 1.0f - 0.5f * m_overcast );
} }
// override the hue, based on sun height above the horizon. crude way to deal with model shortcomings // override the hue, based on sun height above the horizon. crude way to deal with model shortcomings
@@ -288,13 +288,8 @@ void CSkyDome::RebuildColors() {
color = colors::HSVtoRGB(colorconverter); color = colors::HSVtoRGB(colorconverter);
color = interpolate( color, shiftedcolor, shiftfactor ); color = interpolate( color, shiftedcolor, shiftfactor * Global.m_skyhuecorrection );
/*
// gamma control
color.x = std::pow( color.x, m_gammacorrection );
color.x = std::pow( color.y, m_gammacorrection );
color.x = std::pow( color.z, m_gammacorrection );
*/
// crude correction for the times where the model breaks (late night) // crude correction for the times where the model breaks (late night)
// TODO: use proper night sky calculation for these times instead // TODO: use proper night sky calculation for these times instead
if( ( color.x <= 0.05f ) if( ( color.x <= 0.05f )
@@ -304,13 +299,16 @@ void CSkyDome::RebuildColors() {
color.z = 0.75f * std::max( color.z + m_sundirection.y, 0.075f ); color.z = 0.75f * std::max( color.z + m_sundirection.y, 0.075f );
color.x = 0.20f * color.z; color.x = 0.20f * color.z;
color.y = 0.65f * color.z; color.y = 0.65f * color.z;
color = color * ( 1.15f - vertex.y ); // simple gradient, darkening towards the top
} }
// gamma correction // gamma correction
color = glm::pow( color, gammacorrection ); color = glm::pow( color, gammacorrection );
/*
if( Global.GfxFramebufferSRGB ) { if( Global.GfxFramebufferSRGB ) {
color = glm::pow( color, glm::vec3( 2.2f ) - ( gammacorrection * 0.5f ) ); color = glm::pow( color, glm::vec3( 2.2f ) - ( gammacorrection * 0.5f ) );
} }
*/
// simple gradient, darkening towards the top
color *= ( 1.15f - vertex.y );
// save // save
m_colours[ i ] = color; m_colours[ i ] = color;
averagecolor += color; averagecolor += color;

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 21 #define VERSION_MAJOR 21
#define VERSION_MINOR 324 #define VERSION_MINOR 330
#define VERSION_REVISION 0 #define VERSION_REVISION 0