1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Check a result of dynamic_cast

This commit is contained in:
Andrei Kortunov 2022-07-05 17:19:29 +04:00
parent f451b09f10
commit aed0da46a9
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,8 @@ namespace MWRender
size_t frameId = frame % 2;
MWRender::PostProcessor* postProcessor = dynamic_cast<MWRender::PostProcessor*>(cv->getCurrentCamera()->getUserData());
if (!postProcessor)
throw std::runtime_error("PingPongCull: failed to get a PostProcessor!");
if (Stereo::getStereo())
{

View File

@ -40,6 +40,8 @@ namespace fx
if (mUseUBO)
{
osg::UniformBufferBinding* ubb = dynamic_cast<osg::UniformBufferBinding*>(stateset->getAttribute(osg::StateAttribute::UNIFORMBUFFERBINDING, static_cast<int>(Resource::SceneManager::UBOBinding::PostProcessor)));
if (!ubb)
throw std::runtime_error("StateUpdater::apply: failed to get an UniformBufferBinding!");
auto& dest = static_cast<osg::BufferTemplate<UniformData::BufferType>*>(ubb->getBufferData())->getData();
mData.copyTo(dest);
@ -60,4 +62,4 @@ namespace fx
if (mPointLightBuffer)
mPointLightBuffer->applyUniforms(nv->getTraversalNumber(), stateset);
}
}
}