mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 09:56:39 +00:00 
			
		
		
		
	Knowing which are right required making the function non-static, so the shadow manager had to become a singleton as the results of passing it around to where it's needed were hellish. I'm seeing a bunch of OpenGL errors when actually using this, so I'll investigate whether they're happening on master. I'm hesitant to look into it too much, though, as I'm affected by https://gitlab.com/OpenMW/openmw/-/issues/7811, and also have the Windows setting enabled that turns driver timeouts into a BSOD so a kernel dump is collected that I can send to AMD.
		
			
				
	
	
		
			62 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef COMPONENTS_SCENEUTIL_SHADOW_H
 | 
						|
#define COMPONENTS_SCENEUTIL_SHADOW_H
 | 
						|
 | 
						|
#include <components/shader/shadermanager.hpp>
 | 
						|
 | 
						|
namespace osg
 | 
						|
{
 | 
						|
    class StateSet;
 | 
						|
    class Group;
 | 
						|
}
 | 
						|
 | 
						|
namespace osgShadow
 | 
						|
{
 | 
						|
    class ShadowSettings;
 | 
						|
    class ShadowedScene;
 | 
						|
}
 | 
						|
 | 
						|
namespace Settings
 | 
						|
{
 | 
						|
    struct ShadowsCategory;
 | 
						|
}
 | 
						|
 | 
						|
namespace SceneUtil
 | 
						|
{
 | 
						|
    class MWShadowTechnique;
 | 
						|
    class ShadowManager
 | 
						|
    {
 | 
						|
    public:
 | 
						|
        static Shader::ShaderManager::DefineMap getShadowsDisabledDefines();
 | 
						|
 | 
						|
        static const ShadowManager& instance();
 | 
						|
 | 
						|
        explicit ShadowManager(osg::ref_ptr<osg::Group> sceneRoot, osg::ref_ptr<osg::Group> rootNode,
 | 
						|
            unsigned int outdoorShadowCastingMask, unsigned int indoorShadowCastingMask, unsigned int worldMask,
 | 
						|
            const Settings::ShadowsCategory& settings, Shader::ShaderManager& shaderManager);
 | 
						|
        ~ShadowManager();
 | 
						|
 | 
						|
        void setupShadowSettings(const Settings::ShadowsCategory& settings, Shader::ShaderManager& shaderManager);
 | 
						|
 | 
						|
        void disableShadowsForStateSet(osg::StateSet& stateset) const;
 | 
						|
 | 
						|
        Shader::ShaderManager::DefineMap getShadowDefines(const Settings::ShadowsCategory& settings) const;
 | 
						|
 | 
						|
        void enableIndoorMode(const Settings::ShadowsCategory& settings);
 | 
						|
 | 
						|
        void enableOutdoorMode();
 | 
						|
 | 
						|
    protected:
 | 
						|
        static ShadowManager* sInstance;
 | 
						|
 | 
						|
        bool mEnableShadows;
 | 
						|
 | 
						|
        osg::ref_ptr<osgShadow::ShadowedScene> mShadowedScene;
 | 
						|
        osg::ref_ptr<osgShadow::ShadowSettings> mShadowSettings;
 | 
						|
        osg::ref_ptr<MWShadowTechnique> mShadowTechnique;
 | 
						|
 | 
						|
        unsigned int mOutdoorShadowCastingMask;
 | 
						|
        unsigned int mIndoorShadowCastingMask;
 | 
						|
    };
 | 
						|
}
 | 
						|
 | 
						|
#endif // COMPONENTS_SCENEUTIL_SHADOW_H
 |