diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 0e11dca876..196ecdcf7d 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -155,7 +155,6 @@ class LLVector3 friend const LLVector3& operator*=(LLVector3 &a, const LLVector3 &b); // Returns a * b; friend const LLVector3& operator*=(LLVector3 &a, F32 k); // Return a times scaler k friend const LLVector3& operator/=(LLVector3 &a, F32 k); // Return a divided by scaler k - friend const LLVector3& operator/=(LLVector3& a, const LLVector3& b); friend const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &b); // Returns a * b; friend LLVector3 operator-(const LLVector3 &a); // Return vector -a @@ -461,14 +460,6 @@ inline const LLVector3& operator/=(LLVector3& a, F32 k) return a; } -inline const LLVector3& operator/=(LLVector3& a, const LLVector3& b) -{ - a.mV[VX] /= b.mV[VX]; - a.mV[VY] /= b.mV[VY]; - a.mV[VZ] /= b.mV[VZ]; - return a; -} - inline LLVector3 operator-(const LLVector3& a) { return LLVector3(-a.mV[VX], -a.mV[VY], -a.mV[VZ]); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index abee4aba5e..e45473bf68 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -1178,7 +1178,14 @@ LLFontGL* LLFontGL::getFontSansSerifSmallItalic() //static LLFontGL* LLFontGL::getFontSansSerif() { - static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Medium",0)); + static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif","Small",0)); + return fontp; +} + +// static +LLFontGL* LLFontGL::getFontSansSerifMedium() +{ + static LLFontGL* fontp = getFont(LLFontDescriptor("SansSerif", "Medium", 0)); return fontp; } diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 5b8649ba73..e5d7a23382 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -210,6 +210,7 @@ public: static LLFontGL* getFontSansSerifSmallBold(); static LLFontGL* getFontSansSerifSmallItalic(); static LLFontGL* getFontSansSerif(); + static LLFontGL* getFontSansSerifMedium(); static LLFontGL* getFontSansSerifBig(); static LLFontGL* getFontSansSerifHuge(); static LLFontGL* getFontSansSerifBold(); diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 18fdbbfa1b..1c2dca6d3d 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -203,7 +203,7 @@ LLFontDescriptor LLFontDescriptor::normalize() const new_size = "Cascadia"; // if (new_size.empty()) - new_size = "Medium"; + new_size = "Small"; if (removeSubString(new_name,"Bold")) new_style |= LLFontGL::BOLD; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 25d16bf6b4..cc2b3c6e70 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1815,9 +1815,17 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) return; } - LLVector4a vert(x, y, z); - transform(vert); - mVerticesp[mCount] = vert; + if (mUIOffset.empty()) + { + mVerticesp[mCount].set(x,y,z); + } + else + { + LLVector4a vert(x, y, z); + vert.add(mUIOffset.back()); + vert.mul(mUIScale.back()); + mVerticesp[mCount] = vert; + } mCount++; mVerticesp[mCount] = mVerticesp[mCount-1]; @@ -1825,54 +1833,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; } -void LLRender::transform(LLVector3& vert) -{ - if (!mUIOffset.empty()) - { - vert += LLVector3(mUIOffset.back().getF32ptr()); - vert *= LLVector3(mUIScale.back().getF32ptr()); - } -} - -void LLRender::transform(LLVector4a& vert) -{ - if (!mUIOffset.empty()) - { - vert.add(mUIOffset.back()); - vert.mul(mUIScale.back()); - } -} - -void LLRender::untransform(LLVector3& vert) -{ - if (!mUIOffset.empty()) - { - vert /= LLVector3(mUIScale.back().getF32ptr()); - vert -= LLVector3(mUIOffset.back().getF32ptr()); - } -} - -void LLRender::batchTransform(LLVector4a* verts, U32 vert_count) -{ - if (!mUIOffset.empty()) - { - const LLVector4a& offset = mUIOffset.back(); - const LLVector4a& scale = mUIScale.back(); - - for (U32 i = 0; i < vert_count; ++i) - { - verts[i].add(offset); - verts[i].mul(scale); - } - } -} - -void LLRender::vertexBatchPreTransformed(const std::vector& verts) -{ - vertexBatchPreTransformed(verts.data(), narrow(verts.size())); -} - -void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) { if (mCount + vert_count > 4094) { @@ -1893,7 +1854,7 @@ void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, S32 vert_count mVerticesp[mCount] = mVerticesp[mCount-1]; } -void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count) { if (mCount + vert_count > 4094) { @@ -1917,7 +1878,7 @@ void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector } } -void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U* colors, S32 vert_count) +void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) { if (mCount + vert_count > 4094) { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 27c2091f4b..15594155cd 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -450,16 +450,9 @@ public: void diffuseColor4ubv(const U8* c); void diffuseColor4ub(U8 r, U8 g, U8 b, U8 a); - void transform(LLVector3& vert); - void transform(LLVector4a& vert); - void untransform(LLVector3& vert); - - void batchTransform(LLVector4a* verts, U32 vert_count); - - void vertexBatchPreTransformed(const std::vector& verts); - void vertexBatchPreTransformed(const LLVector4a* verts, S32 vert_count); - void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, S32 vert_count); - void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U*, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count); + void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U*, S32 vert_count); void setColorMask(bool writeColor, bool writeAlpha); void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index f320904e02..df74600b34 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -80,7 +80,7 @@ LLUICtrl::Params::Params() mouseenter_callback("mouseenter_callback"), mouseleave_callback("mouseleave_callback"), control_name("control_name"), - font("font", LLFontGL::getFontEmojiMedium()), + font("font", LLFontGL::getFontEmojiSmall()), font_halign("halign"), font_valign("valign"), length("length"), // ignore LLXMLNode cruft diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ec1f72d10b..ca42aa5a7d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9264,7 +9264,7 @@ Change of this parameter will affect the layout of buttons in notification toast Type S32 Value - 90 + 110 ChannelBottomPanelMargin diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index bb9a933854..28f974aa38 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5470,13 +5470,66 @@ void LLAppViewer::purgeCefStaleCaches() LL_PROFILE_ZONE_SCOPED; // TODO: we really shouldn't use a hard coded name for the cache folder here... const std::string browser_parent_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "cef_cache"); - if (LLFile::isdir(browser_parent_cache)) + if (!LLFile::isdir(browser_parent_cache)) { - // This is a sledgehammer approach - nukes the cef_cache dir entirely - // which is then recreated the first time a CEF instance creates an - // individual cache folder. If we ever decide to retain some folders - // e.g. Search UI cache - then we will need a more granular approach. - gDirUtilp->deleteDirAndContents(browser_parent_cache); + return; + } + // We are using a fixed name to not leave stale folders + // around in case something goes wrong on startup. + const std::string holder_cache_name = browser_parent_cache + "_rename"; + + // Try to rename the entire directory first + if (LLFile::rename(browser_parent_cache, holder_cache_name) == 0) + { + LL_DEBUGS("AppInit") << "Successfully renamed CEF cache folder for deletion" << LL_ENDL; + } + else + { + // Rename failed (likely another instance has files open in the cache) + // Create holder folder and move individual subfolders instead + LL_DEBUGS("AppInit") << "Could not rename CEF cache folder (may be in use), moving individual folders" << LL_ENDL; + + if (!LLFile::isdir(holder_cache_name) && LLFile::mkdir(holder_cache_name) != 0) + { + LL_WARNS() << "Failed to create holder folder: " << holder_cache_name << LL_ENDL; + // Attept normal cleanup + gDirUtilp->deleteDirAndContents(browser_parent_cache); + return; + } + + // Iterate through subdirectories in the cache folder + LLDirIterator dir_iter(browser_parent_cache, "*"); + std::string subfolder_name; + while (dir_iter.next(subfolder_name)) + { + if (subfolder_name == "." || subfolder_name == "..") + { + continue; + } + + std::string source_path = browser_parent_cache + gDirUtilp->getDirDelimiter() + subfolder_name; + std::string dest_path = holder_cache_name + gDirUtilp->getDirDelimiter() + subfolder_name; + + // If folder is in use, move will fail, don't delete it. + LLFile::rename(source_path, dest_path); + } + } + + // Post deletion task to the General work queue to avoid blocking the main thread + if (auto queue = LL::WorkQueue::getInstance("General")) + { + // Alternatively throw it at LLPurgeDiskCacheThread to clean + // it during periodic purges. + queue->post([holder_cache_name]() + { + LL_PROFILE_ZONE_NAMED("cef_cache_cleanup"); + gDirUtilp->deleteDirAndContents(holder_cache_name); + }); + } + else + { + LL_WARNS() << "Failed to get General work queue, deleting CEF cache synchronously" << LL_ENDL; + gDirUtilp->deleteDirAndContents(holder_cache_name); } } diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 44501a239d..57b8ae3bc3 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -514,22 +514,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // commands and exit the process before we do anything else. if (!velopack_initialize()) { + // Obsolete? Always return true // Velopack handled the invocation (install/uninstall hook) - - // Drop install related settings - gDirUtilp->initAppDirs("SecondLife"); - - std::string user_settings_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "settings.xml"); - LLControlGroup settings("global"); - if (settings.loadFromFile(user_settings_path)) - { - // If user reinstalls or updates, we want to recheck for nsis leftovers. - if (settings.controlExists("PreviousInstallChecked")) - { - settings.setBOOL("PreviousInstallChecked", false); - } - settings.saveToFile(user_settings_path, true); - } return 0; } #endif diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 128aefea09..e87e09b1aa 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -1114,7 +1114,7 @@ void LLFloaterIMSession::processAgentListUpdates(const LLSD& body) if (moderator_muted_text) label = LLTrans::getString("IM_muted_text_label"); else - label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID); + label = LLIMModel::instance().getName(mSessionID); mInputEditor->setLabel(label); if (moderator_muted_text) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 95d64e88e2..c45c305958 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -937,7 +937,7 @@ void LLFloaterIMSessionTab::hideOrShowTitle() void LLFloaterIMSessionTab::updateSessionName(const std::string& name) { - mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + name); + mInputEditor->setLabel(name); } void LLFloaterIMSessionTab::updateChatIcon(const LLUUID& id) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 11c6bb5604..8f9e52e709 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -50,7 +50,7 @@ const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding -S32 BUTTON_WIDTH = 90; +S32 BUTTON_WIDTH = 110; //static @@ -387,8 +387,20 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) } else { - const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel + S32 button_panel_width = mControlPanel->getRect().getWidth();// get initial width from XML S32 button_panel_height = mControlPanel->getRect().getHeight(); + + // width for 3 columns: 3 buttons + 2 gaps + S32 min_width_required = 3 * BUTTON_WIDTH + 2 * (2 * HPAD); + if (min_width_required > button_panel_width) + { + button_panel_width = min_width_required; + S32 width_increase = button_panel_width - mControlPanel->getRect().getWidth(); + reshape(getRect().getWidth() + width_increase, getRect().getHeight()); + mInfoPanel->reshape(mInfoPanel->getRect().getWidth() + width_increase, mInfoPanel->getRect().getHeight()); + mTextBox->reshape(mTextBox->getRect().getWidth() + width_increase, mTextBox->getRect().getHeight()); + } + //try get an average h_pad to spread out buttons S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size())); if(h_pad < 2*HPAD) diff --git a/indra/newview/llvelopack.cpp b/indra/newview/llvelopack.cpp index 41cf3ec437..233fef0481 100644 --- a/indra/newview/llvelopack.cpp +++ b/indra/newview/llvelopack.cpp @@ -529,6 +529,73 @@ static bool paths_are_equal(const std::wstring& path1, const std::wstring& path2 } } +static void update_taskbar_shortcut(const std::string& nsis_folder_path, const std::wstring& appdata_path, const std::wstring& app_name, const std::wstring& link_name) +{ + std::wstring taskbar_path = appdata_path; + taskbar_path += L"\\Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar\\"; + taskbar_path += link_name; + + if (!PathFileExistsW(taskbar_path.c_str())) + { + // User didn't create one + return; + } + + // Verify we are removing or updating the right thing. + // It is not warranteed that the shortcut points to NSIS. + std::wstring target_path; + if (get_shortcut_target(taskbar_path, target_path)) + { + // Strip the filename part to get just the folder path + std::filesystem::path trim_path(target_path); + if (trim_path.has_filename()) + { + target_path = trim_path.parent_path().wstring(); + } + std::wstring nsis_path_w = ll_convert(nsis_folder_path); + if (!paths_are_equal(nsis_path_w, target_path)) + { + // Shortcut points to something else, don't mess with it + LL_INFOS("Velopack") << "Found a matching shortcut, but it points to a different channel. Expected: " + << ll_convert_wide_to_string(nsis_path_w) + << ", actual: " << ll_convert_wide_to_string(target_path) + << LL_ENDL; + return; + } + } + + // First try to overwrite shortcut + std::wstring current_exe = ll_convert(gDirUtilp->getExecutablePathAndName()); + HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); + if (SUCCEEDED(hr)) + { + LL_INFOS("Velopack") << "Successfully updated taskbar shortcut to point to current exe" << LL_ENDL; + return; + } + + // Try deleting and if possible, recreating separately. We should not leave hanging shortcuts behind. + if (!DeleteFileW(taskbar_path.c_str())) + { + DWORD error = GetLastError(); + if (error != ERROR_FILE_NOT_FOUND) + { + LL_WARNS("Velopack") << "Failed to delete NSIS taskbar shortcut: " + << ll_convert_wide_to_string(taskbar_path) + << " (error: " << error << ")" << LL_ENDL; + } + } + else + { + // Deleted user created link, recreate it with new target if possible. + LL_INFOS("Velopack") << "Updating taskbar shortcut to point to current exe" << LL_ENDL; + HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); + if (FAILED(hr)) + { + LL_WARNS("Velopack") << "Failed to re-create taskbar shortcut, error: " << std::hex << hr << ", NSIS shortcut was removed" << LL_ENDL; + } + } +} + void clear_nsis_links(const std::string& nsis_folder_path) { wchar_t path[MAX_PATH]; @@ -573,68 +640,17 @@ void clear_nsis_links(const std::string& nsis_folder_path) } } - // 3. Taskbar link, which is user-specific and located at: - // %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Second Life.lnk - // Note that it can be a link to velopack already, but since - // we aren't removing, but recreating, it shouldn't be an issue. + // 3. Taskbar links, which are user-specific and located at: + // %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\ + // Note that it can be a link to velopack already or to a different NSIS viewer. + // Name might also be different based on method of creation. if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, path))) { - std::wstring taskbar_path = path; - // Hardcoded, because this name is the default window name and isn't going to change in NSIS - taskbar_path += L"\\Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar\\Second Life.lnk"; - - if (PathFileExistsW(taskbar_path.c_str())) - { - // First try to overwrite shortcut - std::wstring current_exe = ll_convert(gDirUtilp->getExecutablePathAndName()); - - HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); - if (FAILED(hr)) - { - LL_WARNS("Velopack") << "Failed to update taskbar shortcut, error " << std::hex << hr << LL_ENDL; - // Try deleting and if possible recreating separately. We should not leave hanging shortcuts behind. - // It is not warranted that the shortcut points to NSIS, so check the destination first. - std::wstring target_path; - if (get_shortcut_target(taskbar_path, target_path)) - { - // Strip the filename part to get just the folder path - std::filesystem::path trim_path(target_path); - if (trim_path.has_filename()) - { - target_path = trim_path.parent_path().wstring(); - } - std::wstring nsis_path_w = ll_convert(nsis_folder_path); - if (paths_are_equal(nsis_path_w, target_path)) - { - if (!DeleteFileW(taskbar_path.c_str())) - { - DWORD error = GetLastError(); - if (error != ERROR_FILE_NOT_FOUND) - { - LL_WARNS("Velopack") << "Failed to delete NSIS taskbar shortcut: " - << ll_convert_wide_to_string(taskbar_path) - << " (error: " << error << ")" << LL_ENDL; - } - } - else - { - // Deleted user created link, recreate it with new target if possible. - LL_INFOS("Velopack") << "Updating taskbar shortcut to point to current exe" << LL_ENDL; - HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); - if (FAILED(hr)) - { - LL_WARNS("Velopack") << "Failed to re-create taskbar shortcut, error: " << std::hex << hr << ", NSIS shortcut was removed" << LL_ENDL; - } - } - } - } - } - else - { - LL_INFOS("Velopack") << "Successfully updated taskbar shortcut to point to current exe" << LL_ENDL; - } - } - // else user didn't create a taskbar shortcut. + update_taskbar_shortcut(nsis_folder_path, path, app_name, L"Second Life.lnk"); // Window class name + update_taskbar_shortcut(nsis_folder_path, path, app_name, L"Second Life(1).lnk"); // Just in case user somehow did it twice and removed first + update_taskbar_shortcut(nsis_folder_path, path, app_name, L"SecondLifeViewer.lnk"); // Executable name + update_taskbar_shortcut(nsis_folder_path, path, app_name, L"secondlife-bin.lnk"); // Debug builds + update_taskbar_shortcut(nsis_folder_path, path, app_name, app_name + L".lnk"); // Default name } } @@ -858,6 +874,33 @@ static void on_first_run(void* p_user_data, const char* app_version) MultiByteToWideChar(CP_UTF8, 0, app_version, -1, &version[0], len); register_uninstall_info(install_dir, app_name, version); + + // Drop install related settings + // Unfortunately gDirUtilp is not initialized yet and it's shouldn't + // be possible to change location of the settings. For now it's simpler + // to hardcode the location. + std::optional app_data = LLStringUtil::getoptenv("APPDATA"); + if (app_data) + { + // Strip trailing delimiter if present + std::string app_data_path = *app_data; + if (!app_data_path.empty() && (app_data_path.back() == '\\' || app_data_path.back() == '/')) + { + app_data_path.pop_back(); + } + + std::string user_settings_path = app_data_path + "\\SecondLife\\user_settings\\settings.xml"; + LLControlGroup settings("global"); + if (settings.loadFromFile(user_settings_path)) + { + // If user reinstalls or updates, we want to recheck for nsis leftovers. + if (settings.controlExists("PreviousInstallChecked")) + { + settings.setBOOL("PreviousInstallChecked", false); + } + settings.saveToFile(user_settings_path, true); + } + } } static void on_after_install(void* user_data, const char* app_version) diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 97d1070094..bad1cd33a5 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -275,7 +275,7 @@ LLFontGL* LLViewerChat::getChatFont() break; default: case 1: - fontp = LLFontGL::getFontSansSerif(); + fontp = LLFontGL::getFontSansSerifMedium(); break; case 2: fontp = LLFontGL::getFontSansSerifBig(); diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 32cb34bb87..f19d6b5aa4 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -67,12 +67,12 @@ LLViewerParcelOverlay::update_signal_t* LLViewerParcelOverlay::mUpdateSignal = N // [/SL:KB] LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) -: mRegion(region), - mParcelGridsPerEdge(S32(region_width_meters / PARCEL_GRID_STEP_METERS)), +: mRegion( region ), + mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), // Aurora Sim mRegionSize(S32(region_width_meters)), // Aurora Sim - mDirty(false), + mDirty( false ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1) { @@ -479,9 +479,9 @@ void LLViewerParcelOverlay::updatePropertyLines() { for (S32 col = 0; col < GRIDS_PER_EDGE; col++) { - U8 overlay = mOwnership[row * GRIDS_PER_EDGE + col]; + U8 overlay = mOwnership[row*GRIDS_PER_EDGE+col]; S32 colorIndex = overlay & PARCEL_COLOR_MASK; - switch (colorIndex) + switch(colorIndex) { case PARCEL_SELF: case PARCEL_GROUP: @@ -495,11 +495,11 @@ void LLViewerParcelOverlay::updatePropertyLines() const LLColor4U& color = colors[colorIndex]; - F32 left = col * GRID_STEP; - F32 right = left + GRID_STEP; + F32 left = col*GRID_STEP; + F32 right = left+GRID_STEP; - F32 bottom = row * GRID_STEP; - F32 top = bottom + GRID_STEP; + F32 bottom = row*GRID_STEP; + F32 top = bottom+GRID_STEP; // West edge if (overlay & PARCEL_WEST_LINE) @@ -540,121 +540,99 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 Edge& edge = mEdges.back(); edge.color = color; - // Detailized rendering vertices: - // A B C D E F G - // *-*------*--------*--------*------*-* : 'outside' vertices are placed right on the border - // *------*--------*--------*------* : 'inside' vertices are shifted on LINE_WIDTH inside - - // Simplified rendering vertices: - // A G - // *-----------------------------------* - // *-----------------------------------* - F32 outside_x = start_x; F32 outside_y = start_y; - F32 outside_z = land.resolveHeightRegion(outside_x, outside_y); - F32 inside_x = start_x + tick_dx; - F32 inside_y = start_y + tick_dy; - F32 inside_z = land.resolveHeightRegion(inside_x, inside_y); + F32 outside_z = 0.f; + F32 inside_x = start_x + tick_dx; + F32 inside_y = start_y + tick_dy; + F32 inside_z = 0.f; - auto move = [&](F32 distance) + auto split = [&](const LLVector3& start, F32 x, F32 y, F32 z, F32 part) { - outside_x += dx * distance; - outside_y += dy * distance; - outside_z = land.resolveHeightRegion(outside_x, outside_y); - inside_x += dx * distance; - inside_y += dy * distance; - inside_z = land.resolveHeightRegion(inside_x, inside_y); + F32 new_x = start.mV[VX] + (x - start.mV[VX]) * part; + F32 new_y = start.mV[VY] + (y - start.mV[VY]) * part; + F32 new_z = start.mV[VZ] + (z - start.mV[VZ]) * part; + edge.vertices.emplace_back(new_x, new_y, new_z); }; - auto split = [&](U32 lod, const LLVector4a& start, F32 x, F32 y, F32 z, F32 part) + auto checkForSplit = [&]() { - F32 new_x = start[VX] + (x - start[VX]) * part; - F32 new_y = start[VY] + (y - start[VY]) * part; - edge.pushVertex(lod, new_x, new_y, water_z, 0); - }; - - auto checkForSplit = [&](U32 lod) - { - const std::vector& vertices = edge.verticesUnderWater[lod]; - const LLVector4a& last_outside = vertices.back(); - F32 z0 = last_outside[VZ]; + const LLVector3& last_outside = edge.vertices.back(); + F32 z0 = last_outside.mV[VZ]; F32 z1 = outside_z; if ((z0 >= water_z && z1 >= water_z) || (z0 < water_z && z1 < water_z)) return; F32 part = (water_z - z0) / (z1 - z0); - const LLVector4a& last_inside = vertices[vertices.size() - 2]; - split(lod, last_inside, inside_x, inside_y, inside_z, part); - split(lod, last_outside, outside_x, outside_y, outside_z, part); + const LLVector3& last_inside = edge.vertices[edge.vertices.size() - 2]; + split(last_inside, inside_x, inside_y, inside_z, part); + split(last_outside, outside_x, outside_y, outside_z, part); }; - auto pushTwoVertices = [&](U32 lod) - { - LLVector3 out(outside_x, outside_y, outside_z); - LLVector3 in(inside_x, inside_y, inside_z); - if (fabs(inside_z - outside_z) < LINE_WIDTH / 5) - { - edge.pushVertex(lod, inside_x, inside_y, inside_z, water_z); - } - else - { - // Make the line thinner if heights differ too much - LLVector3 dist(in - out); - F32 coef = dist.length() / LINE_WIDTH; - LLVector3 new_in(out + dist / coef); - edge.pushVertex(lod, new_in[VX], new_in[VY], new_in[VZ], water_z); - } - edge.pushVertex(lod, outside_x, outside_y, outside_z, water_z); - }; + // First part, only one vertex + outside_z = land.resolveHeightRegion( outside_x, outside_y ); - // Point A simplified (first two vertices) - pushTwoVertices(1); + edge.vertices.emplace_back(outside_x, outside_y, outside_z); - // Point A detailized (only one vertex) - edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); + inside_x += dx * LINE_WIDTH; + inside_y += dy * LINE_WIDTH; - // Point B (two vertices) - move(LINE_WIDTH); - pushTwoVertices(0); + outside_x += dx * LINE_WIDTH; + outside_y += dy * LINE_WIDTH; - // Points C, D, E - F32 distance = 1.f - LINE_WIDTH; + // Then the "actual edge" + inside_z = land.resolveHeightRegion( inside_x, inside_y ); + outside_z = land.resolveHeightRegion( outside_x, outside_y ); + + edge.vertices.emplace_back(inside_x, inside_y, inside_z); + edge.vertices.emplace_back(outside_x, outside_y, outside_z); + + inside_x += dx * (dx - LINE_WIDTH); + inside_y += dy * (dy - LINE_WIDTH); + + outside_x += dx * (dx - LINE_WIDTH); + outside_y += dy * (dy - LINE_WIDTH); + + // Middle part, full width constexpr S32 GRID_STEP = (S32)PARCEL_GRID_STEP_METERS; - for (U32 i = 1; i < GRID_STEP; ++i) + for (S32 i = 1; i < GRID_STEP; i++) { - move(distance); - checkForSplit(0); - pushTwoVertices(0); - distance = 1.f; + inside_z = land.resolveHeightRegion( inside_x, inside_y ); + outside_z = land.resolveHeightRegion( outside_x, outside_y ); + + checkForSplit(); + + edge.vertices.emplace_back(inside_x, inside_y, inside_z); + edge.vertices.emplace_back(outside_x, outside_y, outside_z); + + inside_x += dx; + inside_y += dy; + + outside_x += dx; + outside_y += dy; } - // Point F (two vertices) - move(1.f - LINE_WIDTH); - checkForSplit(0); - pushTwoVertices(0); + // Extra buffer for edge + inside_x -= dx * LINE_WIDTH; + inside_y -= dy * LINE_WIDTH; - // Point G simplified (last two vertices) - move(LINE_WIDTH); - pushTwoVertices(1); + outside_x -= dx * LINE_WIDTH; + outside_y -= dy * LINE_WIDTH; - // Point G detailized (only one vertex) - edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); -} + inside_z = land.resolveHeightRegion( inside_x, inside_y ); + outside_z = land.resolveHeightRegion( outside_x, outside_y ); -void LLViewerParcelOverlay::Edge::pushVertex(U32 lod, F32 x, F32 y, F32 z, F32 water_z) -{ - verticesUnderWater[lod].emplace_back(x, y, z); - gGL.transform(verticesUnderWater[lod].back()); + checkForSplit(); - if (z >= water_z) - { - verticesAboveWater[lod].push_back(verticesUnderWater[lod].back()); - } - else - { - verticesAboveWater[lod].emplace_back(x, y, water_z); - gGL.transform(verticesAboveWater[lod].back()); - } + edge.vertices.emplace_back(inside_x, inside_y, inside_z); + edge.vertices.emplace_back(outside_x, outside_y, outside_z); + + outside_x += dx * LINE_WIDTH; + outside_y += dy * LINE_WIDTH; + + // Last edge is not drawn to the edge + outside_z = land.resolveHeightRegion( outside_x, outside_y ); + + edge.vertices.emplace_back(outside_x, outside_y, outside_z); } void LLViewerParcelOverlay::setDirty() @@ -703,9 +681,6 @@ void LLViewerParcelOverlay::renderPropertyLines() if (!show) return; - LL_PROFILE_ZONE_SCOPED; - LL_PROFILE_GPU_ZONE("Property Lines"); - LLSurface& land = mRegion->getLand(); bool render_water = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER); @@ -743,8 +718,6 @@ void LLViewerParcelOverlay::renderPropertyLines() // Stomp the camera into two dimensions LLVector3 camera_region = mRegion->getPosRegionFromGlobal( gAgentCamera.getCameraPositionGlobal() ); - bool draw_underwater = camera_region.mV[VZ] < water_z || - !gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER); // Set up a cull plane 2 * PARCEL_GRID_STEP_METERS behind // the camera. The cull plane normal is the camera's at axis. @@ -752,23 +725,15 @@ void LLViewerParcelOverlay::renderPropertyLines() cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS; cull_plane_point += camera_region; - bool render_hidden = !draw_underwater && - LLSelectMgr::sRenderHiddenSelections && - LLFloaterReg::instanceVisible("build"); + bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build"); constexpr F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; - const F32 PROPERTY_LINE_LOD0_DIST_SQUARED = PROPERTY_LINE_CLIP_DIST_SQUARED / 25; for (const Edge& edge : mEdges) { - const std::vector& vertices0 = edge.verticesAboveWater[0]; - const F32* first = vertices0.front().getF32ptr(); - const F32* last = vertices0.back().getF32ptr(); - LLVector3 center((first[VX] + last[VX]) / 2, (first[VY] + last[VY]) / 2, (first[VZ] + last[VZ]) / 2); - gGL.untransform(center); + LLVector3 center = edge.vertices[edge.vertices.size() >> 1]; - F32 dist_squared = dist_vec_squared(center, camera_region); - if (dist_squared > PROPERTY_LINE_CLIP_DIST_SQUARED) + if (dist_vec_squared2D(center, camera_region) > PROPERTY_LINE_CLIP_DIST_SQUARED) { continue; } @@ -782,33 +747,43 @@ void LLViewerParcelOverlay::renderPropertyLines() continue; } - U32 lod = dist_squared < PROPERTY_LINE_LOD0_DIST_SQUARED ? 0 : 1; - gGL.begin(LLRender::TRIANGLE_STRIP); gGL.color4ubv(edge.color.mV); - if (draw_underwater) + for (const LLVector3& vertex : edge.vertices) { - gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); - } - else - { - gGL.vertexBatchPreTransformed(edge.verticesAboveWater[lod]); - - if (render_hidden) + if (render_hidden || camera_z < water_z || vertex.mV[2] >= water_z) { - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); - - LLColor4U color = edge.color; - color.mV[VALPHA] /= 4; - gGL.color4ubv(color.mV); - - gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); + gGL.vertex3fv(vertex.mV); + } + else + { + LLVector3 visible = vertex; + visible.mV[VZ] = water_z; + gGL.vertex3fv(visible.mV); } } gGL.end(); + + if (render_hidden) + { + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + + gGL.begin(LLRender::TRIANGLE_STRIP); + + LLColor4U color = edge.color; + color.mV[VALPHA] /= 4; + gGL.color4ubv(color.mV); + + for (const LLVector3& vertex : edge.vertices) + { + gGL.vertex3fv(vertex.mV); + } + + gGL.end(); + } } gGL.popMatrix(); diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index f6942dfacb..bee79d42de 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -127,10 +127,7 @@ private: struct Edge { - void pushVertex(U32 lod, F32 x, F32 y, F32 z, F32 water_z); - // LOD: 0 - detailized, 1 - simplified - std::vector verticesAboveWater[2]; - std::vector verticesUnderWater[2]; + std::vector vertices; LLColor4U color; }; diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 8ae8268db3..7d33da6e51 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -3194,6 +3194,13 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b LL_WARNS("Voice") << "Expected object from data channel:" << data << LL_ENDL; return; } + + bool is_primary_region = mPrimary; + if (!mPrimary && isSpatial() && gAgent.getRegion()) + { + is_primary_region = (mRegionID == gAgent.getRegion()->getRegionID()); + LL_WARNS() << "mPrimary is false, expected: " << is_primary_region << " connection state: " << getVoiceConnectionState() << LL_ENDL; + } boost::json::object voice_data = voice_data_parsed.as_object(); boost::json::object mute; boost::json::object user_gain; @@ -3283,7 +3290,7 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b if (isSpatial()) { // ignore muted flags from non-primary server - if (mPrimary || primary) + if (is_primary_region || primary) { participant->mIsModeratorMuted = is_moderator_muted; if (gAgentID == agent_id) @@ -3301,11 +3308,15 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b } else { - if (isSpatial() && (mPrimary || primary)) + if (isSpatial() && (is_primary_region || primary)) { // mute info message can be received before join message, so try to mute again later if (participant_obj.contains("m") && participant_obj["m"].is_bool()) { + LL_WARNS() << "Mute info msg received: " << participant_obj["m"].as_bool() + << " but participant " << agent_id + << " was not found in channel " << mChannelID << LL_ENDL; + bool is_moderator_muted = participant_obj["m"].as_bool(); std::string channel_id = mChannelID; F32 delay { 1.5f }; @@ -3317,11 +3328,16 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b if (participant) { participant->mIsModeratorMuted = is_moderator_muted; + LL_WARNS() << "Participant " << agent_id << " is found after delay, is_muted: " << is_moderator_muted << LL_ENDL; if (gAgentID == agent_id) { LLNearbyVoiceModeration::getInstance()->setMutedInfo(channel_id, is_moderator_muted); } } + else + { + LL_WARNS() << "Participant " << agent_id << " is still not found in channel " << channel_id << LL_ENDL; + } }, delay); } } diff --git a/indra/newview/skins/default/xui/da/floater_joystick.xml b/indra/newview/skins/default/xui/da/floater_joystick.xml index 49e1397e9f..c756bc6969 100644 --- a/indra/newview/skins/default/xui/da/floater_joystick.xml +++ b/indra/newview/skins/default/xui/da/floater_joystick.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + diff --git a/indra/newview/skins/default/xui/da/floater_whitelist_entry.xml b/indra/newview/skins/default/xui/da/floater_whitelist_entry.xml index 443e84b64a..e05be4e310 100644 --- a/indra/newview/skins/default/xui/da/floater_whitelist_entry.xml +++ b/indra/newview/skins/default/xui/da/floater_whitelist_entry.xml @@ -3,7 +3,7 @@ Indtast en URL eller et URL mønster for at tilføje til listen med godkendte domæner - +