Post processing shaders now use the same lua commands, no more launcher option to enable live reload

remove_forgotten_code
florent.teppe 2 years ago
parent 3ab0a99154
commit df69fc7659

@ -152,7 +152,6 @@ bool Launcher::AdvancedPage::loadSettings()
connect(postprocessEnabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotPostProcessToggled(bool)));
loadSettingBool(postprocessEnabledCheckBox, "enabled", "Post Processing");
loadSettingBool(postprocessLiveReloadCheckBox, "live reload", "Post Processing");
loadSettingBool(postprocessTransparentPostpassCheckBox, "transparent postpass", "Post Processing");
postprocessHDRTimeComboBox->setValue(Settings::Manager::getDouble("auto exposure speed", "Post Processing"));
@ -309,7 +308,6 @@ void Launcher::AdvancedPage::saveSettings()
saveSettingBool(nightDaySwitchesCheckBox, "day night switches", "Game");
saveSettingBool(postprocessEnabledCheckBox, "enabled", "Post Processing");
saveSettingBool(postprocessLiveReloadCheckBox, "live reload", "Post Processing");
saveSettingBool(postprocessTransparentPostpassCheckBox, "transparent postpass", "Post Processing");
double hdrExposureTime = postprocessHDRTimeComboBox->value();
if (hdrExposureTime != Settings::Manager::getDouble("auto exposure speed", "Post Processing"))
@ -466,7 +464,6 @@ void Launcher::AdvancedPage::slotAnimSourcesToggled(bool checked)
void Launcher::AdvancedPage::slotPostProcessToggled(bool checked)
{
postprocessLiveReloadCheckBox->setEnabled(checked);
postprocessTransparentPostpassCheckBox->setEnabled(checked);
postprocessHDRTimeComboBox->setEnabled(checked);
postprocessHDRTimeLabel->setEnabled(checked);

@ -5,6 +5,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwrender/postprocessor.hpp"
#include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp>
@ -54,7 +55,10 @@ namespace MWLua
{
context.mLuaManager->addAction([]
{
MWBase::Environment::get().getWorld()->getRenderingManager()->getResourceSystem()->getSceneManager()->getShaderManager().triggerShaderReload();
auto world = MWBase::Environment::get().getWorld();
world->getRenderingManager()->getResourceSystem()->getSceneManager()->getShaderManager().triggerShaderReload();
world->getPostProcessor()->triggerShaderReload();
});
};
@ -62,7 +66,9 @@ namespace MWLua
{
context.mLuaManager->addAction([value]
{
MWBase::Environment::get().getWorld()->getRenderingManager()->getResourceSystem()->getSceneManager()->getShaderManager().setHotReloadEnabled(value);
auto world = MWBase::Environment::get().getWorld();
world->getRenderingManager()->getResourceSystem()->getSceneManager()->getShaderManager().setHotReloadEnabled(value);
world->getPostProcessor()->mEnableLiveReload = value;
});
};

@ -102,6 +102,7 @@ namespace MWRender
{
PostProcessor::PostProcessor(RenderingManager& rendering, osgViewer::Viewer* viewer, osg::Group* rootNode, const VFS::Manager* vfs)
: osg::Group()
, mEnableLiveReload(false)
, mRootNode(rootNode)
, mSamples(Settings::Manager::getInt("antialiasing", "Video"))
, mDirty(false)
@ -109,6 +110,7 @@ namespace MWRender
, mRendering(rendering)
, mViewer(viewer)
, mVFS(vfs)
, mTriggerShaderReload(false)
, mReload(false)
, mEnabled(false)
, mUsePostProcessing(false)
@ -370,10 +372,11 @@ namespace MWRender
void PostProcessor::updateLiveReload()
{
static const bool liveReload = Settings::Manager::getBool("live reload", "Post Processing");
if (!liveReload)
if (!mEnableLiveReload && !mTriggerShaderReload)
return;
mTriggerShaderReload = false;//Done only once
for (auto& technique : mTechniques)
{
if (technique->getStatus() == fx::Technique::Status::File_Not_exists)
@ -890,5 +893,10 @@ namespace MWRender
return Stereo::Manager::instance().eyeResolution().y();
return mHeight;
}
void PostProcessor::triggerShaderReload()
{
mTriggerShaderReload = true;
}
}

@ -180,6 +180,10 @@ namespace MWRender
int renderWidth() const;
int renderHeight() const;
void triggerShaderReload();
bool mEnableLiveReload;
private:
void populateTechniqueFiles();
@ -225,6 +229,7 @@ namespace MWRender
osgViewer::Viewer* mViewer;
const VFS::Manager* mVFS;
bool mTriggerShaderReload;
bool mReload;
bool mEnabled;
bool mUsePostProcessing;

@ -670,19 +670,6 @@
<property name="leftMargin">
<number>20</number>
</property>
<item>
<widget class="QCheckBox" name="postprocessLiveReloadCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Debug Mode. Automatically reload active shaders when they are modified on filesystem.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Live reload</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="postprocessTransparentPostpassCheckBox">
<property name="enabled">

Loading…
Cancel
Save