mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 10:21:09 +00:00
Use type alias to avoid long type names and length redefinition for array
This commit is contained in:
parent
6cfabe252d
commit
9d1b7c4a30
@ -42,7 +42,7 @@ namespace
|
||||
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
|
||||
};
|
||||
|
||||
@ -150,7 +150,7 @@ StateGraph* ShadowsBin::cullStateGraph(StateGraph* sg, StateGraph* root, std::un
|
||||
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;
|
||||
osg::ref_ptr<osgUtil::RenderBin> bin(new ShadowsBin);
|
||||
|
@ -12,18 +12,15 @@ namespace osg
|
||||
|
||||
namespace SceneUtil
|
||||
{
|
||||
|
||||
/// renderbin which culls redundant state for shadow map rendering
|
||||
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:
|
||||
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)
|
||||
ShadowsBin();
|
||||
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);
|
||||
|
||||
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…
x
Reference in New Issue
Block a user