From 8a73610997d1236904c24ceb80f39e916336ef5a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 4 Apr 2013 00:22:29 -0500 Subject: NORSPEC-80 Fix for mask cutoff UI showing up in Shininess context --- indra/newview/llpanelface.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 43001e7d2c..c8c71b425d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1957,8 +1957,16 @@ void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) { return; } + LLComboBox* comboMaterials = self->getChild("combobox mattype"); + if (!comboMaterials) + { + return; + } + U32 alpha_value = comboAlphaMode->getCurrentIndex(); - bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking + U32 mattype = comboMaterials->getCurrentIndex(); + + bool show_alphactrls = (alpha_value == ALPHAMODE_MASK) && (mattype == 0); // Alpha masking self->getChildView("label maskcutoff")->setVisible(show_alphactrls); self->getChildView("maskcutoff")->setVisible(show_alphactrls); } -- cgit v1.2.3 From 73aa45d1058724460aa89b14a48ec87ce53a85f4 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 6 Apr 2013 05:20:07 -0700 Subject: Add hack around norspec 59 crash --- indra/newview/llvoavatar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a3093f069d..9d16c28e2f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,6 +4336,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } +#if !LL_DARWIN if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4362,7 +4363,8 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } - +#endif + return num_indices; } -- cgit v1.2.3 From 9e3155c368fba6cb877c55ad4e0c90258a6e9ba9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 11:40:10 -0700 Subject: NORSPEC-82 NORSPEC-85 More UI shenanigans --- indra/newview/llpanelface.cpp | 305 +++++++++++++++++++++++++++--------------- indra/newview/llpanelface.h | 5 +- 2 files changed, 198 insertions(+), 112 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 3853cfde9e..7e1f797471 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -638,6 +638,7 @@ void LLPanelFace::getState() llwarns << "failed getChild for 'combobox mattype'" << llendl; } getChildView("combobox mattype")->setEnabled(editable); + onCommitMaterialsMedia(NULL, this); //if ( LLMediaEngine::getInstance()->getMediaRenderer () ) @@ -879,8 +880,8 @@ void LLPanelFace::getState() } else { - shinytexture_ctrl->setTentative( TRUE ); - shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setTentative( TRUE ); + shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( specmap_id ); } } @@ -888,7 +889,7 @@ void LLPanelFace::getState() if (bumpytexture_ctrl) { if (identical_norm) - { + { bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); bumpytexture_ctrl->setImageAssetID( normmap_id ); @@ -897,16 +898,16 @@ void LLPanelFace::getState() { bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( FALSE ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); + } else { - bumpytexture_ctrl->setTentative( TRUE ); - bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_ctrl->setTentative( TRUE ); + bumpytexture_ctrl->setEnabled( editable ); bumpytexture_ctrl->setImageAssetID( normmap_id ); - } } } + } // planar align bool align_planar = false; @@ -945,6 +946,26 @@ void LLPanelFace::getState() } } + // Needs to be public and before tex scale settings below to properly reflect + // behavior when in planar vs default texgen modes in the + // NORSPEC-84 et al + // + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = true; + bool identical_planar_texgen = false; + + { + struct f11 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + } + // Texture scale { F32 scale_s = 1.f; @@ -958,7 +979,11 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleU")->setValue(editable ? scale_s : 0); + + F32 scale_u = editable ? scale_s : 0; + scale_u *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("TexScaleU")->setValue(scale_u); getChild("TexScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleU")->setEnabled(editable); @@ -981,7 +1006,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyScaleU")->setValue(editable ? scale_s : 0); + F32 scale_s_value = editable ? scale_s : 0; + scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("shinyScaleU")->setValue(scale_s_value); getChild("shinyScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); @@ -1004,9 +1032,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_s ); identical = align_planar ? identical_planar_aligned : identical; - + scale_s_value = editable ? scale_s : 0; + scale_s_value *= identical_planar_texgen ? 2.0f : 1.0f; - getChild("bumpyScaleU")->setValue(editable ? scale_s : 0); + getChild("bumpyScaleU")->setValue(scale_s_value); getChild("bumpyScaleU")->setTentative(LLSD((BOOL)(!identical))); getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); } @@ -1023,7 +1052,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("TexScaleV")->setValue(editable ? scale_t : 0); + F32 scale_t_value = editable ? scale_t : 0; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("TexScaleV")->setValue(scale_t_value); getChild("TexScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("TexScaleV")->setEnabled(editable); @@ -1045,7 +1077,11 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &shiny_func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("shinyScaleV")->setValue(editable ? scale_t : 0); + + scale_t_value = editable ? scale_t : 0; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("shinyScaleV")->setValue(scale_t_value); getChild("shinyScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); @@ -1068,7 +1104,10 @@ void LLPanelFace::getState() identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &bump_func, scale_t ); identical = align_planar ? identical_planar_aligned : identical; - getChild("bumpyScaleV")->setValue(editable ? scale_t : 0); + scale_t_value = editable ? scale_t : 0.0f; + scale_t_value *= identical_planar_texgen ? 2.0f : 1.0f; + + getChild("bumpyScaleV")->setValue(scale_t_value); getChild("bumpyScaleV")->setTentative(LLSD((BOOL)(!identical))); getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); @@ -1096,7 +1135,7 @@ void LLPanelFace::getState() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) @@ -1118,7 +1157,7 @@ void LLPanelFace::getState() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) @@ -1318,20 +1357,20 @@ void LLPanelFace::getState() // Shiny { - F32 shinyf = 0.f; - struct f9 : public LLSelectedTEGetFunctor + U8 shiny = 0; + struct f9 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getShiny()); + return (U8)(object->getTE(face)->getShiny()); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shinyf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { - combobox_shininess->selectNthItem((S32)shinyf); + combobox_shininess->selectNthItem((S32)shiny); } else { @@ -1353,20 +1392,20 @@ void LLPanelFace::getState() // Bumpy { - F32 bumpf = 0.f; - struct f10 : public LLSelectedTEGetFunctor + U8 bumpy = 0; + struct f10 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getBumpmap()); + return object->getTE(face)->getBumpmap(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { - combobox_bumpiness->selectNthItem((S32)bumpf); + combobox_bumpiness->selectNthItem((S32)bumpy); } else { @@ -1377,22 +1416,12 @@ void LLPanelFace::getState() getChildView("label bumpiness")->setEnabled(editable); } - { - F32 genf = 0.f; - struct f11 : public LLSelectedTEGetFunctor - { - F32 get(LLViewerObject* object, S32 face) - { - return (F32)(object->getTE(face)->getTexGen()); - } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, genf ); - S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT; + { LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { - combobox_texgen->selectNthItem(selected_texgen); + combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); // Maps from enum to combobox entry index } else { @@ -1402,37 +1431,30 @@ void LLPanelFace::getState() getChild("combobox texgen")->setTentative(!identical); getChildView("tex gen")->setEnabled(editable); - if (selected_texgen == 1) + if (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR) { - getChild("TexScaleU")->setValue(2.0f * getChild("TexScaleU")->getValue().asReal() ); - getChild("TexScaleV")->setValue(2.0f * getChild("TexScaleV")->getValue().asReal() ); - getChild("shinyScaleU")->setValue(2.0f * getChild("shinyScaleU")->getValue().asReal() ); - getChild("shinyScaleV")->setValue(2.0f * getChild("shinyScaleV")->getValue().asReal() ); - getChild("bumpyScaleU")->setValue(2.0f * getChild("bumpScaleU")->getValue().asReal() ); - getChild("bumpyScaleV")->setValue(2.0f * getChild("bumpScaleV")->getValue().asReal() ); - // EXP-1507 (change label based on the mapping mode) getChild("rpt")->setValue(getString("string repeats per meter")); } else - if (selected_texgen == 0) // FIXME: should not be magic numbers + if (selected_texgen == LLTextureEntry::TEX_GEN_DEFAULT) { getChild("rpt")->setValue(getString("string repeats per face")); } } { - F32 fullbrightf = 0.f; - struct f12 : public LLSelectedTEGetFunctor + U8 fullbright_flag = 0; + struct f12 : public LLSelectedTEGetFunctor { - F32 get(LLViewerObject* object, S32 face) + U8 get(LLViewerObject* object, S32 face) { - return (F32)(object->getTE(face)->getFullbright()); + return object->getTE(face)->getFullbright(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbrightf ); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, fullbright_flag ); - getChild("checkbox fullbright")->setValue((S32)fullbrightf); + getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable); getChild("checkbox fullbright")->setTentative(!identical); } @@ -1556,7 +1578,8 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate //make a local copy of the material for editing // (prevents local edits from overwriting client state on shared materials) - mMaterial = new LLMaterial(*material); + mMaterial = new LLMaterial(*material); + mMaterialID = material_id; // Alpha LLCtrlSelectionInterface* combobox_alphamode = @@ -1572,6 +1595,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(getChild("combobox alphamode"),this); + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + bool identical_texgen = true; + bool identical_planar_texgen = false; + + struct f44 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); @@ -1581,6 +1618,13 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); + + if (identical_planar_texgen) + { + repeat_x *= 2.0f; + repeat_y *= 2.0f; + } + rot = material->getSpecularRotation(); getChild("shinyScaleU")->setValue(repeat_x); getChild("shinyScaleV")->setValue(repeat_y); @@ -1592,7 +1636,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); getChild("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); } - updateShinyControls(combobox_shininess,this); + updateShinyControls(combobox_shininess,this, true); // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); @@ -1602,6 +1646,13 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); + + if (identical_planar_texgen) + { + repeat_x *= 2.0f; + repeat_y *= 2.0f; + } + rot = material->getNormalRotation(); getChild("bumpyScaleU")->setValue(repeat_x); getChild("bumpyScaleV")->setValue(repeat_y); @@ -1609,11 +1660,11 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("bumpyOffsetU")->setValue(offset_x); getChild("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this); + updateBumpyControls(combobox_bumpiness,this, true); } void LLPanelFace::updateMaterial() -{ +{ // assign current state of UI to material definition for submit to sim LL_DEBUGS("Materials") << "Entered." << LL_ENDL; LLComboBox* comboAlphaMode = getChild("combobox alphamode"); LLComboBox* comboBumpiness = getChild("combobox bumpiness"); @@ -1625,6 +1676,18 @@ void LLPanelFace::updateMaterial() U32 alpha_mode = comboAlphaMode->getCurrentIndex(); U32 bumpiness = comboBumpiness->getCurrentIndex(); U32 shininess = comboShininess->getCurrentIndex(); + + LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; + struct f45 : public LLSelectedTEGetFunctor + { + LLTextureEntry::e_texgen get(LLViewerObject* object, S32 face) + { + return (LLTextureEntry::e_texgen)(object->getTE(face)->getTexGen()); + } + } func; + bool identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); + bool identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); + if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) || (bumpiness == BUMPY_TEXTURE) || (shininess == SHINY_TEXTURE)) @@ -1637,17 +1700,26 @@ void LLPanelFace::updateMaterial() mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); - mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); if (bumpiness == BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + + F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); + F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); + + if (identical_planar_texgen) + { + bumpy_scale_u *= 0.5f; + bumpy_scale_v *= 0.5f; + } + mMaterial->setNormalOffset(getChild("bumpyOffsetU")->getValue().asReal(), getChild("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(getChild("bumpyScaleU")->getValue().asReal(), - getChild("bumpyScaleV")->getValue().asReal()); + mMaterial->setNormalRepeat(bumpy_scale_u, bumpy_scale_v); mMaterial->setNormalRotation(getChild("bumpyRot")->getValue().asReal()*DEG_TO_RAD); } else @@ -1665,18 +1737,21 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularID(getChild("shinytexture control")->getImageAssetID()); mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); - mMaterial->setSpecularRepeat(getChild("shinyScaleU")->getValue().asReal(), - getChild("shinyScaleV")->getValue().asReal()); - mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); - //override shininess to 0.2f if this is a new material - if (new_material) + F32 shiny_scale_u = getChild("shinyScaleU")->getValue().asReal(); + F32 shiny_scale_v = getChild("shinyScaleV")->getValue().asReal(); + + if (identical_planar_texgen) { - mMaterial->setSpecularLightColor(LLColor4U::white); - mMaterial->setSpecularLightExponent((U8) (0.2f*255.f)); - mMaterial->setEnvironmentIntensity(0); + shiny_scale_u *= 0.5f; + shiny_scale_v *= 0.5f; } - else + + mMaterial->setSpecularRepeat(shiny_scale_u, shiny_scale_v); + mMaterial->setSpecularRotation(getChild("shinyRot")->getValue().asReal()*DEG_TO_RAD); + + //override shininess to 0.2f if this is a new material + if (!new_material) { mMaterial->setSpecularLightColor(getChild("shinycolorswatch")->get()); mMaterial->setSpecularLightExponent((U8)(255*getChild("glossiness")->getValue().asReal())); @@ -1690,7 +1765,8 @@ void LLPanelFace::updateMaterial() mMaterial->setSpecularOffset(0.0f,0.0f); mMaterial->setSpecularRepeat(1.0f,1.0f); mMaterial->setSpecularRotation(0.0f); - mMaterial->setSpecularLightExponent(0); + mMaterial->setSpecularLightColor(LLMaterial::DEFAULT_SPECULAR_LIGHT_COLOR); + mMaterial->setSpecularLightExponent(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); mMaterial->setEnvironmentIntensity(0); } @@ -1859,9 +1935,8 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) // This is here to insure that we properly update shared UI elements // like the texture ctrls for diffuse/norm/spec so that they are correct // when switching modes - // + // self->getState(); - onCommitMaterialsMedia(ctrl, userdata); } // static @@ -1879,34 +1954,39 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_shiny_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("shinytexture control"); LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = self->getChild("combobox shininess"); - if (!comboShiny) - { - return; - } - if (!shiny_texture_ID.isNull()) + + if(mess_with_shiny_combobox) { - if (!comboShiny->itemExists(USE_TEXTURE)) + if (!comboShiny) { - comboShiny->add(USE_TEXTURE); + return; } - comboShiny->setSimple(USE_TEXTURE); - } - else - { - if (comboShiny->itemExists(USE_TEXTURE)) + if (!shiny_texture_ID.isNull()) + { + if (!comboShiny->itemExists(USE_TEXTURE)) + { + comboShiny->add(USE_TEXTURE); + } + comboShiny->setSimple(USE_TEXTURE); + } + else { - // HACK: This depends on adding the "Use texture" - // item at the end of a list of known length. - comboShiny->remove(SHINY_TEXTURE); + if (comboShiny->itemExists(USE_TEXTURE)) + { + // HACK: This depends on adding the "Use texture" + // item at the end of a list of known length. + comboShiny->remove(SHINY_TEXTURE); + } } } + LLComboBox* combo_matmedia = self->getChild("combobox matmedia"); LLComboBox* combo_mattype = self->getChild("combobox mattype"); U32 materials_media = combo_matmedia->getCurrentIndex(); @@ -1924,7 +2004,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild("bumpytexture control"); @@ -1935,21 +2015,25 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata) { return; } - if (!bumpy_texture_ID.isNull()) + + if (mess_with_combobox) { - if (!comboBumpy->itemExists(USE_TEXTURE)) + if (!bumpy_texture_ID.isNull()) { - comboBumpy->add(USE_TEXTURE); + if (!comboBumpy->itemExists(USE_TEXTURE)) + { + comboBumpy->add(USE_TEXTURE); + } + comboBumpy->setSimple(USE_TEXTURE); } - comboBumpy->setSimple(USE_TEXTURE); - } - else - { - if (comboBumpy->itemExists(USE_TEXTURE)) + else { - // HACK: This depends on adding the "Use texture" - // item at the end of a list of known length. - comboBumpy->remove(BUMPY_TEXTURE); + if (comboBumpy->itemExists(USE_TEXTURE)) + { + // HACK: This depends on adding the "Use texture" + // item at the end of a list of known length. + comboBumpy->remove(BUMPY_TEXTURE); + } } } } @@ -2057,9 +2141,9 @@ void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) @@ -2067,9 +2151,9 @@ void LLPanelFace::onCancelMaterialTexture(const LLSD& data) // not sure what to do here other than updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) @@ -2077,9 +2161,9 @@ void LLPanelFace::onSelectMaterialTexture(const LLSD& data) LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild("combobox shininess"); - updateShinyControls(combo_shiny,this); + updateShinyControls(combo_shiny,this, true); LLComboBox* combo_bumpy = getChild("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this); + updateBumpyControls(combo_bumpy,this, true); } //static @@ -2228,3 +2312,4 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) } } } + diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index a99b4e772f..2138319365 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -93,8 +93,8 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void updateShinyControls( LLUICtrl* ctrl, void* userdata); - static void updateBumpyControls( LLUICtrl* ctrl, void* userdata); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); + static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); @@ -134,3 +134,4 @@ private: }; #endif + -- cgit v1.2.3 From 1a4c8775f8de9eb536afb26fd4a1067059a5a9a8 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 15:42:45 -0700 Subject: NORSPEC-86 Shiny type resets when editing spec glossiness --- indra/newview/llpanelface.cpp | 72 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7e1f797471..05469058a1 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1366,11 +1366,14 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) { - combobox_shininess->selectNthItem((S32)shiny); + combobox_shininess->selectNthItem(spec_map_id.isNull() ? (S32)shiny : SHINY_TEXTURE); } else { @@ -1401,11 +1404,13 @@ void LLPanelFace::getState() } } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); - LLCtrlSelectionInterface* combobox_bumpiness = - childGetSelectionInterface("combobox bumpiness"); + + LLUUID norm_map_id = getChild("shinytexture control")->getImageAssetID(); + + LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) { - combobox_bumpiness->selectNthItem((S32)bumpy); + combobox_bumpiness->selectNthItem(norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE); } else { @@ -1703,10 +1708,11 @@ void LLPanelFace::updateMaterial() mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); if (bumpiness == BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; - mMaterial->setNormalID(getChild("bumpytexture control")->getImageAssetID()); + mMaterial->setNormalID(norm_map_id); F32 bumpy_scale_u = getChild("bumpyScaleU")->getValue().asReal(); F32 bumpy_scale_v = getChild("bumpyScaleV")->getValue().asReal(); @@ -1731,10 +1737,12 @@ void LLPanelFace::updateMaterial() mMaterial->setNormalRotation(0.0f); } + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + if (shininess == SHINY_TEXTURE) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; - mMaterial->setSpecularID(getChild("shinytexture control")->getImageAssetID()); + mMaterial->setSpecularID(spec_map_id); mMaterial->setSpecularOffset(getChild("shinyOffsetU")->getValue().asReal(), getChild("shinyOffsetV")->getValue().asReal()); @@ -1944,6 +1952,13 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; self->sendBump(); + + LLComboBox* combo_bumpy = self->getChild("combobox bumpiness"); + // Need 'true' here to insure that the 'Use Texture' choice is removed + // when we select something other than a spec texture + // + updateBumpyControls(combo_bumpy,self, true); + self->updateMaterial(); } // static @@ -2042,7 +2057,12 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - self->sendShiny(); + self->sendShiny(); + LLComboBox* combo_shiny = self->getChild("combobox shininess"); + // Need 'true' here to insure that the 'Use Texture' choice is removed + // when we select something other than a spec texture + // + updateShinyControls(combo_shiny,self, true); self->updateMaterial(); } @@ -2190,7 +2210,43 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) //F32 repeats_per_meter = self->mCtrlRepeatsPerMeter->get(); F32 repeats_per_meter = (F32)self->getChild("rptctrl")->getValue().asReal();//self->mCtrlRepeatsPerMeter->get(); - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + + LLComboBox* combo_mattype = self->getChild("combobox mattype"); + + U32 material_type = combo_mattype->getCurrentIndex(); + + switch (material_type) + { + case MATTYPE_DIFFUSE: + { + LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); + } + break; + + case MATTYPE_NORMAL: + { + LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); + LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); + bumpy_scale_u->setValue(bumpy_scale_u->getValue().asReal() * repeats_per_meter); + bumpy_scale_v->setValue(bumpy_scale_v->getValue().asReal() * repeats_per_meter); + self->updateMaterial(); + } + break; + + case MATTYPE_SPECULAR: + { + LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); + LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); + shiny_scale_u->setValue(shiny_scale_u->getValue().asReal() * repeats_per_meter); + shiny_scale_v->setValue(shiny_scale_v->getValue().asReal() * repeats_per_meter); + self->updateMaterial(); + } + break; + + default: + llassert(false); + break; + } } struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor -- cgit v1.2.3 From b2ebfbf665c0bab8dc6697c389248236f168fa14 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 8 Apr 2013 16:48:24 -0700 Subject: NORSPEC-83 repts per meter active with bumpy none --- indra/newview/llpanelface.cpp | 84 ++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 05469058a1..b20360ff4b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -820,43 +820,28 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( editable ); - if (!editable) - { - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - } - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( editable ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); } else if (id.isNull()) - { - // None selected - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( FALSE ); - texture_ctrl->setImageAssetID( LLUUID::null ); - shinytexture_ctrl->setTentative( FALSE ); - shinytexture_ctrl->setEnabled( FALSE ); - shinytexture_ctrl->setImageAssetID( LLUUID::null ); - bumpytexture_ctrl->setTentative( FALSE ); - bumpytexture_ctrl->setEnabled( FALSE ); - bumpytexture_ctrl->setImageAssetID( LLUUID::null ); - getChildView("combobox alphamode")->setEnabled( FALSE ); - getChildView("label alphamode")->setEnabled( FALSE ); - getChildView("maskcutoff")->setEnabled( FALSE); - getChildView("label maskcutoff")->setEnabled( FALSE ); - } - else - { - // Tentative: multiple selected with different textures - texture_ctrl->setTentative( TRUE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + { + // None selected + texture_ctrl->setTentative( FALSE ); + texture_ctrl->setEnabled( FALSE ); + texture_ctrl->setImageAssetID( LLUUID::null ); + getChildView("combobox alphamode")->setEnabled( FALSE ); + getChildView("label alphamode")->setEnabled( FALSE ); + getChildView("maskcutoff")->setEnabled( FALSE); + getChildView("label maskcutoff")->setEnabled( FALSE ); + } + else + { + // Tentative: multiple selected with different textures + texture_ctrl->setTentative( TRUE ); + texture_ctrl->setEnabled( editable ); + texture_ctrl->setImageAssetID( id ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1355,9 +1340,10 @@ void LLPanelFace::getState() } + U8 shiny = 0; + // Shiny - { - U8 shiny = 0; + { struct f9 : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 face) @@ -1393,9 +1379,10 @@ void LLPanelFace::getState() getChildView("label shinycolor")->setEnabled(editable); } + U8 bumpy = 0; + // Bumpy - { - U8 bumpy = 0; + { struct f10 : public LLSelectedTEGetFunctor { U8 get(LLViewerObject* object, S32 face) @@ -1405,12 +1392,14 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, bumpy ); - LLUUID norm_map_id = getChild("shinytexture control")->getImageAssetID(); + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + + bumpy = norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE; LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) - { - combobox_bumpiness->selectNthItem(norm_map_id.isNull() ? (S32)bumpy : BUMPY_TEXTURE); + { + combobox_bumpiness->selectNthItem(bumpy); } else { @@ -1476,17 +1465,30 @@ void LLPanelFace::getState() // BUG: Only repeats along S axis // BUG: Only works for boxes. LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); - return object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; + F32 repeats_s = object->getTE(face)->mScaleS / object->getScale().mV[s_axis]; + F32 repeats_t = object->getTE(face)->mScaleT / object->getScale().mV[t_axis]; + return llmax(repeats_s, repeats_t); } - } func; + + } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); getChild("rptctrl")->setValue(editable ? repeats : 0); getChild("rptctrl")->setTentative(!identical); + LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) { - BOOL enabled = editable && (!mComboTexGen || mComboTexGen->getCurrentIndex() != 1); + S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; + BOOL enabled = editable && (index != 1); + U32 material_type = combobox_mattype->getCurrentIndex(); + switch (material_type) + { + default: + case MATTYPE_DIFFUSE: enabled = (editable && !id.isNull()); break; + case MATTYPE_SPECULAR: enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); break; + case MATTYPE_NORMAL: enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); break; + } getChildView("rptctrl")->setEnabled(enabled); } } -- cgit v1.2.3 From af44715f9014b56c3f8abe63edcb67e7248f1cd4 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Tue, 9 Apr 2013 09:24:58 -0700 Subject: NORSPEC-87 NORSPEC-88 fix interaction between norm/spec scale (aka repeats) and repeats per meter control --- indra/newview/llpanelface.cpp | 85 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b20360ff4b..7a9087333c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1455,7 +1455,10 @@ void LLPanelFace::getState() // Repeats per meter { - F32 repeats = 1.f; + F32 repeats_diff = 1.f; + F32 repeats_norm = 1.f; + F32 repeats_spec = 1.f; + struct f13 : public LLSelectedTEGetFunctor { F32 get(LLViewerObject* object, S32 face) @@ -1470,26 +1473,92 @@ void LLPanelFace::getState() return llmax(repeats_s, repeats_t); } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); + } func_diff; + bool identical_diff_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_diff, repeats_diff ); + + struct f14 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getNormalRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_norm; + BOOL identical_norm_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_norm, repeats_norm ); + + struct f15 : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getSpecularRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_spec; + BOOL identical_spec_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_spec, repeats_spec ); - getChild("rptctrl")->setValue(editable ? repeats : 0); - getChild("rptctrl")->setTentative(!identical); LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; BOOL enabled = editable && (index != 1); + BOOL identical = true; + F32 repeats = 1.0f; + U32 material_type = combobox_mattype->getCurrentIndex(); switch (material_type) { default: - case MATTYPE_DIFFUSE: enabled = (editable && !id.isNull()); break; - case MATTYPE_SPECULAR: enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); break; - case MATTYPE_NORMAL: enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); break; + case MATTYPE_DIFFUSE: + { + enabled = editable && !id.isNull(); + identical = identical_diff_repeats; + repeats = repeats_diff; + } + break; + + case MATTYPE_SPECULAR: + { + enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); + identical = identical_spec_repeats; + repeats = repeats_spec; + } + break; + + case MATTYPE_NORMAL: + { + enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); + identical = identical_norm_repeats; + repeats = repeats_norm; + } + break; } + getChildView("rptctrl")->setEnabled(enabled); + getChild("rptctrl")->setValue(editable ? repeats : 1.0f); + getChild("rptctrl")->setTentative(!identical); } } -- cgit v1.2.3 From 74712b47dfec67e014a4f7e0aca1bebcd15ea4e7 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Tue, 9 Apr 2013 09:39:57 -0700 Subject: NORSPEC-84 fix alpha mode UI appearing when coming back from media mode --- indra/newview/llpanelface.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7a9087333c..9af4bed918 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2005,6 +2005,10 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("bumpyOffsetU")->setEnabled(texParmsEnable); self->getChildView("bumpyOffsetV")->setEnabled(texParmsEnable); self->getChildView("checkbox planar align")->setEnabled(texParmsEnable); + + // Needed to handle transitions to/from media mode + // NORSPEC-84 + updateAlphaControls(ctrl,userdata); } // static -- cgit v1.2.3 From 893bcf34f7daa432ce70224b4d30d3c22f9c80ad Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 9 Apr 2013 12:37:57 -0700 Subject: NORSPEC-59 work around nV driver crash when doing deferred rendering on NV 9400M/9600M --- indra/newview/llviewershadermgr.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 286152867f..ce066d85f1 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -783,9 +783,6 @@ BOOL LLViewerShaderMgr::loadBasicShaders() // Load basic dependency shaders first // All of these have to load for any shaders to function -#if LL_DARWIN // Mac can't currently handle all 8 lights, - S32 sum_lights_class = 2; -#else S32 sum_lights_class = 3; // class one cards will get the lower sum lights @@ -796,14 +793,21 @@ BOOL LLViewerShaderMgr::loadBasicShaders() { sum_lights_class = 2; } -#endif // If we have sun and moon only checked, then only sum those lights. if (gPipeline.getLightingDetail() == 0) { sum_lights_class = 1; } - + +#if LL_DARWIN + // Work around driver crashes on older Macs when using deferred rendering + // NORSPEC-59 + // + if (gGLManager.mIsMobileGF) + sum_lights_class = 3; +#endif + // Use the feature table to mask out the max light level to use. Also make sure it's at least 1. S32 max_light_class = gSavedSettings.getS32("RenderShaderLightingMaxLevel"); sum_lights_class = llclamp(sum_lights_class, 1, max_light_class); -- cgit v1.2.3 From 78d23e66425265e43584c6c4fd4fce9c675f4771 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 00:27:32 -0500 Subject: NORSPEC-75 Add appropriate draw calls to underwater render passes so objects with material data don't disappear in water. --- indra/newview/lldrawpoolalpha.cpp | 4 +++ indra/newview/lldrawpoolsimple.cpp | 19 ++++++++++++- indra/newview/llface.cpp | 6 +++- indra/newview/llspatialpartition.cpp | 1 + indra/newview/llspatialpartition.h | 2 +- indra/newview/llvovolume.cpp | 55 ++++++++++++++++++++++-------------- 6 files changed, 63 insertions(+), 24 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index a8abe9a267..1f5829c7ec 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -253,6 +253,10 @@ void LLDrawPoolAlpha::render(S32 pass) simple_shader->setMinimumAlpha(0.33f); pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } if (fullbright_shader) { diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 6e0ea78af2..1dbaad9c18 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -198,7 +198,11 @@ void LLDrawPoolSimple::render(S32 pass) if (LLPipeline::sRenderDeferred) { //if deferred rendering is enabled, bump faces aren't registered as simple //render bump faces here as simple so bump faces will appear under water - pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_MATERIAL, mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_SPECMAP, mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_NORMMAP, mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_NORMSPEC, mask, TRUE, TRUE); } } else @@ -355,6 +359,11 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) gGL.setSceneBlendType(LLRender::BT_ALPHA); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); + + pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, FALSE); + pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask, TRUE, FALSE); + pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask, TRUE, FALSE); + pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask, TRUE, FALSE); } void LLDrawPoolFullbright::endPostDeferredPass(S32 pass) @@ -405,12 +414,20 @@ void LLDrawPoolFullbright::render(S32 pass) fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask, TRUE, TRUE); + pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask, TRUE, TRUE); } else { gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR; renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); + pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask); + pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask); + pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask); + pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask); } stop_glerror(); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3d6acedd02..8f8b35c578 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1311,6 +1311,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (tep) { + LLMaterial* mat = tep->getMaterialParams().get(); + GLfloat alpha[4] = { 0.00f, @@ -1319,7 +1321,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, 0.75f }; - if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) + if ((!LLPipeline::sRenderDeferred || !mat) && + getPoolType() != LLDrawPool::POOL_ALPHA && + (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) { color.mV[3] = U8 (alpha[tep->getShiny()] * 255); } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 7ec0d7df58..f42586c715 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4639,6 +4639,7 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, mFace(NULL), mDistance(0.f), mDrawMode(LLRender::TRIANGLES), + mMaterial(NULL), mSpecColor(1.0f, 1.0f, 1.0f, 0.5f), mEnvIntensity(0.0f), mAlphaMaskCutoff(0.5f), diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 13196de1ef..bfb2de6ba6 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -120,7 +120,7 @@ public: F32 mDistance; U32 mDrawMode; - LLMaterialID mMaterialID; // If this is null, the following parameters are unused. + LLMaterial* mMaterial; // If this is null, the following parameters are unused. LLPointer mSpecularMap; const LLMatrix4* mSpecularMapMatrix; LLPointer mNormalMap; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b46f4d7351..23192e61bc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3997,6 +3997,11 @@ bool can_batch_texture(LLFace* facep) return false; } + if (facep->getTextureEntry()->getMaterialParams().notNull()) + { //materials don't work with texture batching yet + return false; + } + if (facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA) { //can't batch invisiprims return false; @@ -4067,13 +4072,17 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - const LLMaterialID& matid = facep->getTextureEntry()->getMaterialID(); + LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams() : NULL; bool batchable = false; if (index < 255 && idx >= 0) { - if (index < draw_vec[idx]->mTextureList.size()) + if (mat || draw_vec[idx]->mMaterial) + { //can't batch textures when materials are present (yet) + batchable = false; + } + else if (index < draw_vec[idx]->mTextureList.size()) { if (draw_vec[idx]->mTextureList[index].isNull()) { @@ -4103,13 +4112,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mBump == bump && draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mMaterialID == matid) + draw_vec[idx]->mMaterial == mat) { draw_vec[idx]->mCount += facep->getIndicesCount(); draw_vec[idx]->mEnd += facep->getGeomCount(); draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, facep->getVirtualSize()); - if (index >= draw_vec[idx]->mTextureList.size()) + if (index < 255 && index >= draw_vec[idx]->mTextureList.size()) { draw_vec[idx]->mTextureList.resize(index+1); draw_vec[idx]->mTextureList[index] = tex; @@ -4131,22 +4140,22 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (facep->getTextureEntry()->getMaterialParams().notNull()) - { + if (mat) + { // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = matid; + draw_info->mMaterial = mat; LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); + 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 = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + 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(); @@ -4463,7 +4472,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); } - LLMaterial* mat = te->getMaterialParams().get(); + LLMaterial* mat = LLPipeline::sRenderDeferred ? te->getMaterialParams().get() : NULL; if (mat) { @@ -4920,13 +4929,13 @@ struct CompareBatchBreakerModified { return lte->getFullbright() < rte->getFullbright(); } - else if (lhs->getTexture() != rhs->getTexture()) + else if (LLPipeline::sRenderDeferred && lte->getMaterialParams() != rte->getMaterialParams()) { - return lhs->getTexture() < rhs->getTexture(); + return lte->getMaterialParams() < rte->getMaterialParams(); } else { - return lte->getMaterialParams() < rte->getMaterialParams(); + return lhs->getTexture() < rhs->getTexture(); } } }; @@ -5057,6 +5066,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (!can_batch_texture(facep)) { //face is bump mapped or has an animated texture matrix -- can't //batch more than 1 texture at a time + facep->setTextureIndex(0); break; } @@ -5107,6 +5117,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setTextureIndex(cur_tex); } } + else + { + facep->setTextureIndex(0); + } tex = texture_list[0]; } @@ -5202,8 +5216,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: index_offset += facep->getGeomCount(); indices_index += facep->getIndicesCount(); - - + //append face to appropriate render batch BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA; -- cgit v1.2.3 From f86fd87437963a4e4eeffa58f4a7fb5ba30ce193 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 01:12:18 -0500 Subject: Fix for mac build? --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 23192e61bc..bc1daa8b10 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4072,7 +4072,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams() : NULL; + LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams().get() : NULL; bool batchable = false; -- cgit v1.2.3 From 41097e74ecea7f99d2e4b0ee03dfa40ed6463f46 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 01:24:26 -0500 Subject: NORSPEC-75 Fix bug introduced by previous change where objects with an emissive mask appear fullbright. --- indra/newview/lldrawpoolsimple.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 1dbaad9c18..1a6293c010 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -359,11 +359,6 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass) gGL.setSceneBlendType(LLRender::BT_ALPHA); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); - - pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, FALSE); - pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask, TRUE, FALSE); - pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask, TRUE, FALSE); - pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask, TRUE, FALSE); } void LLDrawPoolFullbright::endPostDeferredPass(S32 pass) -- cgit v1.2.3 From 6a417acd63d576271a8b752e42a79156dd8bdc27 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 10 Apr 2013 10:23:03 -0700 Subject: NORSPEC-92 More UI fixes --- indra/newview/llpanelface.cpp | 27 ++++++++++++++++++++++----- indra/newview/llselectmgr.cpp | 4 +--- indra/newview/llselectmgr.h | 2 ++ indra/newview/llvoavatar.cpp | 2 -- 4 files changed, 25 insertions(+), 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9af4bed918..b404fbb9d5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1780,7 +1780,7 @@ void LLPanelFace::updateMaterial() mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); - if (bumpiness == BUMPY_TEXTURE) + if (!norm_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; mMaterial->setNormalID(norm_map_id); @@ -1810,7 +1810,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); - if (shininess == SHINY_TEXTURE) + if (!spec_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; mMaterial->setSpecularID(spec_map_id); @@ -1850,7 +1850,24 @@ void LLPanelFace::updateMaterial() } LL_DEBUGS("Materials") << "Updating material: " << mMaterial->asLLSD() << LL_ENDL; - LLSelectMgr::getInstance()->selectionSetMaterial( mMaterial ); + + LLMaterialPtr material_to_set = mMaterial; + + // If we're editing a single face and not the entire material for an object, + // we need to clone the material so that our changes to the material's settings + // don't automatically propagate to the non-selected faces + // NORSPEC-92 + // + LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = sel->getFirstNode(); + if (node) + { + if (node->getTESelectMask() != TE_SELECT_MASK_ALL) + { + material_to_set = new LLMaterial(*mMaterial); + } + } + LLSelectMgr::getInstance()->selectionSetMaterial( material_to_set ); } else { @@ -2030,7 +2047,7 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_bumpy = self->getChild("combobox bumpiness"); // Need 'true' here to insure that the 'Use Texture' choice is removed - // when we select something other than a spec texture + // when we select something other than a normmap texture // updateBumpyControls(combo_bumpy,self, true); self->updateMaterial(); @@ -2084,7 +2101,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 == SHINY_TEXTURE) && show_shininess; // Use texture + bool show_shinyctrls = (shiny_value != 0) && 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/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5089570319..4f58d09db3 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -104,7 +104,6 @@ const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; const S32 MAX_ACTION_QUEUE_SIZE = 20; const S32 MAX_SILS_PER_FRAME = 50; const S32 MAX_OBJECTS_PER_PACKET = 254; -const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; // // Globals @@ -1181,7 +1180,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount()) { //LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject()); - LLBBox bbox = mSavedSelectionBBox; mGridOrigin = mSavedSelectionBBox.getCenterAgent(); mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f; @@ -1200,7 +1198,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & { mGridRotation = first_grid_object->getRenderRotation(); LLVector3 first_grid_obj_pos = first_grid_object->getRenderPosition(); - + (void)first_grid_obj_pos; LLVector4a min_extents(F32_MAX); LLVector4a max_extents(-F32_MAX); BOOL grid_changed = FALSE; diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 9d187f6272..1991b5581b 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -123,6 +123,8 @@ typedef enum e_selection_type SELECT_TYPE_HUD }ESelectType; +const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; + // Contains information about a selected object, particularly which TEs are selected. class LLSelectNode { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9d16c28e2f..f861f49296 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,7 +4336,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } -#if !LL_DARWIN if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4363,7 +4362,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } -#endif return num_indices; } -- cgit v1.2.3 From 9e9e0f3ea6dad9d0f553aaeb0819e660e248ad9f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 10 Apr 2013 10:31:51 -0700 Subject: NORSPEC-98 side-step nV compiler fail-o-rama --- .../shaders/class1/deferred/alphaNonIndexedF.glsl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl index 10e9670894..07a7ee4e1a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -55,6 +55,12 @@ uniform vec4 light_position[8]; uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; +#if 0 +uniform vec4 light_position[1]; +uniform vec3 light_direction[1]; +uniform vec3 light_attenuation[1]; +uniform vec3 light_diffuse[1]; +#endif float calcDirectionalLight(vec3 n, vec3 l) { @@ -124,11 +130,17 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - for (int i = 2; i < 8; i++) - { - light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - } - +#define LIGHT_LOOP(i) \ + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; -- cgit v1.2.3 From 250175a0fa1dd1811e7b27a8cd8e6f99ff20ced9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 10 Apr 2013 13:12:15 -0700 Subject: NORSPEC-56 slight tweak to log formatting to correct material count --- indra/newview/llmaterialmgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 25e92e27d9..81284e42dd 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -554,8 +554,8 @@ void LLMaterialMgr::processGetQueue() postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id)); - LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialSize << " materials." - << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; + LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialsData.size() << " materials." + << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL; LLHTTPClient::post(capURL, postData, materialsResponder); } } -- cgit v1.2.3 From 81781bf0d85eb7d37f6b4d1a9abebab4c9b0af0e Mon Sep 17 00:00:00 2001 From: Tonya Souther Date: Thu, 11 Apr 2013 10:21:33 -0500 Subject: NORSPEC-94: Set default specular color to white. --- indra/newview/llpanelface.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9af4bed918..a0f2fb702e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1374,10 +1374,21 @@ void LLPanelFace::getState() getChildView("environment")->setEnabled(editable); getChild("environment")->setTentative(!identical); getChildView("label environment")->setEnabled(editable); - getChildView("shinycolorswatch")->setEnabled(editable); 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 ); + } U8 bumpy = 0; -- cgit v1.2.3 From 35400fb415d296ab0fde9e2775a98f15041985e0 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Thu, 11 Apr 2013 10:24:27 -0700 Subject: NORSPEC-96 less insane repeats per meter behavior in planar mode for norm/spec maps --- indra/newview/llpanelface.cpp | 44 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b404fbb9d5..c55923599f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1543,7 +1543,7 @@ void LLPanelFace::getState() { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); identical = identical_spec_repeats; - repeats = repeats_spec; + repeats = repeats_spec * (identical_planar_texgen ? 2.0f : 1.0f); } break; @@ -1551,11 +1551,11 @@ void LLPanelFace::getState() { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); identical = identical_norm_repeats; - repeats = repeats_norm; + repeats = repeats_norm * (identical_planar_texgen ? 2.0f : 1.0f); } break; } - + getChildView("rptctrl")->setEnabled(enabled); getChild("rptctrl")->setValue(editable ? repeats : 1.0f); getChild("rptctrl")->setTentative(!identical); @@ -2305,8 +2305,38 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLComboBox* combo_mattype = self->getChild("combobox mattype"); + F32 obj_scale_s = 1.0f; + F32 obj_scale_t = 1.0f; + U32 material_type = combo_mattype->getCurrentIndex(); + struct f_objscale_s : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + return object->getScale().mV[s_axis]; + } + + } scale_s_func; + + struct f_objscale_t : public LLSelectedTEGetFunctor + { + F32 get(LLViewerObject* object, S32 face) + { + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + return object->getScale().mV[t_axis]; + } + + } scale_t_func; + + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_s_func, obj_scale_s ); + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &scale_t_func, obj_scale_t ); + switch (material_type) { case MATTYPE_DIFFUSE: @@ -2319,8 +2349,8 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); - bumpy_scale_u->setValue(bumpy_scale_u->getValue().asReal() * repeats_per_meter); - bumpy_scale_v->setValue(bumpy_scale_v->getValue().asReal() * repeats_per_meter); + bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); + bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); self->updateMaterial(); } break; @@ -2329,8 +2359,8 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); - shiny_scale_u->setValue(shiny_scale_u->getValue().asReal() * repeats_per_meter); - shiny_scale_v->setValue(shiny_scale_v->getValue().asReal() * repeats_per_meter); + shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); + shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); self->updateMaterial(); } break; -- cgit v1.2.3 From 19430bfce05748c363bb83c7e78e605ee6af3b14 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Thu, 11 Apr 2013 11:57:50 -0700 Subject: NORSPEC-98 fix? for mac shader compiler crasher --- .../shaders/class1/deferred/alphaF.glsl | 21 +++++++++++++++------ .../shaders/class1/deferred/alphaNonIndexedF.glsl | 11 ++++------- .../shaders/class2/deferred/alphaF.glsl | 19 ++++++++++++++----- .../shaders/class2/deferred/alphaNonIndexedF.glsl | 19 ++++++++++++++----- .../class2/deferred/alphaNonIndexedNoColorF.glsl | 17 +++++++++++++---- 5 files changed, 60 insertions(+), 27 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 4ef69824a1..d6baec0ee0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -105,7 +105,10 @@ void main() vec4 diff= diffuseLookup(vary_texcoord0.xy); - vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col; + vec3 n = vary_norm; + vec3 l = light_position[0].xyz; + vec3 dlight = calcDirectionalLight(n, l); + dlight = dlight * vary_directional.rgb * vary_pointlight_col; vec4 col = vec4(vary_ambient + dlight, vertex_color.a); vec4 color = diff * col; @@ -115,11 +118,17 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - for (int i = 2; i < 8; i++) - { - light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - } - +#define LIGHT_LOOP(i) \ + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl index 07a7ee4e1a..eff7b91a88 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -55,12 +55,6 @@ uniform vec4 light_position[8]; uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -#if 0 -uniform vec4 light_position[1]; -uniform vec3 light_direction[1]; -uniform vec3 light_attenuation[1]; -uniform vec3 light_diffuse[1]; -#endif float calcDirectionalLight(vec3 n, vec3 l) { @@ -120,7 +114,10 @@ void main() vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy); - vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col; + vec3 n = vary_norm; + vec3 l = light_position[0].xyz; + vec3 dlight = calcDirectionalLight(n, l); + dlight = dlight * vary_directional.rgb * vary_pointlight_col; vec4 col = vec4(vary_ambient + dlight, vertex_color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 6f10ff8451..f93bf66fa9 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -189,7 +189,10 @@ void main() { shadow = 1.0; } - vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col; + vec3 n = vary_norm; + vec3 l = light_position[0].xyz; + vec3 dlight = calcDirectionalLight(n, l); + dlight = dlight * vary_directional.rgb * vary_pointlight_col; vec4 diff = diffuseLookup(vary_texcoord0.xy); vec4 col = vec4(vary_ambient + dlight *shadow, vertex_color.a); @@ -200,11 +203,17 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - for (int i = 2; i < 8; i++) - { +#define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - } - + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl index 8fd8bb8066..08fbb3c29b 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl @@ -203,7 +203,10 @@ void main() { shadow = 1.0; } - vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col; + vec3 n = vary_norm; + vec3 l = light_position[0].xyz; + vec3 dlight = calcDirectionalLight(n, l); + dlight = dlight * vary_directional.rgb * vary_pointlight_col; vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy); vec4 col = vec4(vary_ambient + dlight*shadow, vertex_color.a); @@ -214,11 +217,17 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - for (int i = 2; i < 8; i++) - { +#define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - } - + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) + color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl index ff75b039b2..6567f3fded 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl @@ -210,7 +210,10 @@ void main() { shadow = 1.0; } - vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col; + vec3 n = vary_norm; + vec3 l = light_position[0].xyz; + vec3 dlight = calcDirectionalLight(n, l); + dlight = dlight * vary_directional.rgb * vary_pointlight_col; vec4 col = vec4(vary_ambient + dlight*shadow, 1.0); vec4 color = diff * col; @@ -220,10 +223,16 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - for (int i = 2; i < 8; i++) - { +#define LIGHT_LOOP(i) light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - } + + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) color.rgb += diff.rgb * vary_pointlight_col * light_col; -- cgit v1.2.3 From 7d623abfc3c7f6ef99ae3189a592211f4bf696db Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Thu, 11 Apr 2013 20:16:11 -0700 Subject: NORSPEC-98 redux...hopefully fix mac AND linux at the same time --- .../shaders/class1/deferred/alphaF.glsl | 10 ++++-- .../shaders/class1/deferred/alphaNonIndexedF.glsl | 11 +++++-- .../shaders/class2/deferred/alphaF.glsl | 16 ++++++--- .../shaders/class2/deferred/alphaNonIndexedF.glsl | 13 ++++++-- .../class2/deferred/alphaNonIndexedNoColorF.glsl | 10 ++++-- indra/newview/lldrawpoolavatar.cpp | 4 +++ indra/newview/llviewershadermgr.cpp | 38 +++++++++++++++++++++- indra/newview/llviewershadermgr.h | 3 ++ 8 files changed, 89 insertions(+), 16 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index d6baec0ee0..eff94b143a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -118,7 +118,8 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); -#define LIGHT_LOOP(i) \ +#if MAC_GEFORCE_HACK + #define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); LIGHT_LOOP(1) @@ -128,7 +129,12 @@ void main() LIGHT_LOOP(5) LIGHT_LOOP(6) LIGHT_LOOP(7) - +#else + for (int i = 2; i < 8; i++) + { + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + } +#endif color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl index eff7b91a88..e872dadcc1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -126,8 +126,8 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); - -#define LIGHT_LOOP(i) \ +#if MAC_GEFORCE_HACK + #define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); LIGHT_LOOP(1) @@ -137,7 +137,12 @@ void main() LIGHT_LOOP(5) LIGHT_LOOP(6) LIGHT_LOOP(7) - +#else + for (int i = 2; i < 8; i++) + { + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + } +#endif color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index f93bf66fa9..1a25ea97b7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -64,10 +64,10 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -float calcDirectionalLight(vec3 n, vec3 l) +vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = pow(max(dot(n,l),0.0), 0.7); - return a; + return vec3(a,a,a); } float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) @@ -203,9 +203,10 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); -#define LIGHT_LOOP(i) \ +#if MAC_GEFORCE_HACK + #define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - + LIGHT_LOOP(1) LIGHT_LOOP(2) LIGHT_LOOP(3) @@ -213,7 +214,12 @@ void main() LIGHT_LOOP(5) LIGHT_LOOP(6) LIGHT_LOOP(7) - +#else + for (int i = 2; i < 8; i++) + { + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + } +#endif color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl index 08fbb3c29b..39a5a9894d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl @@ -64,10 +64,10 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -float calcDirectionalLight(vec3 n, vec3 l) +vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = pow(max(dot(n,l),0.0), 0.7); - return a; + return vec3(a,a,a); } float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) @@ -217,7 +217,8 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); -#define LIGHT_LOOP(i) \ +#if MAC_GEFORCE_HACK + #define LIGHT_LOOP(i) \ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); LIGHT_LOOP(1) @@ -227,6 +228,12 @@ void main() LIGHT_LOOP(5) LIGHT_LOOP(6) LIGHT_LOOP(7) +#else + for (int i = 2; i < 8; i++) + { + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + } +#endif color.rgb += diff.rgb * vary_pointlight_col * light_col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl index 6567f3fded..4bd9ccca1d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl @@ -223,7 +223,8 @@ void main() color.rgb = scaleSoftClip(color.rgb); vec3 light_col = vec3(0,0,0); -#define LIGHT_LOOP(i) +#if MAC_GEFORCE_HACK + #define LIGHT_LOOP(i) light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); LIGHT_LOOP(1) @@ -233,7 +234,12 @@ void main() LIGHT_LOOP(5) LIGHT_LOOP(6) LIGHT_LOOP(7) - +#else + for (int i = 2; i < 8; i++) + { + light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + } +#endif color.rgb += diff.rgb * vary_pointlight_col * light_col; frag_color = color; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index aa5687f338..0ceb7c6c45 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -274,7 +274,11 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha() void LLDrawPoolAvatar::beginDeferredRiggedAlpha() { +#if LL_DARWIN + sVertexProgram = gGLManager.mIsMobileGF ? &gDeferredSkinnedAlphaProgramMac : &gDeferredSkinnedAlphaProgram; +#else sVertexProgram = &gDeferredSkinnedAlphaProgram; +#endif gPipeline.bindDeferredShader(*sVertexProgram); sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gPipeline.enableLightsDynamic(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index ce066d85f1..4d16b4869c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -175,6 +175,9 @@ LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram; LLGLSLShader gDeferredSkinnedDiffuseProgram; LLGLSLShader gDeferredSkinnedBumpProgram; LLGLSLShader gDeferredSkinnedAlphaProgram; +#if LL_DARWIN +LLGLSLShader gDeferredSkinnedAlphaProgramMac; +#endif LLGLSLShader gDeferredBumpProgram; LLGLSLShader gDeferredTerrainProgram; LLGLSLShader gDeferredTreeProgram; @@ -276,6 +279,9 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredSoftenProgram); mShaderList.push_back(&gDeferredAlphaProgram); mShaderList.push_back(&gDeferredSkinnedAlphaProgram); +#if LL_DARWIN + mShaderList.push_back(&gDeferredSkinnedAlphaProgramMac); +#endif mShaderList.push_back(&gDeferredFullbrightProgram); mShaderList.push_back(&gDeferredEmissiveProgram); mShaderList.push_back(&gDeferredAvatarEyesProgram); @@ -1082,6 +1088,9 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedDiffuseProgram.unload(); gDeferredSkinnedBumpProgram.unload(); gDeferredSkinnedAlphaProgram.unload(); +#if LL_DARWIN + gDeferredSkinnedAlphaProgramMac.unload(); +#endif gDeferredBumpProgram.unload(); gDeferredImpostorProgram.unload(); gDeferredTerrainProgram.unload(); @@ -1212,7 +1221,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - + gDeferredSkinnedAlphaProgram.addPermutation("MAC_GEFORCE_HACK","0"); success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL); // Hack to include uniforms for lighting without linking in lighting file @@ -1220,6 +1229,33 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true; } +#if LL_DARWIN + if (success) + { + gDeferredSkinnedAlphaProgramMac.mName = "Deferred Skinned Alpha Shader"; + gDeferredSkinnedAlphaProgramMac.mFeatures.atmosphericHelpers = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.hasObjectSkinning = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesAtmospherics = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.hasGamma = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.hasAtmospherics = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesLighting = false; + gDeferredSkinnedAlphaProgramMac.mFeatures.hasLighting = false; + gDeferredSkinnedAlphaProgramMac.mFeatures.isAlphaLighting = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.disableTextureIndex = true; + gDeferredSkinnedAlphaProgramMac.mShaderFiles.clear(); + gDeferredSkinnedAlphaProgramMac.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredSkinnedAlphaProgramMac.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredSkinnedAlphaProgramMac.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredSkinnedAlphaProgramMac.addPermutation("MAC_GEFORCE_HACK","1"); + + success = gDeferredSkinnedAlphaProgramMac.createShader(NULL, NULL); + + // Hack to include uniforms for lighting without linking in lighting file + gDeferredSkinnedAlphaProgramMac.mFeatures.calculatesLighting = true; + gDeferredSkinnedAlphaProgramMac.mFeatures.hasLighting = true; + } +#endif + if (success) { gDeferredBumpProgram.mName = "Deferred Bump Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index e9283d8bad..38310ed7cf 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -331,6 +331,9 @@ extern LLGLSLShader gDeferredNonIndexedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedDiffuseProgram; extern LLGLSLShader gDeferredSkinnedBumpProgram; extern LLGLSLShader gDeferredSkinnedAlphaProgram; +#if LL_DARWIN +extern LLGLSLShader gDeferredSkinnedAlphaProgramMac; +#endif extern LLGLSLShader gDeferredBumpProgram; extern LLGLSLShader gDeferredTerrainProgram; extern LLGLSLShader gDeferredTreeProgram; -- cgit v1.2.3 From 7bf67f786621e88e69415c5750a3b900d7b1e544 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 12 Apr 2013 08:14:46 -0700 Subject: NORSPEC-111 probable fix for IntelHD advanced lighting crasher --- .../shaders/class1/avatar/objectSkinV.glsl | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 43ed41a205..ff30560adc 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -26,22 +26,28 @@ ATTRIBUTE vec4 weight4; -uniform mat4 matrixPalette[32]; +uniform mat4 matrixPalette[64]; mat4 getObjectSkinnedTransform() { - int i; - vec4 w = fract(weight4); - vec4 index = floor(weight4); - - float scale = 1.0/(w.x+w.y+w.z+w.w); - w *= scale; + float w0 = fract(weight4.x); + float w1 = fract(weight4.y); + float w2 = fract(weight4.z); + float w3 = fract(weight4.w); + + int i0 = int(floor(weight4.x)); + int i1 = int(floor(weight4.y)); + int i2 = int(floor(weight4.z)); + int i3 = int(floor(weight4.w)); + + //float scale = 1.0/(w.x+w.y+w.z+w.w); + //w *= scale; - mat4 mat = matrixPalette[int(index.x)]*w.x; - mat += matrixPalette[int(index.y)]*w.y; - mat += matrixPalette[int(index.z)]*w.z; - mat += matrixPalette[int(index.w)]*w.w; + mat4 mat = matrixPalette[i0]*w0; + mat += matrixPalette[i1]*w1; + mat += matrixPalette[i2]*w2; + mat += matrixPalette[i3]*w3; return mat; } -- cgit v1.2.3 From f4becc0e1b0239d349b0d00c8bf4709f2a0c1163 Mon Sep 17 00:00:00 2001 From: g Date: Fri, 12 Apr 2013 13:42:52 -0700 Subject: NORSPEC-91 default to alpha blend when a material is present and a diff tex with alpha is applied --- indra/newview/llpanelface.cpp | 84 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 15 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index be88cb6ab6..f91f1f7d3a 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -291,10 +291,55 @@ void LLPanelFace::sendTexture() } LLSelectMgr::getInstance()->selectionSetImage(id); } + + mIsAlpha = FALSE; + LLGLenum image_format; + struct f2 : public LLSelectedTEGetFunctor + { + LLGLenum get(LLViewerObject* object, S32 te_index) + { + LLGLenum image_format = GL_RGB; + + LLViewerTexture* image = object->getTEImage(te_index); + if (image) image_format = image->getPrimaryFormat(); + return image_format; + } + } func2; + LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, image_format ); + + mIsAlpha = FALSE; + switch (image_format) + { + case GL_RGBA: + case GL_ALPHA: + { + mIsAlpha = TRUE; + } + break; + + case GL_RGB: break; + default: + { + llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + } + break; + } + + LLComboBox* comboAlphaMode = getChild("combobox alphamode"); + if (comboAlphaMode) + { + U32 alpha_mode = comboAlphaMode->getCurrentIndex(); + if (mIsAlpha && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE)) + { + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + comboAlphaMode->selectNthItem(alpha_mode); + } + } void LLPanelFace::sendBump() -{ +{ LLComboBox* mComboBumpiness = getChild("combobox bumpiness"); if(!mComboBumpiness)return; U32 bumpiness = mComboBumpiness->getCurrentIndex(); @@ -789,7 +834,7 @@ void LLPanelFace::getState() } } alpha_get_func; - U8 alpha_mode = 1; + U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &alpha_get_func, alpha_mode); { @@ -798,10 +843,13 @@ void LLPanelFace::getState() if (combobox_alphamode) { - if (!mIsAlpha) - { - alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - } + // Should never want to reflect something other than the correct state + // if it's supposed to be set to NONE, that should be enforced elsewhere + // + //if (!mIsAlpha) + //{ + // alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + //} combobox_alphamode->selectNthItem(alpha_mode); } @@ -1775,9 +1823,18 @@ void LLPanelFace::updateMaterial() bool identical_texgen = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, selected_texgen ); bool identical_planar_texgen = (identical_texgen && (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR)); - if ((mIsAlpha && (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)) - || (bumpiness == BUMPY_TEXTURE) - || (shininess == SHINY_TEXTURE)) + LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + + bool doing_diffuse_alpha = (alpha_mode != LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + bool doing_bumps = (bumpiness == BUMPY_TEXTURE) || !norm_map_id.isNull(); + bool doing_shiny = (shininess == SHINY_TEXTURE) || !spec_map_id.isNull(); + + doing_diffuse_alpha = doing_diffuse_alpha && mIsAlpha; + + if (doing_diffuse_alpha + || doing_bumps + || doing_shiny) { // The user's specified something that needs a material. bool new_material = false; @@ -1786,11 +1843,10 @@ void LLPanelFace::updateMaterial() new_material = true; mMaterial = LLMaterialPtr(new LLMaterial()); } - - mMaterial->setDiffuseAlphaMode(getChild("combobox alphamode")->getCurrentIndex()); + + mMaterial->setDiffuseAlphaMode(alpha_mode); mMaterial->setAlphaMaskCutoff((U8)(getChild("maskcutoff")->getValue().asInteger())); - - LLUUID norm_map_id = getChild("bumpytexture control")->getImageAssetID(); + if (!norm_map_id.isNull()) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; @@ -1818,8 +1874,6 @@ void LLPanelFace::updateMaterial() mMaterial->setNormalRepeat(1.0f,1.0f); mMaterial->setNormalRotation(0.0f); } - - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); if (!spec_map_id.isNull()) { -- cgit v1.2.3 From fafa21315f043ab51e3373e825c85646685778a6 Mon Sep 17 00:00:00 2001 From: g Date: Fri, 12 Apr 2013 15:21:35 -0700 Subject: Fix issue with alphaNonIndexedNoColorF shader and static init fail on default spec color (real source of NORSPEC-94, I think) --- .../shaders/class2/deferred/alphaNonIndexedNoColorF.glsl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl index 4bd9ccca1d..566aefea6a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl @@ -53,6 +53,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; VARYING vec2 vary_texcoord0; +VARYING vec3 vary_norm; uniform vec2 shadow_res; @@ -65,10 +66,10 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -float calcDirectionalLight(vec3 n, vec3 l) +vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = pow(max(dot(n,l),0.0), 0.7); - return a; + return vec3(a, a, a); } float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) -- cgit v1.2.3