mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 09:09:42 +00:00
Remove redundant ShadowsBin::sCastingPrograms
This variable is only used in ShadowsBin constructor and it's initialized each time before constructor call so required value can be just passed into ShadowsBin ctor. Make ShadowsBin default constructor private because it is required by osg even it's not actually called.
This commit is contained in:
parent
9d1b7c4a30
commit
590a340e6e
2 changed files with 6 additions and 11 deletions
|
@ -42,11 +42,7 @@ namespace
|
|||
namespace SceneUtil
|
||||
{
|
||||
|
||||
ShadowsBin::CastingPrograms ShadowsBin::sCastingPrograms = {
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
|
||||
};
|
||||
|
||||
ShadowsBin::ShadowsBin()
|
||||
ShadowsBin::ShadowsBin(const CastingPrograms& castingPrograms)
|
||||
{
|
||||
mNoTestStateSet = new osg::StateSet;
|
||||
mNoTestStateSet->addUniform(new osg::Uniform("useDiffuseMapForShadowAlpha", false));
|
||||
|
@ -57,10 +53,10 @@ ShadowsBin::ShadowsBin()
|
|||
mShaderAlphaTestStateSet->addUniform(new osg::Uniform("useDiffuseMapForShadowAlpha", true));
|
||||
mShaderAlphaTestStateSet->setMode(GL_BLEND, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);
|
||||
|
||||
for (size_t i = 0; i < sCastingPrograms.size(); ++i)
|
||||
for (size_t i = 0; i < castingPrograms.size(); ++i)
|
||||
{
|
||||
mAlphaFuncShaders[i] = new osg::StateSet;
|
||||
mAlphaFuncShaders[i]->setAttribute(sCastingPrograms[i], osg::StateAttribute::ON | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);
|
||||
mAlphaFuncShaders[i]->setAttribute(castingPrograms[i], osg::StateAttribute::ON | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,8 +148,7 @@ StateGraph* ShadowsBin::cullStateGraph(StateGraph* sg, StateGraph* root, std::un
|
|||
|
||||
void ShadowsBin::addPrototype(const std::string & name, const CastingPrograms& castingPrograms)
|
||||
{
|
||||
sCastingPrograms = castingPrograms;
|
||||
osg::ref_ptr<osgUtil::RenderBin> bin(new ShadowsBin);
|
||||
osg::ref_ptr<osgUtil::RenderBin> bin(new ShadowsBin(castingPrograms));
|
||||
osgUtil::RenderBin::addRenderBinPrototype(name, bin);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SceneUtil
|
|||
using CastingPrograms = Array<osg::ref_ptr<osg::Program>>;
|
||||
|
||||
META_Object(SceneUtil, ShadowsBin)
|
||||
ShadowsBin();
|
||||
ShadowsBin(const CastingPrograms& castingPrograms);
|
||||
ShadowsBin(const ShadowsBin& rhs, const osg::CopyOp& copyop)
|
||||
: osgUtil::RenderBin(rhs, copyop)
|
||||
, mNoTestStateSet(rhs.mNoTestStateSet)
|
||||
|
@ -65,7 +65,7 @@ namespace SceneUtil
|
|||
static void addPrototype(const std::string& name, const CastingPrograms& castingPrograms);
|
||||
|
||||
private:
|
||||
static CastingPrograms sCastingPrograms;
|
||||
ShadowsBin() {}
|
||||
|
||||
osg::ref_ptr<osg::StateSet> mNoTestStateSet;
|
||||
osg::ref_ptr<osg::StateSet> mShaderAlphaTestStateSet;
|
||||
|
|
Loading…
Reference in a new issue