Minor tweaks of little consequence. Nullcheck, overrun paranoia.

This commit is contained in:
Shyotl
2011-04-15 02:42:30 -05:00
parent 4d2dde73d7
commit dbd26ddee1
4 changed files with 49 additions and 32 deletions

View File

@@ -238,9 +238,11 @@ public:
class LLGLSSpecular
{
public:
F32 mShininess;
LLGLSSpecular(const LLColor4& color, F32 shininess)
{
if (shininess > 0.0f)
mShininess = shininess;
if (mShininess > 0.0f)
{
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV);
S32 shiny = (S32)(shininess*128.f);
@@ -250,8 +252,11 @@ public:
}
~LLGLSSpecular()
{
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
if (mShininess > 0.f)
{
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
}
}
};

View File

@@ -832,15 +832,21 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
{
flush();
mCurrColorMask[0] = writeColorR;
mCurrColorMask[1] = writeColorG;
mCurrColorMask[2] = writeColorB;
if (mCurrColorMask[0] != writeColorR ||
mCurrColorMask[1] != writeColorG ||
mCurrColorMask[2] != writeColorB ||
mCurrColorMask[3] != writeAlpha)
{
mCurrColorMask[0] = writeColorR;
mCurrColorMask[1] = writeColorG;
mCurrColorMask[2] = writeColorB;
mCurrColorMask[3] = writeAlpha;
glColorMask(writeColorR ? GL_TRUE : GL_FALSE,
writeColorG ? GL_TRUE : GL_FALSE,
writeColorB ? GL_TRUE : GL_FALSE,
writeAlpha ? GL_TRUE : GL_FALSE);
writeColorB ? GL_TRUE : GL_FALSE,
writeAlpha ? GL_TRUE : GL_FALSE);
}
}
void LLRender::setSceneBlendType(eBlendType type)
@@ -878,15 +884,19 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
{
flush();
mCurrAlphaFunc = func;
mCurrAlphaFuncVal = value;
if (func == CF_DEFAULT)
if (mCurrAlphaFunc != func ||
mCurrAlphaFuncVal != value)
{
glAlphaFunc(GL_GREATER, 0.01f);
}
else
{
glAlphaFunc(sGLCompareFunc[func], value);
mCurrAlphaFunc = func;
mCurrAlphaFuncVal = value;
if (func == CF_DEFAULT)
{
glAlphaFunc(GL_GREATER, 0.01f);
}
else
{
glAlphaFunc(sGLCompareFunc[func], value);
}
}
}