mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 15:36:39 +00:00
Fix crashes on exit in the LightManager (bug #6044)
This commit is contained in:
parent
c54ef55ebb
commit
11c57978b6
2 changed files with 12 additions and 1 deletions
components/sceneutil
|
@ -439,7 +439,11 @@ namespace SceneUtil
|
||||||
|
|
||||||
void apply(osg::State &state) const override
|
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)
|
for (size_t i = 0; i < mLights.size(); ++i)
|
||||||
{
|
{
|
||||||
auto light = mLights[i];
|
auto light = mLights[i];
|
||||||
|
@ -832,6 +836,11 @@ namespace SceneUtil
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightManager::~LightManager()
|
||||||
|
{
|
||||||
|
getOrCreateStateSet()->removeAttribute(osg::StateAttribute::LIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
LightManager::LightManager(bool ffp)
|
LightManager::LightManager(bool ffp)
|
||||||
: mStartLight(0)
|
: mStartLight(0)
|
||||||
, mLightingMask(~0u)
|
, mLightingMask(~0u)
|
||||||
|
|
|
@ -137,6 +137,8 @@ namespace SceneUtil
|
||||||
|
|
||||||
LightManager(const LightManager& copy, const osg::CopyOp& copyop);
|
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.
|
/// @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.
|
/// 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
|
/// If you have some views that do not require lighting, then set the Camera's cull mask to not include
|
||||||
|
|
Loading…
Reference in a new issue