Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplifying remove render targets in more C++11 style #2524

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions OgreMain/src/OgreRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,20 +630,16 @@ namespace Ogre {
// Remove all the render targets. Destroy primary target last since others may depend on it.
// Keep mRenderTargets valid all the time, so that render targets could receive
// appropriate notifications, for example FBO based about GL context destruction.
RenderTarget* primary = 0;
for (RenderTargetMap::iterator it = mRenderTargets.begin(); it != mRenderTargets.end(); /* note - no increment */)
{
RenderTarget* current = it->second;
if (!primary && current->isPrimary())
Joilnen marked this conversation as resolved.
Show resolved Hide resolved
{
++it;
primary = current;
}
else
{
it = mRenderTargets.erase(it);
OGRE_DELETE current;
RenderTarget* primary {nullptr};
RenderTarget* current {nullptr};
for (auto &&a : mRenderTargets) {
current = a.second;
if (!primary && a.second->isPrimary()) {
primary = a.second;
continue;
}
OGRE_DELETE a.second;
mRenderTargets.erase(a.first);
}
OGRE_DELETE primary;
mRenderTargets.clear();
Expand Down