diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 198b13ee06..6f7b2f40e6 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4168,12 +4168,8 @@ void LLViewerObject::changeTENormalMap(S32 index, LLViewerTexture* new_image) { return ; } - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } mTENormalMaps[index] = new_image ; + refreshMaterials(); } void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) @@ -4182,12 +4178,8 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) { return ; } - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } mTESpecularMaps[index] = new_image ; + refreshMaterials(); } S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) @@ -4389,17 +4381,7 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID << ", material " << pMaterialID << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); - if (retval) - { - // Kitty would like to know if this is necessary? - // Since we should get a setTEMaterialParams that does it anyway? - // - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - } + refreshMaterials(); } return retval; } @@ -4414,23 +4396,28 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return 0; } - retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); - LL_DEBUGS("Material") << "Changing material params for te " << (S32)te - << ", object " << mID - << " (" << retval << ")" - << LL_ENDL; - setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null); - setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null); - - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } + retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("Material") << "Changing material params for te " << (S32)te + << ", object " << mID + << " (" << retval << ")" + << LL_ENDL; + setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null); + setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null); + refreshMaterials(); return retval; } +void LLViewerObject::refreshMaterials() +{ + setChanged(ALL_CHANGED); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); + dirtySpatialGroup(TRUE); + } +} S32 LLViewerObject::setTEScale(const U8 te, const F32 s, const F32 t) { |