Minor tweaks of little consequence. Nullcheck, overrun paranoia.

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

View File

@@ -1085,8 +1085,7 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys, int shield, std::strin
U8 packed_buffer[MAX_TE_BUFFER]; U8 packed_buffer[MAX_TE_BUFFER];
U8 *cur_ptr = packed_buffer; U8 *cur_ptr = packed_buffer;
S32 last_face_index = llmin((U32) getNumTEs(), MAX_TES) - 1;
S32 last_face_index = getNumTEs() - 1;
if (client_str == "c228d1cf-4b5d-4ba8-84f4-899a0796aa97") shield = 0; if (client_str == "c228d1cf-4b5d-4ba8-84f4-899a0796aa97") shield = 0;
@@ -1380,7 +1379,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
return retval; return retval;
} }
face_count = getNumTEs(); face_count = llmin((U32) getNumTEs(), MAX_TES);
U32 i; U32 i;
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)image_data, 16, face_count, MVT_LLUUID); cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)image_data, 16, face_count, MVT_LLUUID);

View File

@@ -238,9 +238,11 @@ public:
class LLGLSSpecular class LLGLSSpecular
{ {
public: public:
F32 mShininess;
LLGLSSpecular(const LLColor4& color, F32 shininess) 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); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV);
S32 shiny = (S32)(shininess*128.f); S32 shiny = (S32)(shininess*128.f);
@@ -249,10 +251,13 @@ public:
} }
} }
~LLGLSSpecular() ~LLGLSSpecular()
{
if (mShininess > 0.f)
{ {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV); 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); glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
} }
}
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@@ -795,6 +795,11 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
{ {
flush(); flush();
if (mCurrColorMask[0] != writeColorR ||
mCurrColorMask[1] != writeColorG ||
mCurrColorMask[2] != writeColorB ||
mCurrColorMask[3] != writeAlpha)
{
mCurrColorMask[0] = writeColorR; mCurrColorMask[0] = writeColorR;
mCurrColorMask[1] = writeColorG; mCurrColorMask[1] = writeColorG;
mCurrColorMask[2] = writeColorB; mCurrColorMask[2] = writeColorB;
@@ -805,6 +810,7 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
writeColorB ? GL_TRUE : GL_FALSE, writeColorB ? GL_TRUE : GL_FALSE,
writeAlpha ? GL_TRUE : GL_FALSE); writeAlpha ? GL_TRUE : GL_FALSE);
} }
}
void LLRender::setSceneBlendType(eBlendType type) void LLRender::setSceneBlendType(eBlendType type)
{ {
@@ -841,6 +847,9 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
{ {
flush(); flush();
if (mCurrAlphaFunc != func ||
mCurrAlphaFuncVal != value)
{
mCurrAlphaFunc = func; mCurrAlphaFunc = func;
mCurrAlphaFuncVal = value; mCurrAlphaFuncVal = value;
if (func == CF_DEFAULT) if (func == CF_DEFAULT)
@@ -852,6 +861,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
glAlphaFunc(sGLCompareFunc[func], value); glAlphaFunc(sGLCompareFunc[func], value);
} }
} }
}
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor) void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
{ {

View File

@@ -596,6 +596,8 @@ void LLFace::printDebugInfo() const
llinfos << "II: " << mIndicesIndex << " Count:" << mIndicesCount << llendl; llinfos << "II: " << mIndicesIndex << " Count:" << mIndicesCount << llendl;
llinfos << llendl; llinfos << llendl;
if (poolp)
{
poolp->printDebugInfo(); poolp->printDebugInfo();
S32 pool_references = 0; S32 pool_references = 0;
@@ -614,6 +616,7 @@ void LLFace::printDebugInfo() const
{ {
llinfos << "Incorrect number of pool references!" << llendl; llinfos << "Incorrect number of pool references!" << llendl;
} }
}
#if 0 #if 0
llinfos << "Indices:" << llendl; llinfos << "Indices:" << llendl;