Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 165 files). Show all
Unified · Split
| @@ -19,14 +19,14 @@ STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager){ · 18 unmodified lines | ||
| 19 | 19 | auto scriptEngine = manager->engine().get(); |
| 20 | 20 | |
| 21 | 21 | scriptRegisterMetaType<RenderScriptingInterface::RenderMethod, scriptValueFromEnumClass<RenderScriptingInterface::RenderMethod>, scriptValueToEnumClass<RenderScriptingInterface::RenderMethod> >(scriptEngine, "RenderMethod"); |
| 22 | − scriptRegisterMetaType<AntialiasingConfig::Mode, scriptValueFromEnumClass<AntialiasingConfig::Mode>, scriptValueToEnumClass<AntialiasingConfig::Mode> >(scriptEngine, "Mode"); | |
| 22 | + scriptRegisterMetaType<AntialiasingSetupConfig::Mode, scriptValueFromEnumClass<AntialiasingSetupConfig::Mode>, scriptValueToEnumClass<AntialiasingSetupConfig::Mode> >(scriptEngine, "Mode"); | |
| 23 | 23 | })); |
| 24 | 24 | |
| 25 | 25 | STATIC_SCRIPT_INITIALIZER(+[](ScriptManager* manager){ |
| 26 | 26 | auto scriptEngine = manager->engine().get(); |
| 27 | 27 | |
| 28 | 28 | scriptEngine->registerEnum("Render.RenderMethod",QMetaEnum::fromType<RenderScriptingInterface::RenderMethod>()); |
| 29 | − scriptEngine->registerEnum("AntialiasingMode",QMetaEnum::fromType<AntialiasingConfig::Mode>()); | |
| 29 | + scriptEngine->registerEnum("AntialiasingMode",QMetaEnum::fromType<AntialiasingSetupConfig::Mode>()); | |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | RenderScriptingInterface* RenderScriptingInterface::getInstance() { |
| @@ -49,7 +49,7 @@ void RenderScriptingInterface::loadSettings() { · 16 unmodified lines | ||
| 49 | 49 | _shadowsEnabled = (_shadowsEnabledSetting.get()); |
| 50 | 50 | _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); |
| 51 | 51 | //_antialiasingMode = (_antialiasingModeSetting.get()); |
| 52 | − _antialiasingMode = static_cast<AntialiasingConfig::Mode>(_antialiasingModeSetting.get()); | |
| 52 | + _antialiasingMode = static_cast<AntialiasingSetupConfig::Mode>(_antialiasingModeSetting.get()); | |
| 53 | 53 | _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); |
| 54 | 54 | _fullScreenScreen = (_fullScreenScreenSetting.get()); |
| 55 | 55 | }); |
| @@ -84,10 +84,16 @@ void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) { · 28 unmodified lines | ||
| 84 | 84 | _renderMethod = (int)renderMethod; |
| 85 | 85 | _renderMethodSetting.set((int)renderMethod); |
| 86 | 86 | |
| 87 | − auto config = dynamic_cast<render::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch")); | |
| 87 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 88 | + auto config = dynamic_cast<render::SwitchConfig*>(renderConfig->getConfig("RenderMainView.DeferredForwardSwitch")); | |
| 88 | 89 | if (config) { |
| 89 | 90 | config->setBranch((int)renderMethod); |
| 90 | 91 | } |
| 92 | + | |
| 93 | + auto secondaryConfig = dynamic_cast<render::SwitchConfig*>(renderConfig->getConfig("RenderSecondView.DeferredForwardSwitch")); | |
| 94 | + if (secondaryConfig) { | |
| 95 | + secondaryConfig->setBranch((int)renderMethod); | |
| 96 | + } | |
| 91 | 97 | }); |
| 92 | 98 | } |
| 93 | 99 | |
| @@ -111,17 +117,16 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { · 17 unmodified lines | ||
| 111 | 117 | _renderSettingLock.withWriteLock([&] { |
| 112 | 118 | _shadowsEnabled = (enabled); |
| 113 | 119 | _shadowsEnabledSetting.set(enabled); |
| 120 | + Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 114 | 121 | |
| 115 | 122 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); |
| 116 | 123 | assert(renderConfig); |
| 117 | 124 | auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); |
| 118 | 125 | if (lightingModelConfig) { |
| 119 | − Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 120 | 126 | lightingModelConfig->setShadow(enabled); |
| 121 | 127 | } |
| 122 | 128 | auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); |
| 123 | 129 | if (secondaryLightingModelConfig) { |
| 124 | − Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 125 | 130 | secondaryLightingModelConfig->setShadow(enabled); |
| 126 | 131 | } |
| 127 | 132 | }); |
| @@ -142,63 +147,70 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 14 unmodified lines | ||
| 142 | 147 | _renderSettingLock.withWriteLock([&] { |
| 143 | 148 | _ambientOcclusionEnabled = (enabled); |
| 144 | 149 | _ambientOcclusionEnabledSetting.set(enabled); |
| 150 | + Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); | |
| 145 | 151 | |
| 146 | − auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | |
| 152 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 153 | + auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | |
| 147 | 154 | if (lightingModelConfig) { |
| 148 | − Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); | |
| 149 | 155 | lightingModelConfig->setAmbientOcclusion(enabled); |
| 150 | 156 | } |
| 157 | + | |
| 158 | + auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | |
| 159 | + if (secondaryLightingModelConfig) { | |
| 160 | + secondaryLightingModelConfig->setAmbientOcclusion(enabled); | |
| 161 | + } | |
| 151 | 162 | }); |
| 152 | 163 | } |
| 153 | 164 | |
| 154 | −AntialiasingConfig::Mode RenderScriptingInterface::getAntialiasingMode() const { | |
| 165 | +AntialiasingSetupConfig::Mode RenderScriptingInterface::getAntialiasingMode() const { | |
| 155 | 166 | return _antialiasingMode; |
| 156 | 167 | } |
| 157 | 168 | |
| 158 | −void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode) { | |
| 169 | +void RenderScriptingInterface::setAntialiasingMode(AntialiasingSetupConfig::Mode mode) { | |
| 159 | 170 | if (_antialiasingMode != mode) { |
| 160 | 171 | forceAntialiasingMode(mode); |
| 161 | 172 | emit settingsChanged(); |
| 162 | 173 | } |
| 163 | 174 | } |
| 164 | 175 | |
| 165 | −void setAntialiasingModeForView(AntialiasingConfig::Mode mode, JitterSampleConfig *jitterCamConfig, AntialiasingConfig *antialiasingConfig) { | |
| 176 | +void setAntialiasingModeForView(AntialiasingSetupConfig::Mode mode, AntialiasingSetupConfig *antialiasingSetupConfig, AntialiasingConfig *antialiasingConfig) { | |
| 166 | 177 | switch (mode) { |
| 167 | − case AntialiasingConfig::Mode::NONE: | |
| 168 | − jitterCamConfig->none(); | |
| 178 | + case AntialiasingSetupConfig::Mode::NONE: | |
| 179 | + antialiasingSetupConfig->none(); | |
| 169 | 180 | antialiasingConfig->blend = 1; |
| 170 | 181 | antialiasingConfig->setDebugFXAA(false); |
| 171 | 182 | break; |
| 172 | − case AntialiasingConfig::Mode::TAA: | |
| 173 | − jitterCamConfig->play(); | |
| 183 | + case AntialiasingSetupConfig::Mode::TAA: | |
| 184 | + antialiasingSetupConfig->play(); | |
| 174 | 185 | antialiasingConfig->blend = 0.25; |
| 175 | 186 | antialiasingConfig->setDebugFXAA(false); |
| 176 | 187 | break; |
| 177 | − case AntialiasingConfig::Mode::FXAA: | |
| 178 | − jitterCamConfig->none(); | |
| 188 | + case AntialiasingSetupConfig::Mode::FXAA: | |
| 189 | + antialiasingSetupConfig->none(); | |
| 179 | 190 | antialiasingConfig->blend = 0.25; |
| 180 | 191 | antialiasingConfig->setDebugFXAA(true); |
| 181 | 192 | break; |
| 182 | 193 | default: |
| 183 | − jitterCamConfig->none(); | |
| 194 | + antialiasingSetupConfig->none(); | |
| 184 | 195 | antialiasingConfig->blend = 1; |
| 185 | 196 | antialiasingConfig->setDebugFXAA(false); |
| 186 | 197 | break; |
| 187 | 198 | } |
| 188 | 199 | } |
| 189 | 200 | |
| 190 | −void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) { | |
| 201 | +void RenderScriptingInterface::forceAntialiasingMode(AntialiasingSetupConfig::Mode mode) { | |
| 191 | 202 | _renderSettingLock.withWriteLock([&] { |
| 192 | 203 | _antialiasingMode = mode; |
| 193 | 204 | |
| 194 | − auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderMainView.JitterCam"); | |
| 195 | − auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<Antialiasing>("RenderMainView.Antialiasing"); | |
| 196 | − auto secondViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderSecondView.JitterCam"); | |
| 197 | − auto secondViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<Antialiasing>("RenderSecondView.Antialiasing"); | |
| 198 | − if (mode != AntialiasingConfig::Mode::NONE | |
| 199 | − && mode != AntialiasingConfig::Mode::TAA | |
| 200 | − && mode != AntialiasingConfig::Mode::FXAA) { | |
| 201 | − _antialiasingMode = AntialiasingConfig::Mode::NONE; | |
| 205 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 206 | + auto mainViewJitterCamConfig = renderConfig->getConfig<AntialiasingSetup>("RenderMainView.JitterCam"); | |
| 207 | + auto mainViewAntialiasingConfig = renderConfig->getConfig<Antialiasing>("RenderMainView.Antialiasing"); | |
| 208 | + auto secondViewJitterCamConfig = renderConfig->getConfig<AntialiasingSetup>("RenderSecondView.JitterCam"); | |
| 209 | + auto secondViewAntialiasingConfig = renderConfig->getConfig<Antialiasing>("RenderSecondView.Antialiasing"); | |
| 210 | + if (mode != AntialiasingSetupConfig::Mode::NONE | |
| 211 | + && mode != AntialiasingSetupConfig::Mode::TAA | |
| 212 | + && mode != AntialiasingSetupConfig::Mode::FXAA) { | |
| 213 | + _antialiasingMode = AntialiasingSetupConfig::Mode::NONE; | |
| 202 | 214 | } |
| 203 | 215 | if (mainViewJitterCamConfig && mainViewAntialiasingConfig) { |
| 204 | 216 | setAntialiasingModeForView( mode, mainViewJitterCamConfig, mainViewAntialiasingConfig); |
| @@ -271,7 +283,7 @@ void RenderScriptingInterface::forceViewportResolutionScale(float scale) { · 66 unmodified lines | ||
| 271 | 283 | return; |
| 272 | 284 | } |
| 273 | 285 | _renderSettingLock.withWriteLock([&] { |
| 274 | − _viewportResolutionScale = (scale); | |
| 286 | + _viewportResolutionScale = scale; | |
| 275 | 287 | _viewportResolutionScaleSetting.set(scale); |
| 276 | 288 | |
| 277 | 289 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); |
| @@ -279,12 +291,23 @@ void RenderScriptingInterface::forceViewportResolutionScale(float scale) { · 1 unmodified line | ||
| 279 | 291 | auto deferredView = renderConfig->getConfig("RenderMainView.RenderDeferredTask"); |
| 280 | 292 | // mainView can be null if we're rendering in forward mode |
| 281 | 293 | if (deferredView) { |
| 282 | − deferredView->setProperty("resolutionScale", _viewportResolutionScale); | |
| 294 | + deferredView->setProperty("resolutionScale", scale); | |
| 283 | 295 | } |
| 284 | 296 | auto forwardView = renderConfig->getConfig("RenderMainView.RenderForwardTask"); |
| 285 | 297 | // mainView can be null if we're rendering in forward mode |
| 286 | 298 | if (forwardView) { |
| 287 | − forwardView->setProperty("resolutionScale", _viewportResolutionScale); | |
| 299 | + forwardView->setProperty("resolutionScale", scale); | |
| 300 | + } | |
| 301 | + | |
| 302 | + auto deferredSecondView = renderConfig->getConfig("RenderSecondView.RenderDeferredTask"); | |
| 303 | + // mainView can be null if we're rendering in forward mode | |
| 304 | + if (deferredSecondView) { | |
| 305 | + deferredSecondView->setProperty("resolutionScale", scale); | |
| 306 | + } | |
| 307 | + auto forwardSecondView = renderConfig->getConfig("RenderMainView.RenderForwardTask"); | |
| 308 | + // mainView can be null if we're rendering in forward mode | |
| 309 | + if (forwardSecondView) { | |
| 310 | + forwardSecondView->setProperty("resolutionScale", scale); | |
| 288 | 311 | } |
| 289 | 312 | }); |
| 290 | 313 | } |