16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 12:09:18 +02:00

application component state switches, chromatic aberration post process filter, minor ai logic tweaks, minor cab controls tweaks, minor bug fixes

This commit is contained in:
tmj-fstate
2020-03-01 03:16:12 +01:00
parent 642b8fb623
commit 09ad3dbacd
13 changed files with 254 additions and 200 deletions

View File

@@ -4751,26 +4751,8 @@ TController::UpdateSituation(double dt) {
mvControlling->OperatePantographValve( end::front, operation_t::enable ); mvControlling->OperatePantographValve( end::front, operation_t::enable );
} }
} }
}
}
}
if( mvOccupied->Vel > 5 ) { if( mvOccupied->Vel > 5 ) {
if( fActionTime > 0.0 ) {
if( mvOccupied->AIHintPantstate != 0 ) {
// use suggested pantograph setup
auto const pantographsetup{ mvOccupied->AIHintPantstate };
mvControlling->OperatePantographValve(
end::front,
( pantographsetup & ( 1 << 0 ) ?
operation_t::enable :
operation_t::disable ) );
mvControlling->OperatePantographValve(
end::rear,
( pantographsetup & ( 1 << 1 ) ?
operation_t::enable :
operation_t::disable ) );
}
else {
// opuszczenie przedniego po rozpędzeniu się o ile jest więcej niż jeden // opuszczenie przedniego po rozpędzeniu się o ile jest więcej niż jeden
if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) { if( mvControlling->EnginePowerSource.CollectorParameters.CollectorsNo > 1 ) {
if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0 if( ( iDirection >= 0 ) && ( useregularpantographlayout ) ) // jak jedzie w kierunku sprzęgu 0
@@ -4788,6 +4770,24 @@ TController::UpdateSituation(double dt) {
} }
} }
} }
}
else {
// use suggested pantograph setup
if( mvOccupied->Vel > 5 ) {
auto const pantographsetup{ mvOccupied->AIHintPantstate };
mvControlling->OperatePantographValve(
end::front,
( pantographsetup & ( 1 << 0 ) ?
operation_t::enable :
operation_t::disable ) );
mvControlling->OperatePantographValve(
end::rear,
( pantographsetup & ( 1 << 1 ) ?
operation_t::enable :
operation_t::disable ) );
}
}
} }
} }
@@ -4875,12 +4875,13 @@ TController::UpdateSituation(double dt) {
if (AIControllFlag) { if (AIControllFlag) {
CheckTimeControllers(); CheckTimeControllers();
if( fActionTime > 0.0 ) {
// low priority operations // low priority operations
// compartment lights // compartment lights
if( mvOccupied->CompartmentLights.start_type == start_t::manual ) { if( mvOccupied->CompartmentLights.start_type == start_t::manual ) {
auto const currentlightstate { mvOccupied->CompartmentLights.is_enabled }; auto const currentlightstate{ mvOccupied->CompartmentLights.is_enabled };
auto const lightlevel { Global.fLuminance * ConsistShade }; auto const lightlevel{ Global.fLuminance * ConsistShade };
auto const desiredlightstate { ( auto const desiredlightstate{ (
currentlightstate ? currentlightstate ?
lightlevel < 0.40 : // turn off if lighting level goes above 0.4 lightlevel < 0.40 : // turn off if lighting level goes above 0.4
lightlevel < 0.35 ) }; // turn on if lighting level goes below 0.35 lightlevel < 0.35 ) }; // turn on if lighting level goes below 0.35
@@ -4890,6 +4891,7 @@ TController::UpdateSituation(double dt) {
} }
} }
} }
}
LastReactionTime -= reactiontime; LastReactionTime -= reactiontime;
// Ra: nie wiem czemu ReactionTime potrafi dostać 12 sekund, to jest przegięcie, bo przeżyna STÓJ // Ra: nie wiem czemu ReactionTime potrafi dostać 12 sekund, to jest przegięcie, bo przeżyna STÓJ

View File

@@ -454,6 +454,7 @@ private:
// returns true if any vehicle in the consist has an open door // returns true if any vehicle in the consist has an open door
bool doors_open() const; bool doors_open() const;
void AutoRewident(); // ustawia hamulce w składzie void AutoRewident(); // ustawia hamulce w składzie
void UpdatePantographs();
// members // members
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń) double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji

View File

@@ -2194,7 +2194,7 @@ TDynamicObject::init_sections( TModel3d const *Model, std::string const &Namepre
if( sectionsubmodel != nullptr ) { if( sectionsubmodel != nullptr ) {
// HACK: disable automatic self-illumination threshold, at least until 3d model update // HACK: disable automatic self-illumination threshold, at least until 3d model update
if( Overrideselfillum ) { if( Overrideselfillum ) {
sectionsubmodel->SetSelfIllum( 2.0f, true, true ); sectionsubmodel->SetSelfIllum( 2.0f, true, false );
} }
Sections.push_back( { Sections.push_back( {
sectionsubmodel, sectionsubmodel,
@@ -2615,7 +2615,7 @@ TDynamicObject::update_load_sections() {
SectionLoadVisibility.push_back( { section.load, false } ); SectionLoadVisibility.push_back( { section.load, false } );
// HACK: disable automatic self-illumination threshold, at least until 3d model update // HACK: disable automatic self-illumination threshold, at least until 3d model update
if( MoverParameters->CompartmentLights.start_type == start_t::manual ) { if( MoverParameters->CompartmentLights.start_type == start_t::manual ) {
section.load->SetSelfIllum( 2.0f, true, true ); section.load->SetSelfIllum( 2.0f, true, false );
} }
} }
} }
@@ -3696,9 +3696,9 @@ bool TDynamicObject::Update(double dt, double dt1)
// compartment lights // compartment lights
// if the vehicle has a controller, we base the light state on state of the controller otherwise we check the vehicle itself // if the vehicle has a controller, we base the light state on state of the controller otherwise we check the vehicle itself
if( ( ctOwner != nullptr ? if( ( ctOwner != nullptr ? ctOwner->Controlling()->Battery != SectionLightsActive :
ctOwner->Controlling()->Battery != SectionLightsActive : Mechanik != nullptr ? Mechanik->primary() == false : // don't touch lights in a stand-alone manned vehicle
MoverParameters->CompartmentLights.is_active == true ) ) { // without controller lights are off. NOTE: this likely mess up the EMU MoverParameters->CompartmentLights.is_active == true ) ) { // without controller switch the lights off
toggle_lights(); toggle_lights();
} }

View File

@@ -648,10 +648,11 @@ global_settings::ConfigParse(cParser &Parser) {
// old variable, repurposed as update rate of python screen renderer // old variable, repurposed as update rate of python screen renderer
Parser.getTokens(); Parser.getTokens();
Parser >> token; Parser >> token;
auto const priority { ToLower( token ) }; auto const priority { token };
PythonScreenUpdateRate = ( PythonScreenUpdateRate = (
priority == "lower" ? 500 : priority == "lower" ? 500 :
priority == "lowest" ? 1000 : priority == "lowest" ? 1000 :
priority == "off" ? 0 :
200 ); 200 );
} }
else if( token == "python.updatetime" ) else if( token == "python.updatetime" )
@@ -805,6 +806,11 @@ global_settings::ConfigParse(cParser &Parser) {
else if (token == "rg32f") else if (token == "rg32f")
gfx_postfx_motionblur_format = GL_RG32F; gfx_postfx_motionblur_format = GL_RG32F;
} }
else if (token == "gfx.postfx.chromaticaberration.enabled")
{
Parser.getTokens(1);
Parser >> gfx_postfx_chromaticaberration_enabled;
}
else if (token == "gfx.format.color") else if (token == "gfx.format.color")
{ {
Parser.getTokens(1); Parser.getTokens(1);
@@ -833,6 +839,11 @@ global_settings::ConfigParse(cParser &Parser) {
else if (token == "z32f") else if (token == "z32f")
gfx_format_depth = GL_DEPTH_COMPONENT32F; gfx_format_depth = GL_DEPTH_COMPONENT32F;
} }
else if (token == "gfx.skiprendering")
{
Parser.getTokens(1);
Parser >> gfx_skiprendering;
}
else if (token == "gfx.skippipeline") else if (token == "gfx.skippipeline")
{ {
Parser.getTokens(1); Parser.getTokens(1);
@@ -859,6 +870,11 @@ global_settings::ConfigParse(cParser &Parser) {
Parser >> gfx_shadergamma; Parser >> gfx_shadergamma;
} }
*/ */
else if (token == "python.enabled")
{
Parser.getTokens(1);
Parser >> python_enabled;
}
else if (token == "python.threadedupload") else if (token == "python.threadedupload")
{ {
Parser.getTokens(1); Parser.getTokens(1);

View File

@@ -195,10 +195,12 @@ struct global_settings {
std::string fullscreen_monitor; std::string fullscreen_monitor;
bool python_enabled = true;
bool python_mipmaps = true; bool python_mipmaps = true;
bool python_threadedupload = true; bool python_threadedupload = true;
bool python_uploadmain = true; bool python_uploadmain = true;
bool gfx_skiprendering = false;
int gfx_framebuffer_width = -1; int gfx_framebuffer_width = -1;
int gfx_framebuffer_height = -1; int gfx_framebuffer_height = -1;
int gfx_framebuffer_fidelity = -1; int gfx_framebuffer_fidelity = -1;
@@ -209,6 +211,7 @@ struct global_settings {
GLenum gfx_postfx_motionblur_format = GL_RG16F; GLenum gfx_postfx_motionblur_format = GL_RG16F;
GLenum gfx_format_color = GL_RGB16F; GLenum gfx_format_color = GL_RGB16F;
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F; GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
bool gfx_postfx_chromaticaberration_enabled = true;
bool gfx_skippipeline = false; bool gfx_skippipeline = false;
bool gfx_extraeffects = true; bool gfx_extraeffects = true;
bool gfx_shadergamma = false; bool gfx_shadergamma = false;

View File

@@ -2281,7 +2281,7 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
{ {
bool OK = false; bool OK = false;
if ((IsMainCtrlNoPowerPos()) && (CabActive != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && (DynamicBrakeFlag)) if ( ( DynamicBrakeFlag ) && ( TrainType == dt_ET42 ) && ( CabActive != 0 ) && ( IsMainCtrlNoPowerPos() ) && ( ScndCtrlPos == 0 ) )
{ {
OK = DynamicBrakeSwitch(false); OK = DynamicBrakeSwitch(false);
} }
@@ -2291,19 +2291,24 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
{ {
// if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos<ScndCtrlPosNo) and // if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos<ScndCtrlPosNo) and
// (not CoupledCtrl) then // (not CoupledCtrl) then
if ((ScndCtrlPos < ScndCtrlPosNo) && (!CoupledCtrl) && if ((ScndCtrlPos < ScndCtrlPosNo) && (!CoupledCtrl))
((EngineType != TEngineType::DieselElectric) || (!AutoRelayFlag)))
{
if (CtrlSpeed == 1)
{ {
// TBD, TODO: refactor this validation as part of relay check routine (currently in tractionforce()
// TBD, TODO: diesel electric engine utilize scndctrlactualpos like the other types?
if( ( EngineType == TEngineType::DieselElectric )
&& ( ( IsMainCtrlNoPowerPos() ) || ( AutoRelayFlag ) || ( ShuntMode ) || ( false == Mains ) ) ) {
OK = false;
}
else {
if( CtrlSpeed == 1 ) {
ScndCtrlPos++; ScndCtrlPos++;
} }
else if (CtrlSpeed > 1) else if( CtrlSpeed > 1 ) {
{
ScndCtrlPos = ScndCtrlPosNo; // takie chamskie, potem poprawie ScndCtrlPos = ScndCtrlPosNo; // takie chamskie, potem poprawie
} }
OK = true; OK = true;
} }
}
else // nie mozna zmienic else // nie mozna zmienic
OK = false; OK = false;
if (OK) if (OK)

View File

@@ -247,7 +247,8 @@ void python_taskqueue::exit() {
// adds specified task along with provided collection of data to the work queue. returns true on success // adds specified task along with provided collection of data to the work queue. returns true on success
auto python_taskqueue::insert( task_request const &Task ) -> bool { auto python_taskqueue::insert( task_request const &Task ) -> bool {
if( ( Task.renderer.empty() ) if( ( false == Global.python_enabled )
|| ( Task.renderer.empty() )
|| ( Task.input == nullptr ) || ( Task.input == nullptr )
|| ( Task.target == 0 ) ) { return false; } || ( Task.target == 0 ) ) { return false; }

View File

@@ -986,17 +986,34 @@ void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &C
void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data const &Command ) {
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric ) if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntModeAllow )
&& ( true == Train->mvControlled->ShuntMode ) ) { && ( true == Train->mvControlled->ShuntMode ) ) {
if( Command.action != GLFW_RELEASE ) {
Train->mvControlled->AnPos = clamp( Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos + 0.025, Train->mvControlled->AnPos + 0.025,
0.0, 1.0 ); 0.0, 1.0 );
} }
}
else { else {
if( Train->ggScndCtrl.type() == TGaugeType::push ) {
// two-state control, active while the button is down
if( Command.action == GLFW_PRESS ) {
// activate on press
Train->mvControlled->IncScndCtrl( 1 ); Train->mvControlled->IncScndCtrl( 1 );
} }
else if( Command.action == GLFW_RELEASE ) {
// zero on release
Train->mvControlled->DecScndCtrl( 2 );
}
}
else {
// multi-state control
if( Command.action != GLFW_RELEASE ) {
// on press or hold
Train->mvControlled->IncScndCtrl( 1 );
}
}
} }
} }
@@ -5521,30 +5538,22 @@ void TTrain::OnCommand_whistleactivate( TTrain *Train, command_data const &Comma
void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command ) {
if( Train->ggRadioButton.SubModel == nullptr ) { if( Command.action != GLFW_PRESS ) { return; }
if( Command.action == GLFW_PRESS ) {
WriteLog( "Radio switch is missing, or wasn't defined" );
}
/*
// NOTE: we ignore the lack of 3d model to allow system reset after receiving radio-stop signal
return;
*/
}
if( Command.action == GLFW_PRESS ) { // NOTE: we ignore the lack of 3d model to allow system reset after receiving radio-stop signal
/*
if( false == Train->m_controlmapper.contains( "radio_sw:" ) ) {
return;
}
*/
// only reacting to press, so the sound can loop uninterrupted // only reacting to press, so the sound can loop uninterrupted
if( false == Train->mvOccupied->Radio ) { if( false == Train->mvOccupied->Radio ) {
// turn on // turn on
Train->mvOccupied->Radio = true; Train->mvOccupied->Radio = true;
// visual feedback
Train->ggRadioButton.UpdateValue( 1.0, Train->dsbSwitch );
} }
else { else {
// turn off // turn off
Train->mvOccupied->Radio = false; Train->mvOccupied->Radio = false;
// visual feedback
Train->ggRadioButton.UpdateValue( 0.0, Train->dsbSwitch );
}
} }
} }
@@ -6864,7 +6873,6 @@ bool TTrain::Update( double const Deltatime )
ggFuseButton.Update(); ggFuseButton.Update();
ggConverterFuseButton.Update(); ggConverterFuseButton.Update();
ggStLinOffButton.Update(); ggStLinOffButton.Update();
ggRadioButton.Update();
ggRadioChannelSelector.Update(); ggRadioChannelSelector.Update();
ggRadioChannelPrevious.Update(); ggRadioChannelPrevious.Update();
ggRadioChannelNext.Update(); ggRadioChannelNext.Update();
@@ -6996,6 +7004,7 @@ bool TTrain::Update( double const Deltatime )
// screens // screens
fScreenTimer += Deltatime; fScreenTimer += Deltatime;
if( ( this == simulation::Train ) // no point in drawing screens for vehicles other than our own if( ( this == simulation::Train ) // no point in drawing screens for vehicles other than our own
&& ( Global.PythonScreenUpdateRate > 0 )
&& ( fScreenTimer > Global.PythonScreenUpdateRate * 0.001f ) && ( fScreenTimer > Global.PythonScreenUpdateRate * 0.001f )
&& ( false == FreeFlyModeFlag ) ) { // don't bother if we're outside && ( false == FreeFlyModeFlag ) ) { // don't bother if we're outside
fScreenTimer = 0.f; fScreenTimer = 0.f;
@@ -7883,9 +7892,6 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
if( m_radiosound.offset() == nullvector ) { if( m_radiosound.offset() == nullvector ) {
m_radiosound.offset( btLampkaRadio.model_offset() ); m_radiosound.offset( btLampkaRadio.model_offset() );
} }
if( m_radiosound.offset() == nullvector ) {
m_radiosound.offset( ggRadioButton.model_offset() );
}
if( m_radiostop.offset() == nullvector ) { if( m_radiostop.offset() == nullvector ) {
m_radiostop.offset( m_radiosound.offset() ); m_radiostop.offset( m_radiosound.offset() );
} }
@@ -8259,7 +8265,6 @@ void TTrain::clear_cab_controls()
ggFuseButton.Clear(); ggFuseButton.Clear();
ggConverterFuseButton.Clear(); ggConverterFuseButton.Clear();
ggStLinOffButton.Clear(); ggStLinOffButton.Clear();
ggRadioButton.Clear();
ggRadioChannelSelector.Clear(); ggRadioChannelSelector.Clear();
ggRadioChannelPrevious.Clear(); ggRadioChannelPrevious.Clear();
ggRadioChannelNext.Clear(); ggRadioChannelNext.Clear();
@@ -8443,9 +8448,6 @@ void TTrain::set_cab_controls( int const Cab ) {
1.f : 1.f :
0.f ) ); 0.f ) );
// radio // radio
if( true == mvOccupied->Radio ) {
ggRadioButton.PutValue( 1.f );
}
ggRadioChannelSelector.PutValue( ( Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1 ) - 1 ); ggRadioChannelSelector.PutValue( ( Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1 ) - 1 );
// pantographs // pantographs
/* /*
@@ -8985,7 +8987,6 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
{ "motorblowersfront_sw:", ggMotorBlowersFrontButton }, { "motorblowersfront_sw:", ggMotorBlowersFrontButton },
{ "motorblowersrear_sw:", ggMotorBlowersRearButton }, { "motorblowersrear_sw:", ggMotorBlowersRearButton },
{ "motorblowersalloff_sw:", ggMotorBlowersAllOffButton }, { "motorblowersalloff_sw:", ggMotorBlowersAllOffButton },
{ "radio_sw:", ggRadioButton },
{ "radiochannel_sw:", ggRadioChannelSelector }, { "radiochannel_sw:", ggRadioChannelSelector },
{ "radiochannelprev_sw:", ggRadioChannelPrevious }, { "radiochannelprev_sw:", ggRadioChannelPrevious },
{ "radiochannelnext_sw:", ggRadioChannelNext }, { "radiochannelnext_sw:", ggRadioChannelNext },
@@ -9081,7 +9082,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
{ "pantfront_sw:", &mvControlled->Pantographs[end::front].valve.is_enabled }, { "pantfront_sw:", &mvControlled->Pantographs[end::front].valve.is_enabled },
{ "pantrear_sw:", &mvControlled->Pantographs[end::rear].valve.is_enabled }, { "pantrear_sw:", &mvControlled->Pantographs[end::rear].valve.is_enabled },
{ "pantfrontoff_sw:", &mvControlled->Pantographs[end::front].valve.is_disabled }, { "pantfrontoff_sw:", &mvControlled->Pantographs[end::front].valve.is_disabled },
{ "pantrearoff_sw:", &mvControlled->Pantographs[end::rear].valve.is_disabled } { "pantrearoff_sw:", &mvControlled->Pantographs[end::rear].valve.is_disabled },
{ "radio_sw:", &mvOccupied->Radio },
}; };
{ {
auto lookup = autoboolgauges.find( Label ); auto lookup = autoboolgauges.find( Label );

View File

@@ -486,7 +486,6 @@ public: // reszta może by?publiczna
TGauge ggFuseButton; TGauge ggFuseButton;
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
TGauge ggStLinOffButton; TGauge ggStLinOffButton;
TGauge ggRadioButton;
TGauge ggRadioChannelSelector; TGauge ggRadioChannelSelector;
TGauge ggRadioChannelPrevious; TGauge ggRadioChannelPrevious;
TGauge ggRadioChannelNext; TGauge ggRadioChannelNext;

View File

@@ -151,6 +151,7 @@ bool opengl33_renderer::Init(GLFWwindow *Window)
m_pfx_motionblur = std::make_unique<gl::postfx>("motionblur"); m_pfx_motionblur = std::make_unique<gl::postfx>("motionblur");
m_pfx_tonemapping = std::make_unique<gl::postfx>("tonemapping"); m_pfx_tonemapping = std::make_unique<gl::postfx>("tonemapping");
m_pfx_chromaticaberration = std::make_unique<gl::postfx>( "chromaticaberration" );
m_empty_cubemap = std::make_unique<gl::cubemap>(); m_empty_cubemap = std::make_unique<gl::cubemap>();
m_empty_cubemap->alloc(Global.gfx_format_color, 16, 16, GL_RGB, GL_FLOAT); m_empty_cubemap->alloc(Global.gfx_format_color, 16, 16, GL_RGB, GL_FLOAT);
@@ -584,7 +585,7 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
gl::buffer::unbind(); gl::buffer::unbind();
m_current_viewport = &vp; m_current_viewport = &vp;
if (!simulation::is_ready) if ((!simulation::is_ready) || (Global.gfx_skiprendering))
{ {
gl::program::unbind(); gl::program::unbind();
gl::framebuffer::unbind(); gl::framebuffer::unbind();
@@ -798,6 +799,11 @@ 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);
m_pfx_tonemapping->apply(*vp.main2_tex, nullptr); m_pfx_tonemapping->apply(*vp.main2_tex, nullptr);
if( Global.gfx_postfx_chromaticaberration_enabled ) {
m_pfx_chromaticaberration->apply( *vp.main2_tex, nullptr );
}
opengl_texture::reset_unit_cache(); opengl_texture::reset_unit_cache();
} }

View File

@@ -363,6 +363,7 @@ class opengl33_renderer : public gfx_renderer {
std::unique_ptr<gl::postfx> m_pfx_motionblur; std::unique_ptr<gl::postfx> m_pfx_motionblur;
std::unique_ptr<gl::postfx> m_pfx_tonemapping; std::unique_ptr<gl::postfx> m_pfx_tonemapping;
std::unique_ptr<gl::postfx> m_pfx_chromaticaberration;
std::unique_ptr<gl::program> m_shadow_shader; std::unique_ptr<gl::program> m_shadow_shader;
std::unique_ptr<gl::program> m_alpha_shadow_shader; std::unique_ptr<gl::program> m_alpha_shadow_shader;

View File

@@ -404,9 +404,14 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
m_colorpass = m_renderpass; m_colorpass = m_renderpass;
if( ( !simulation::is_ready ) || ( Global.gfx_skiprendering ) ) {
::glClearColor( 51.0f / 255.f, 102.0f / 255.f, 85.0f / 255.f, 1.f ); // initial background Color
::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
break;
}
if( ( true == Global.RenderShadows ) if( ( true == Global.RenderShadows )
&& ( false == Global.bWireFrame ) && ( false == Global.bWireFrame )
&& ( true == simulation::is_ready )
&& ( m_shadowcolor != colors::white ) ) { && ( m_shadowcolor != colors::white ) ) {
// run shadowmaps pass before color // run shadowmaps pass before color
@@ -443,8 +448,7 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
} }
} }
if( ( true == m_environmentcubetexturesupport ) if( true == m_environmentcubetexturesupport ) {
&& ( true == simulation::is_ready ) ) {
// potentially update environmental cube map // potentially update environmental cube map
m_renderpass.draw_stats = {}; m_renderpass.draw_stats = {};
if( true == Render_reflections() ) { if( true == Render_reflections() ) {
@@ -454,16 +458,10 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
::glViewport( 0, 0, Global.iWindowWidth, Global.iWindowHeight ); ::glViewport( 0, 0, Global.iWindowWidth, Global.iWindowHeight );
if( simulation::is_ready ) {
auto const skydomecolour = simulation::Environment.m_skydome.GetAverageColor(); auto const skydomecolour = simulation::Environment.m_skydome.GetAverageColor();
::glClearColor( skydomecolour.x, skydomecolour.y, skydomecolour.z, 0.f ); // kolor nieba ::glClearColor( skydomecolour.x, skydomecolour.y, skydomecolour.z, 0.f ); // kolor nieba
}
else {
::glClearColor( 51.0f / 255.f, 102.0f / 255.f, 85.0f / 255.f, 1.f ); // initial background Color
}
::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); ::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if( simulation::is_ready ) {
// setup // setup
setup_matrices(); setup_matrices();
// render // render
@@ -558,7 +556,6 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
select_unit( m_diffusetextureunit ); select_unit( m_diffusetextureunit );
::glMatrixMode( GL_MODELVIEW ); ::glMatrixMode( GL_MODELVIEW );
} }
}
// store draw stats // store draw stats
m_colorpass.draw_stats = m_renderpass.draw_stats; m_colorpass.draw_stats = m_renderpass.draw_stats;

View File

@@ -0,0 +1,21 @@
in vec2 f_coords;
layout(location = 0) out vec4 out_color;
#texture (color_tex, 0, RGB)
uniform sampler2D iChannel0;
void main()
{
float amount = 0.001;
vec2 uv = f_coords;
vec3 col;
col.r = texture( iChannel0, vec2(uv.x+amount,uv.y) ).r;
col.g = texture( iChannel0, uv ).g;
col.b = texture( iChannel0, vec2(uv.x-amount,uv.y) ).b;
col *= (1.0 - amount * 0.5);
out_color = vec4(col,1.0);
}