From 04fceb5f006d6f3b9b36996382e4c1483a599dde Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 3 May 2013 09:16:15 -0700 Subject: NORSPEC-151 make disabling bumpyshiny disable adv lighting model as well --- indra/newview/llface.cpp | 1 + indra/newview/llfloaterpreference.cpp | 5 ++++- indra/newview/llvovolume.cpp | 3 ++- indra/newview/pipeline.cpp | 3 ++- .../default/xui/en/panel_preferences_graphics1.xml | 23 ++++++++++++---------- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 08a16c9c33..dad62dd045 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1331,6 +1331,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) { + llassert(tep->getShiny() <= 3); color.mV[3] = U8 (alpha[tep->getShiny()] * 255); } } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index bbf88060c1..b45c944a5f 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1089,8 +1089,9 @@ void LLFloaterPreference::refreshEnabledState() ctrl_reflections->setEnabled(reflections); // Bump & Shiny + LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - getChild("BumpShiny")->setEnabled(bumpshiny ? TRUE : FALSE); + bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); radio_reflection_detail->setEnabled(reflections); @@ -1149,6 +1150,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && shaders && gGLManager.mHasFramebufferObject && gSavedSettings.getBOOL("RenderAvatarVP") && @@ -2319,3 +2321,4 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings() } } + diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a08a8a9676..9b940300f5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,7 +4152,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (mat) + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; @@ -4178,6 +4178,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, 0.5f, 0.75f }; + llassert(shiny <= 3); float spec = alpha[shiny]; LLVector4 specColor(spec, spec, spec, spec); draw_info->mSpecColor = specColor; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f053d26172..4cce654f47 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1018,7 +1018,8 @@ void LLPipeline::updateRenderDeferred() { BOOL deferred = ((RenderDeferred && LLRenderTarget::sUseFBO && - LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && VertexShaderEnable && RenderAvatarVP && WindLightUseAtmosShaders) ? TRUE : FALSE) && diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 708dcf4e95..d7db7caf66 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -211,16 +211,19 @@ name="TransparentWater" top_pad="7" width="256" /> - + + + Date: Fri, 3 May 2013 15:59:43 -0700 Subject: NORSPEC-160 fix trashing of spec map from sunshine integration snafu --- indra/newview/llpanelface.cpp | 2 +- indra/newview/llviewerobject.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1a3f4832fd..74b1915cac 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2118,7 +2118,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); U32 shiny_value = comboShiny->getCurrentIndex(); - bool show_shinyctrls = (shiny_value != 0) && show_shininess; // Use texture + bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture self->getChildView("label glossiness")->setVisible(show_shinyctrls); self->getChildView("glossiness")->setVisible(show_shinyctrls); self->getChildView("label environment")->setVisible(show_shinyctrls); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fe43583271..ee7003ae30 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4088,7 +4088,7 @@ S32 LLViewerObject::setTENormalMapCore(const U8 te, LLViewerTexture *image) { llassert(image); S32 retval = TEM_CHANGE_TEXTURE; - const LLUUID& uuid = image->getID(); + const LLUUID& uuid = image ? image->getID() : LLUUID::null; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { @@ -4116,9 +4116,8 @@ S32 LLViewerObject::setTENormalMapCore(const U8 te, LLViewerTexture *image) S32 LLViewerObject::setTESpecularMapCore(const U8 te, LLViewerTexture *image) { - llassert(image); S32 retval = TEM_CHANGE_TEXTURE; - const LLUUID& uuid = image->getID(); + const LLUUID& uuid = image ? image->getID() : LLUUID::null; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { @@ -4181,14 +4180,14 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) { - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); return setTENormalMapCore(te, image); } S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid) { - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); return setTESpecularMapCore(te, image); } -- cgit v1.2.3 From e0f2a242a7f67f7fa6181fbd65b6cea3a20facc4 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 4 May 2013 18:13:26 -0700 Subject: Remove unnecessary assert as ternary protects against null ptr deref --- indra/newview/llviewerobject.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ee7003ae30..c020ee36d3 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4086,7 +4086,6 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) S32 LLViewerObject::setTENormalMapCore(const U8 te, LLViewerTexture *image) { - llassert(image); S32 retval = TEM_CHANGE_TEXTURE; const LLUUID& uuid = image ? image->getID() : LLUUID::null; if (uuid != getTE(te)->getID() || -- cgit v1.2.3 From d42a0e4e80d2b2cd51e43f7d340a6043b55635ec Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 08:56:32 -0700 Subject: NORSPEC-126 Make objects with normal maps applied obey legacy shiny settings --- indra/newview/llface.cpp | 3 ++- indra/newview/llvovolume.cpp | 51 +++++++++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index dad62dd045..77dd1fe607 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1327,7 +1327,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, 0.75f }; - if ((!LLPipeline::sRenderDeferred || !mat) && + if ((!LLPipeline::sRenderDeferred || !mat || mat->getSpecularID().isNull()) && getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) { @@ -1335,6 +1335,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, color.mV[3] = U8 (alpha[tep->getShiny()] * 255); } } + } // INDICES diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9b940300f5..6cfdc1e9c6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,38 +4152,45 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; + + U8 shiny = facep->getTextureEntry()->getShiny(); + float alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; + float spec = alpha[shiny & TEM_SHINY_MASK]; + LLVector4 specColor(spec, spec, spec, spec); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = spec; + draw_info->mSpecularMap = NULL; + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; - LLVector4 specColor; - specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + + if (!mat->getSpecularID().isNull()) + { + LLVector4 specColor; + specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } + draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } else { - U8 shiny = facep->getTextureEntry()->getShiny(); - float alpha[4] = - { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; - llassert(shiny <= 3); - float spec = alpha[shiny]; - LLVector4 specColor(spec, spec, spec, spec); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = spec; - if (type == LLRenderPass::PASS_GRASS) { draw_info->mAlphaMaskCutoff = 0.5f; -- cgit v1.2.3 From cd50679da26925b33fbf75992ab122062b222c04 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 10:19:55 -0700 Subject: NORSPEC-94 fix this without setting in getState causing round-trip wierdness with spec color picker --- indra/newview/llpanelface.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 74b1915cac..1fbf4a39e6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1297,6 +1297,7 @@ void LLPanelFace::getState() mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } + // Color transparency { getChildView("color trans")->setEnabled(editable); @@ -1363,14 +1364,10 @@ void LLPanelFace::getState() getChild("shinycolorswatch")->setTentative(!identical); getChildView("label shinycolor")->setEnabled(editable); } - // NORSPEC-94: Set default specular color to white (will get - // overwritten from material when loaded) + LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); - color = LLColor4::white; if(mShinyColorSwatch) { - mShinyColorSwatch->setOriginal(color); - mShinyColorSwatch->set(color, TRUE); mShinyColorSwatch->setValid(editable); mShinyColorSwatch->setEnabled( editable ); mShinyColorSwatch->setCanApplyImmediately( editable ); @@ -1716,13 +1713,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } updateShinyControls(combobox_shininess,this, true); + // Assert desired colorswatch color to match material AFTER updateShinyControls + // to avoid getting overwritten with the default on some UI state changes. + // + if (!material->getSpecularID().isNull()) + { + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + } + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -2097,6 +2101,18 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (!comboShiny->itemExists(USE_TEXTURE)) { comboShiny->add(USE_TEXTURE); + + // NORSPEC-94: Set default specular color to white + // + LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. + // + LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; + mShinyColorSwatch->setOriginal(LLColor4::white); + mShinyColorSwatch->set(LLColor4::white, TRUE); + } } comboShiny->setSimple(USE_TEXTURE); } -- cgit v1.2.3