Skip to content

Commit

Permalink
Fixed the light direction being reset on changes to render settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fo76utils committed Jan 31, 2025
1 parent d1aeaf2 commit 3fdca33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/glview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ void GLView::updateSettings()
cfg.moveSpd = settings.value( "General/Camera/Movement Speed" ).toFloat();
cfg.rotSpd = settings.value( "General/Camera/Rotation Speed" ).toFloat();
cfg.upAxis = UpAxis(settings.value( "General/Up Axis", ZAxis ).toInt());
int z = settings.value( "Lighting/Declination", 0 ).toInt();
declination = float( z % 720 ) * 0.25f; // Divide by 4 because sliders are -720 <-> 720
z = settings.value( "Lighting/Planar Angle", 0 ).toInt();
planarAngle = float( z % 720 ) * 0.25f;
z = settings.value( "General/Camera/Startup Direction", 1 ).toInt();
int z = settings.value( "General/Camera/Startup Direction", 1 ).toInt();
static const ViewState startupDirections[6] = {
ViewLeft, ViewFront, ViewTop, ViewRight, ViewBack, ViewBottom
};
Expand Down
5 changes: 5 additions & 0 deletions src/ui/widgets/lightingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ LightingWidget::LightingWidget( GLView * ogl, QWidget * parent ) : QWidget(paren
tmp = settings.value( "Settings/Render/Lighting/Tone Mapping", POS ).toInt();
ui->sldToneMapping->setValue( std::clamp< int >( tmp, 0, BRIGHT ) );
ui->btnFrontal->setChecked( settings.value( "Settings/Render/Lighting/Frontal Light", true ).toBool() );

tmp = settings.value( "Lighting/Declination", 0 ).toInt();
ogl->declination = float( tmp % int(POS) ) * ( 180.0f / float(POS) );
tmp = settings.value( "Lighting/Planar Angle", 0 ).toInt();
ogl->planarAngle = float( tmp % int(POS) ) * ( 180.0f / float(POS) );
}

LightingWidget::~LightingWidget()
Expand Down

0 comments on commit 3fdca33

Please sign in to comment.