diff options
-rwxr-xr-x | indra/llmath/llvolume.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llpanelface.cpp | 38 | ||||
-rwxr-xr-x | indra/newview/llpanelface.h | 7 |
3 files changed, 37 insertions, 12 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index f9dd843b92..1932272afb 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -7252,7 +7252,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe F32 rd = s1*t2-s2*t1; - float r = rd*rd > 0.f ? 1.0F / rd : 1024.f; //some made up large ratio for division by zero + float r = ((rd*rd) > FLT_EPSILON) ? 1.0F / rd : 1024.f; //some made up large ratio for division by zero llassert(llfinite(r)); llassert(!llisnan(r)); @@ -7276,7 +7276,7 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe LLVector4a n = normal[a]; const LLVector4a& t = tan1[a]; - + llassert(tan1[a].getLength3().getF32() >= 0.f); llassert(tan2[a].getLength3().getF32() >= 0.f); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4fd55e1cf2..c446132289 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -772,10 +772,6 @@ void LLPanelFace::updateUI() // Normal map LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); - if (bumpy != BUMPY_TEXTURE) - { - normmap_id = LLUUID::null; - } mIsAlpha = FALSE; LLGLenum image_format = GL_RGB; @@ -815,7 +811,7 @@ void LLPanelFace::updateUI() // See if that's been overridden by a material setting for same... // - LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode); + LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) @@ -2288,6 +2284,36 @@ void LLPanelFace::LLSelectedTEMaterial::getMaxNormalRepeats(F32& repeats, bool& identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_norm_repeats_func, repeats); } +void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha) +{ + struct LLSelectedTEGetDiffuseAlphaMode : public LLSelectedTEGetFunctor<U8> + { + LLSelectedTEGetDiffuseAlphaMode() : _isAlpha(false) {} + LLSelectedTEGetDiffuseAlphaMode(bool diffuse_texture_has_alpha) : _isAlpha(diffuse_texture_has_alpha) {} + virtual ~LLSelectedTEGetDiffuseAlphaMode() {} + + U8 get(LLViewerObject* object, S32 face) + { + U8 diffuse_mode = _isAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + LLTextureEntry* tep = object->getTE(face); + if (tep) + { + LLMaterial* mat = tep->getMaterialParams().get(); + mat = (tep->getMaterialID().isNull() ? NULL : mat); + if (mat) + { + diffuse_mode = mat->getDiffuseAlphaMode(); + } + } + + return diffuse_mode; + } + bool _isAlpha; // whether or not the diffuse texture selected contains alpha information + } get_diff_mode(diffuse_texture_has_alpha); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode); +} + void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical) { struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor<F32> @@ -2336,4 +2362,4 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic } max_diff_repeats_func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats ); -}
\ No newline at end of file +} diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 79e6898e49..c6a53b6aef 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -297,8 +297,8 @@ private: LLTextureEntry* tep = object ? object->getTE(face) : NULL; if (tep) { - material_ptr = object->getTE(face)->getMaterialParams(); - if (!material_ptr.isNull()) + material_ptr = tep->getMaterialParams(); + if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } @@ -404,11 +404,10 @@ private: static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material); static void getMaxSpecularRepeats(F32& repeats, bool& identical); static void getMaxNormalRepeats(F32& repeats, bool& identical); + static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha); DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null) DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null) - DEF_GET_MAT_STATE(U8,U8,getDiffuseAlphaMode,LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f) DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f) DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f) |