CMaterial: Make use of size_t for loops where applicable

Consistency.

While we're at it, remove an unused include.
This commit is contained in:
Lioncash 2020-06-16 18:42:25 -04:00
parent f44a5fc8d2
commit 2d2210cd9e

View File

@ -6,7 +6,6 @@
#include "Core/OpenGL/CShaderGenerator.h" #include "Core/OpenGL/CShaderGenerator.h"
#include <Common/Hash/CFNV1A.h> #include <Common/Hash/CFNV1A.h>
#include <iostream>
#include <GL/glew.h> #include <GL/glew.h>
uint64 CMaterial::sCurrentMaterial = 0; uint64 CMaterial::sCurrentMaterial = 0;
@ -191,31 +190,33 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
// COLOR0_Amb,Mat is initialized by the node instead of by the material // COLOR0_Amb,Mat is initialized by the node instead of by the material
// Set depth write - force on if alpha is disabled (lots of weird depth issues otherwise) // Set depth write - force on if alpha is disabled (lots of weird depth issues otherwise)
if ((mOptions & EMaterialOption::DepthWrite) || (Options & ERenderOption::NoAlpha)) glDepthMask(GL_TRUE); if ((mOptions & EMaterialOption::DepthWrite) || (Options & ERenderOption::NoAlpha))
else glDepthMask(GL_FALSE); glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
// Set color/alpha write // Set color/alpha write
GLboolean bColorWrite = mOptions.HasFlag(EMaterialOption::ColorWrite); const GLboolean bColorWrite = mOptions.HasFlag(EMaterialOption::ColorWrite);
GLboolean bAlphaWrite = mOptions.HasFlag(EMaterialOption::AlphaWrite); const GLboolean bAlphaWrite = mOptions.HasFlag(EMaterialOption::AlphaWrite);
glColorMask(bColorWrite, bColorWrite, bColorWrite, bAlphaWrite); glColorMask(bColorWrite, bColorWrite, bColorWrite, bAlphaWrite);
// Load uniforms // Load uniforms
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++) for (size_t iPass = 0; iPass < mPasses.size(); iPass++)
mPasses[iPass]->SetAnimCurrent(Options, iPass); mPasses[iPass]->SetAnimCurrent(Options, iPass);
sCurrentMaterial = HashParameters(); sCurrentMaterial = HashParameters();
} }
else // If the passes are otherwise the same, update UV anims that use the model matrix
// If the passes are otherwise the same, update UV anims that use the model matrix
else
{ {
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++) for (size_t iPass = 0; iPass < mPasses.size(); iPass++)
{ {
EUVAnimMode mode = mPasses[iPass]->AnimMode(); const EUVAnimMode mode = mPasses[iPass]->AnimMode();
if ((mode == EUVAnimMode::InverseMV) || (mode == EUVAnimMode::InverseMVTranslated) || if (mode == EUVAnimMode::InverseMV || mode == EUVAnimMode::InverseMVTranslated ||
(mode == EUVAnimMode::ModelMatrix) || (mode == EUVAnimMode::SimpleMode)) mode == EUVAnimMode::ModelMatrix || mode == EUVAnimMode::SimpleMode)
{
mPasses[iPass]->SetAnimCurrent(Options, iPass); mPasses[iPass]->SetAnimCurrent(Options, iPass);
}
} }
} }