Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 6 files). Show all
Unified · Split
| @@ -16,6 +16,8 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <QScreen> |
| 17 | 17 | #include "ScreenName.h" |
| 18 | 18 | |
| 19 | +#include <MeshPartPayload.h> | |
| 20 | + | |
| 19 | 21 | STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager){ |
| 20 | 22 | auto scriptEngine = manager->engine().get(); |
| 21 | 23 | |
| @@ -43,16 +45,17 @@ RenderScriptingInterface::RenderScriptingInterface() { · 21 unmodified lines | ||
| 43 | 45 | }); |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | − | |
| 47 | 48 | void RenderScriptingInterface::loadSettings() { |
| 48 | 49 | _renderSettingLock.withReadLock([&] { |
| 49 | − _renderMethod = (_renderMethodSetting.get()); | |
| 50 | − _shadowsEnabled = (_shadowsEnabledSetting.get()); | |
| 51 | − _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); | |
| 52 | − //_antialiasingMode = (_antialiasingModeSetting.get()); | |
| 50 | + _renderMethod = _renderMethodSetting.get(); | |
| 51 | + _shadowsEnabled = _shadowsEnabledSetting.get(); | |
| 52 | + _hazeEnabled = _hazeEnabledSetting.get(); | |
| 53 | + _bloomEnabled = _bloomEnabledSetting.get(); | |
| 54 | + _ambientOcclusionEnabled = _ambientOcclusionEnabledSetting.get(); | |
| 55 | + _proceduralMaterialsEnabled = _proceduralMaterialsEnabledSetting.get(); | |
| 53 | 56 | _antialiasingMode = static_cast<AntialiasingConfig::Mode>(_antialiasingModeSetting.get()); |
| 54 | − _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); | |
| 55 | − _fullScreenScreen = (_fullScreenScreenSetting.get()); | |
| 57 | + _viewportResolutionScale = _viewportResolutionScaleSetting.get(); | |
| 58 | + _fullScreenScreen = _fullScreenScreenSetting.get(); | |
| 56 | 59 | }); |
| 57 | 60 | |
| 58 | 61 | // If full screen screen is not initialized, or set to an invalid value, |
| @@ -65,7 +68,10 @@ void RenderScriptingInterface::loadSettings() { · 6 unmodified lines | ||
| 65 | 68 | |
| 66 | 69 | forceRenderMethod((RenderMethod)_renderMethod); |
| 67 | 70 | forceShadowsEnabled(_shadowsEnabled); |
| 71 | + forceHazeEnabled(_hazeEnabled); | |
| 72 | + forceBloomEnabled(_bloomEnabled); | |
| 68 | 73 | forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); |
| 74 | + forceProceduralMaterialsEnabled(_proceduralMaterialsEnabled); | |
| 69 | 75 | forceAntialiasingMode(_antialiasingMode); |
| 70 | 76 | forceViewportResolutionScale(_viewportResolutionScale); |
| 71 | 77 | } |
| @@ -136,19 +142,76 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { · 64 unmodified lines | ||
| 136 | 142 | |
| 137 | 143 | auto renderConfig = qApp->getRenderEngine()->getConfiguration(); |
| 138 | 144 | assert(renderConfig); |
| 145 | + Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 139 | 146 | auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); |
| 140 | 147 | if (lightingModelConfig) { |
| 141 | − Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 142 | 148 | lightingModelConfig->setShadow(enabled); |
| 143 | 149 | } |
| 144 | 150 | auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); |
| 145 | 151 | if (secondaryLightingModelConfig) { |
| 146 | − Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled); | |
| 147 | 152 | secondaryLightingModelConfig->setShadow(enabled); |
| 148 | 153 | } |
| 149 | 154 | }); |
| 150 | 155 | } |
| 151 | 156 | |
| 157 | +bool RenderScriptingInterface::getHazeEnabled() const { | |
| 158 | + return _hazeEnabled; | |
| 159 | +} | |
| 160 | + | |
| 161 | +void RenderScriptingInterface::setHazeEnabled(bool enabled) { | |
| 162 | + if (_hazeEnabled != enabled) { | |
| 163 | + forceHazeEnabled(enabled); | |
| 164 | + emit settingsChanged(); | |
| 165 | + } | |
| 166 | +} | |
| 167 | + | |
| 168 | +void RenderScriptingInterface::forceHazeEnabled(bool enabled) { | |
| 169 | + _renderSettingLock.withWriteLock([&] { | |
| 170 | + _hazeEnabled = (enabled); | |
| 171 | + _hazeEnabledSetting.set(enabled); | |
| 172 | + | |
| 173 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 174 | + assert(renderConfig); | |
| 175 | + auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | |
| 176 | + if (lightingModelConfig) { | |
| 177 | + lightingModelConfig->setHaze(enabled); | |
| 178 | + } | |
| 179 | + auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | |
| 180 | + if (secondaryLightingModelConfig) { | |
| 181 | + secondaryLightingModelConfig->setHaze(enabled); | |
| 182 | + } | |
| 183 | + }); | |
| 184 | +} | |
| 185 | + | |
| 186 | +bool RenderScriptingInterface::getBloomEnabled() const { | |
| 187 | + return _bloomEnabled; | |
| 188 | +} | |
| 189 | + | |
| 190 | +void RenderScriptingInterface::setBloomEnabled(bool enabled) { | |
| 191 | + if (_bloomEnabled != enabled) { | |
| 192 | + forceBloomEnabled(enabled); | |
| 193 | + emit settingsChanged(); | |
| 194 | + } | |
| 195 | +} | |
| 196 | + | |
| 197 | +void RenderScriptingInterface::forceBloomEnabled(bool enabled) { | |
| 198 | + _renderSettingLock.withWriteLock([&] { | |
| 199 | + _bloomEnabled = (enabled); | |
| 200 | + _bloomEnabledSetting.set(enabled); | |
| 201 | + | |
| 202 | + auto renderConfig = qApp->getRenderEngine()->getConfiguration(); | |
| 203 | + assert(renderConfig); | |
| 204 | + auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | |
| 205 | + if (lightingModelConfig) { | |
| 206 | + lightingModelConfig->setBloom(enabled); | |
| 207 | + } | |
| 208 | + auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel"); | |
| 209 | + if (secondaryLightingModelConfig) { | |
| 210 | + secondaryLightingModelConfig->setBloom(enabled); | |
| 211 | + } | |
| 212 | + }); | |
| 213 | +} | |
| 214 | + | |
| 152 | 215 | bool RenderScriptingInterface::getAmbientOcclusionEnabled() const { |
| 153 | 216 | return _ambientOcclusionEnabled; |
| 154 | 217 | } |
| @@ -165,11 +228,29 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 10 unmodified lines | ||
| 165 | 228 | _ambientOcclusionEnabled = (enabled); |
| 166 | 229 | _ambientOcclusionEnabledSetting.set(enabled); |
| 167 | 230 | |
| 168 | − auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); | |
| 169 | − if (lightingModelConfig) { | |
| 170 | − Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); | |
| 171 | − lightingModelConfig->setAmbientOcclusion(enabled); | |
| 172 | − } | |
| 231 | + Menu::getInstance()->setIsOptionChecked(MenuOption::AmbientOcclusion, enabled); | |
| 232 | + ModelMeshPartPayload::enableMaterialProceduralShaders = enabled; | |
| 233 | + }); | |
| 234 | +} | |
| 235 | + | |
| 236 | +bool RenderScriptingInterface::getProceduralMaterialsEnabled() const { | |
| 237 | + return _proceduralMaterialsEnabled; | |
| 238 | +} | |
| 239 | + | |
| 240 | +void RenderScriptingInterface::setProceduralMaterialsEnabled(bool enabled) { | |
| 241 | + if (_proceduralMaterialsEnabled != enabled) { | |
| 242 | + forceProceduralMaterialsEnabled(enabled); | |
| 243 | + emit settingsChanged(); | |
| 244 | + } | |
| 245 | +} | |
| 246 | + | |
| 247 | +void RenderScriptingInterface::forceProceduralMaterialsEnabled(bool enabled) { | |
| 248 | + _renderSettingLock.withWriteLock([&] { | |
| 249 | + _proceduralMaterialsEnabled = (enabled); | |
| 250 | + _proceduralMaterialsEnabledSetting.set(enabled); | |
| 251 | + | |
| 252 | + Menu::getInstance()->setIsOptionChecked(MenuOption::MaterialProceduralShaders, enabled); | |
| 253 | + ModelMeshPartPayload::enableMaterialProceduralShaders = enabled; | |
| 173 | 254 | }); |
| 174 | 255 | } |
| 175 | 256 | |
| @@ -233,7 +314,6 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo · 57 unmodified lines | ||
| 233 | 314 | }); |
| 234 | 315 | } |
| 235 | 316 | |
| 236 | − | |
| 237 | 317 | float RenderScriptingInterface::getViewportResolutionScale() const { |
| 238 | 318 | return _viewportResolutionScale; |
| 239 | 319 | } |