mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:59:57 +00:00
[Postprocessing] Small cleanup
This commit is contained in:
parent
e5e6645575
commit
66aa546e97
2 changed files with 16 additions and 22 deletions
|
@ -228,22 +228,11 @@ namespace MWRender
|
|||
|
||||
mViewer->setSceneData(this);
|
||||
mViewer->getCamera()->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
|
||||
mViewer->getCamera()->setImplicitBufferAttachmentMask(0, 0);
|
||||
mViewer->getCamera()->getGraphicsContext()->setResizedCallback(new ResizedCallback(this));
|
||||
mViewer->getCamera()->setUserData(this);
|
||||
|
||||
setCullCallback(mStateUpdater);
|
||||
mHUDCamera->setCullCallback(new HUDCullCallback);
|
||||
|
||||
static bool init = false;
|
||||
|
||||
if (init)
|
||||
{
|
||||
resize();
|
||||
init = true;
|
||||
}
|
||||
|
||||
init = true;
|
||||
}
|
||||
|
||||
void PostProcessor::disable()
|
||||
|
@ -631,7 +620,7 @@ namespace MWRender
|
|||
auto it = technique->getRenderTargetsMap().find(whitelist);
|
||||
if (it != technique->getRenderTargetsMap().end() && renderTargetCache[it->second.mTarget])
|
||||
{
|
||||
subPass.mStateSet->setTextureAttributeAndModes(subTexUnit, renderTargetCache[it->second.mTarget]);
|
||||
subPass.mStateSet->setTextureAttribute(subTexUnit, renderTargetCache[it->second.mTarget]);
|
||||
subPass.mStateSet->addUniform(new osg::Uniform(std::string(it->first).c_str(), subTexUnit++));
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +649,7 @@ namespace MWRender
|
|||
return Status_Error;
|
||||
}
|
||||
|
||||
if (!technique || Misc::StringUtils::ciEqual(technique->getName(), "main") || (location.has_value() && location.value() <= 0))
|
||||
if (!technique || technique->getLocked() || (location.has_value() && location.value() <= 0))
|
||||
return Status_Error;
|
||||
|
||||
disableTechnique(technique, false);
|
||||
|
@ -675,7 +664,7 @@ namespace MWRender
|
|||
|
||||
PostProcessor::Status PostProcessor::disableTechnique(std::shared_ptr<fx::Technique> technique, bool dirty)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual(technique->getName(), "main"))
|
||||
if (technique->getLocked())
|
||||
return Status_Error;
|
||||
|
||||
auto it = std::find(mTechniques.begin(), mTechniques.end(), technique);
|
||||
|
@ -819,21 +808,22 @@ namespace MWRender
|
|||
std::vector<std::string> techniqueStrings;
|
||||
Misc::StringUtils::split(Settings::Manager::getString("chain", "Post Processing"), techniqueStrings, ",");
|
||||
|
||||
techniqueStrings.insert(techniqueStrings.begin(), "main");
|
||||
const std::string& mainIdentifier = "main";
|
||||
|
||||
auto main = loadTechnique(mainIdentifier);
|
||||
|
||||
if (main)
|
||||
main->setLocked(true);
|
||||
|
||||
mTechniques.push_back(std::move(main));
|
||||
|
||||
for (auto& techniqueName : techniqueStrings)
|
||||
{
|
||||
Misc::StringUtils::trim(techniqueName);
|
||||
|
||||
if (techniqueName.empty())
|
||||
if (techniqueName.empty() || Misc::StringUtils::ciEqual(techniqueName, mainIdentifier))
|
||||
continue;
|
||||
|
||||
if ((&techniqueName != &techniqueStrings.front()) && techniqueName == "main")
|
||||
{
|
||||
Log(Debug::Warning) << "main.omwfx techniqued specified in chain, this is not allowed. technique file will be ignored if it exists.";
|
||||
continue;
|
||||
}
|
||||
|
||||
mTechniques.push_back(loadTechnique(techniqueName));
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,9 @@ namespace fx
|
|||
|
||||
bool getDynamic() const { return mDynamic; }
|
||||
|
||||
void setLocked(bool locked) { mLocked = locked; }
|
||||
bool getLocked() const { return mLocked; }
|
||||
|
||||
private:
|
||||
[[noreturn]] void error(const std::string& msg);
|
||||
|
||||
|
@ -293,6 +296,7 @@ namespace fx
|
|||
std::string mLastError;
|
||||
|
||||
bool mDynamic = false;
|
||||
bool mLocked = false;
|
||||
};
|
||||
|
||||
template<> void Technique::parseBlockImp<Lexer::Shared>();
|
||||
|
|
Loading…
Reference in a new issue