Merge pull request #294 from overte-org/fix/default_aa

Secondary camera now has the same antialiasing settings as main one
This commit is contained in:
ksuprynowicz 2022-12-27 15:19:40 +01:00 committed by GitHub
commit 76b3f1bcdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 25 deletions

View file

@ -132,36 +132,49 @@ void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode
}
}
void setAntialiasingModeForView(AntialiasingConfig::Mode mode, JitterSampleConfig *jitterCamConfig, AntialiasingConfig *antialiasingConfig) {
switch (mode) {
case AntialiasingConfig::Mode::NONE:
jitterCamConfig->none();
antialiasingConfig->blend = 1;
antialiasingConfig->setDebugFXAA(false);
break;
case AntialiasingConfig::Mode::TAA:
jitterCamConfig->play();
antialiasingConfig->blend = 0.25;
antialiasingConfig->setDebugFXAA(false);
break;
case AntialiasingConfig::Mode::FXAA:
jitterCamConfig->none();
antialiasingConfig->blend = 0.25;
antialiasingConfig->setDebugFXAA(true);
break;
default:
jitterCamConfig->none();
antialiasingConfig->blend = 1;
antialiasingConfig->setDebugFXAA(false);
break;
}
}
void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) {
_renderSettingLock.withWriteLock([&] {
_antialiasingMode = mode;
auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderMainView.JitterCam");
auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<Antialiasing>("RenderMainView.Antialiasing");
auto secondViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderSecondView.JitterCam");
auto secondViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<Antialiasing>("RenderSecondView.Antialiasing");
if (mode != AntialiasingConfig::Mode::NONE
&& mode != AntialiasingConfig::Mode::TAA
&& mode != AntialiasingConfig::Mode::FXAA) {
_antialiasingMode = AntialiasingConfig::Mode::NONE;
}
if (mainViewJitterCamConfig && mainViewAntialiasingConfig) {
switch (mode) {
case AntialiasingConfig::Mode::NONE:
mainViewJitterCamConfig->none();
mainViewAntialiasingConfig->blend = 1;
mainViewAntialiasingConfig->setDebugFXAA(false);
break;
case AntialiasingConfig::Mode::TAA:
mainViewJitterCamConfig->play();
mainViewAntialiasingConfig->blend = 0.25;
mainViewAntialiasingConfig->setDebugFXAA(false);
break;
case AntialiasingConfig::Mode::FXAA:
mainViewJitterCamConfig->none();
mainViewAntialiasingConfig->blend = 0.25;
mainViewAntialiasingConfig->setDebugFXAA(true);
break;
default:
_antialiasingMode = AntialiasingConfig::Mode::NONE;
mainViewJitterCamConfig->none();
mainViewAntialiasingConfig->blend = 1;
mainViewAntialiasingConfig->setDebugFXAA(false);
break;
}
setAntialiasingModeForView( mode, mainViewJitterCamConfig, mainViewAntialiasingConfig);
}
if (secondViewJitterCamConfig && secondViewAntialiasingConfig) {
setAntialiasingModeForView( mode, secondViewJitterCamConfig, secondViewAntialiasingConfig);
}
_antialiasingModeSetting.set(_antialiasingMode);

View file

@ -194,7 +194,7 @@ private:
int _renderMethod{ RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED };
bool _shadowsEnabled{ true };
bool _ambientOcclusionEnabled{ false };
AntialiasingConfig::Mode _antialiasingMode{ AntialiasingConfig::Mode::TAA };
AntialiasingConfig::Mode _antialiasingMode{ AntialiasingConfig::Mode::NONE };
float _viewportResolutionScale{ 1.0f };
// Actual settings saved on disk
@ -202,7 +202,7 @@ private:
Setting::Handle<bool> _shadowsEnabledSetting { "shadowsEnabled", true };
Setting::Handle<bool> _ambientOcclusionEnabledSetting { "ambientOcclusionEnabled", false };
//Setting::Handle<AntialiasingConfig::Mode> _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA };
Setting::Handle<int> _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA };
Setting::Handle<int> _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::NONE };
Setting::Handle<float> _viewportResolutionScaleSetting { "viewportResolutionScale", 1.0f };
// Force assign both setting AND runtime value to the parameter value