Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -10,13 +10,14 @@ · 9 unmodified lines | ||
| 10 | 10 | #include "LightingModel.h" |
| 11 | 11 | #include "AntialiasingEffect.h" |
| 12 | 12 | |
| 13 | −std::once_flag RenderScriptingInterface::registry_flag; | |
| 14 | 13 | |
| 15 | 14 | RenderScriptingInterface* RenderScriptingInterface::getInstance() { |
| 16 | 15 | static RenderScriptingInterface sharedInstance; |
| 17 | 16 | return &sharedInstance; |
| 18 | 17 | } |
| 19 | 18 | |
| 19 | +std::once_flag RenderScriptingInterface::registry_flag; | |
| 20 | + | |
| 20 | 21 | RenderScriptingInterface::RenderScriptingInterface() { |
| 21 | 22 | std::call_once(registry_flag, [] { |
| 22 | 23 | qmlRegisterType<RenderScriptingInterface>("RenderEnums", 1, 0, "RenderEnums"); |
| @@ -25,19 +26,19 @@ RenderScriptingInterface::RenderScriptingInterface() { · 2 unmodified lines | ||
| 25 | 26 | |
| 26 | 27 | void RenderScriptingInterface::loadSettings() { |
| 27 | 28 | _renderSettingLock.withReadLock([&] { |
| 28 | − _renderMethod.store(_renderMethodSetting.get()); | |
| 29 | − _shadowsEnabled.store(_shadowsEnabledSetting.get()); | |
| 30 | − _ambientOcclusionEnabled.store(_ambientOcclusionEnabledSetting.get()); | |
| 31 | − _antialiasingEnabled.store(_antialiasingEnabledSetting.get()); | |
| 29 | + _renderMethod = (_renderMethodSetting.get()); | |
| 30 | + _shadowsEnabled = (_shadowsEnabledSetting.get()); | |
| 31 | + _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); | |
| 32 | + _antialiasingEnabled = (_antialiasingEnabledSetting.get()); | |
| 32 | 33 | }); |
| 33 | − forceRenderMethod((RenderMethod)_renderMethod.load()); | |
| 34 | − forceShadowsEnabled(_shadowsEnabled.load()); | |
| 35 | − forceAmbientOcclusionEnabled(_ambientOcclusionEnabled.load()); | |
| 36 | − forceAntialiasingEnabled(_antialiasingEnabled.load()); | |
| 34 | + forceRenderMethod((RenderMethod)_renderMethod); | |
| 35 | + forceShadowsEnabled(_shadowsEnabled); | |
| 36 | + forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); | |
| 37 | + forceAntialiasingEnabled(_antialiasingEnabled); | |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | RenderScriptingInterface::RenderMethod RenderScriptingInterface::getRenderMethod() { |
| 40 | − return (RenderMethod) _renderMethod.load(); | |
| 41 | + return (RenderMethod) _renderMethod; | |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | void RenderScriptingInterface::setRenderMethod(RenderMethod renderMethod) { |
| @@ -53,7 +54,6 @@ void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) { · 9 unmodified lines | ||
| 53 | 54 | |
| 54 | 55 | auto config = dynamic_cast<task::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch")); |
| 55 | 56 | if (config) { |
| 56 | − _renderMethodSetting.set((int)renderMethod); | |
| 57 | 57 | config->setBranch((int)renderMethod); |
| 58 | 58 | } |
| 59 | 59 | }); |
| @@ -65,7 +65,7 @@ QStringList RenderScriptingInterface::getRenderMethodNames() const { · 5 unmodified lines | ||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | bool RenderScriptingInterface::getShadowsEnabled() { |
| 68 | − return _shadowsEnabled.load(); | |
| 68 | + return _shadowsEnabled; | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | void RenderScriptingInterface::setShadowsEnabled(bool enabled) { |
| @@ -77,7 +77,7 @@ void RenderScriptingInterface::setShadowsEnabled(bool enabled) { · 5 unmodified lines | ||
| 77 | 77 | |
| 78 | 78 | void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { |
| 79 | 79 | _renderSettingLock.withWriteLock([&] { |
| 80 | − _shadowsEnabled.store(enabled); | |
| 80 | + _shadowsEnabled = (enabled); | |
| 81 | 81 | _shadowsEnabledSetting.set(enabled); |
| 82 | 82 | |
| 83 | 83 | auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); |
| @@ -89,11 +89,11 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { · 5 unmodified lines | ||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | bool RenderScriptingInterface::getAmbientOcclusionEnabled() { |
| 92 | − return _ambientOcclusionEnabled.load(); | |
| 92 | + return _ambientOcclusionEnabled; | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | void RenderScriptingInterface::setAmbientOcclusionEnabled(bool enabled) { |
| 96 | − if (_ambientOcclusionEnabled.load() != enabled) { | |
| 96 | + if (_ambientOcclusionEnabled != enabled) { | |
| 97 | 97 | forceAmbientOcclusionEnabled(enabled); |
| 98 | 98 | emit settingsChanged(); |
| 99 | 99 | } |
| @@ -101,7 +101,7 @@ void RenderScriptingInterface::setAmbientOcclusionEnabled(bool enabled) { · 1 unmodified line | ||
| 101 | 101 | |
| 102 | 102 | void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { |
| 103 | 103 | _renderSettingLock.withWriteLock([&] { |
| 104 | − _ambientOcclusionEnabled.store(enabled); | |
| 104 | + _ambientOcclusionEnabled = (enabled); | |
| 105 | 105 | _ambientOcclusionEnabledSetting.set(enabled); |
| 106 | 106 | |
| 107 | 107 | auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel"); |
| @@ -113,11 +113,11 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 5 unmodified lines | ||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | bool RenderScriptingInterface::getAntialiasingEnabled() { |
| 116 | − return _antialiasingEnabled.load(); | |
| 116 | + return _antialiasingEnabled; | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) { |
| 120 | − if (_antialiasingEnabled.load() != enabled) { | |
| 120 | + if (_antialiasingEnabled != enabled) { | |
| 121 | 121 | forceAntialiasingEnabled(enabled); |
| 122 | 122 | emit settingsChanged(); |
| 123 | 123 | } |
| @@ -125,7 +125,7 @@ void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) { · 1 unmodified line | ||
| 125 | 125 | |
| 126 | 126 | void RenderScriptingInterface::forceAntialiasingEnabled(bool enabled) { |
| 127 | 127 | _renderSettingLock.withWriteLock([&] { |
| 128 | − _antialiasingEnabled.store(enabled); | |
| 128 | + _antialiasingEnabled = (enabled); | |
| 129 | 129 | _antialiasingEnabledSetting.set(enabled); |
| 130 | 130 | |
| 131 | 131 | auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderMainView.JitterCam"); |