diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llface.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 51 |
3 files changed, 54 insertions, 30 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/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<LLUICtrl>("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<LLColorSwatchCtrl>("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<LLUICtrl>("shinyRot")->setValue(rot*RAD_TO_DEG); getChild<LLUICtrl>("shinyOffsetU")->setValue(offset_x); getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y); - getChild<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent()); getChild<LLUICtrl>("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<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + } + // Bumpy (normal) texture_ctrl = getChild<LLTextureCtrl>("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<LLColorSwatchCtrl>("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); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 637d40c5b5..941892a597 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4168,39 +4168,46 @@ 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) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; draw_info->mShaderMask = shader_mask; - 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; |