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

range loop refactoring #2908

Merged
merged 7 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 3 additions & 6 deletions Components/Bites/src/OgreApplicationContextAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,10 @@ void ApplicationContextAndroid::shutdown()

void ApplicationContextAndroid::pollEvents()
{
for(WindowList::iterator it = mWindows.begin(); it != mWindows.end(); ++it)
for(auto& w : mWindows)
{
Ogre::RenderWindow* win = it->render;
win->windowMovedOrResized();
// it->native becomes invalid after surface change
// win->resize(w, h);
windowResized(win);
w.render->windowMovedOrResized();
windowResized(w.render);
}
}

Expand Down
14 changes: 5 additions & 9 deletions Components/Bites/src/OgreApplicationContextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,13 @@ void ApplicationContextBase::locateResources()

Ogre::String sec, type, arch;
// go through all specified resource groups
Ogre::ConfigFile::SettingsBySection_::const_iterator seci;
for(seci = cf.getSettingsBySection().begin(); seci != cf.getSettingsBySection().end(); ++seci) {
sec = seci->first;
const Ogre::ConfigFile::SettingsMultiMap& settings = seci->second;
Ogre::ConfigFile::SettingsMultiMap::const_iterator i;

for(auto& s : cf.getSettingsBySection()) {
sec = s.first;
// go through all resource paths
for (i = settings.begin(); i != settings.end(); i++)
for (auto& t : s.second)
{
type = i->first;
arch = i->second;
type = t.first;
arch = t.second;

Ogre::StringUtil::trim(arch);
if (arch.empty() || arch[0] == '.')
Expand Down
9 changes: 3 additions & 6 deletions Components/Bites/src/OgreSGTechniqueResolverListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ Ogre::Technique *SGTechniqueResolverListener::handleSchemeNotFound(unsigned shor
mShaderGenerator->validateMaterial(schemeName, *originalMaterial);

// Grab the generated technique.
Ogre::Material::Techniques::const_iterator it;
for(it = originalMaterial->getTechniques().begin(); it != originalMaterial->getTechniques().end(); ++it)
for(auto *t : originalMaterial->getTechniques())
{
Ogre::Technique* curTech = *it;

if (curTech->getSchemeName() == schemeName)
if (t->getSchemeName() == schemeName)
{
return curTech;
return t;
}
}

Expand Down
62 changes: 22 additions & 40 deletions Components/Overlay/src/OgreOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ namespace Ogre {
//---------------------------------------------------------------------
Overlay::Overlay(const String& name) :
mName(name),
mRotate(0.0f),
mRotate(0.0f),
mScrollX(0.0f), mScrollY(0.0f),
mScaleX(1.0f), mScaleY(1.0f),
mLastViewportWidth(0), mLastViewportHeight(0),
mTransformOutOfDate(true), mTransformUpdated(true),
mTransformOutOfDate(true), mTransformUpdated(true),
mZOrder(100), mVisible(false), mInitialised(false)

{
Expand All @@ -56,11 +56,10 @@ namespace Ogre {
// remove children

OGRE_DELETE mRootNode;

for (OverlayContainerList::iterator i = m2DElements.begin();
i != m2DElements.end(); ++i)

for (auto *e : m2DElements)
{
(*i)->_notifyParent(0, 0);
e->_notifyParent(0, 0);
}
}
//---------------------------------------------------------------------
Expand All @@ -74,11 +73,9 @@ namespace Ogre {
ushort zorder = static_cast<ushort>(mZOrder * 100.0f);

// Notify attached 2D elements
OverlayContainerList::iterator i, iend;
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
zorder = (*i)->_notifyZOrder(zorder);
zorder = e->_notifyZOrder(zorder);
}
}
//---------------------------------------------------------------------
Expand Down Expand Up @@ -123,11 +120,9 @@ namespace Ogre {
//---------------------------------------------------------------------
void Overlay::initialise(void)
{
OverlayContainerList::iterator i, iend;
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
(*i)->initialise();
e->initialise();
}
mInitialised = true;
}
Expand Down Expand Up @@ -189,16 +184,10 @@ namespace Ogre {
//---------------------------------------------------------------------
OverlayContainer* Overlay::getChild(const String& name)
{

OverlayContainerList::iterator i, iend;
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
if ((*i)->getName() == name)
{
return *i;

}
if (e->getName() == name)
return e;
}
return NULL;
}
Expand Down Expand Up @@ -269,10 +258,9 @@ namespace Ogre {

if(tmpViewportDimensionsChanged)
{
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
(*i)->_notifyViewport();
e->_notifyViewport();
}
}

Expand All @@ -282,10 +270,9 @@ namespace Ogre {
Matrix4 xform;
_getWorldTransforms(&xform);

iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
(*i)->_notifyWorldTransforms(xform);
e->_notifyWorldTransforms(xform);
}

mTransformUpdated = false;
Expand All @@ -305,12 +292,10 @@ namespace Ogre {
queue->setDefaultQueueGroup(oldgrp);
queue->setDefaultRenderablePriority(oldPriority);
// Add 2D elements
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
(*i)->_update();

(*i)->_updateRenderQueue(queue);
e->_update();
e->_updateRenderQueue(queue);
}
}
}
Expand Down Expand Up @@ -342,14 +327,12 @@ namespace Ogre {
{
OverlayElement* ret = NULL;
int currZ = -1;
OverlayContainerList::iterator i, iend;
iend = m2DElements.end();
for (i = m2DElements.begin(); i != iend; ++i)
for (auto *e : m2DElements)
{
int z = (*i)->getZOrder();
int z = e->getZOrder();
if (z > currZ)
{
OverlayElement* elementFound = (*i)->findElementAt(x,y);
OverlayElement* elementFound = e->findElementAt(x,y);
if(elementFound)
{
currZ = elementFound->getZOrder();
Expand All @@ -359,6 +342,5 @@ namespace Ogre {
}
return ret;
}

}