mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-25 15:11:33 +00:00
Use type alias to avoid long type names and length redefinition for array
This commit is contained in:
parent
6cfabe252d
commit
9d1b7c4a30
2 changed files with 16 additions and 11 deletions
|
@ -42,7 +42,7 @@ namespace
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
std::array<osg::ref_ptr<osg::Program>, GL_ALWAYS - GL_NEVER + 1> ShadowsBin::sCastingPrograms = {
|
ShadowsBin::CastingPrograms ShadowsBin::sCastingPrograms = {
|
||||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ StateGraph* ShadowsBin::cullStateGraph(StateGraph* sg, StateGraph* root, std::un
|
||||||
return sg;
|
return sg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowsBin::addPrototype(const std::string & name, const std::array<osg::ref_ptr<osg::Program>, GL_ALWAYS - GL_NEVER + 1>& castingPrograms)
|
void ShadowsBin::addPrototype(const std::string & name, const CastingPrograms& castingPrograms)
|
||||||
{
|
{
|
||||||
sCastingPrograms = castingPrograms;
|
sCastingPrograms = castingPrograms;
|
||||||
osg::ref_ptr<osgUtil::RenderBin> bin(new ShadowsBin);
|
osg::ref_ptr<osgUtil::RenderBin> bin(new ShadowsBin);
|
||||||
|
|
|
@ -12,18 +12,15 @@ namespace osg
|
||||||
|
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
/// renderbin which culls redundant state for shadow map rendering
|
/// renderbin which culls redundant state for shadow map rendering
|
||||||
class ShadowsBin : public osgUtil::RenderBin
|
class ShadowsBin : public osgUtil::RenderBin
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
static std::array<osg::ref_ptr<osg::Program>, GL_ALWAYS - GL_NEVER + 1> sCastingPrograms;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> mNoTestStateSet;
|
|
||||||
osg::ref_ptr<osg::StateSet> mShaderAlphaTestStateSet;
|
|
||||||
|
|
||||||
std::array<osg::ref_ptr<osg::StateSet>, GL_ALWAYS - GL_NEVER + 1> mAlphaFuncShaders;
|
|
||||||
public:
|
public:
|
||||||
|
template <class T>
|
||||||
|
using Array = std::array<T, GL_ALWAYS - GL_NEVER + 1>;
|
||||||
|
|
||||||
|
using CastingPrograms = Array<osg::ref_ptr<osg::Program>>;
|
||||||
|
|
||||||
META_Object(SceneUtil, ShadowsBin)
|
META_Object(SceneUtil, ShadowsBin)
|
||||||
ShadowsBin();
|
ShadowsBin();
|
||||||
ShadowsBin(const ShadowsBin& rhs, const osg::CopyOp& copyop)
|
ShadowsBin(const ShadowsBin& rhs, const osg::CopyOp& copyop)
|
||||||
|
@ -65,7 +62,15 @@ namespace SceneUtil
|
||||||
|
|
||||||
osgUtil::StateGraph* cullStateGraph(osgUtil::StateGraph* sg, osgUtil::StateGraph* root, std::unordered_set<osgUtil::StateGraph*>& uninteresting, bool cullFaceOverridden);
|
osgUtil::StateGraph* cullStateGraph(osgUtil::StateGraph* sg, osgUtil::StateGraph* root, std::unordered_set<osgUtil::StateGraph*>& uninteresting, bool cullFaceOverridden);
|
||||||
|
|
||||||
static void addPrototype(const std::string& name, const std::array<osg::ref_ptr<osg::Program>, GL_ALWAYS - GL_NEVER + 1>& castingPrograms);
|
static void addPrototype(const std::string& name, const CastingPrograms& castingPrograms);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static CastingPrograms sCastingPrograms;
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::StateSet> mNoTestStateSet;
|
||||||
|
osg::ref_ptr<osg::StateSet> mShaderAlphaTestStateSet;
|
||||||
|
|
||||||
|
Array<osg::ref_ptr<osg::StateSet>> mAlphaFuncShaders;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue