From 05ad44d0b1527339f8da788898cf9fa1ab92ba84 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Fri, 18 Dec 2020 01:44:46 +0000 Subject: [PATCH] Set correct array size --- components/sceneutil/mwshadowtechnique.hpp | 4 ++-- components/sceneutil/shadowsbin.cpp | 6 +++--- components/sceneutil/shadowsbin.hpp | 8 ++++---- components/shader/removedalphafunc.cpp | 4 ++-- components/shader/removedalphafunc.hpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/sceneutil/mwshadowtechnique.hpp b/components/sceneutil/mwshadowtechnique.hpp index 96b1c7d0e..7ffe687b4 100644 --- a/components/sceneutil/mwshadowtechnique.hpp +++ b/components/sceneutil/mwshadowtechnique.hpp @@ -215,7 +215,7 @@ namespace SceneUtil { virtual void createShaders(); - virtual std::array, GL_ALWAYS - GL_NEVER> getCastingPrograms() const { return _castingPrograms; } + virtual std::array, GL_ALWAYS - GL_NEVER + 1> getCastingPrograms() const { return _castingPrograms; } virtual bool selectActiveLights(osgUtil::CullVisitor* cv, ViewDependentData* vdd) const; @@ -290,7 +290,7 @@ namespace SceneUtil { }; osg::ref_ptr _debugHud; - std::array, GL_ALWAYS - GL_NEVER> _castingPrograms; + std::array, GL_ALWAYS - GL_NEVER + 1> _castingPrograms; }; } diff --git a/components/sceneutil/shadowsbin.cpp b/components/sceneutil/shadowsbin.cpp index 9e6d461ae..de778f14b 100644 --- a/components/sceneutil/shadowsbin.cpp +++ b/components/sceneutil/shadowsbin.cpp @@ -42,8 +42,8 @@ namespace namespace SceneUtil { -std::array, GL_ALWAYS - GL_NEVER> ShadowsBin::sCastingPrograms = { - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr +std::array, GL_ALWAYS - GL_NEVER + 1> ShadowsBin::sCastingPrograms = { + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; ShadowsBin::ShadowsBin() @@ -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, GL_ALWAYS - GL_NEVER>& castingPrograms) +void ShadowsBin::addPrototype(const std::string & name, const std::array, GL_ALWAYS - GL_NEVER + 1>& castingPrograms) { sCastingPrograms = castingPrograms; osg::ref_ptr bin(new ShadowsBin); diff --git a/components/sceneutil/shadowsbin.hpp b/components/sceneutil/shadowsbin.hpp index 7247a9af4..d8bdd8607 100644 --- a/components/sceneutil/shadowsbin.hpp +++ b/components/sceneutil/shadowsbin.hpp @@ -17,12 +17,12 @@ namespace SceneUtil class ShadowsBin : public osgUtil::RenderBin { private: - static std::array, GL_ALWAYS - GL_NEVER> sCastingPrograms; + static std::array, GL_ALWAYS - GL_NEVER + 1> sCastingPrograms; osg::ref_ptr mNoTestStateSet; osg::ref_ptr mShaderAlphaTestStateSet; - std::array, GL_ALWAYS - GL_NEVER> mAlphaFuncShaders; + std::array, GL_ALWAYS - GL_NEVER + 1> mAlphaFuncShaders; public: META_Object(SceneUtil, ShadowsBin) ShadowsBin(); @@ -65,13 +65,13 @@ namespace SceneUtil osgUtil::StateGraph* cullStateGraph(osgUtil::StateGraph* sg, osgUtil::StateGraph* root, std::unordered_set& uninteresting); - static void addPrototype(const std::string& name, const std::array, GL_ALWAYS - GL_NEVER>& castingPrograms); + static void addPrototype(const std::string& name, const std::array, GL_ALWAYS - GL_NEVER + 1>& castingPrograms); }; class ShadowsBinAdder { public: - ShadowsBinAdder(const std::string& name, const std::array, GL_ALWAYS - GL_NEVER>& castingPrograms){ ShadowsBin::addPrototype(name, castingPrograms); } + ShadowsBinAdder(const std::string& name, const std::array, GL_ALWAYS - GL_NEVER + 1>& castingPrograms){ ShadowsBin::addPrototype(name, castingPrograms); } }; } diff --git a/components/shader/removedalphafunc.cpp b/components/shader/removedalphafunc.cpp index 0da36ab48..6b701b890 100644 --- a/components/shader/removedalphafunc.cpp +++ b/components/shader/removedalphafunc.cpp @@ -6,8 +6,8 @@ namespace Shader { - std::array, GL_ALWAYS - GL_NEVER> RemovedAlphaFunc::sInstances{ - nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr + std::array, GL_ALWAYS - GL_NEVER + 1> RemovedAlphaFunc::sInstances{ + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; osg::ref_ptr RemovedAlphaFunc::getInstance(GLenum func) diff --git a/components/shader/removedalphafunc.hpp b/components/shader/removedalphafunc.hpp index 1aa9978cf..c744391e5 100644 --- a/components/shader/removedalphafunc.hpp +++ b/components/shader/removedalphafunc.hpp @@ -34,7 +34,7 @@ namespace Shader protected: virtual ~RemovedAlphaFunc() = default; - static std::array, GL_ALWAYS - GL_NEVER> sInstances; + static std::array, GL_ALWAYS - GL_NEVER + 1> sInstances; }; } #endif //OPENMW_COMPONENTS_REMOVEDALPHAFUNC_H