mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Fix crashes on exit in the LightManager (bug #6044)
This commit is contained in:
parent
c54ef55ebb
commit
11c57978b6
@ -439,7 +439,11 @@ namespace SceneUtil
|
||||
|
||||
void apply(osg::State &state) const override
|
||||
{
|
||||
auto* lightUniform = mLightManager->getStateSet()->getUniform("LightBuffer");
|
||||
osg::StateSet* stateSet = mLightManager->getStateSet();
|
||||
if (!stateSet)
|
||||
return;
|
||||
|
||||
auto* lightUniform = stateSet->getUniform("LightBuffer");
|
||||
for (size_t i = 0; i < mLights.size(); ++i)
|
||||
{
|
||||
auto light = mLights[i];
|
||||
@ -832,6 +836,11 @@ namespace SceneUtil
|
||||
return "";
|
||||
}
|
||||
|
||||
LightManager::~LightManager()
|
||||
{
|
||||
getOrCreateStateSet()->removeAttribute(osg::StateAttribute::LIGHT);
|
||||
}
|
||||
|
||||
LightManager::LightManager(bool ffp)
|
||||
: mStartLight(0)
|
||||
, mLightingMask(~0u)
|
||||
|
@ -137,6 +137,8 @@ namespace SceneUtil
|
||||
|
||||
LightManager(const LightManager& copy, const osg::CopyOp& copyop);
|
||||
|
||||
~LightManager();
|
||||
|
||||
/// @param mask This mask is compared with the current Camera's cull mask to determine if lighting is desired.
|
||||
/// By default, it's ~0u i.e. always on.
|
||||
/// If you have some views that do not require lighting, then set the Camera's cull mask to not include
|
||||
|
Loading…
Reference in New Issue
Block a user