diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index c3b402defac1d0157324092591405e5ac2b6cd70..4e45280d35061e4816423100b24adeaa3865608f 100755 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -374,8 +374,8 @@ bool LLGLManager::initGL() mIsIntel = TRUE; #if LL_WINDOWS if (mGLRenderer.find("HD") != std::string::npos - && (mGLRenderer.find("2000") != std::string::npos - || mGLRenderer.find("3000") != std::string::npos)) + && ((mGLRenderer.find("2000") != std::string::npos || mGLRenderer.find("3000") != std::string::npos) + || (mGLVersion == 3.1f && mGLRenderer.find("INTEL(R) HD GRAPHICS") != std::string::npos))) { mIsHD3K = TRUE; } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 51596c75574a7d26ed337de58f9a37ecb8060a49..46ed8975e07b4eef4e2c92b6a7215ef08773b6b4 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,15 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) +S64Bytes LLImageGL::sGlobalTextureMemory(0); +S64Bytes LLImageGL::sBoundTextureMemory(0); +S64Bytes LLImageGL::sCurBoundTextureMemory(0); +#else S32Bytes LLImageGL::sGlobalTextureMemory(0); S32Bytes LLImageGL::sBoundTextureMemory(0); S32Bytes LLImageGL::sCurBoundTextureMemory(0); +#endif S32 LLImageGL::sCount = 0; BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 4e5940ae6569d2bb741398104668f4dddd36a78d..ccd549f7ab534b55cb347f4e8667040a031aa488 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -230,9 +230,15 @@ public: static F32 sLastFrameTime; // Global memory statistics +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) + static S64Bytes sGlobalTextureMemory; // Tracks main memory texmem + static S64Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + static S64Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame +#else static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame +#endif static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index 7653548b61b659b7065f7b841c61da502668f190..39dff1609a8a25f22c5db542fa5bfe246a78b067 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -2,6 +2,17 @@ <llsd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="llsd.xsd"> <map> + <key>AlchemyAlignMaterials</key> + <map> + <key>Comment</key> + <string>Align material layers when modifying object faces</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>AlchemyAutoAcceptNewInventory</key> <map> <key>Comment</key> diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b7698f753549aa2adc7fa1adf3a6d547e62c883c..a308f9f8c852740d86c8ae6136cccb9a21b82d1e 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -119,6 +119,11 @@ F32 LLPanelFace::getCurrentShinyScaleU() { return getChild<LLUICtrl>("shinySca F32 LLPanelFace::getCurrentShinyScaleV() { return getChild<LLUICtrl>("shinyScaleV")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentTextureRot() { return getChild<LLUICtrl>("TexRot")->getValue().asReal(); } +F32 LLPanelFace::getCurrentTextureScaleU() { return getChild<LLUICtrl>("TexScaleU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentTextureScaleV() { return getChild<LLUICtrl>("TexScaleV")->getValue().asReal(); } +F32 LLPanelFace::getCurrentTextureOffsetU() { return getChild<LLUICtrl>("TexOffsetU")->getValue().asReal(); } +F32 LLPanelFace::getCurrentTextureOffsetV() { return getChild<LLUICtrl>("TexOffsetV")->getValue().asReal(); } // // Methods @@ -152,6 +157,7 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); getChild<LLUICtrl>("button align")->setCommitCallback(boost::bind(&LLPanelFace::onClickAutoFix, this)); + getChild<LLUICtrl>("checkbox align mats")->setCommitCallback(boost::bind(&LLPanelFace::onClickAlignMats, this, _2)); setMouseOpaque(FALSE); @@ -265,7 +271,7 @@ void LLPanelFace::sendTexture() if( !mTextureCtrl->getTentative() ) { // we grab the item id first, because we want to do a - // permissions check in the selection manager. ARGH! + // permissions check in the selection manager. LLUUID id = mTextureCtrl->getImageItemID(); if(id.isNull()) { @@ -551,6 +557,11 @@ void LLPanelFace::sendTextureInfo() LLPanelFaceSendFunctor sendfunc; LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); + + if (gSavedSettings.getBOOL("AlchemyAlignMaterials")) + { + alignMaterialProperties(); + } } void LLPanelFace::refresh() @@ -560,6 +571,7 @@ void LLPanelFace::refresh() if (objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + static LLCachedControl<bool> sAlignMaterials(gSavedSettings, "AlchemyAlignMaterials"); // only turn on auto-adjust button if there is a media renderer and the media is loaded getChildView("button align")->setEnabled(editable); @@ -585,10 +597,6 @@ void LLPanelFace::refresh() bool identical_norm = false; bool identical_spec = false; - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); - LLTextureCtrl* shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID id; LLUUID normmap_id; LLUUID specmap_id; @@ -738,9 +746,9 @@ void LLPanelFace::refresh() if (identical_diffuse) { - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + mTextureCtrl->setTentative( FALSE ); + mTextureCtrl->setEnabled( editable ); + mTextureCtrl->setImageAssetID( id ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -749,9 +757,9 @@ void LLPanelFace::refresh() else if (id.isNull()) { // None selected - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( FALSE ); - texture_ctrl->setImageAssetID( LLUUID::null ); + mTextureCtrl->setTentative( FALSE ); + mTextureCtrl->setEnabled( FALSE ); + mTextureCtrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled( FALSE ); getChildView("label alphamode")->setEnabled( FALSE ); getChildView("maskcutoff")->setEnabled( FALSE); @@ -760,22 +768,22 @@ void LLPanelFace::refresh() else { // Tentative: multiple selected with different textures - texture_ctrl->setTentative( TRUE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + mTextureCtrl->setTentative( TRUE ); + mTextureCtrl->setEnabled( editable ); + mTextureCtrl->setImageAssetID( id ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); } - shinytexture_ctrl->setTentative( !identical_spec ); - shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( specmap_id ); + mShinyTextureCtrl->setTentative( !identical_spec ); + mShinyTextureCtrl->setEnabled( editable ); + mShinyTextureCtrl->setImageAssetID( specmap_id ); - bumpytexture_ctrl->setTentative( !identical_norm ); - bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( normmap_id ); + mBumpyTextureCtrl->setTentative( !identical_norm ); + mBumpyTextureCtrl->setEnabled( editable ); + mBumpyTextureCtrl->setImageAssetID( normmap_id ); // planar align bool align_planar = false; @@ -838,8 +846,8 @@ void LLPanelFace::refresh() getChild<LLUICtrl>("bumpyScaleU")->setValue(norm_scale_s); getChildView("TexScaleU")->setEnabled(editable); - getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); + getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull() && !sAlignMaterials); + getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull() && !sAlignMaterials); BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); @@ -876,8 +884,8 @@ void LLPanelFace::refresh() BOOL spec_scale_tentative = !identical_spec_scale_t; getChildView("TexScaleV")->setEnabled(editable); - getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); + getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull() && !sAlignMaterials); + getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull() && !sAlignMaterials); getChild<LLUICtrl>("TexScaleV")->setValue(diff_scale_t); getChild<LLUICtrl>("shinyScaleV")->setValue(norm_scale_t); @@ -915,8 +923,8 @@ void LLPanelFace::refresh() getChild<LLUICtrl>("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); getChildView("TexOffsetU")->setEnabled(editable); - getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); + getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull() && !sAlignMaterials); + getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull() && !sAlignMaterials); } { @@ -945,8 +953,8 @@ void LLPanelFace::refresh() getChild<LLUICtrl>("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); getChildView("TexOffsetV")->setEnabled(editable); - getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); + getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull() && !sAlignMaterials); + getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull() && !sAlignMaterials); } // Texture rotation @@ -972,8 +980,8 @@ void LLPanelFace::refresh() F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; getChildView("TexRot")->setEnabled(editable); - getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); + getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull() && !sAlignMaterials); + getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull() && !sAlignMaterials); getChild<LLUICtrl>("TexRot")->setTentative(diff_rot_tentative); getChild<LLUICtrl>("shinyRot")->setTentative(LLSD(norm_rot_tentative)); @@ -1028,6 +1036,8 @@ void LLPanelFace::refresh() getChildView("checkbox fullbright")->setEnabled(editable); getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright); + getChildView("checkbox align mats")->setEnabled(editable && (specmap_id.notNull() || normmap_id.notNull())); + // Repeats per meter { F32 repeats_diff = 1.f; @@ -1062,13 +1072,15 @@ void LLPanelFace::refresh() break; case MATTYPE_SPECULAR: - enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); + enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull()) + && !sAlignMaterials); identical_repeats = identical_spec_repeats; repeats = repeats_spec; break; case MATTYPE_NORMAL: - enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); + enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull()) + && !sAlignMaterials); identical_repeats = identical_norm_repeats; repeats = repeats_norm; break; @@ -1117,8 +1129,7 @@ void LLPanelFace::refresh() // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - texture_ctrl->setImageAssetID(material->getSpecularID()); + mShinyTextureCtrl->setImageAssetID(material->getSpecularID()); if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) { @@ -1153,8 +1164,8 @@ void LLPanelFace::refresh() } // Bumpy (normal) - texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); + mTextureCtrl = getChild<LLTextureCtrl>("bumpytexture control"); + mTextureCtrl->setImageAssetID(material->getNormalID()); if (!material->getNormalID().isNull()) { @@ -1195,11 +1206,9 @@ void LLPanelFace::refresh() clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); - texture_ctrl->setImageAssetID( LLUUID::null ); - texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. + mTextureCtrl->setImageAssetID( LLUUID::null ); + mTextureCtrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. - LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); mColorSwatch->setEnabled( FALSE ); mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); mColorSwatch->setValid(FALSE); @@ -1276,15 +1285,12 @@ void LLPanelFace::onCommitMaterialsMedia() void LLPanelFace::updateVisibility() { - LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia"); - LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype"); - - U32 materials_media = combo_matmedia->getCurrentIndex(); - U32 material_type = combo_mattype->getCurrentIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); - bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); + U32 materials_media = mComboMatMedia->getCurrentIndex(); + U32 material_type = mComboMatType->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled(); + bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); + bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); + bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); getChildView("combobox mattype")->setVisible(!show_media); getChildView("rptctrl")->setVisible(true); @@ -1355,8 +1361,7 @@ void LLPanelFace::onCommitMaterialType() // static void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID shiny_texture_ID = mShinyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; LLComboBox* comboShiny = getChild<LLComboBox>("combobox shininess"); @@ -1380,14 +1385,10 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh } } - LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia"); - LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype"); - U32 materials_media = combo_matmedia->getCurrentIndex(); - U32 material_type = combo_mattype->getCurrentIndex(); - 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_media = mComboMatMedia->getCurrentIndex() == MATMEDIA_MEDIA && mComboMatType->getEnabled(); + bool show_shininess = (!show_media && mComboMatType->getCurrentIndex() == MATTYPE_SPECULAR + && mComboMatType->getEnabled()); + bool show_shinyctrls = (comboShiny->getCurrentIndex() == SHINY_TEXTURE && show_shininess); // Use texture getChildView("label glossiness")->setVisible(show_shinyctrls); getChildView("glossiness")->setVisible(show_shinyctrls); getChildView("label environment")->setVisible(show_shinyctrls); @@ -1396,18 +1397,15 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh getChildView("shinycolorswatch")->setVisible(show_shinyctrls); } -// static void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; LLComboBox* comboBumpy = getChild<LLComboBox>("combobox bumpiness"); if (mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LLUUID bumpy_texture_ID = mBumpyTextureCtrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; if (!bumpy_texture_ID.isNull() && is_setting_texture) @@ -1439,7 +1437,6 @@ void LLPanelFace::onCommitBump(const LLSD& userdata) sendBump(userdata.asInteger()); } -// static void LLPanelFace::updateAlphaControls() { LLComboBox* comboAlphaMode = getChild<LLComboBox>("combobox alphamode"); @@ -1447,13 +1444,11 @@ void LLPanelFace::updateAlphaControls() U32 alpha_value = comboAlphaMode->getCurrentIndex(); bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking - LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia"); U32 mat_media = MATMEDIA_MATERIAL; - mat_media = combobox_matmedia->getCurrentIndex(); + mat_media = mComboMatMedia->getCurrentIndex(); - LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype"); U32 mat_type = MATTYPE_DIFFUSE; - mat_type = combobox_mattype->getCurrentIndex(); + mat_type = mComboMatType->getCurrentIndex(); show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE); @@ -1545,7 +1540,7 @@ void LLPanelFace::onCancelSpecularTexture() U8 shiny = 0; bool identical_shiny = false; LLSelectedTE::getShiny(shiny, identical_shiny); - LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); + LLUUID spec_map_id = mShinyTextureCtrl->getImageAssetID(); shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } @@ -1555,7 +1550,7 @@ void LLPanelFace::onCancelNormalTexture() U8 bumpy = 0; bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy, identical_bumpy); - LLUUID spec_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); + LLUUID spec_map_id = mBumpyTextureCtrl->getImageAssetID(); bumpy = spec_map_id.isNull() ? bumpy : BUMPY_TEXTURE; sendBump(bumpy); } @@ -1695,15 +1690,11 @@ void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) } // Commit the number of repeats per meter -// static void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl) { - LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia"); - LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype"); - - U32 materials_media = combo_matmedia->getCurrentIndex(); + U32 materials_media = mComboMatMedia->getCurrentIndex(); - U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? combo_mattype->getCurrentIndex() : 0; + U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? mComboMatType->getCurrentIndex() : 0; F32 repeats_per_meter = ctrl->getValue().asReal(); F32 obj_scale_s = 1.0f; @@ -1806,7 +1797,59 @@ void LLPanelFace::onClickAutoFix() LLSelectMgr::getInstance()->getSelection()->applyToObjects(&sendfunc); } +void LLPanelFace::onClickAlignMats(const LLSD& userdata) +{ + refresh(); + if (userdata.asBoolean()) + { + alignMaterialProperties(); + } +} +void LLPanelFace::alignMaterialProperties() +{ + bool has_bumpy = (bool)getCurrentNormalMap().notNull(); + bool has_shiny = (bool)getCurrentSpecularMap().notNull(); + + if (!(has_shiny || has_bumpy)) return; + + F32 tex_scale_u = getCurrentTextureScaleU(); + F32 tex_scale_v = getCurrentTextureScaleV(); + F32 tex_offset_u = getCurrentTextureOffsetU(); + F32 tex_offset_v = getCurrentTextureOffsetV(); + F32 tex_rot = getCurrentTextureRot(); + + bool identical_planar_texgen = isIdenticalPlanarTexgen(); + + if (has_shiny) + { + childSetValue("shinyScaleU", tex_scale_u); + childSetValue("shinyScaleV", tex_scale_v); + childSetValue("shinyOffsetU", tex_offset_u); + childSetValue("shinyOffsetV", tex_offset_v); + childSetValue("shinyRot", tex_rot); + + LLSelectedTEMaterial::setSpecularRepeatX(this, identical_planar_texgen ? tex_scale_u * 0.5f : tex_scale_u); + LLSelectedTEMaterial::setSpecularRepeatY(this, identical_planar_texgen ? tex_scale_v * 0.5f : tex_scale_v); + LLSelectedTEMaterial::setSpecularOffsetX(this, identical_planar_texgen ? tex_offset_u * 0.5f : tex_offset_u); + LLSelectedTEMaterial::setSpecularOffsetY(this, identical_planar_texgen ? tex_offset_v * 0.5f : tex_offset_v); + LLSelectedTEMaterial::setSpecularRotation(this, tex_rot * DEG_TO_RAD); + } + if (has_bumpy) + { + childSetValue("bumpyScaleU", tex_scale_u); + childSetValue("bumpyScaleV", tex_scale_v); + childSetValue("bumpyOffsetU", tex_offset_u); + childSetValue("bumpyOffsetV", tex_offset_v); + childSetValue("bumpyRot", tex_rot); + + LLSelectedTEMaterial::setNormalRepeatX(this, identical_planar_texgen ? tex_scale_u * 0.5f : tex_scale_u); + LLSelectedTEMaterial::setNormalRepeatY(this, identical_planar_texgen ? tex_scale_v * 0.5f : tex_scale_v); + LLSelectedTEMaterial::setNormalOffsetX(this, identical_planar_texgen ? tex_offset_u * 0.5f : tex_offset_u); + LLSelectedTEMaterial::setNormalOffsetY(this, identical_planar_texgen ? tex_offset_v * 0.5f : tex_offset_v); + LLSelectedTEMaterial::setNormalRotation(this, tex_rot * DEG_TO_RAD); + } +} // TODO: I don't know who put these in or what these are for??? void LLPanelFace::setMediaURL(const std::string& url) @@ -1826,52 +1869,35 @@ void LLPanelFace::onCommitPlanarAlign() void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; - LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype"); - if (!combo_mattype) - { - return; - } - U32 mattype = combo_mattype->getCurrentIndex(); - std::string which_control = "texture control"; - switch (mattype) - { - case MATTYPE_SPECULAR: - which_control = "shinytexture control"; - break; - case MATTYPE_NORMAL: - which_control = "bumpytexture control"; - break; - // no default needed - } + U32 mattype = mComboMatType->getCurrentIndex(); + const std::string& which_control = (mattype == MATTYPE_SPECULAR ? "shinytexture control" + : mattype == MATTYPE_NORMAL ? "bumpytexture control" + : "texture control"); LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(which_control); - if (texture_ctrl) - { - LLUUID obj_owner_id; - std::string obj_owner_name; - LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); + LLUUID obj_owner_id; + std::string obj_owner_name; + LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); - LLSaleInfo sale_info; - LLSelectMgr::instance().selectGetSaleInfo(sale_info); + LLSaleInfo sale_info; + LLSelectMgr::instance().selectGetSaleInfo(sale_info); - bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? - bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? - bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? - bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? + bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? + bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? + bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? - if (can_copy && can_transfer) - { - texture_ctrl->setCanApply(true, true); - return; - } + if (can_copy && can_transfer) + { + texture_ctrl->setCanApply(true, true); + return; + } - // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale - texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale + texture_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && !sale_info.isForSale()); - if (gSavedSettings.getBOOL("TextureLivePreview")) - { - LLNotificationsUtil::add("LivePreviewUnavailable"); - } + if (gSavedSettings.getBOOL("TextureLivePreview")) + { + LLNotificationsUtil::add("LivePreviewUnavailable"); } } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 263d42cee04bb60e5369867986c3716810274829..7ee030f20d36996a7351e8785b368292472a027f 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -174,6 +174,8 @@ protected: void onCommitPlanarAlign(); void onCommitRepeatsPerMeter(LLUICtrl* ctrl); void onClickAutoFix(); + void onClickAlignMats(const LLSD& userdata); + void alignMaterialProperties(); static F32 valueGlow(LLViewerObject* object, S32 face); @@ -201,6 +203,11 @@ private: F32 getCurrentShinyScaleV(); F32 getCurrentShinyOffsetU(); F32 getCurrentShinyOffsetV(); + F32 getCurrentTextureRot(); + F32 getCurrentTextureScaleU(); + F32 getCurrentTextureScaleV(); + F32 getCurrentTextureOffsetU(); + F32 getCurrentTextureOffsetV(); // Update visibility of controls to match current UI mode // (e.g. materials vs media editing) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 8f961f6f4b9f69a1dda104acbd33203649561574..ad2bb5988fee35b8ffd21aabab4c96ea7bf6c8a6 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -103,6 +103,7 @@ #include "llselectmgr.h" #include "llspellcheckmenuhandler.h" #include "llstatusbar.h" +#include "lltexturecache.h" #include "lltextureview.h" #include "lltoolbarview.h" #include "lltoolcomp.h" @@ -120,6 +121,7 @@ #include "llviewerparcelmgr.h" #include "llviewerstats.h" #include "llvoavatarself.h" +#include "llvovolume.h" #include "llvoicevivox.h" #include "llworldmap.h" #include "pipeline.h" @@ -3329,6 +3331,69 @@ class ALCheckLocationBar : public view_listener_t } }; +void destroy_texture(const LLUUID& id) +{ + if (id.isNull() || id == IMG_DEFAULT) return; + LLViewerFetchedTexture* texture = LLViewerTextureManager::getFetchedTexture(id); + if (texture) + texture->clearFetchedResults(); + LLAppViewer::getTextureCache()->removeFromCache(id); +} + +class LLRefreshTexturesObject : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); + ++iter) + { + LLSelectNode* node = *iter; + std::map< LLUUID, std::vector<U8> > faces_per_tex; + for (U8 i = 0; i < node->getObject()->getNumTEs(); ++i) + { + if (!node->isTESelected(i)) continue; + LLViewerTexture* img = node->getObject()->getTEImage(i); + faces_per_tex[img->getID()].push_back(i); + + if (node->getObject()->getTE(i)->getMaterialParams().notNull()) + { + LLViewerTexture* norm_img = node->getObject()->getTENormalMap(i); + faces_per_tex.at(norm_img->getID()).push_back(i); + LLViewerTexture* spec_img = node->getObject()->getTESpecularMap(i); + faces_per_tex.at(spec_img->getID()).push_back(i); + } + } + + for (std::pair< LLUUID, std::vector<U8> > it : faces_per_tex) + { + destroy_texture(it.first); + } + + if (node->getObject()->isSculpted()) + { + LLSculptParams* sculpt_params = dynamic_cast<LLSculptParams*>(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT)); + if (sculpt_params) + { + LLUUID sculptie = sculpt_params->getSculptTexture(); + LLViewerFetchedTexture* tx = LLViewerTextureManager::getFetchedTexture(sculptie); + if (tx) + { + const LLViewerTexture::ll_volume_list_t* pVolumeList = tx->getVolumeList(); + destroy_texture(sculptie); + for (S32 idxVolume = 0; idxVolume < tx->getNumVolumes(); ++idxVolume) + { + LLVOVolume* pVolume = pVolumeList->at(idxVolume); + if (pVolume) pVolume->notifyMeshLoaded(); + } + } + } + } + } + return true; + } +}; + class LLEnableGrid : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9333,6 +9398,7 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); // <Alchemy> + view_listener_t::addMenu(new LLRefreshTexturesObject(), "Object.RefreshTex"); view_listener_t::addMenu(new LLEditParticleSource(), "Object.EditParticles"); view_listener_t::addMenu(new LLEnableEditParticleSource(), "Object.EnableEditParticles"); view_listener_t::addMenu(new LLSyncAnimations(), "Tools.ResyncAnimations"); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b1e20f25ba0ff97169f3dde67507cfb4351968e3..24717c7cc61a2ede2ada5b34b421af611574dd22 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -90,11 +90,15 @@ S32 LLViewerTexture::sAuxCount = 0; LLFrameTimer LLViewerTexture::sEvaluationTimer; F32 LLViewerTexture::sDesiredDiscardBias = 0.f; F32 LLViewerTexture::sDesiredDiscardScale = 1.1f; -S32Bytes LLViewerTexture::sBoundTextureMemory; -S32Bytes LLViewerTexture::sTotalTextureMemory; S32Megabytes LLViewerTexture::sMaxBoundTextureMemory; S32Megabytes LLViewerTexture::sMaxTotalTextureMem; +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) +S64Bytes LLViewerTexture::sBoundTextureMemory; +S64Bytes LLViewerTexture::sTotalTextureMemory; +S64Bytes LLViewerTexture::sMaxDesiredTextureMem; +#else S32Bytes LLViewerTexture::sMaxDesiredTextureMem; +#endif S8 LLViewerTexture::sCameraMovingDiscardBias = 0; F32 LLViewerTexture::sCameraMovingBias = 0.0f; S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size @@ -482,7 +486,7 @@ bool LLViewerTexture::isMemoryForTextureLow() bool low_mem = false; if (gGLManager.mHasATIMemInfo) { - S32 meminfo[4]; + GLint meminfo[4]; glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo); if((S32Megabytes)meminfo[0] < MIN_FREE_TEXTURE_MEMORY) @@ -539,7 +543,11 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; sMaxBoundTextureMemory = gTextureList.getMaxResidentTexMem(); sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem(); +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) + sMaxDesiredTextureMem = S64Megabytes(sMaxTotalTextureMem); //in Bytes, by default and when total used texture memory is small. +#else sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small. +#endif if (sBoundTextureMemory >= sMaxBoundTextureMemory || sTotalTextureMemory >= sMaxTotalTextureMem) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 5240b52c0c7745639643b0b544c62060e8ed5f90..d433bd4dd24567b9d72c9d31a77b65d1b21ce04d 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -211,11 +211,17 @@ public: static LLFrameTimer sEvaluationTimer; static F32 sDesiredDiscardBias; static F32 sDesiredDiscardScale; - static S32Bytes sBoundTextureMemory; - static S32Bytes sTotalTextureMemory; static S32Megabytes sMaxBoundTextureMemory; static S32Megabytes sMaxTotalTextureMem; - static S32Bytes sMaxDesiredTextureMem ; +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) + static S64Bytes sBoundTextureMemory; + static S64Bytes sTotalTextureMemory; + static S64Bytes sMaxDesiredTextureMem ; +#else + static S32Bytes sBoundTextureMemory; + static S32Bytes sTotalTextureMemory; + static S32Bytes sMaxDesiredTextureMem; +#endif static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; static S32 sMaxSculptRez ; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 3088eb2d6eac9618f881a786f188e04ca79773fc..1b92b6dc0bc06c14381cd6da853b018ce2441d78 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1331,6 +1331,11 @@ S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, fl max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam); +#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) + if (get_recommended) + max_texmem = llmin(max_texmem, S32Megabytes(512)); +#endif + return max_texmem; } @@ -1342,11 +1347,11 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32Megabytes mem) S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory")); F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); S32Megabytes default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default - if (mem == (S32Bytes)0) + if (mem == (S32Megabytes)0) { - mem = cur_mem > (S32Bytes)0 ? cur_mem : default_mem; + mem = cur_mem > (S32Megabytes)0 ? cur_mem : default_mem; } - else if (mem < (S32Bytes)0) + else if (mem < (S32Megabytes)0) { mem = default_mem; } @@ -1397,6 +1402,8 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32Megabytes mem) LL_INFOS() << "Total Video Memory set to: " << vb_mem << " MB" << LL_ENDL; LL_INFOS() << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << LL_ENDL; + LL_INFOS() << "Total Texture Memory set to: " << mMaxTotalTextureMemInMegaBytes << " MB" << LL_ENDL; + LL_INFOS() << "Maxiumum Resident Texture Memory set to: " << mMaxResidentTexMemInMegaBytes << " MB" << LL_ENDL; } /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml index 4450edec467f8f44db8558522605e31ed98bc2c8..818bbadfa9e39c94a92c210813e28bc49b3a14fe 100755 --- a/indra/newview/skins/default/xui/en/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_hardware_settings.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - height="224" + height="215" layout="topleft" name="Hardware Settings Floater" help_topic="hardware_settings_floater" title="HARDWARE SETTINGS" - width="615"> + width="525"> <text type="string" length="1" @@ -16,7 +16,7 @@ left="10" name="Filtering:" top="20" - width="188"> + width="148"> Filtering: </text> <check_box @@ -37,7 +37,7 @@ left="10" name="antialiasing label" top_pad="5" - width="188"> + width="148"> Antialiasing: </text> <combo_box @@ -92,7 +92,7 @@ left="10" name="antialiasing label" top_pad="11" - width="188"> + width="148"> Vertical Sync: </text> <combo_box @@ -138,7 +138,7 @@ increment="0.01" initial_value="1" label="Gamma:" - label_width="198" + label_width="158" layout="topleft" left="10" max_val="2" @@ -165,8 +165,8 @@ layout="topleft" left="10" name="Enable VBO:" - top_pad="10" - width="188"> + top_pad="13" + width="148"> Enable VBO: </text> <check_box @@ -187,8 +187,8 @@ layout="topleft" left="10" name="tc label" - top_pad="10" - width="188"> + top_pad="5" + width="148"> Enable S3TC: </text> <check_box @@ -202,6 +202,7 @@ tool_tip="Compresses textures in video memory, allowing for higher resolution textures to be loaded at the cost of some color quality." width="315" /> <slider + can_edit_text="true" control_name="TextureMemory" decimal_digits="0" follows="left|top" @@ -209,14 +210,14 @@ increment="16" initial_value="32" label="Texture Memory (MB):" - label_width="195" + label_width="148" layout="topleft" left="10" - max_val="4096" + max_val="2048" name="GraphicsCardTextureMemory" tool_tip="Amount of memory to allocate for textures. Defaults to video card memory. Reducing this may improve performance but may also make textures blurry." - top_pad="10" - width="360" /> + top_pad="5" + width="460" /> <spinner control_name="RenderFogRatio" decimal_digits="1" @@ -224,14 +225,14 @@ height="22" initial_value="4" label="Fog Distance Ratio:" - label_width="198" + label_width="158" layout="topleft" left_delta="0" max_val="10" min_val="0.5" name="fog" - top_pad="7" - width="262" /> + top_pad="5" + width="222" /> <button follows="right|bottom" height="22" @@ -240,6 +241,6 @@ layout="topleft" left="-102" name="OK" - top="192" + top="187" width="90" /> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml index 2ee586ea7ee6cba48bb1f8150c536b3ab2a56596..9bf9774669ecb7937a55ad43b1acba36409cc163 100755 --- a/indra/newview/skins/default/xui/en/menu_object.xml +++ b/indra/newview/skins/default/xui/en/menu_object.xml @@ -286,6 +286,12 @@ <menu_item_call.on_enable function="Object.EnableDelete" /> </menu_item_call> + <menu_item_call + label="Refresh" + name="Refresh"> + <menu_item_call.on_click + function="Object.RefreshTex" /> + </menu_item_call> <menu_item_call enabled="true" label="Copy Key" diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 605df33c380653a2337b37b8d6d4074d06f3e236..58b39b39c1643b5351e5b7a84b7327857a094d69 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -101,6 +101,16 @@ name="checkbox fullbright" top_pad="4" width="81" /> + <check_box + control_name="AlchemyAlignMaterials" + height="19" + label="Sync Materials Layers" + layout="topleft" + left_pad="50" + name="checkbox align mats" + tool_tip="Synchronize material layers across faces of an object" + top_delta="0" + width="110" /> <combo_box height="23" layout="topleft"