Compositor: No longer append 'Compositor/' to Effects when the Compositor is

enabled. Do not remove transparent bins in shadow passes.
This commit is contained in:
Fernando García Liñán 2020-03-14 20:33:45 +01:00
parent 40725a76ab
commit 1b6545fc05
2 changed files with 1 additions and 34 deletions

View File

@ -33,7 +33,6 @@
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/scene/util/SGReaderWriterOptions.hxx> #include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/scene/tgdb/userdata.hxx>
#include <simgear/scene/util/SGSceneFeatures.hxx> #include <simgear/scene/util/SGSceneFeatures.hxx>
#include <simgear/scene/util/SplicingVisitor.hxx> #include <simgear/scene/util/SplicingVisitor.hxx>
#include <simgear/structure/SGExpression.hxx> #include <simgear/structure/SGExpression.hxx>
@ -127,16 +126,7 @@ Effect* makeEffect(const string& name,
itr->second.valid()) itr->second.valid())
return itr->second.get(); return itr->second.get();
} }
string effectFileName; string effectFileName(name);
// Use getPropertyRoot() because the SGReaderWriterOptions might not have a
// valid property tree
if (getPropertyRoot()->getBoolValue("/sim/version/compositor-support", false) &&
name.substr(0, name.find("/")) == "Effects") {
// Temporarily append the Compositor/ directory to every effect that should
// be inside Effects/.
effectFileName += "Compositor/";
}
effectFileName += name;
effectFileName += ".eff"; effectFileName += ".eff";
string absFileName string absFileName
= SGModelLib::findDataFile(effectFileName, options); = SGModelLib::findDataFile(effectFileName, options);

View File

@ -36,24 +36,6 @@
#include "Compositor.hxx" #include "Compositor.hxx"
#include "CompositorUtil.hxx" #include "CompositorUtil.hxx"
namespace {
osgUtil::RenderBin::RenderBinList
removeTransparentBins(simgear::EffectCullVisitor *cv)
{
osgUtil::RenderBin::RenderBinList transparent_bins;
osgUtil::RenderStage *stage = cv->getRenderStage();
osgUtil::RenderBin::RenderBinList &rbl = stage->getRenderBinList();
for (auto rbi = rbl.begin(); rbi != rbl.end(); ) {
if (rbi->second->getSortMode() == osgUtil::RenderBin::SORT_BACK_TO_FRONT) {
transparent_bins.insert(std::make_pair(rbi->first, rbi->second));
rbl.erase(rbi++);
} else {
++rbi;
}
}
return transparent_bins;
}
} // anonymous namespace
namespace simgear { namespace simgear {
namespace compositor { namespace compositor {
@ -407,8 +389,6 @@ public:
traverse(node, nv); traverse(node, nv);
removeTransparentBins(cv);
// The light matrix uniform is updated after the traverse in case the // The light matrix uniform is updated after the traverse in case the
// OSG near/far plane calculations were enabled // OSG near/far plane calculations were enabled
osg::Matrixf light_matrix = osg::Matrixf light_matrix =
@ -736,9 +716,6 @@ public:
SG_LOG(SG_INPUT, SG_WARN, "ScenePassBuilder::build: Pass '" SG_LOG(SG_INPUT, SG_WARN, "ScenePassBuilder::build: Pass '"
<< shadow_pass_name << "is not a shadow pass"); << shadow_pass_name << "is not a shadow pass");
} }
} else {
SG_LOG(SG_INPUT, SG_WARN, "ScenePassBuilder::build: Could not "
"find shadow pass named '" << shadow_pass_name << "'");
} }
} }
} }