mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Sprinkle some const-ref in loop
This was done on the good advices of clang-tidy
This commit is contained in:
parent
76320aae45
commit
cb08f490d7
@ -30,7 +30,7 @@ namespace Resource
|
|||||||
|
|
||||||
std::vector<SceneUtil::EmulatedAnimation> emulatedAnimations;
|
std::vector<SceneUtil::EmulatedAnimation> emulatedAnimations;
|
||||||
|
|
||||||
for (auto animation : mAnimationManager->getAnimationList())
|
for (const auto& animation : mAnimationManager->getAnimationList())
|
||||||
{
|
{
|
||||||
if (animation)
|
if (animation)
|
||||||
{
|
{
|
||||||
|
@ -371,11 +371,10 @@ namespace Shader
|
|||||||
void ShaderManager::setGlobalDefines(DefineMap & globalDefines)
|
void ShaderManager::setGlobalDefines(DefineMap & globalDefines)
|
||||||
{
|
{
|
||||||
mGlobalDefines = globalDefines;
|
mGlobalDefines = globalDefines;
|
||||||
for (auto shaderMapElement: mShaders)
|
for (const auto& [key, shader]: mShaders)
|
||||||
{
|
{
|
||||||
std::string templateId = shaderMapElement.first.first;
|
std::string templateId = key.first;
|
||||||
ShaderManager::DefineMap defines = shaderMapElement.first.second;
|
ShaderManager::DefineMap defines = key.second;
|
||||||
osg::ref_ptr<osg::Shader> shader = shaderMapElement.second;
|
|
||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
// I'm not sure how to handle a shader that was already broken as there's no way to get a potential replacement to the nodes that need it.
|
// I'm not sure how to handle a shader that was already broken as there's no way to get a potential replacement to the nodes that need it.
|
||||||
continue;
|
continue;
|
||||||
@ -391,13 +390,13 @@ namespace Shader
|
|||||||
void ShaderManager::releaseGLObjects(osg::State *state)
|
void ShaderManager::releaseGLObjects(osg::State *state)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMutex);
|
std::lock_guard<std::mutex> lock(mMutex);
|
||||||
for (auto shader : mShaders)
|
for (const auto& [_, shader] : mShaders)
|
||||||
{
|
{
|
||||||
if (shader.second != nullptr)
|
if (shader != nullptr)
|
||||||
shader.second->releaseGLObjects(state);
|
shader->releaseGLObjects(state);
|
||||||
}
|
}
|
||||||
for (auto program : mPrograms)
|
for (const auto& [_, program] : mPrograms)
|
||||||
program.second->releaseGLObjects(state);
|
program->releaseGLObjects(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -245,13 +245,13 @@ namespace Terrain
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mIndexBufferMutex);
|
std::lock_guard<std::mutex> lock(mIndexBufferMutex);
|
||||||
for (auto indexbuffer : mIndexBufferMap)
|
for (const auto& [_, indexbuffer] : mIndexBufferMap)
|
||||||
indexbuffer.second->releaseGLObjects(state);
|
indexbuffer->releaseGLObjects(state);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mUvBufferMutex);
|
std::lock_guard<std::mutex> lock(mUvBufferMutex);
|
||||||
for (auto uvbuffer : mUvBufferMap)
|
for (const auto& [_, uvbuffer] : mUvBufferMap)
|
||||||
uvbuffer.second->releaseGLObjects(state);
|
uvbuffer->releaseGLObjects(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user