diff options
Diffstat (limited to 'indra')
200 files changed, 2417 insertions, 5114 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index bf0a051799..62ed631e06 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -85,17 +85,17 @@ if (ENABLE_MEDIA_PLUGINS) add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins) endif (ENABLE_MEDIA_PLUGINS) -if (LINUX) - if (INSTALL_PROPRIETARY) - include(LLAppearanceUtility) - add_subdirectory(${LLAPPEARANCEUTILITY_SRC_DIR} ${LLAPPEARANCEUTILITY_BIN_DIR}) - endif (INSTALL_PROPRIETARY) -elseif (WINDOWS) - # cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake - if (EXISTS ${VIEWER_DIR}win_setup) - add_subdirectory(${VIEWER_DIR}win_setup) - endif (EXISTS ${VIEWER_DIR}win_setup) -endif (LINUX) +# if (LINUX) +# if (INSTALL_PROPRIETARY) +# include(LLAppearanceUtility) +# add_subdirectory(${LLAPPEARANCEUTILITY_SRC_DIR} ${LLAPPEARANCEUTILITY_BIN_DIR}) +# endif (INSTALL_PROPRIETARY) +# elseif (WINDOWS) +# # cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake +# if (EXISTS ${VIEWER_DIR}win_setup) +# add_subdirectory(${VIEWER_DIR}win_setup) +# endif (EXISTS ${VIEWER_DIR}win_setup) +# endif (LINUX) if (WINDOWS) # cmake EXISTS requires an absolute path, see indra/cmake/Variables.cmake diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 5cb25368d2..fc18ffebb5 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -155,30 +155,11 @@ if (LINUX) -fvisibility=hidden ) - set(GCC_CLANG_COMPATIBLE_WARNINGS - -Wno-parentheses - -Wno-deprecated - -Wno-c++20-compat - -Wno-pessimizing-move - ) - - set(CLANG_WARNINGS - ${GCC_CLANG_COMPATIBLE_WARNINGS} - # Put clang specific warning configuration here - ) - - set(GCC_WARNINGS - ${GCC_CLANG_COMPATIBLE_WARNINGS} - ) - add_link_options( -Wl,--no-keep-memory -Wl,--build-id -Wl,--no-undefined ) - if (NOT GCC_DISABLE_FATAL_WARNINGS) - add_compile_options( -Werror ) - endif (NOT GCC_DISABLE_FATAL_WARNINGS) # this stops us requiring a really recent glibc at runtime add_compile_options(-fno-stack-protector) @@ -189,9 +170,6 @@ if (LINUX) -lstdc++ -lm ) - add_compile_options(${CLANG_WARNINGS}) - else() - add_compile_options(${GCC_WARNINGS}) endif() endif (LINUX) @@ -200,7 +178,7 @@ if (DARWIN) set(CLANG_DISABLE_FATAL_WARNINGS OFF) set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - set(DARWIN_extra_cstar_flags "-Wno-unused-local-typedef -Wno-deprecated-declarations") + set(DARWIN_extra_cstar_flags "-Wno-deprecated-declarations") # Ensure that CMAKE_CXX_FLAGS has the correct -g debug information format -- # see Variables.cmake. string(REPLACE "-gdwarf-2" "-g${CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT}" @@ -209,22 +187,26 @@ if (DARWIN) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}") # NOTE: it's critical that the optimization flag is put in front. # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered. -## Really?? On developer machines too? -##set(ENABLE_SIGNING TRUE) -##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.") + ## Really?? On developer machines too? + ##set(ENABLE_SIGNING TRUE) + ##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.") # required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function # see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) +endif(DARWIN) - set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs) - - list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor ) +if(LINUX OR DARWIN) + add_compile_options(-Wall -Wno-sign-compare -Wno-trigraphs -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-local-typedef) - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13) - list(APPEND GCC_WARNINGS -Wno-unused-but-set-variable -Wno-unused-variable ) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-Wno-stringop-truncation -Wno-parentheses -Wno-c++20-compat) endif() + if (NOT GCC_DISABLE_FATAL_WARNINGS) + add_compile_options(-Werror) + endif () + add_compile_options(${GCC_WARNINGS}) add_compile_options(-m${ADDRESS_SIZE}) -endif () +endif (LINUX OR DARWIN) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index ced012426f..1e6dabd6c0 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -106,7 +106,8 @@ if(WINDOWS) else(ADDRESS_SIZE EQUAL 32) set(redist_find_path "$ENV{VCTOOLSREDISTDIR}x64\\Microsoft.VC${MSVC_TOOLSET_VER}.CRT") endif(ADDRESS_SIZE EQUAL 32) - get_filename_component(redist_path "${redist_find_path}" ABSOLUTE) + get_filename_component(redist_path_component "${redist_find_path}" ABSOLUTE) + set(redist_path ${redist_path_component} CACHE INTERNAL "MSVC Redist Path" FORCE) MESSAGE(STATUS "VC Runtime redist path: ${redist_path}") endif (MSVC_TOOLSET_VER AND DEFINED ENV{VCTOOLSREDISTDIR}) @@ -132,12 +133,11 @@ if(WINDOWS) msvcp${MSVC_VER}_2.dll msvcp${MSVC_VER}_atomic_wait.dll msvcp${MSVC_VER}_codecvt_ids.dll - msvcr${MSVC_VER}.dll vcruntime${MSVC_VER}.dll vcruntime${MSVC_VER}_1.dll vcruntime${MSVC_VER}_threads.dll ) - if(redist_path AND EXISTS "${redist_path}/${release_msvc_file}") + if(DEFINED redist_path AND EXISTS "${redist_path}/${release_msvc_file}") MESSAGE(STATUS "Copying redist file from ${redist_path}/${release_msvc_file}") to_staging_dirs( ${redist_path} diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake index c544440adc..64e33f6c83 100644 --- a/indra/cmake/Havok.cmake +++ b/indra/cmake/Havok.cmake @@ -27,26 +27,26 @@ else (LL_DEBUG_HAVOK) endif (LL_DEBUG_HAVOK) set(HAVOK_LIBS - hkBase - hkCompat + hkgpConvexDecomposition hkGeometryUtilities - hkInternal hkSerialize hkSceneData hkpCollide hkpUtilities hkpConstraintSolver hkpDynamics - hkpInternal - hkaiInternal hkaiPathfinding hkaiAiPhysicsBridge - hkcdInternal hkcdCollide hkpVehicle hkVisualize hkaiVisualize - hkgpConvexDecomposition + hkaiInternal + hkcdInternal + hkpInternal + hkInternal + hkCompat + hkBase ) unset(HK_DEBUG_LIBRARIES) @@ -60,16 +60,22 @@ if (DEBUG_PREBUILT) # but making it pretty is a lot more work message(STATUS "${ARGN}") endfunction(DEBUG_MESSAGE) + function(DEBUG_EXEC_FUNC) + execute_process(COMMAND ${ARGN}) + endfunction(DEBUG_EXEC_FUNC) else (DEBUG_PREBUILT) # without DEBUG_PREBUILT, DEBUG_MESSAGE() is a no-op function(DEBUG_MESSAGE) endfunction(DEBUG_MESSAGE) + function(DEBUG_EXEC_FUNC) + execute_process(COMMAND ${ARGN} OUTPUT_QUIET) + endfunction(DEBUG_EXEC_FUNC) endif (DEBUG_PREBUILT) # DEBUG_EXEC() reports each execute_process() before invoking function(DEBUG_EXEC) DEBUG_MESSAGE(${ARGN}) - execute_process(COMMAND ${ARGN}) + DEBUG_EXEC_FUNC(${ARGN}) endfunction(DEBUG_EXEC) # *TODO: Figure out why we need to extract like this... @@ -79,9 +85,7 @@ foreach(HAVOK_LIB ${HAVOK_LIBS}) find_library(HAVOK_RELWITHDEBINFO_LIB_${HAVOK_LIB} ${HAVOK_LIB} PATHS ${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}) if(LINUX) - set(debug_dir "${HAVOK_DEBUG_LIBRARY_PATH}/${HAVOK_LIB}") set(release_dir "${HAVOK_RELEASE_LIBRARY_PATH}/${HAVOK_LIB}") - set(relwithdebinfo_dir "${HAVOK_RELWITHDEBINFO_LIBRARY_PATH}/${HAVOK_LIB}") # Try to avoid extracting havok library each time we run cmake. if("${havok_${HAVOK_LIB}_extracted}" STREQUAL "" AND EXISTS "${PREBUILD_TRACKING_DIR}/havok_${HAVOK_LIB}_extracted") @@ -92,8 +96,8 @@ foreach(HAVOK_LIB ${HAVOK_LIBS}) if(${PREBUILD_TRACKING_DIR}/havok_source_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/havok_${HAVOK_LIB}_extracted OR NOT ${havok_${HAVOK_LIB}_extracted} EQUAL 0) DEBUG_MESSAGE("Extracting ${HAVOK_LIB}...") - foreach(lib ${debug_dir} ${release_dir} ${relwithdebinfo_dir}) - DEBUG_EXEC("mkdir" ${lib}) + foreach(lib ${release_dir}) + DEBUG_EXEC("mkdir" "-p" ${lib}) DEBUG_EXEC("ar" "-xv" "../lib${HAVOK_LIB}.a" WORKING_DIRECTORY ${lib}) endforeach(lib) @@ -104,17 +108,12 @@ foreach(HAVOK_LIB ${HAVOK_LIBS}) endif() - file(GLOB extracted_debug "${debug_dir}/*.o") file(GLOB extracted_release "${release_dir}/*.o") - file(GLOB extracted_relwithdebinfo "${relwithdebinfo_dir}/*.o") - - DEBUG_MESSAGE("extracted_debug ${debug_dir}/*.o") DEBUG_MESSAGE("extracted_release ${release_dir}/*.o") - DEBUG_MESSAGE("extracted_relwithdebinfo ${relwithdebinfo_dir}/*.o") - list(APPEND HK_DEBUG_LIBRARIES ${extracted_debug}) + list(APPEND HK_DEBUG_LIBRARIES ${extracted_release}) list(APPEND HK_RELEASE_LIBRARIES ${extracted_release}) - list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${extracted_relwithdebinfo}) + list(APPEND HK_RELWITHDEBINFO_LIBRARIES ${extracted_release}) else(LINUX) # Win32 list(APPEND HK_DEBUG_LIBRARIES ${HAVOK_DEBUG_LIB_${HAVOK_LIB}}) diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 347dd02cd7..355907bcf5 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -4,11 +4,7 @@ include(Prebuilt) include_guard() -# ND: Turn this off by default, the openal code in the viewer isn't very well maintained, seems -# to have memory leaks, has no option to play music streams -# It probably makes sense to to completely remove it - -set(USE_OPENAL OFF CACHE BOOL "Enable OpenAL") +set(USE_OPENAL ON CACHE BOOL "Enable OpenAL") # ND: To streamline arguments passed, switch from OPENAL to USE_OPENAL # To not break all old build scripts convert old arguments but warn about it if(OPENAL) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index a8c702bfef..c040090ea3 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -43,6 +43,8 @@ macro (use_prebuilt_binary _binary) message(STATUS "Installing ${_binary}...") execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}" install + -A${ADDRESS_SIZE} + --skip-source-environment --install-dir=${AUTOBUILD_INSTALL_DIR} ${_binary} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" diff --git a/indra/cmake/bugsplat.cmake b/indra/cmake/bugsplat.cmake index 509981d72c..0798d4f51f 100644 --- a/indra/cmake/bugsplat.cmake +++ b/indra/cmake/bugsplat.cmake @@ -1,13 +1,13 @@ -if (INSTALL_PROPRIETARY) +if (INSTALL_PROPRIETARY AND NOT LINUX) # Note that viewer_manifest.py makes decision based on BUGSPLAT_DB and not USE_BUGSPLAT if (BUGSPLAT_DB) set(USE_BUGSPLAT ON CACHE BOOL "Use the BugSplat crash reporting system") else (BUGSPLAT_DB) set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system") endif (BUGSPLAT_DB) -else (INSTALL_PROPRIETARY) +else (INSTALL_PROPRIETARY AND NOT LINUX) set(USE_BUGSPLAT OFF CACHE BOOL "Use the BugSplat crash reporting system") -endif (INSTALL_PROPRIETARY) +endif (INSTALL_PROPRIETARY AND NOT LINUX) include_guard() add_library( ll::bugsplat INTERFACE IMPORTED ) @@ -36,6 +36,6 @@ if (USE_BUGSPLAT) set_property( TARGET ll::bugsplat APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS LL_BUGSPLAT) else() - set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name") + set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name" FORCE) endif (USE_BUGSPLAT) diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 18d682b554..755547bfaa 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -79,7 +79,7 @@ bool LLAudioEngine_OpenAL::init(void* userdata, const std::string &app_title) ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); - alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); + alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor); LL_INFOS() << "ALC version: " << major << "." << minor << LL_ENDL; LL_INFOS() << "ALC default device: " @@ -190,6 +190,8 @@ LLAudioChannelOpenAL::~LLAudioChannelOpenAL() void LLAudioChannelOpenAL::cleanup() { alSourceStop(mALSource); + alSourcei(mALSource, AL_BUFFER, AL_NONE); + mCurrentBufferp = NULL; } diff --git a/indra/llcommon/classic_callback.h b/indra/llcommon/classic_callback.h index 009c25d67c..8a6ac7f7ff 100644 --- a/indra/llcommon/classic_callback.h +++ b/indra/llcommon/classic_callback.h @@ -184,8 +184,8 @@ protected: template <typename SIGNATURE, typename USERDATA=void*, typename CALLABLE=void(*)()> auto makeClassicCallback(CALLABLE&& callable) { - return std::move(ClassicCallback<SIGNATURE, USERDATA, CALLABLE> - (std::forward<CALLABLE>(callable))); + return ClassicCallback<SIGNATURE, USERDATA, CALLABLE> + (std::forward<CALLABLE>(callable)); } /***************************************************************************** diff --git a/indra/llcommon/coro_scheduler.cpp b/indra/llcommon/coro_scheduler.cpp index 02b9f11333..2d8b6e1a97 100644 --- a/indra/llcommon/coro_scheduler.cpp +++ b/indra/llcommon/coro_scheduler.cpp @@ -87,7 +87,7 @@ boost::fibers::context* scheduler::pick_next() noexcept /*------------------------- logging stuff --------------------------*/ // Unless this log tag is enabled, don't even bother posting. - LL_DEBUGS("LLCoros.scheduler"); + LL_DEBUGS("LLCoros.scheduler") << " "; // This feature is inherently hard to verify. The logging in the // lambda below seems useful, but also seems like a lot of overhead // for a coroutine context switch. Try posting the logging lambda to a diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index d2de88ff0a..566ea2ea14 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -31,15 +31,15 @@ class LLUUID; -static const F32 REGION_WIDTH_METERS = 256.f; -static const S32 REGION_WIDTH_UNITS = 256; -static const U32 REGION_WIDTH_U32 = 256; +static constexpr F32 REGION_WIDTH_METERS = 256.f; +static constexpr S32 REGION_WIDTH_UNITS = 256; +static constexpr U32 REGION_WIDTH_U32 = 256; -const F32 REGION_HEIGHT_METERS = 4096.f; +constexpr F32 REGION_HEIGHT_METERS = 4096.f; -const F32 DEFAULT_AGENT_DEPTH = 0.45f; -const F32 DEFAULT_AGENT_WIDTH = 0.60f; -const F32 DEFAULT_AGENT_HEIGHT = 1.9f; +constexpr F32 DEFAULT_AGENT_DEPTH = 0.45f; +constexpr F32 DEFAULT_AGENT_WIDTH = 0.60f; +constexpr F32 DEFAULT_AGENT_HEIGHT = 1.9f; enum ETerrainBrushType { @@ -67,112 +67,112 @@ enum EMouseClickType{ // keys // Bit masks for various keyboard modifier keys. -const MASK MASK_NONE = 0x0000; -const MASK MASK_CONTROL = 0x0001; // Mapped to cmd on Macs -const MASK MASK_ALT = 0x0002; -const MASK MASK_SHIFT = 0x0004; -const MASK MASK_NORMALKEYS = 0x0007; // A real mask - only get the bits for normal modifier keys -const MASK MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows -const MASK MASK_MODIFIERS = MASK_CONTROL|MASK_ALT|MASK_SHIFT|MASK_MAC_CONTROL; +constexpr MASK MASK_NONE = 0x0000; +constexpr MASK MASK_CONTROL = 0x0001; // Mapped to cmd on Macs +constexpr MASK MASK_ALT = 0x0002; +constexpr MASK MASK_SHIFT = 0x0004; +constexpr MASK MASK_NORMALKEYS = 0x0007; // A real mask - only get the bits for normal modifier keys +constexpr MASK MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows +constexpr MASK MASK_MODIFIERS = MASK_CONTROL|MASK_ALT|MASK_SHIFT|MASK_MAC_CONTROL; // Special keys go into >128 -const KEY KEY_SPECIAL = 0x80; // special keys start here -const KEY KEY_RETURN = 0x81; -const KEY KEY_LEFT = 0x82; -const KEY KEY_RIGHT = 0x83; -const KEY KEY_UP = 0x84; -const KEY KEY_DOWN = 0x85; -const KEY KEY_ESCAPE = 0x86; -const KEY KEY_BACKSPACE =0x87; -const KEY KEY_DELETE = 0x88; -const KEY KEY_SHIFT = 0x89; -const KEY KEY_CONTROL = 0x8A; -const KEY KEY_ALT = 0x8B; -const KEY KEY_HOME = 0x8C; -const KEY KEY_END = 0x8D; -const KEY KEY_PAGE_UP = 0x8E; -const KEY KEY_PAGE_DOWN = 0x8F; -const KEY KEY_HYPHEN = 0x90; -const KEY KEY_EQUALS = 0x91; -const KEY KEY_INSERT = 0x92; -const KEY KEY_CAPSLOCK = 0x93; -const KEY KEY_TAB = 0x94; -const KEY KEY_ADD = 0x95; -const KEY KEY_SUBTRACT =0x96; -const KEY KEY_MULTIPLY =0x97; -const KEY KEY_DIVIDE = 0x98; -const KEY KEY_F1 = 0xA1; -const KEY KEY_F2 = 0xA2; -const KEY KEY_F3 = 0xA3; -const KEY KEY_F4 = 0xA4; -const KEY KEY_F5 = 0xA5; -const KEY KEY_F6 = 0xA6; -const KEY KEY_F7 = 0xA7; -const KEY KEY_F8 = 0xA8; -const KEY KEY_F9 = 0xA9; -const KEY KEY_F10 = 0xAA; -const KEY KEY_F11 = 0xAB; -const KEY KEY_F12 = 0xAC; - -const KEY KEY_PAD_UP = 0xC0; -const KEY KEY_PAD_DOWN = 0xC1; -const KEY KEY_PAD_LEFT = 0xC2; -const KEY KEY_PAD_RIGHT = 0xC3; -const KEY KEY_PAD_HOME = 0xC4; -const KEY KEY_PAD_END = 0xC5; -const KEY KEY_PAD_PGUP = 0xC6; -const KEY KEY_PAD_PGDN = 0xC7; -const KEY KEY_PAD_CENTER = 0xC8; // the 5 in the middle -const KEY KEY_PAD_INS = 0xC9; -const KEY KEY_PAD_DEL = 0xCA; -const KEY KEY_PAD_RETURN = 0xCB; -const KEY KEY_PAD_ADD = 0xCC; // not used -const KEY KEY_PAD_SUBTRACT = 0xCD; // not used -const KEY KEY_PAD_MULTIPLY = 0xCE; // not used -const KEY KEY_PAD_DIVIDE = 0xCF; // not used - -const KEY KEY_BUTTON0 = 0xD0; -const KEY KEY_BUTTON1 = 0xD1; -const KEY KEY_BUTTON2 = 0xD2; -const KEY KEY_BUTTON3 = 0xD3; -const KEY KEY_BUTTON4 = 0xD4; -const KEY KEY_BUTTON5 = 0xD5; -const KEY KEY_BUTTON6 = 0xD6; -const KEY KEY_BUTTON7 = 0xD7; -const KEY KEY_BUTTON8 = 0xD8; -const KEY KEY_BUTTON9 = 0xD9; -const KEY KEY_BUTTON10 = 0xDA; -const KEY KEY_BUTTON11 = 0xDB; -const KEY KEY_BUTTON12 = 0xDC; -const KEY KEY_BUTTON13 = 0xDD; -const KEY KEY_BUTTON14 = 0xDE; -const KEY KEY_BUTTON15 = 0xDF; - -const KEY KEY_NONE = 0xFF; // not sent from keyboard. For internal use only. - -const S32 KEY_COUNT = 256; - - -const F32 DEFAULT_WATER_HEIGHT = 20.0f; +constexpr KEY KEY_SPECIAL = 0x80; // special keys start here +constexpr KEY KEY_RETURN = 0x81; +constexpr KEY KEY_LEFT = 0x82; +constexpr KEY KEY_RIGHT = 0x83; +constexpr KEY KEY_UP = 0x84; +constexpr KEY KEY_DOWN = 0x85; +constexpr KEY KEY_ESCAPE = 0x86; +constexpr KEY KEY_BACKSPACE =0x87; +constexpr KEY KEY_DELETE = 0x88; +constexpr KEY KEY_SHIFT = 0x89; +constexpr KEY KEY_CONTROL = 0x8A; +constexpr KEY KEY_ALT = 0x8B; +constexpr KEY KEY_HOME = 0x8C; +constexpr KEY KEY_END = 0x8D; +constexpr KEY KEY_PAGE_UP = 0x8E; +constexpr KEY KEY_PAGE_DOWN = 0x8F; +constexpr KEY KEY_HYPHEN = 0x90; +constexpr KEY KEY_EQUALS = 0x91; +constexpr KEY KEY_INSERT = 0x92; +constexpr KEY KEY_CAPSLOCK = 0x93; +constexpr KEY KEY_TAB = 0x94; +constexpr KEY KEY_ADD = 0x95; +constexpr KEY KEY_SUBTRACT =0x96; +constexpr KEY KEY_MULTIPLY =0x97; +constexpr KEY KEY_DIVIDE = 0x98; +constexpr KEY KEY_F1 = 0xA1; +constexpr KEY KEY_F2 = 0xA2; +constexpr KEY KEY_F3 = 0xA3; +constexpr KEY KEY_F4 = 0xA4; +constexpr KEY KEY_F5 = 0xA5; +constexpr KEY KEY_F6 = 0xA6; +constexpr KEY KEY_F7 = 0xA7; +constexpr KEY KEY_F8 = 0xA8; +constexpr KEY KEY_F9 = 0xA9; +constexpr KEY KEY_F10 = 0xAA; +constexpr KEY KEY_F11 = 0xAB; +constexpr KEY KEY_F12 = 0xAC; + +constexpr KEY KEY_PAD_UP = 0xC0; +constexpr KEY KEY_PAD_DOWN = 0xC1; +constexpr KEY KEY_PAD_LEFT = 0xC2; +constexpr KEY KEY_PAD_RIGHT = 0xC3; +constexpr KEY KEY_PAD_HOME = 0xC4; +constexpr KEY KEY_PAD_END = 0xC5; +constexpr KEY KEY_PAD_PGUP = 0xC6; +constexpr KEY KEY_PAD_PGDN = 0xC7; +constexpr KEY KEY_PAD_CENTER = 0xC8; // the 5 in the middle +constexpr KEY KEY_PAD_INS = 0xC9; +constexpr KEY KEY_PAD_DEL = 0xCA; +constexpr KEY KEY_PAD_RETURN = 0xCB; +constexpr KEY KEY_PAD_ADD = 0xCC; // not used +constexpr KEY KEY_PAD_SUBTRACT = 0xCD; // not used +constexpr KEY KEY_PAD_MULTIPLY = 0xCE; // not used +constexpr KEY KEY_PAD_DIVIDE = 0xCF; // not used + +constexpr KEY KEY_BUTTON0 = 0xD0; +constexpr KEY KEY_BUTTON1 = 0xD1; +constexpr KEY KEY_BUTTON2 = 0xD2; +constexpr KEY KEY_BUTTON3 = 0xD3; +constexpr KEY KEY_BUTTON4 = 0xD4; +constexpr KEY KEY_BUTTON5 = 0xD5; +constexpr KEY KEY_BUTTON6 = 0xD6; +constexpr KEY KEY_BUTTON7 = 0xD7; +constexpr KEY KEY_BUTTON8 = 0xD8; +constexpr KEY KEY_BUTTON9 = 0xD9; +constexpr KEY KEY_BUTTON10 = 0xDA; +constexpr KEY KEY_BUTTON11 = 0xDB; +constexpr KEY KEY_BUTTON12 = 0xDC; +constexpr KEY KEY_BUTTON13 = 0xDD; +constexpr KEY KEY_BUTTON14 = 0xDE; +constexpr KEY KEY_BUTTON15 = 0xDF; + +constexpr KEY KEY_NONE = 0xFF; // not sent from keyboard. For internal use only. + +constexpr S32 KEY_COUNT = 256; + + +constexpr F32 DEFAULT_WATER_HEIGHT = 20.0f; // Maturity ratings for simulators -const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG -const U8 SIM_ACCESS_PG = 13; -const U8 SIM_ACCESS_MATURE = 21; -const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only -const U8 SIM_ACCESS_DOWN = 254; -const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; +constexpr U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG +constexpr U8 SIM_ACCESS_PG = 13; +constexpr U8 SIM_ACCESS_MATURE = 21; +constexpr U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only +constexpr U8 SIM_ACCESS_DOWN = 254; +constexpr U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; // attachment constants -const U8 ATTACHMENT_ADD = 0x80; +constexpr U8 ATTACHMENT_ADD = 0x80; // god levels -const U8 GOD_MAINTENANCE = 250; -const U8 GOD_FULL = 200; -const U8 GOD_LIAISON = 150; -const U8 GOD_CUSTOMER_SERVICE = 100; -const U8 GOD_LIKE = 1; -const U8 GOD_NOT = 0; +constexpr U8 GOD_MAINTENANCE = 250; +constexpr U8 GOD_FULL = 200; +constexpr U8 GOD_LIAISON = 150; +constexpr U8 GOD_CUSTOMER_SERVICE = 100; +constexpr U8 GOD_LIKE = 1; +constexpr U8 GOD_NOT = 0; // "agent id" for things that should be done to ALL agents LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS; @@ -239,120 +239,120 @@ LL_COMMON_API extern const LLUUID BLANK_OBJECT_NORMAL; LL_COMMON_API extern const LLUUID BLANK_MATERIAL_ASSET_ID; // radius within which a chat message is fully audible -const F32 CHAT_NORMAL_RADIUS = 20.f; +constexpr F32 CHAT_NORMAL_RADIUS = 20.f; // media commands -const U32 PARCEL_MEDIA_COMMAND_STOP = 0; -const U32 PARCEL_MEDIA_COMMAND_PAUSE = 1; -const U32 PARCEL_MEDIA_COMMAND_PLAY = 2; -const U32 PARCEL_MEDIA_COMMAND_LOOP = 3; -const U32 PARCEL_MEDIA_COMMAND_TEXTURE = 4; -const U32 PARCEL_MEDIA_COMMAND_URL = 5; -const U32 PARCEL_MEDIA_COMMAND_TIME = 6; -const U32 PARCEL_MEDIA_COMMAND_AGENT = 7; -const U32 PARCEL_MEDIA_COMMAND_UNLOAD = 8; -const U32 PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9; -const U32 PARCEL_MEDIA_COMMAND_TYPE = 10; -const U32 PARCEL_MEDIA_COMMAND_SIZE = 11; -const U32 PARCEL_MEDIA_COMMAND_DESC = 12; -const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13; +constexpr U32 PARCEL_MEDIA_COMMAND_STOP = 0; +constexpr U32 PARCEL_MEDIA_COMMAND_PAUSE = 1; +constexpr U32 PARCEL_MEDIA_COMMAND_PLAY = 2; +constexpr U32 PARCEL_MEDIA_COMMAND_LOOP = 3; +constexpr U32 PARCEL_MEDIA_COMMAND_TEXTURE = 4; +constexpr U32 PARCEL_MEDIA_COMMAND_URL = 5; +constexpr U32 PARCEL_MEDIA_COMMAND_TIME = 6; +constexpr U32 PARCEL_MEDIA_COMMAND_AGENT = 7; +constexpr U32 PARCEL_MEDIA_COMMAND_UNLOAD = 8; +constexpr U32 PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9; +constexpr U32 PARCEL_MEDIA_COMMAND_TYPE = 10; +constexpr U32 PARCEL_MEDIA_COMMAND_SIZE = 11; +constexpr U32 PARCEL_MEDIA_COMMAND_DESC = 12; +constexpr U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13; const S32 CHAT_CHANNEL_DEBUG = S32_MAX; // agent constants -const U32 CONTROL_AT_POS_INDEX = 0; -const U32 CONTROL_AT_NEG_INDEX = 1; -const U32 CONTROL_LEFT_POS_INDEX = 2; -const U32 CONTROL_LEFT_NEG_INDEX = 3; -const U32 CONTROL_UP_POS_INDEX = 4; -const U32 CONTROL_UP_NEG_INDEX = 5; -const U32 CONTROL_PITCH_POS_INDEX = 6; -const U32 CONTROL_PITCH_NEG_INDEX = 7; -const U32 CONTROL_YAW_POS_INDEX = 8; -const U32 CONTROL_YAW_NEG_INDEX = 9; -const U32 CONTROL_FAST_AT_INDEX = 10; -const U32 CONTROL_FAST_LEFT_INDEX = 11; -const U32 CONTROL_FAST_UP_INDEX = 12; -const U32 CONTROL_FLY_INDEX = 13; -const U32 CONTROL_STOP_INDEX = 14; -const U32 CONTROL_FINISH_ANIM_INDEX = 15; -const U32 CONTROL_STAND_UP_INDEX = 16; -const U32 CONTROL_SIT_ON_GROUND_INDEX = 17; -const U32 CONTROL_MOUSELOOK_INDEX = 18; -const U32 CONTROL_NUDGE_AT_POS_INDEX = 19; -const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; -const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; -const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; -const U32 CONTROL_NUDGE_UP_POS_INDEX = 23; -const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; -const U32 CONTROL_TURN_LEFT_INDEX = 25; -const U32 CONTROL_TURN_RIGHT_INDEX = 26; -const U32 CONTROL_AWAY_INDEX = 27; -const U32 CONTROL_LBUTTON_DOWN_INDEX = 28; -const U32 CONTROL_LBUTTON_UP_INDEX = 29; -const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; -const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; -const U32 TOTAL_CONTROLS = 32; - -const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 -const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 -const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 -const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 -const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 -const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 -const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 -const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 -const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 -const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 - -const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 -const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 -const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 - -const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 -const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 -const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 -const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 -const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 -const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 - -const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 -const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 -const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 -const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 -const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 -const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 -const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 -const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 - -const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 - -const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 -const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 -const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 -const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 +constexpr U32 CONTROL_AT_POS_INDEX = 0; +constexpr U32 CONTROL_AT_NEG_INDEX = 1; +constexpr U32 CONTROL_LEFT_POS_INDEX = 2; +constexpr U32 CONTROL_LEFT_NEG_INDEX = 3; +constexpr U32 CONTROL_UP_POS_INDEX = 4; +constexpr U32 CONTROL_UP_NEG_INDEX = 5; +constexpr U32 CONTROL_PITCH_POS_INDEX = 6; +constexpr U32 CONTROL_PITCH_NEG_INDEX = 7; +constexpr U32 CONTROL_YAW_POS_INDEX = 8; +constexpr U32 CONTROL_YAW_NEG_INDEX = 9; +constexpr U32 CONTROL_FAST_AT_INDEX = 10; +constexpr U32 CONTROL_FAST_LEFT_INDEX = 11; +constexpr U32 CONTROL_FAST_UP_INDEX = 12; +constexpr U32 CONTROL_FLY_INDEX = 13; +constexpr U32 CONTROL_STOP_INDEX = 14; +constexpr U32 CONTROL_FINISH_ANIM_INDEX = 15; +constexpr U32 CONTROL_STAND_UP_INDEX = 16; +constexpr U32 CONTROL_SIT_ON_GROUND_INDEX = 17; +constexpr U32 CONTROL_MOUSELOOK_INDEX = 18; +constexpr U32 CONTROL_NUDGE_AT_POS_INDEX = 19; +constexpr U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; +constexpr U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; +constexpr U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; +constexpr U32 CONTROL_NUDGE_UP_POS_INDEX = 23; +constexpr U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; +constexpr U32 CONTROL_TURN_LEFT_INDEX = 25; +constexpr U32 CONTROL_TURN_RIGHT_INDEX = 26; +constexpr U32 CONTROL_AWAY_INDEX = 27; +constexpr U32 CONTROL_LBUTTON_DOWN_INDEX = 28; +constexpr U32 CONTROL_LBUTTON_UP_INDEX = 29; +constexpr U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; +constexpr U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; +constexpr U32 TOTAL_CONTROLS = 32; + +constexpr U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 +constexpr U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 +constexpr U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 +constexpr U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 +constexpr U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 +constexpr U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 +constexpr U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 +constexpr U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 +constexpr U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 +constexpr U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 + +constexpr U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 +constexpr U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 +constexpr U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 + +constexpr U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 +constexpr U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 +constexpr U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 +constexpr U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 +constexpr U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 +constexpr U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 + +constexpr U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 +constexpr U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 +constexpr U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 +constexpr U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 +constexpr U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 +constexpr U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 +constexpr U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 +constexpr U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 + +constexpr U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 + +constexpr U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 +constexpr U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 +constexpr U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 +constexpr U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 // move these up so that we can hide them in "State" for object updates // (for now) -const U32 AGENT_ATTACH_OFFSET = 4; -const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; +constexpr U32 AGENT_ATTACH_OFFSET = 4; +constexpr U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; // RN: this method swaps the upper and lower nibbles to maintain backward // compatibility with old objects that only used the upper nibble #define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4))) // DO NOT CHANGE THE SEQUENCE OF THIS LIST!! -const U8 CLICK_ACTION_NONE = 0; -const U8 CLICK_ACTION_TOUCH = 0; -const U8 CLICK_ACTION_SIT = 1; -const U8 CLICK_ACTION_BUY = 2; -const U8 CLICK_ACTION_PAY = 3; -const U8 CLICK_ACTION_OPEN = 4; -const U8 CLICK_ACTION_PLAY = 5; -const U8 CLICK_ACTION_OPEN_MEDIA = 6; -const U8 CLICK_ACTION_ZOOM = 7; -const U8 CLICK_ACTION_DISABLED = 8; -const U8 CLICK_ACTION_IGNORE = 9; +constexpr U8 CLICK_ACTION_NONE = 0; +constexpr U8 CLICK_ACTION_TOUCH = 0; +constexpr U8 CLICK_ACTION_SIT = 1; +constexpr U8 CLICK_ACTION_BUY = 2; +constexpr U8 CLICK_ACTION_PAY = 3; +constexpr U8 CLICK_ACTION_OPEN = 4; +constexpr U8 CLICK_ACTION_PLAY = 5; +constexpr U8 CLICK_ACTION_OPEN_MEDIA = 6; +constexpr U8 CLICK_ACTION_ZOOM = 7; +constexpr U8 CLICK_ACTION_DISABLED = 8; +constexpr U8 CLICK_ACTION_IGNORE = 9; // DO NOT CHANGE THE SEQUENCE OF THIS LIST!! diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 3d18864b80..950f88e791 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -216,13 +216,6 @@ public: // soon as the application status changes away from APP_STATUS_RUNNING // (isRunning()). // - // sleep() returns true if it sleeps undisturbed for the entire specified - // duration. The idea is that you can code 'while sleep(duration) ...', - // which will break the loop once shutdown begins. - // - // Since any time-based LLUnit should be implicitly convertible to - // F32Milliseconds, accept that specific type as a proxy. - static bool sleep(F32Milliseconds duration); // Allow any duration defined in terms of <chrono>. // One can imagine a wonderfully general bidirectional conversion system // between any type derived from LLUnits::LLUnit<T, LLUnits::Seconds> and @@ -262,7 +255,7 @@ public: void setDebugFileNames(const std::string &path); // Return the Google Breakpad minidump filename after a crash. - char *getMiniDumpFilename() { return mMinidumpPath; } + char* getMiniDumpFilename() { return mMinidumpPath; } std::string* getStaticDebugFile() { return &mStaticDebugFileName; } std::string* getDynamicDebugFile() { return &mDynamicDebugFileName; } diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index d4b063f88c..96b48c1532 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -176,7 +176,7 @@ constexpr U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + // the negative value to a huge positive value, producing the wrong answer! // llless() specifically addresses that case. template <typename T0, typename T1> -inline bool llless(T0 d0, T1 d1) +constexpr bool llless(T0 d0, T1 d1) { if constexpr (std::is_signed_v<T0> && ! std::is_signed_v<T1>) { @@ -204,13 +204,13 @@ inline bool llless(T0 d0, T1 d1) // recursion tail template <typename T> -inline auto llmax(T data) +constexpr auto llmax(T data) { return data; } template <typename T0, typename T1, typename... Ts> -inline auto llmax(T0 d0, T1 d1, Ts... rest) +constexpr auto llmax(T0 d0, T1 d1, Ts... rest) { auto maxrest = llmax(d1, rest...); return llless(maxrest, d0)? d0 : maxrest; @@ -218,20 +218,20 @@ inline auto llmax(T0 d0, T1 d1, Ts... rest) // recursion tail template <typename T> -inline auto llmin(T data) +constexpr auto llmin(T data) { return data; } template <typename T0, typename T1, typename... Ts> -inline auto llmin(T0 d0, T1 d1, Ts... rest) +constexpr auto llmin(T0 d0, T1 d1, Ts... rest) { auto minrest = llmin(d1, rest...); return llless(d0, minrest) ? d0 : minrest; } template <typename A, typename MIN, typename MAX> -inline A llclamp(A a, MIN minval, MAX maxval) +constexpr A llclamp(A a, MIN minval, MAX maxval) { // The only troublesome case is if A is unsigned and either minval or // maxval is both signed and negative. Casting a negative number to @@ -262,13 +262,13 @@ inline A llclamp(A a, MIN minval, MAX maxval) } template <class LLDATATYPE> -inline LLDATATYPE llclampf(LLDATATYPE a) +constexpr LLDATATYPE llclampf(LLDATATYPE a) { return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(1)); } template <class LLDATATYPE> -inline LLDATATYPE llclampb(LLDATATYPE a) +constexpr LLDATATYPE llclampb(LLDATATYPE a) { return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(255)); } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b552aede82..d65fb16f5b 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -550,7 +550,13 @@ private: public: ll_convert(const FROM& ref): mRef(ref) {} - template <typename TO> + inline operator const FROM&() const + { + return mRef; + } + + template <typename TO, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> inline operator TO() const { return ll_convert_impl<TO, std::decay_t<const FROM>>()(mRef); @@ -559,7 +565,15 @@ public: // When the TO type must be explicit, use a function template to get // ll_convert_to<TO>(from_value) API. -template<typename TO, typename FROM> +template<typename SAME> +const SAME& ll_convert_to(const SAME& in) +{ + return in; +} + +template<typename TO, + typename FROM, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> TO ll_convert_to(const FROM& in) { return ll_convert_impl<TO, std::decay_t<const FROM>>()(in); diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp index de06dab264..21a663a003 100644 --- a/indra/llcommon/lua_function.cpp +++ b/indra/llcommon/lua_function.cpp @@ -1150,7 +1150,7 @@ lua_function(check_stop, "check_stop(): ensure that a Lua script responds to vie * help() *****************************************************************************/ lua_function(help, - "LL.help(): list viewer's Lua functions\n" + "help(): list viewer's Lua functions\n" "LL.help(function): show help string for specific function") { auto& luapump{ LLEventPumps::instance().obtain("lua output") }; @@ -1210,7 +1210,7 @@ lua_function(help, *****************************************************************************/ lua_function( leaphelp, - "LL.leaphelp(): list viewer's LEAP APIs\n" + "leaphelp(): list viewer's LEAP APIs\n" "LL.leaphelp(api): show help for specific api string name") { LLSD request; diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index d597e90ba0..b6a1bea42c 100644 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -61,6 +61,8 @@ namespace { #ifdef __clang__ # pragma clang diagnostic ignored "-Wunused-function" +#elif defined(LL_GNUC) +# pragma GCC diagnostic ignored "-Wunused-function" #endif void test_that_error_h_includes_enough_things_to_compile_a_message() { diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp index adf5804272..91304b4885 100644 --- a/indra/llcommon/tests/llsingleton_test.cpp +++ b/indra/llcommon/tests/llsingleton_test.cpp @@ -240,12 +240,14 @@ namespace tut PSing1::initParamSingleton("again"); }); ensure_contains("second ctor(string) didn't throw", threw, "twice"); +#ifndef LL_GNUC // FIXME: Fails to build under GCC // try to initialize using the other constructor -- should be // well-formed, but illegal at runtime threw = catcherr.catch_llerrs([](){ PSing1::initParamSingleton(17); }); ensure_contains("other ctor(int) didn't throw", threw, "twice"); +#endif PSing1::deleteSingleton(); ensure("false negative on wasDeleted()", PSing1::wasDeleted()); threw = catcherr.catch_llerrs([](){ @@ -254,6 +256,7 @@ namespace tut ensure_contains("accessed deleted LLParamSingleton", threw, "deleted"); } +#ifndef LL_GNUC // FIXME: Fails to build under GCC template<> template<> void singleton_object_t::test<13>() { @@ -275,6 +278,7 @@ namespace tut }); ensure_contains("other ctor(string) didn't throw", threw, "twice"); } +#endif class CircularPCtor: public LLParamSingleton<CircularPCtor> { diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a45ab5a09c..2baf140e6a 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -143,10 +143,6 @@ LLSettingsDay::LLSettingsDay() : //========================================================================= LLSD& LLSettingsDay::getSettings() { - if (mDaySettings.size() > 0) - { - return mDaySettings; - } mDaySettings = LLSD::emptyMap(); LLSD& settings = LLSettingsBase::getSettings(); diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp index 4649e13376..198fedcb03 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" -//#include "vmath.h" #include "v2math.h" #include "v3math.h" #include "v4math.h" @@ -47,8 +46,8 @@ bool LLVector2::abs() { bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } + if (mV[VX] < 0.f) { mV[VX] = -mV[VX]; ret = true; } + if (mV[VY] < 0.f) { mV[VY] = -mV[VY]; ret = true; } return ret; } @@ -67,7 +66,7 @@ F32 angle_between(const LLVector2& a, const LLVector2& b) return angle; } -bool are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) +bool are_parallel(const LLVector2& a, const LLVector2& b, F32 epsilon) { LLVector2 an = a; LLVector2 bn = b; @@ -82,28 +81,28 @@ bool are_parallel(const LLVector2 &a, const LLVector2 &b, float epsilon) } -F32 dist_vec(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return (F32) sqrt( x*x + y*y ); } -F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec_squared(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return x*x + y*y; } -F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec_squared2D(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return x*x + y*y; } -LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u) +LLVector2 lerp(const LLVector2& a, const LLVector2& b, F32 u) { return LLVector2( a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, @@ -113,14 +112,14 @@ LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u) LLSD LLVector2::getValue() const { LLSD ret; - ret[0] = mV[0]; - ret[1] = mV[1]; + ret[0] = mV[VX]; + ret[1] = mV[VY]; return ret; } void LLVector2::setValue(const LLSD& sd) { - mV[0] = (F32) sd[0].asReal(); - mV[1] = (F32) sd[1].asReal(); + mV[VX] = (F32) sd[0].asReal(); + mV[VY] = (F32) sd[1].asReal(); } diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index a61c946304..a0ba3ec505 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -36,7 +36,7 @@ class LLQuaternion; // Llvector2 = |x y z w| -static const U32 LENGTHOFVECTOR2 = 2; +static constexpr U32 LENGTHOFVECTOR2 = 2; class LLVector2 { @@ -82,7 +82,7 @@ class LLVector2 const LLVector2& scaleVec(const LLVector2& vec); // scales per component by vec - bool isNull(); // Returns true if vector has a _very_small_ length + bool isNull() const; // Returns true if vector has a _very_small_ length bool isExactlyZero() const { return !mV[VX] && !mV[VY]; } F32 operator[](int idx) const { return mV[idx]; } @@ -113,16 +113,16 @@ class LLVector2 // Non-member functions -F32 angle_between(const LLVector2 &a, const LLVector2 &b); // Returns angle (radians) between a and b -bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel -F32 dist_vec(const LLVector2 &a, const LLVector2 &b); // Returns distance between a and b -F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b -F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component -LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u); // Returns a vector that is a linear interpolation between a and b +F32 angle_between(const LLVector2& a, const LLVector2& b); // Returns angle (radians) between a and b +bool are_parallel(const LLVector2& a, const LLVector2& b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel +F32 dist_vec(const LLVector2& a, const LLVector2& b); // Returns distance between a and b +F32 dist_vec_squared(const LLVector2& a, const LLVector2& b);// Returns distance squared between a and b +F32 dist_vec_squared2D(const LLVector2& a, const LLVector2& b);// Returns distance squared between a and b ignoring Z component +LLVector2 lerp(const LLVector2& a, const LLVector2& b, F32 u); // Returns a vector that is a linear interpolation between a and b // Constructors -inline LLVector2::LLVector2(void) +inline LLVector2::LLVector2() { mV[VX] = 0.f; mV[VY] = 0.f; @@ -153,27 +153,27 @@ inline LLVector2::LLVector2(const LLSD &sd) // Clear and Assignment Functions -inline void LLVector2::clear(void) +inline void LLVector2::clear() { mV[VX] = 0.f; mV[VY] = 0.f; } -inline void LLVector2::setZero(void) +inline void LLVector2::setZero() { mV[VX] = 0.f; mV[VY] = 0.f; } // deprecated -inline void LLVector2::clearVec(void) +inline void LLVector2::clearVec() { mV[VX] = 0.f; mV[VY] = 0.f; } // deprecated -inline void LLVector2::zeroVec(void) +inline void LLVector2::zeroVec() { mV[VX] = 0.f; mV[VY] = 0.f; @@ -222,31 +222,31 @@ inline void LLVector2::setVec(const F32 *vec) // LLVector2 Magnitude and Normalization Functions -inline F32 LLVector2::length(void) const +inline F32 LLVector2::length() const { - return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); } -inline F32 LLVector2::lengthSquared(void) const +inline F32 LLVector2::lengthSquared() const { - return mV[0]*mV[0] + mV[1]*mV[1]; + return mV[VX]*mV[VX] + mV[VY]*mV[VY]; } -inline F32 LLVector2::normalize(void) +inline F32 LLVector2::normalize() { - F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]); + F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); F32 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mV[0] *= oomag; - mV[1] *= oomag; + mV[VX] *= oomag; + mV[VY] *= oomag; } else { - mV[0] = 0.f; - mV[1] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; mag = 0; } return (mag); @@ -259,33 +259,33 @@ inline bool LLVector2::isFinite() const } // deprecated -inline F32 LLVector2::magVec(void) const +inline F32 LLVector2::magVec() const { - return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); } // deprecated -inline F32 LLVector2::magVecSquared(void) const +inline F32 LLVector2::magVecSquared() const { - return mV[0]*mV[0] + mV[1]*mV[1]; + return mV[VX]*mV[VX] + mV[VY]*mV[VY]; } // deprecated -inline F32 LLVector2::normVec(void) +inline F32 LLVector2::normVec() { - F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1]); + F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); F32 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mV[0] *= oomag; - mV[1] *= oomag; + mV[VX] *= oomag; + mV[VY] *= oomag; } else { - mV[0] = 0.f; - mV[1] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; mag = 0; } return (mag); @@ -299,7 +299,7 @@ inline const LLVector2& LLVector2::scaleVec(const LLVector2& vec) return *this; } -inline bool LLVector2::isNull() +inline bool LLVector2::isNull() const { if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] ) { @@ -312,7 +312,7 @@ inline bool LLVector2::isNull() // LLVector2 Operators // For sorting. By convention, x is "more significant" than y. -inline bool operator<(const LLVector2 &a, const LLVector2 &b) +inline bool operator<(const LLVector2& a, const LLVector2& b) { if( a.mV[VX] == b.mV[VX] ) { @@ -325,95 +325,95 @@ inline bool operator<(const LLVector2 &a, const LLVector2 &b) } -inline LLVector2 operator+(const LLVector2 &a, const LLVector2 &b) +inline LLVector2 operator+(const LLVector2& a, const LLVector2& b) { LLVector2 c(a); return c += b; } -inline LLVector2 operator-(const LLVector2 &a, const LLVector2 &b) +inline LLVector2 operator-(const LLVector2& a, const LLVector2& b) { LLVector2 c(a); return c -= b; } -inline F32 operator*(const LLVector2 &a, const LLVector2 &b) +inline F32 operator*(const LLVector2& a, const LLVector2& b) { - return (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1]); + return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY]); } -inline LLVector2 operator%(const LLVector2 &a, const LLVector2 &b) +inline LLVector2 operator%(const LLVector2& a, const LLVector2& b) { - return LLVector2(a.mV[0]*b.mV[1] - b.mV[0]*a.mV[1], a.mV[1]*b.mV[0] - b.mV[1]*a.mV[0]); + return LLVector2(a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY], a.mV[VY]*b.mV[VX] - b.mV[VY]*a.mV[VX]); } -inline LLVector2 operator/(const LLVector2 &a, F32 k) +inline LLVector2 operator/(const LLVector2& a, F32 k) { F32 t = 1.f / k; - return LLVector2( a.mV[0] * t, a.mV[1] * t ); + return LLVector2( a.mV[VX] * t, a.mV[VY] * t ); } -inline LLVector2 operator*(const LLVector2 &a, F32 k) +inline LLVector2 operator*(const LLVector2& a, F32 k) { - return LLVector2( a.mV[0] * k, a.mV[1] * k ); + return LLVector2( a.mV[VX] * k, a.mV[VY] * k ); } -inline LLVector2 operator*(F32 k, const LLVector2 &a) +inline LLVector2 operator*(F32 k, const LLVector2& a) { - return LLVector2( a.mV[0] * k, a.mV[1] * k ); + return LLVector2( a.mV[VX] * k, a.mV[VY] * k ); } -inline bool operator==(const LLVector2 &a, const LLVector2 &b) +inline bool operator==(const LLVector2& a, const LLVector2& b) { - return ( (a.mV[0] == b.mV[0]) - &&(a.mV[1] == b.mV[1])); + return ( (a.mV[VX] == b.mV[VX]) + &&(a.mV[VY] == b.mV[VY])); } -inline bool operator!=(const LLVector2 &a, const LLVector2 &b) +inline bool operator!=(const LLVector2& a, const LLVector2& b) { - return ( (a.mV[0] != b.mV[0]) - ||(a.mV[1] != b.mV[1])); + return ( (a.mV[VX] != b.mV[VX]) + ||(a.mV[VY] != b.mV[VY])); } -inline const LLVector2& operator+=(LLVector2 &a, const LLVector2 &b) +inline const LLVector2& operator+=(LLVector2& a, const LLVector2& b) { - a.mV[0] += b.mV[0]; - a.mV[1] += b.mV[1]; + a.mV[VX] += b.mV[VX]; + a.mV[VY] += b.mV[VY]; return a; } -inline const LLVector2& operator-=(LLVector2 &a, const LLVector2 &b) +inline const LLVector2& operator-=(LLVector2& a, const LLVector2& b) { - a.mV[0] -= b.mV[0]; - a.mV[1] -= b.mV[1]; + a.mV[VX] -= b.mV[VX]; + a.mV[VY] -= b.mV[VY]; return a; } -inline const LLVector2& operator%=(LLVector2 &a, const LLVector2 &b) +inline const LLVector2& operator%=(LLVector2& a, const LLVector2& b) { - LLVector2 ret(a.mV[0]*b.mV[1] - b.mV[0]*a.mV[1], a.mV[1]*b.mV[0] - b.mV[1]*a.mV[0]); + LLVector2 ret(a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY], a.mV[VY]*b.mV[VX] - b.mV[VY]*a.mV[VX]); a = ret; return a; } -inline const LLVector2& operator*=(LLVector2 &a, F32 k) +inline const LLVector2& operator*=(LLVector2& a, F32 k) { - a.mV[0] *= k; - a.mV[1] *= k; + a.mV[VX] *= k; + a.mV[VY] *= k; return a; } -inline const LLVector2& operator/=(LLVector2 &a, F32 k) +inline const LLVector2& operator/=(LLVector2& a, F32 k) { F32 t = 1.f / k; - a.mV[0] *= t; - a.mV[1] *= t; + a.mV[VX] *= t; + a.mV[VY] *= t; return a; } -inline LLVector2 operator-(const LLVector2 &a) +inline LLVector2 operator-(const LLVector2& a) { - return LLVector2( -a.mV[0], -a.mV[1] ); + return LLVector2( -a.mV[VX], -a.mV[VY] ); } inline void update_min_max(LLVector2& min, LLVector2& max, const LLVector2& pos) @@ -431,7 +431,7 @@ inline void update_min_max(LLVector2& min, LLVector2& max, const LLVector2& pos) } } -inline std::ostream& operator<<(std::ostream& s, const LLVector2 &a) +inline std::ostream& operator<<(std::ostream& s, const LLVector2& a) { s << "{ " << a.mV[VX] << ", " << a.mV[VY] << " }"; return s; diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp index bb55c812b5..bd6d838186 100644 --- a/indra/llmath/v3dmath.cpp +++ b/indra/llmath/v3dmath.cpp @@ -57,13 +57,13 @@ bool LLVector3d::clamp(F64 min, F64 max) { bool ret{ false }; - if (mdV[0] < min) { mdV[0] = min; ret = true; } - if (mdV[1] < min) { mdV[1] = min; ret = true; } - if (mdV[2] < min) { mdV[2] = min; ret = true; } + if (mdV[VX] < min) { mdV[VX] = min; ret = true; } + if (mdV[VY] < min) { mdV[VY] = min; ret = true; } + if (mdV[VZ] < min) { mdV[VZ] = min; ret = true; } - if (mdV[0] > max) { mdV[0] = max; ret = true; } - if (mdV[1] > max) { mdV[1] = max; ret = true; } - if (mdV[2] > max) { mdV[2] = max; ret = true; } + if (mdV[VX] > max) { mdV[VX] = max; ret = true; } + if (mdV[VY] > max) { mdV[VY] = max; ret = true; } + if (mdV[VZ] > max) { mdV[VZ] = max; ret = true; } return ret; } @@ -74,9 +74,9 @@ bool LLVector3d::abs() { bool ret{ false }; - if (mdV[0] < 0.0) { mdV[0] = -mdV[0]; ret = true; } - if (mdV[1] < 0.0) { mdV[1] = -mdV[1]; ret = true; } - if (mdV[2] < 0.0) { mdV[2] = -mdV[2]; ret = true; } + if (mdV[VX] < 0.0) { mdV[VX] = -mdV[VX]; ret = true; } + if (mdV[VY] < 0.0) { mdV[VY] = -mdV[VY]; ret = true; } + if (mdV[VZ] < 0.0) { mdV[VZ] = -mdV[VZ]; ret = true; } return ret; } @@ -89,9 +89,9 @@ std::ostream& operator<<(std::ostream& s, const LLVector3d &a) const LLVector3d& LLVector3d::operator=(const LLVector4 &a) { - mdV[0] = a.mV[0]; - mdV[1] = a.mV[1]; - mdV[2] = a.mV[2]; + mdV[VX] = a.mV[VX]; + mdV[VY] = a.mV[VY]; + mdV[VZ] = a.mV[VZ]; return *this; } diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h index ece8c54ea4..7c94ebdf9b 100644 --- a/indra/llmath/v3dmath.h +++ b/indra/llmath/v3dmath.h @@ -54,17 +54,17 @@ class LLVector3d void setValue(const LLSD& sd) { - mdV[0] = sd[0].asReal(); - mdV[1] = sd[1].asReal(); - mdV[2] = sd[2].asReal(); + mdV[VX] = sd[0].asReal(); + mdV[VY] = sd[1].asReal(); + mdV[VZ] = sd[2].asReal(); } LLSD getValue() const { LLSD ret; - ret[0] = mdV[0]; - ret[1] = mdV[1]; - ret[2] = mdV[2]; + ret[0] = mdV[VX]; + ret[1] = mdV[VY]; + ret[2] = mdV[VZ]; return ret; } @@ -134,26 +134,26 @@ typedef LLVector3d LLGlobalVec; inline const LLVector3d &LLVector3d::set(const LLVector3 &vec) { - mdV[0] = vec.mV[0]; - mdV[1] = vec.mV[1]; - mdV[2] = vec.mV[2]; + mdV[VX] = vec.mV[VX]; + mdV[VY] = vec.mV[VY]; + mdV[VZ] = vec.mV[VZ]; return *this; } inline const LLVector3d &LLVector3d::setVec(const LLVector3 &vec) { - mdV[0] = vec.mV[0]; - mdV[1] = vec.mV[1]; - mdV[2] = vec.mV[2]; + mdV[VX] = vec.mV[VX]; + mdV[VY] = vec.mV[VY]; + mdV[VZ] = vec.mV[VZ]; return *this; } inline LLVector3d::LLVector3d(void) { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2] = 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; } inline LLVector3d::LLVector3d(const F64 x, const F64 y, const F64 z) @@ -199,33 +199,33 @@ inline bool LLVector3d::isFinite() const inline const LLVector3d& LLVector3d::clear(void) { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2]= 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; return (*this); } inline const LLVector3d& LLVector3d::clearVec(void) { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2]= 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; return (*this); } inline const LLVector3d& LLVector3d::setZero(void) { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2] = 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; return (*this); } inline const LLVector3d& LLVector3d::zeroVec(void) { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2] = 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; return (*this); } @@ -239,17 +239,17 @@ inline const LLVector3d& LLVector3d::set(const F64 x, const F64 y, const F64 inline const LLVector3d& LLVector3d::set(const LLVector3d &vec) { - mdV[0] = vec.mdV[0]; - mdV[1] = vec.mdV[1]; - mdV[2] = vec.mdV[2]; + mdV[VX] = vec.mdV[VX]; + mdV[VY] = vec.mdV[VY]; + mdV[VZ] = vec.mdV[VZ]; return (*this); } inline const LLVector3d& LLVector3d::set(const F64 *vec) { - mdV[0] = vec[0]; - mdV[1] = vec[1]; - mdV[2] = vec[2]; + mdV[VX] = vec[0]; + mdV[VY] = vec[1]; + mdV[VZ] = vec[2]; return (*this); } @@ -261,61 +261,61 @@ inline const LLVector3d& LLVector3d::setVec(const F64 x, const F64 y, const F return (*this); } -inline const LLVector3d& LLVector3d::setVec(const LLVector3d &vec) +inline const LLVector3d& LLVector3d::setVec(const LLVector3d& vec) { - mdV[0] = vec.mdV[0]; - mdV[1] = vec.mdV[1]; - mdV[2] = vec.mdV[2]; + mdV[VX] = vec.mdV[VX]; + mdV[VY] = vec.mdV[VY]; + mdV[VZ] = vec.mdV[VZ]; return (*this); } -inline const LLVector3d& LLVector3d::setVec(const F64 *vec) +inline const LLVector3d& LLVector3d::setVec(const F64* vec) { - mdV[0] = vec[0]; - mdV[1] = vec[1]; - mdV[2] = vec[2]; + mdV[VX] = vec[VX]; + mdV[VY] = vec[VY]; + mdV[VZ] = vec[VZ]; return (*this); } -inline F64 LLVector3d::normVec(void) +inline F64 LLVector3d::normVec() { - F64 mag = (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); + F64 mag = sqrt(mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]); F64 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mdV[0] *= oomag; - mdV[1] *= oomag; - mdV[2] *= oomag; + mdV[VX] *= oomag; + mdV[VY] *= oomag; + mdV[VZ] *= oomag; } else { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2] = 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; mag = 0; } return (mag); } -inline F64 LLVector3d::normalize(void) +inline F64 LLVector3d::normalize() { - F64 mag = (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); + F64 mag = sqrt(mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]); F64 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mdV[0] *= oomag; - mdV[1] *= oomag; - mdV[2] *= oomag; + mdV[VX] *= oomag; + mdV[VY] *= oomag; + mdV[VZ] *= oomag; } else { - mdV[0] = 0.f; - mdV[1] = 0.f; - mdV[2] = 0.f; + mdV[VX] = 0.f; + mdV[VY] = 0.f; + mdV[VZ] = 0.f; mag = 0; } return (mag); @@ -323,24 +323,24 @@ inline F64 LLVector3d::normalize(void) // LLVector3d Magnitude and Normalization Functions -inline F64 LLVector3d::magVec(void) const +inline F64 LLVector3d::magVec() const { - return (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); + return sqrt(mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]); } -inline F64 LLVector3d::magVecSquared(void) const +inline F64 LLVector3d::magVecSquared() const { - return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; + return mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]; } -inline F64 LLVector3d::length(void) const +inline F64 LLVector3d::length() const { - return (F32) sqrt(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); + return sqrt(mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]); } -inline F64 LLVector3d::lengthSquared(void) const +inline F64 LLVector3d::lengthSquared() const { - return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; + return mdV[VX]*mdV[VX] + mdV[VY]*mdV[VY] + mdV[VZ]*mdV[VZ]; } inline LLVector3d operator+(const LLVector3d& a, const LLVector3d& b) @@ -357,109 +357,109 @@ inline LLVector3d operator-(const LLVector3d& a, const LLVector3d& b) inline F64 operator*(const LLVector3d& a, const LLVector3d& b) { - return (a.mdV[0]*b.mdV[0] + a.mdV[1]*b.mdV[1] + a.mdV[2]*b.mdV[2]); + return (a.mdV[VX]*b.mdV[VX] + a.mdV[VY]*b.mdV[VY] + a.mdV[VZ]*b.mdV[VZ]); } inline LLVector3d operator%(const LLVector3d& a, const LLVector3d& b) { - return LLVector3d( a.mdV[1]*b.mdV[2] - b.mdV[1]*a.mdV[2], a.mdV[2]*b.mdV[0] - b.mdV[2]*a.mdV[0], a.mdV[0]*b.mdV[1] - b.mdV[0]*a.mdV[1] ); + return LLVector3d( a.mdV[VY]*b.mdV[VZ] - b.mdV[VY]*a.mdV[VZ], a.mdV[VZ]*b.mdV[VX] - b.mdV[VZ]*a.mdV[VX], a.mdV[VX]*b.mdV[VY] - b.mdV[VX]*a.mdV[VY] ); } inline LLVector3d operator/(const LLVector3d& a, const F64 k) { F64 t = 1.f / k; - return LLVector3d( a.mdV[0] * t, a.mdV[1] * t, a.mdV[2] * t ); + return LLVector3d( a.mdV[VX] * t, a.mdV[VY] * t, a.mdV[VZ] * t ); } inline LLVector3d operator*(const LLVector3d& a, const F64 k) { - return LLVector3d( a.mdV[0] * k, a.mdV[1] * k, a.mdV[2] * k ); + return LLVector3d( a.mdV[VX] * k, a.mdV[VY] * k, a.mdV[VZ] * k ); } inline LLVector3d operator*(F64 k, const LLVector3d& a) { - return LLVector3d( a.mdV[0] * k, a.mdV[1] * k, a.mdV[2] * k ); + return LLVector3d( a.mdV[VX] * k, a.mdV[VY] * k, a.mdV[VZ] * k ); } inline bool operator==(const LLVector3d& a, const LLVector3d& b) { - return ( (a.mdV[0] == b.mdV[0]) - &&(a.mdV[1] == b.mdV[1]) - &&(a.mdV[2] == b.mdV[2])); + return ( (a.mdV[VX] == b.mdV[VX]) + &&(a.mdV[VY] == b.mdV[VY]) + &&(a.mdV[VZ] == b.mdV[VZ])); } inline bool operator!=(const LLVector3d& a, const LLVector3d& b) { - return ( (a.mdV[0] != b.mdV[0]) - ||(a.mdV[1] != b.mdV[1]) - ||(a.mdV[2] != b.mdV[2])); + return ( (a.mdV[VX] != b.mdV[VX]) + ||(a.mdV[VY] != b.mdV[VY]) + ||(a.mdV[VZ] != b.mdV[VZ])); } inline const LLVector3d& operator+=(LLVector3d& a, const LLVector3d& b) { - a.mdV[0] += b.mdV[0]; - a.mdV[1] += b.mdV[1]; - a.mdV[2] += b.mdV[2]; + a.mdV[VX] += b.mdV[VX]; + a.mdV[VY] += b.mdV[VY]; + a.mdV[VZ] += b.mdV[VZ]; return a; } inline const LLVector3d& operator-=(LLVector3d& a, const LLVector3d& b) { - a.mdV[0] -= b.mdV[0]; - a.mdV[1] -= b.mdV[1]; - a.mdV[2] -= b.mdV[2]; + a.mdV[VX] -= b.mdV[VX]; + a.mdV[VY] -= b.mdV[VY]; + a.mdV[VZ] -= b.mdV[VZ]; return a; } inline const LLVector3d& operator%=(LLVector3d& a, const LLVector3d& b) { - LLVector3d ret( a.mdV[1]*b.mdV[2] - b.mdV[1]*a.mdV[2], a.mdV[2]*b.mdV[0] - b.mdV[2]*a.mdV[0], a.mdV[0]*b.mdV[1] - b.mdV[0]*a.mdV[1]); + LLVector3d ret( a.mdV[VY]*b.mdV[VZ] - b.mdV[VY]*a.mdV[VZ], a.mdV[VZ]*b.mdV[VX] - b.mdV[VZ]*a.mdV[VX], a.mdV[VX]*b.mdV[VY] - b.mdV[VX]*a.mdV[VY]); a = ret; return a; } inline const LLVector3d& operator*=(LLVector3d& a, const F64 k) { - a.mdV[0] *= k; - a.mdV[1] *= k; - a.mdV[2] *= k; + a.mdV[VX] *= k; + a.mdV[VY] *= k; + a.mdV[VZ] *= k; return a; } inline const LLVector3d& operator/=(LLVector3d& a, const F64 k) { F64 t = 1.f / k; - a.mdV[0] *= t; - a.mdV[1] *= t; - a.mdV[2] *= t; + a.mdV[VX] *= t; + a.mdV[VY] *= t; + a.mdV[VZ] *= t; return a; } inline LLVector3d operator-(const LLVector3d& a) { - return LLVector3d( -a.mdV[0], -a.mdV[1], -a.mdV[2] ); + return LLVector3d( -a.mdV[VX], -a.mdV[VY], -a.mdV[VZ] ); } inline F64 dist_vec(const LLVector3d& a, const LLVector3d& b) { - F64 x = a.mdV[0] - b.mdV[0]; - F64 y = a.mdV[1] - b.mdV[1]; - F64 z = a.mdV[2] - b.mdV[2]; + F64 x = a.mdV[VX] - b.mdV[VX]; + F64 y = a.mdV[VY] - b.mdV[VY]; + F64 z = a.mdV[VZ] - b.mdV[VZ]; return (F32) sqrt( x*x + y*y + z*z ); } inline F64 dist_vec_squared(const LLVector3d& a, const LLVector3d& b) { - F64 x = a.mdV[0] - b.mdV[0]; - F64 y = a.mdV[1] - b.mdV[1]; - F64 z = a.mdV[2] - b.mdV[2]; + F64 x = a.mdV[VX] - b.mdV[VX]; + F64 y = a.mdV[VY] - b.mdV[VY]; + F64 z = a.mdV[VZ] - b.mdV[VZ]; return x*x + y*y + z*z; } inline F64 dist_vec_squared2D(const LLVector3d& a, const LLVector3d& b) { - F64 x = a.mdV[0] - b.mdV[0]; - F64 y = a.mdV[1] - b.mdV[1]; + F64 x = a.mdV[VX] - b.mdV[VX]; + F64 y = a.mdV[VY] - b.mdV[VY]; return x*x + y*y; } diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp index 73ad2a4ed6..941a122528 100644 --- a/indra/llmath/v3math.cpp +++ b/indra/llmath/v3math.cpp @@ -58,13 +58,13 @@ bool LLVector3::clamp(F32 min, F32 max) { bool ret{ false }; - if (mV[0] < min) { mV[0] = min; ret = true; } - if (mV[1] < min) { mV[1] = min; ret = true; } - if (mV[2] < min) { mV[2] = min; ret = true; } + if (mV[VX] < min) { mV[VX] = min; ret = true; } + if (mV[VY] < min) { mV[VY] = min; ret = true; } + if (mV[VZ] < min) { mV[VZ] = min; ret = true; } - if (mV[0] > max) { mV[0] = max; ret = true; } - if (mV[1] > max) { mV[1] = max; ret = true; } - if (mV[2] > max) { mV[2] = max; ret = true; } + if (mV[VX] > max) { mV[VX] = max; ret = true; } + if (mV[VY] > max) { mV[VY] = max; ret = true; } + if (mV[VZ] > max) { mV[VZ] = max; ret = true; } return ret; } @@ -85,9 +85,9 @@ bool LLVector3::clampLength( F32 length_limit ) { length_limit = 0.f; } - mV[0] *= length_limit; - mV[1] *= length_limit; - mV[2] *= length_limit; + mV[VX] *= length_limit; + mV[VY] *= length_limit; + mV[VZ] *= length_limit; changed = true; } } @@ -116,35 +116,35 @@ bool LLVector3::clampLength( F32 length_limit ) { // yes it can be salvaged --> // bring the components down before we normalize - mV[0] /= max_abs_component; - mV[1] /= max_abs_component; - mV[2] /= max_abs_component; + mV[VX] /= max_abs_component; + mV[VY] /= max_abs_component; + mV[VZ] /= max_abs_component; normalize(); if (length_limit < 0.f) { length_limit = 0.f; } - mV[0] *= length_limit; - mV[1] *= length_limit; - mV[2] *= length_limit; + mV[VX] *= length_limit; + mV[VY] *= length_limit; + mV[VZ] *= length_limit; } } return changed; } -bool LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec) +bool LLVector3::clamp(const LLVector3& min_vec, const LLVector3& max_vec) { bool ret{ false }; - if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = true; } - if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = true; } - if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = true; } + if (mV[VX] < min_vec[0]) { mV[VX] = min_vec[0]; ret = true; } + if (mV[VY] < min_vec[1]) { mV[VY] = min_vec[1]; ret = true; } + if (mV[VZ] < min_vec[2]) { mV[VZ] = min_vec[2]; ret = true; } - if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = true; } - if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = true; } - if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = true; } + if (mV[VX] > max_vec[0]) { mV[VX] = max_vec[0]; ret = true; } + if (mV[VY] > max_vec[1]) { mV[VY] = max_vec[1]; ret = true; } + if (mV[VZ] > max_vec[2]) { mV[VZ] = max_vec[2]; ret = true; } return ret; } @@ -156,9 +156,9 @@ bool LLVector3::abs() { bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } - if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; } + if (mV[VX] < 0.f) { mV[VX] = -mV[VX]; ret = true; } + if (mV[VY] < 0.f) { mV[VY] = -mV[VY]; ret = true; } + if (mV[VZ] < 0.f) { mV[VZ] = -mV[VZ]; ret = true; } return ret; } @@ -194,13 +194,13 @@ void LLVector3::snap(S32 sig_digits) mV[VZ] = snap_to_sig_figs(mV[VZ], sig_digits); } -const LLVector3& LLVector3::rotVec(const LLMatrix3 &mat) +const LLVector3& LLVector3::rotVec(const LLMatrix3& mat) { *this = *this * mat; return *this; } -const LLVector3& LLVector3::rotVec(const LLQuaternion &q) +const LLVector3& LLVector3::rotVec(const LLQuaternion& q) { *this = *this * q; return *this; @@ -228,7 +228,7 @@ const LLVector3& LLVector3::transVec(const LLMatrix4& mat) } -const LLVector3& LLVector3::rotVec(F32 angle, const LLVector3 &vec) +const LLVector3& LLVector3::rotVec(F32 angle, const LLVector3& vec) { if ( !vec.isExactlyZero() && angle ) { @@ -263,35 +263,35 @@ LLVector3 LLVector3::scaledVec(const LLVector3& vec) const return ret; } -const LLVector3& LLVector3::set(const LLVector3d &vec) +const LLVector3& LLVector3::set(const LLVector3d& vec) { - mV[0] = (F32)vec.mdV[0]; - mV[1] = (F32)vec.mdV[1]; - mV[2] = (F32)vec.mdV[2]; + mV[VX] = (F32)vec.mdV[VX]; + mV[VY] = (F32)vec.mdV[VY]; + mV[VZ] = (F32)vec.mdV[VZ]; return (*this); } -const LLVector3& LLVector3::set(const LLVector4 &vec) +const LLVector3& LLVector3::set(const LLVector4& vec) { - mV[0] = vec.mV[0]; - mV[1] = vec.mV[1]; - mV[2] = vec.mV[2]; + mV[VX] = vec.mV[VX]; + mV[VY] = vec.mV[VY]; + mV[VZ] = vec.mV[VZ]; return (*this); } -const LLVector3& LLVector3::setVec(const LLVector3d &vec) +const LLVector3& LLVector3::setVec(const LLVector3d& vec) { - mV[0] = (F32)vec.mdV[0]; - mV[1] = (F32)vec.mdV[1]; - mV[2] = (F32)vec.mdV[2]; + mV[VX] = (F32)vec.mdV[0]; + mV[VY] = (F32)vec.mdV[1]; + mV[VZ] = (F32)vec.mdV[2]; return (*this); } -const LLVector3& LLVector3::setVec(const LLVector4 &vec) +const LLVector3& LLVector3::setVec(const LLVector4& vec) { - mV[0] = vec.mV[0]; - mV[1] = vec.mV[1]; - mV[2] = vec.mV[2]; + mV[VX] = vec.mV[VX]; + mV[VY] = vec.mV[VY]; + mV[VZ] = vec.mV[VZ]; return (*this); } @@ -302,14 +302,14 @@ LLVector3::LLVector3(const LLVector2 &vec) mV[VZ] = 0; } -LLVector3::LLVector3(const LLVector3d &vec) +LLVector3::LLVector3(const LLVector3d& vec) { mV[VX] = (F32)vec.mdV[VX]; mV[VY] = (F32)vec.mdV[VY]; mV[VZ] = (F32)vec.mdV[VZ]; } -LLVector3::LLVector3(const LLVector4 &vec) +LLVector3::LLVector3(const LLVector4& vec) { mV[VX] = (F32)vec.mV[VX]; mV[VY] = (F32)vec.mV[VY]; @@ -330,20 +330,20 @@ LLVector3::LLVector3(const LLSD& sd) LLSD LLVector3::getValue() const { LLSD ret; - ret[0] = mV[0]; - ret[1] = mV[1]; - ret[2] = mV[2]; + ret[0] = mV[VX]; + ret[1] = mV[VY]; + ret[2] = mV[VZ]; return ret; } void LLVector3::setValue(const LLSD& sd) { - mV[0] = (F32) sd[0].asReal(); - mV[1] = (F32) sd[1].asReal(); - mV[2] = (F32) sd[2].asReal(); + mV[VX] = (F32) sd[0].asReal(); + mV[VY] = (F32) sd[1].asReal(); + mV[VZ] = (F32) sd[2].asReal(); } -const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) +const LLVector3& operator*=(LLVector3& a, const LLQuaternion& rot) { const F32 rw = - rot.mQ[VX] * a.mV[VX] - rot.mQ[VY] * a.mV[VY] - rot.mQ[VZ] * a.mV[VZ]; const F32 rx = rot.mQ[VW] * a.mV[VX] + rot.mQ[VY] * a.mV[VZ] - rot.mQ[VZ] * a.mV[VY]; diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index d063b15c74..53491533c2 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -41,7 +41,7 @@ class LLQuaternion; // LLvector3 = |x y z w| -static const U32 LENGTHOFVECTOR3 = 3; +static constexpr U32 LENGTHOFVECTOR3 = 3; class LLVector3 { @@ -169,11 +169,11 @@ LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u); // Returns a vect LLVector3 point_to_box_offset(LLVector3& pos, const LLVector3* box); // Displacement from query point to nearest point on bounding box. bool box_valid_and_non_zero(const LLVector3* box); -inline LLVector3::LLVector3(void) +inline LLVector3::LLVector3() { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; } inline LLVector3::LLVector3(const F32 x, const F32 y, const F32 z) @@ -210,32 +210,32 @@ inline bool LLVector3::isFinite() const // Clear and Assignment Functions -inline void LLVector3::clear(void) +inline void LLVector3::clear() { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; } -inline void LLVector3::setZero(void) +inline void LLVector3::setZero() { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; } -inline void LLVector3::clearVec(void) +inline void LLVector3::clearVec() { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; } -inline void LLVector3::zeroVec(void) +inline void LLVector3::zeroVec() { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; } inline void LLVector3::set(F32 x, F32 y, F32 z) @@ -245,18 +245,18 @@ inline void LLVector3::set(F32 x, F32 y, F32 z) mV[VZ] = z; } -inline void LLVector3::set(const LLVector3 &vec) +inline void LLVector3::set(const LLVector3& vec) { - mV[0] = vec.mV[0]; - mV[1] = vec.mV[1]; - mV[2] = vec.mV[2]; + mV[VX] = vec.mV[VX]; + mV[VY] = vec.mV[VY]; + mV[VZ] = vec.mV[VZ]; } -inline void LLVector3::set(const F32 *vec) +inline void LLVector3::set(const F32* vec) { - mV[0] = vec[0]; - mV[1] = vec[1]; - mV[2] = vec[2]; + mV[VX] = vec[0]; + mV[VY] = vec[1]; + mV[VZ] = vec[2]; } // deprecated @@ -268,61 +268,61 @@ inline void LLVector3::setVec(F32 x, F32 y, F32 z) } // deprecated -inline void LLVector3::setVec(const LLVector3 &vec) +inline void LLVector3::setVec(const LLVector3& vec) { - mV[0] = vec.mV[0]; - mV[1] = vec.mV[1]; - mV[2] = vec.mV[2]; + mV[VX] = vec.mV[VX]; + mV[VY] = vec.mV[VY]; + mV[VZ] = vec.mV[VZ]; } // deprecated -inline void LLVector3::setVec(const F32 *vec) +inline void LLVector3::setVec(const F32* vec) { - mV[0] = vec[0]; - mV[1] = vec[1]; - mV[2] = vec[2]; + mV[VX] = vec[0]; + mV[VY] = vec[1]; + mV[VZ] = vec[2]; } -inline F32 LLVector3::normalize(void) +inline F32 LLVector3::normalize() { - F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]); + F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mV[0] *= oomag; - mV[1] *= oomag; - mV[2] *= oomag; + mV[VX] *= oomag; + mV[VY] *= oomag; + mV[VZ] *= oomag; } else { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; mag = 0; } return (mag); } // deprecated -inline F32 LLVector3::normVec(void) +inline F32 LLVector3::normVec() { - F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]); + F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 oomag; if (mag > FP_MAG_THRESHOLD) { oomag = 1.f/mag; - mV[0] *= oomag; - mV[1] *= oomag; - mV[2] *= oomag; + mV[VX] *= oomag; + mV[VY] *= oomag; + mV[VZ] *= oomag; } else { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; mag = 0; } return (mag); @@ -330,171 +330,178 @@ inline F32 LLVector3::normVec(void) // LLVector3 Magnitude and Normalization Functions -inline F32 LLVector3::length(void) const +inline F32 LLVector3::length() const { - return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); } -inline F32 LLVector3::lengthSquared(void) const +inline F32 LLVector3::lengthSquared() const { - return mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]; + return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } -inline F32 LLVector3::magVec(void) const +inline F32 LLVector3::magVec() const { - return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); } -inline F32 LLVector3::magVecSquared(void) const +inline F32 LLVector3::magVecSquared() const { - return mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]; + return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } inline bool LLVector3::inRange( F32 min, F32 max ) const { - return mV[0] >= min && mV[0] <= max && - mV[1] >= min && mV[1] <= max && - mV[2] >= min && mV[2] <= max; + return mV[VX] >= min && mV[VX] <= max && + mV[VY] >= min && mV[VY] <= max && + mV[VZ] >= min && mV[VZ] <= max; } -inline LLVector3 operator+(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 operator+(const LLVector3& a, const LLVector3& b) { LLVector3 c(a); return c += b; } -inline LLVector3 operator-(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 operator-(const LLVector3& a, const LLVector3& b) { LLVector3 c(a); return c -= b; } -inline F32 operator*(const LLVector3 &a, const LLVector3 &b) +inline F32 operator*(const LLVector3& a, const LLVector3& b) { - return (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]); + return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]); } -inline LLVector3 operator%(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 operator%(const LLVector3& a, const LLVector3& b) { - return LLVector3( a.mV[1]*b.mV[2] - b.mV[1]*a.mV[2], a.mV[2]*b.mV[0] - b.mV[2]*a.mV[0], a.mV[0]*b.mV[1] - b.mV[0]*a.mV[1] ); + return LLVector3( a.mV[VY]*b.mV[VZ] - b.mV[VY]*a.mV[VZ], a.mV[VZ]*b.mV[VX] - b.mV[VZ]*a.mV[VX], a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY] ); } -inline LLVector3 operator/(const LLVector3 &a, F32 k) +inline LLVector3 operator/(const LLVector3& a, F32 k) { F32 t = 1.f / k; - return LLVector3( a.mV[0] * t, a.mV[1] * t, a.mV[2] * t ); + return LLVector3( a.mV[VX] * t, a.mV[VY] * t, a.mV[VZ] * t ); } -inline LLVector3 operator*(const LLVector3 &a, F32 k) +inline LLVector3 operator*(const LLVector3& a, F32 k) { - return LLVector3( a.mV[0] * k, a.mV[1] * k, a.mV[2] * k ); + return LLVector3( a.mV[VX] * k, a.mV[VY] * k, a.mV[VZ] * k ); } -inline LLVector3 operator*(F32 k, const LLVector3 &a) +inline LLVector3 operator*(F32 k, const LLVector3& a) { - return LLVector3( a.mV[0] * k, a.mV[1] * k, a.mV[2] * k ); + return LLVector3( a.mV[VX] * k, a.mV[VY] * k, a.mV[VZ] * k ); } -inline bool operator==(const LLVector3 &a, const LLVector3 &b) +inline bool operator==(const LLVector3& a, const LLVector3& b) { - return ( (a.mV[0] == b.mV[0]) - &&(a.mV[1] == b.mV[1]) - &&(a.mV[2] == b.mV[2])); + return ( (a.mV[VX] == b.mV[VX]) + &&(a.mV[VY] == b.mV[VY]) + &&(a.mV[VZ] == b.mV[VZ])); } -inline bool operator!=(const LLVector3 &a, const LLVector3 &b) +inline bool operator!=(const LLVector3& a, const LLVector3& b) { - return ( (a.mV[0] != b.mV[0]) - ||(a.mV[1] != b.mV[1]) - ||(a.mV[2] != b.mV[2])); + return ( (a.mV[VX] != b.mV[VX]) + ||(a.mV[VY] != b.mV[VY]) + ||(a.mV[VZ] != b.mV[VZ])); } -inline bool operator<(const LLVector3 &a, const LLVector3 &b) +inline bool operator<(const LLVector3& a, const LLVector3& b) { - return (a.mV[0] < b.mV[0] - || (a.mV[0] == b.mV[0] - && (a.mV[1] < b.mV[1] - || ((a.mV[1] == b.mV[1]) - && a.mV[2] < b.mV[2])))); + return (a.mV[VX] < b.mV[VX] + || (a.mV[VX] == b.mV[VX] + && (a.mV[VY] < b.mV[VY] + || ((a.mV[VY] == b.mV[VY]) + && a.mV[VZ] < b.mV[VZ])))); } -inline const LLVector3& operator+=(LLVector3 &a, const LLVector3 &b) +inline const LLVector3& operator+=(LLVector3& a, const LLVector3& b) { - a.mV[0] += b.mV[0]; - a.mV[1] += b.mV[1]; - a.mV[2] += b.mV[2]; + a.mV[VX] += b.mV[VX]; + a.mV[VY] += b.mV[VY]; + a.mV[VZ] += b.mV[VZ]; return a; } -inline const LLVector3& operator-=(LLVector3 &a, const LLVector3 &b) +inline const LLVector3& operator-=(LLVector3& a, const LLVector3& b) { - a.mV[0] -= b.mV[0]; - a.mV[1] -= b.mV[1]; - a.mV[2] -= b.mV[2]; + a.mV[VX] -= b.mV[VX]; + a.mV[VY] -= b.mV[VY]; + a.mV[VZ] -= b.mV[VZ]; return a; } -inline const LLVector3& operator%=(LLVector3 &a, const LLVector3 &b) +inline const LLVector3& operator%=(LLVector3& a, const LLVector3& b) { - LLVector3 ret( a.mV[1]*b.mV[2] - b.mV[1]*a.mV[2], a.mV[2]*b.mV[0] - b.mV[2]*a.mV[0], a.mV[0]*b.mV[1] - b.mV[0]*a.mV[1]); + LLVector3 ret( a.mV[VY]*b.mV[VZ] - b.mV[VY]*a.mV[VZ], a.mV[VZ]*b.mV[VX] - b.mV[VZ]*a.mV[VX], a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY]); a = ret; return a; } -inline const LLVector3& operator*=(LLVector3 &a, F32 k) +inline const LLVector3& operator*=(LLVector3& a, F32 k) { - a.mV[0] *= k; - a.mV[1] *= k; - a.mV[2] *= k; + a.mV[VX] *= k; + a.mV[VY] *= k; + a.mV[VZ] *= k; return a; } -inline const LLVector3& operator*=(LLVector3 &a, const LLVector3 &b) +inline const LLVector3& operator*=(LLVector3& a, const LLVector3& b) { - a.mV[0] *= b.mV[0]; - a.mV[1] *= b.mV[1]; - a.mV[2] *= b.mV[2]; + a.mV[VX] *= b.mV[VX]; + a.mV[VY] *= b.mV[VY]; + a.mV[VZ] *= b.mV[VZ]; return a; } -inline const LLVector3& operator/=(LLVector3 &a, F32 k) +inline const LLVector3& operator/=(LLVector3& a, F32 k) { - F32 t = 1.f / k; - a.mV[0] *= t; - a.mV[1] *= t; - a.mV[2] *= t; + a.mV[VX] /= k; + a.mV[VY] /= k; + a.mV[VZ] /= 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) +inline LLVector3 operator-(const LLVector3& a) { - return LLVector3( -a.mV[0], -a.mV[1], -a.mV[2] ); + return LLVector3( -a.mV[VX], -a.mV[VY], -a.mV[VZ] ); } -inline F32 dist_vec(const LLVector3 &a, const LLVector3 &b) +inline F32 dist_vec(const LLVector3& a, const LLVector3& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; - F32 z = a.mV[2] - b.mV[2]; - return (F32) sqrt( x*x + y*y + z*z ); + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; + F32 z = a.mV[VZ] - b.mV[VZ]; + return sqrt( x*x + y*y + z*z ); } -inline F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b) +inline F32 dist_vec_squared(const LLVector3& a, const LLVector3& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; - F32 z = a.mV[2] - b.mV[2]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; + F32 z = a.mV[VZ] - b.mV[VZ]; return x*x + y*y + z*z; } -inline F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b) +inline F32 dist_vec_squared2D(const LLVector3& a, const LLVector3& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return x*x + y*y; } -inline LLVector3 projected_vec(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 projected_vec(const LLVector3& a, const LLVector3& b) { F32 bb = b * b; if (bb > FP_MAG_THRESHOLD * FP_MAG_THRESHOLD) @@ -519,18 +526,18 @@ inline LLVector3 inverse_projected_vec(const LLVector3& a, const LLVector3& b) return normalized_a * (b_length / dot_product); } -inline LLVector3 parallel_component(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 parallel_component(const LLVector3& a, const LLVector3& b) { return projected_vec(a, b); } -inline LLVector3 orthogonal_component(const LLVector3 &a, const LLVector3 &b) +inline LLVector3 orthogonal_component(const LLVector3& a, const LLVector3& b) { return a - projected_vec(a, b); } -inline LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u) +inline LLVector3 lerp(const LLVector3& a, const LLVector3& b, F32 u) { return LLVector3( a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, @@ -589,7 +596,7 @@ inline F32 angle_between(const LLVector3& a, const LLVector3& b) return atan2f(sqrtf(c * c), ab); // return the angle } -inline bool are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon) +inline bool are_parallel(const LLVector3& a, const LLVector3& b, F32 epsilon) { LLVector3 an = a; LLVector3 bn = b; diff --git a/indra/llmath/v4math.cpp b/indra/llmath/v4math.cpp index 0aa6eb09c3..e87bfc0013 100644 --- a/indra/llmath/v4math.cpp +++ b/indra/llmath/v4math.cpp @@ -36,13 +36,13 @@ // LLVector4 // Axis-Angle rotations -const LLVector4& LLVector4::rotVec(const LLMatrix4 &mat) +const LLVector4& LLVector4::rotVec(const LLMatrix4& mat) { *this = *this * mat; return *this; } -const LLVector4& LLVector4::rotVec(const LLQuaternion &q) +const LLVector4& LLVector4::rotVec(const LLQuaternion& q) { *this = *this * q; return *this; @@ -64,16 +64,16 @@ bool LLVector4::abs() { bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } - if (mV[2] < 0.f) { mV[2] = -mV[2]; ret = true; } - if (mV[3] < 0.f) { mV[3] = -mV[3]; ret = true; } + if (mV[VX] < 0.f) { mV[VX] = -mV[VX]; ret = true; } + if (mV[VY] < 0.f) { mV[VY] = -mV[VY]; ret = true; } + if (mV[VZ] < 0.f) { mV[VZ] = -mV[VZ]; ret = true; } + if (mV[VW] < 0.f) { mV[VW] = -mV[VW]; ret = true; } return ret; } -std::ostream& operator<<(std::ostream& s, const LLVector4 &a) +std::ostream& operator<<(std::ostream& s, const LLVector4& a) { s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << ", " << a.mV[VW] << " }"; return s; @@ -108,12 +108,12 @@ bool are_parallel(const LLVector4 &a, const LLVector4 &b, F32 epsilon) } -LLVector3 vec4to3(const LLVector4 &vec) +LLVector3 vec4to3(const LLVector4& vec) { return LLVector3( vec.mV[VX], vec.mV[VY], vec.mV[VZ] ); } -LLVector4 vec3to4(const LLVector3 &vec) +LLVector4 vec3to4(const LLVector3& vec) { return LLVector4(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); } diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index a5b6f506d7..e2092d1277 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -38,7 +38,7 @@ class LLQuaternion; // LLVector4 = |x y z w| -static const U32 LENGTHOFVECTOR4 = 4; +static constexpr U32 LENGTHOFVECTOR4 = 4; class LLVector4 { @@ -58,19 +58,19 @@ class LLVector4 LLSD getValue() const { LLSD ret; - ret[0] = mV[0]; - ret[1] = mV[1]; - ret[2] = mV[2]; - ret[3] = mV[3]; + ret[0] = mV[VX]; + ret[1] = mV[VY]; + ret[2] = mV[VZ]; + ret[3] = mV[VW]; return ret; } void setValue(const LLSD& sd) { - mV[0] = (F32)sd[0].asReal(); - mV[1] = (F32)sd[1].asReal(); - mV[2] = (F32)sd[2].asReal(); - mV[3] = (F32)sd[3].asReal(); + mV[VX] = (F32)sd[0].asReal(); + mV[VY] = (F32)sd[1].asReal(); + mV[VZ] = (F32)sd[2].asReal(); + mV[VW] = (F32)sd[3].asReal(); } @@ -231,7 +231,7 @@ inline bool LLVector4::isFinite() const // Clear and Assignment Functions -inline void LLVector4::clear(void) +inline void LLVector4::clear() { mV[VX] = 0.f; mV[VY] = 0.f; @@ -240,7 +240,7 @@ inline void LLVector4::clear(void) } // deprecated -inline void LLVector4::clearVec(void) +inline void LLVector4::clearVec() { mV[VX] = 0.f; mV[VY] = 0.f; @@ -249,7 +249,7 @@ inline void LLVector4::clearVec(void) } // deprecated -inline void LLVector4::zeroVec(void) +inline void LLVector4::zeroVec() { mV[VX] = 0.f; mV[VY] = 0.f; @@ -273,7 +273,7 @@ inline void LLVector4::set(F32 x, F32 y, F32 z, F32 w) mV[VW] = w; } -inline void LLVector4::set(const LLVector4 &vec) +inline void LLVector4::set(const LLVector4& vec) { mV[VX] = vec.mV[VX]; mV[VY] = vec.mV[VY]; @@ -281,7 +281,7 @@ inline void LLVector4::set(const LLVector4 &vec) mV[VW] = vec.mV[VW]; } -inline void LLVector4::set(const LLVector3 &vec, F32 w) +inline void LLVector4::set(const LLVector3& vec, F32 w) { mV[VX] = vec.mV[VX]; mV[VY] = vec.mV[VY]; @@ -289,7 +289,7 @@ inline void LLVector4::set(const LLVector3 &vec, F32 w) mV[VW] = w; } -inline void LLVector4::set(const F32 *vec) +inline void LLVector4::set(const F32* vec) { mV[VX] = vec[VX]; mV[VY] = vec[VY]; @@ -317,7 +317,7 @@ inline void LLVector4::setVec(F32 x, F32 y, F32 z, F32 w) } // deprecated -inline void LLVector4::setVec(const LLVector4 &vec) +inline void LLVector4::setVec(const LLVector4& vec) { mV[VX] = vec.mV[VX]; mV[VY] = vec.mV[VY]; @@ -326,7 +326,7 @@ inline void LLVector4::setVec(const LLVector4 &vec) } // deprecated -inline void LLVector4::setVec(const LLVector3 &vec, F32 w) +inline void LLVector4::setVec(const LLVector3& vec, F32 w) { mV[VX] = vec.mV[VX]; mV[VY] = vec.mV[VY]; @@ -335,7 +335,7 @@ inline void LLVector4::setVec(const LLVector3 &vec, F32 w) } // deprecated -inline void LLVector4::setVec(const F32 *vec) +inline void LLVector4::setVec(const F32* vec) { mV[VX] = vec[VX]; mV[VY] = vec[VY]; @@ -345,75 +345,75 @@ inline void LLVector4::setVec(const F32 *vec) // LLVector4 Magnitude and Normalization Functions -inline F32 LLVector4::length(void) const +inline F32 LLVector4::length() const { - return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); } -inline F32 LLVector4::lengthSquared(void) const +inline F32 LLVector4::lengthSquared() const { return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } -inline F32 LLVector4::magVec(void) const +inline F32 LLVector4::magVec() const { - return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); } -inline F32 LLVector4::magVecSquared(void) const +inline F32 LLVector4::magVecSquared() const { return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } // LLVector4 Operators -inline LLVector4 operator+(const LLVector4 &a, const LLVector4 &b) +inline LLVector4 operator+(const LLVector4& a, const LLVector4& b) { LLVector4 c(a); return c += b; } -inline LLVector4 operator-(const LLVector4 &a, const LLVector4 &b) +inline LLVector4 operator-(const LLVector4& a, const LLVector4& b) { LLVector4 c(a); return c -= b; } -inline F32 operator*(const LLVector4 &a, const LLVector4 &b) +inline F32 operator*(const LLVector4& a, const LLVector4& b) { return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]); } -inline LLVector4 operator%(const LLVector4 &a, const LLVector4 &b) +inline LLVector4 operator%(const LLVector4& a, const LLVector4& b) { return LLVector4(a.mV[VY]*b.mV[VZ] - b.mV[VY]*a.mV[VZ], a.mV[VZ]*b.mV[VX] - b.mV[VZ]*a.mV[VX], a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY]); } -inline LLVector4 operator/(const LLVector4 &a, F32 k) +inline LLVector4 operator/(const LLVector4& a, F32 k) { F32 t = 1.f / k; return LLVector4( a.mV[VX] * t, a.mV[VY] * t, a.mV[VZ] * t ); } -inline LLVector4 operator*(const LLVector4 &a, F32 k) +inline LLVector4 operator*(const LLVector4& a, F32 k) { return LLVector4( a.mV[VX] * k, a.mV[VY] * k, a.mV[VZ] * k ); } -inline LLVector4 operator*(F32 k, const LLVector4 &a) +inline LLVector4 operator*(F32 k, const LLVector4& a) { return LLVector4( a.mV[VX] * k, a.mV[VY] * k, a.mV[VZ] * k ); } -inline bool operator==(const LLVector4 &a, const LLVector4 &b) +inline bool operator==(const LLVector4& a, const LLVector4& b) { return ( (a.mV[VX] == b.mV[VX]) &&(a.mV[VY] == b.mV[VY]) &&(a.mV[VZ] == b.mV[VZ])); } -inline bool operator!=(const LLVector4 &a, const LLVector4 &b) +inline bool operator!=(const LLVector4& a, const LLVector4& b) { return ( (a.mV[VX] != b.mV[VX]) ||(a.mV[VY] != b.mV[VY]) @@ -421,7 +421,7 @@ inline bool operator!=(const LLVector4 &a, const LLVector4 &b) ||(a.mV[VW] != b.mV[VW]) ); } -inline const LLVector4& operator+=(LLVector4 &a, const LLVector4 &b) +inline const LLVector4& operator+=(LLVector4& a, const LLVector4& b) { a.mV[VX] += b.mV[VX]; a.mV[VY] += b.mV[VY]; @@ -429,7 +429,7 @@ inline const LLVector4& operator+=(LLVector4 &a, const LLVector4 &b) return a; } -inline const LLVector4& operator-=(LLVector4 &a, const LLVector4 &b) +inline const LLVector4& operator-=(LLVector4& a, const LLVector4& b) { a.mV[VX] -= b.mV[VX]; a.mV[VY] -= b.mV[VY]; @@ -437,14 +437,14 @@ inline const LLVector4& operator-=(LLVector4 &a, const LLVector4 &b) return a; } -inline const LLVector4& operator%=(LLVector4 &a, const LLVector4 &b) +inline const LLVector4& operator%=(LLVector4& a, const LLVector4& b) { LLVector4 ret(a.mV[VY]*b.mV[VZ] - b.mV[VY]*a.mV[VZ], a.mV[VZ]*b.mV[VX] - b.mV[VZ]*a.mV[VX], a.mV[VX]*b.mV[VY] - b.mV[VX]*a.mV[VY]); a = ret; return a; } -inline const LLVector4& operator*=(LLVector4 &a, F32 k) +inline const LLVector4& operator*=(LLVector4& a, F32 k) { a.mV[VX] *= k; a.mV[VY] *= k; @@ -452,7 +452,7 @@ inline const LLVector4& operator*=(LLVector4 &a, F32 k) return a; } -inline const LLVector4& operator/=(LLVector4 &a, F32 k) +inline const LLVector4& operator/=(LLVector4& a, F32 k) { F32 t = 1.f / k; a.mV[VX] *= t; @@ -461,24 +461,24 @@ inline const LLVector4& operator/=(LLVector4 &a, F32 k) return a; } -inline LLVector4 operator-(const LLVector4 &a) +inline LLVector4 operator-(const LLVector4& a) { return LLVector4( -a.mV[VX], -a.mV[VY], -a.mV[VZ] ); } -inline F32 dist_vec(const LLVector4 &a, const LLVector4 &b) +inline F32 dist_vec(const LLVector4& a, const LLVector4& b) { LLVector4 vec = a - b; return (vec.length()); } -inline F32 dist_vec_squared(const LLVector4 &a, const LLVector4 &b) +inline F32 dist_vec_squared(const LLVector4& a, const LLVector4& b) { LLVector4 vec = a - b; return (vec.lengthSquared()); } -inline LLVector4 lerp(const LLVector4 &a, const LLVector4 &b, F32 u) +inline LLVector4 lerp(const LLVector4& a, const LLVector4& b, F32 u) { return LLVector4( a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, @@ -487,9 +487,9 @@ inline LLVector4 lerp(const LLVector4 &a, const LLVector4 &b, F32 u) a.mV[VW] + (b.mV[VW] - a.mV[VW]) * u); } -inline F32 LLVector4::normalize(void) +inline F32 LLVector4::normalize() { - F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 oomag; if (mag > FP_MAG_THRESHOLD) @@ -501,18 +501,18 @@ inline F32 LLVector4::normalize(void) } else { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; - mag = 0; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; + mag = 0.f; } return (mag); } // deprecated -inline F32 LLVector4::normVec(void) +inline F32 LLVector4::normVec() { - F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 oomag; if (mag > FP_MAG_THRESHOLD) @@ -524,22 +524,23 @@ inline F32 LLVector4::normVec(void) } else { - mV[0] = 0.f; - mV[1] = 0.f; - mV[2] = 0.f; - mag = 0; + mV[VX] = 0.f; + mV[VY] = 0.f; + mV[VZ] = 0.f; + mag = 0.f; } return (mag); } // Because apparently some parts of the viewer use this for color info. -inline const LLVector4 srgbVector4(const LLVector4 &a) { +inline const LLVector4 srgbVector4(const LLVector4& a) +{ LLVector4 srgbColor; - srgbColor.mV[0] = linearTosRGB(a.mV[0]); - srgbColor.mV[1] = linearTosRGB(a.mV[1]); - srgbColor.mV[2] = linearTosRGB(a.mV[2]); - srgbColor.mV[3] = a.mV[3]; + srgbColor.mV[VX] = linearTosRGB(a.mV[VX]); + srgbColor.mV[VY] = linearTosRGB(a.mV[VY]); + srgbColor.mV[VZ] = linearTosRGB(a.mV[VZ]); + srgbColor.mV[VW] = a.mV[VW]; return srgbColor; } diff --git a/indra/llprimitive/object_flags.h b/indra/llprimitive/object_flags.h index e2cdba072a..06e216ba49 100644 --- a/indra/llprimitive/object_flags.h +++ b/indra/llprimitive/object_flags.h @@ -57,16 +57,16 @@ const U32 FLAGS_CAMERA_SOURCE = (1U << 22); //const U32 FLAGS_UNUSED_001 = (1U << 23); // was FLAGS_CAST_SHADOWS -//const U32 FLAGS_UNUSED_002 = (1U << 24); -//const U32 FLAGS_UNUSED_003 = (1U << 25); -//const U32 FLAGS_UNUSED_004 = (1U << 26); -//const U32 FLAGS_UNUSED_005 = (1U << 27); +const U32 FLAGS_SERVER_AUTOPILOT = (1U << 24); // Update was for an agent AND that agent is being autopiloted from the server +//const U32 FLAGS_UNUSED_002 = (1U << 25); +//const U32 FLAGS_UNUSED_003 = (1U << 26); +//const U32 FLAGS_UNUSED_004 = (1U << 27); const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28); const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29); -//const U32 FLAGS_UNUSED_006 = (1U << 30); // was FLAGS_TEMPORARY -//const U32 FLAGS_UNUSED_007 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED +//const U32 FLAGS_UNUSED_005 = (1U << 30); // was FLAGS_TEMPORARY +//const U32 FLAGS_UNUSED_006 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; const U32 FLAGS_WORLD = FLAGS_USE_PHYSICS | FLAGS_PHANTOM | FLAGS_TEMPORARY_ON_REZ; diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index ccff7c7a8c..04401e9bea 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -10,7 +10,6 @@ include(LLImage) include(LLWindow) set(llrender_SOURCE_FILES - llatmosphere.cpp llcubemap.cpp llcubemaparray.cpp llfontbitmapcache.cpp @@ -23,7 +22,6 @@ set(llrender_SOURCE_FILES llglslshader.cpp llgltexture.cpp llimagegl.cpp - llpostprocess.cpp llrender.cpp llrender2dutils.cpp llrendernavprim.cpp @@ -40,7 +38,6 @@ set(llrender_SOURCE_FILES set(llrender_HEADER_FILES CMakeLists.txt - llatmosphere.h llcubemap.h llcubemaparray.h llfontgl.h @@ -56,7 +53,6 @@ set(llrender_HEADER_FILES llgltexture.h llgltypes.h llimagegl.h - llpostprocess.h llrender.h llrender2dutils.h llrendernavprim.h diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp deleted file mode 100644 index eae5623a3c..0000000000 --- a/indra/llrender/llatmosphere.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/** - * @file llatmosphere.cpp - * @brief LLAtmosphere integration impl - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2018, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llatmosphere.h" -#include "llfasttimer.h" -#include "llsys.h" -#include "llglheaders.h" -#include "llrender.h" -#include "llshadermgr.h" -#include "llglslshader.h" - -LLAtmosphere* gAtmosphere = nullptr; - -// Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column -// (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html), -// summed and averaged in each bin (e.g. the value for 360nm is the average -// of the ASTM G-173 values for all wavelengths between 360 and 370nm). -// Values in W.m^-2. -const int kLambdaMin = 360; -const int kLambdaMax = 830; -const double kSolarIrradiance[48] = { - 1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253, - 1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298, - 1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533, - 1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482, - 1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082, - 1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992 -}; - -// Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/ -// referencespectra/o3spectra2011/index.html for 233K, summed and averaged in -// each bin (e.g. the value for 360nm is the average of the original values -// for all wavelengths between 360 and 370nm). Values in m^2. -const double kOzoneCrossSection[48] = { - 1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27, - 8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26, - 1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25, - 4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25, - 2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26, - 6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26, - 2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27 -}; - -// From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2. -const double kDobsonUnit = 2.687e20; -// Maximum number density of ozone molecules, in m^-3 (computed so at to get -// 300 Dobson units of ozone - for this we divide 300 DU by the integral of -// the ozone density profile defined below, which is equal to 15km). -const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0; -const double kRayleigh = 1.24062e-6; -const double kRayleighScaleHeight = 8000.0; -const double kMieScaleHeight = 1200.0; -const double kMieAngstromAlpha = 0.0; -const double kMieAngstromBeta = 5.328e-3; -const double kMieSingleScatteringAlbedo = 0.9; -const double kGroundAlbedo = 0.1; - -AtmosphericModelSettings::AtmosphericModelSettings() - : m_skyBottomRadius(6360.0f) - , m_skyTopRadius(6420.0f) - , m_sunArcRadians(0.00045f) - , m_mieAnisotropy(0.8f) -{ - DensityLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); - DensityLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); - - m_rayleighProfile.push_back(rayleigh_density); - m_mieProfile.push_back(mie_density); - - // Density profile increasing linearly from 0 to 1 between 10 and 25km, and - // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate - // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/ - // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10). - m_absorptionProfile.push_back(DensityLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); - m_absorptionProfile.push_back(DensityLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); -} - -AtmosphericModelSettings::AtmosphericModelSettings( - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile) -: m_skyBottomRadius(6360.0f) -, m_skyTopRadius(6420.0f) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(0.00045f) -, m_mieAnisotropy(0.8f) -{ -} - -AtmosphericModelSettings::AtmosphericModelSettings( - F32 skyBottomRadius, - F32 skyTopRadius, - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile, - F32 sunArcRadians, - F32 mieAniso) -: m_skyBottomRadius(skyBottomRadius) -, m_skyTopRadius(skyTopRadius) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(sunArcRadians) -, m_mieAnisotropy(mieAniso) -{ -} - -bool AtmosphericModelSettings::operator==(const AtmosphericModelSettings& rhs) const -{ - if (m_skyBottomRadius != rhs.m_skyBottomRadius) - { - return false; - } - - if (m_skyTopRadius != rhs.m_skyTopRadius) - { - return false; - } - - if (m_sunArcRadians != rhs.m_sunArcRadians) - { - return false; - } - - if (m_mieAnisotropy != rhs.m_mieAnisotropy) - { - return false; - } - - if (m_rayleighProfile != rhs.m_rayleighProfile) - { - return false; - } - - if (m_mieProfile != rhs.m_mieProfile) - { - return false; - } - - if (m_absorptionProfile != rhs.m_absorptionProfile) - { - return false; - } - - return true; -} - -void LLAtmosphere::initClass() -{ - if (!gAtmosphere) - { - gAtmosphere = new LLAtmosphere; - } -} - -void LLAtmosphere::cleanupClass() -{ - if(gAtmosphere) - { - delete gAtmosphere; - } - gAtmosphere = NULL; -} - -LLAtmosphere::LLAtmosphere() -{ - for (int l = kLambdaMin; l <= kLambdaMax; l += 10) - { - double lambda = static_cast<double>(l) * 1e-3; // micro-meters - double mie = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha); - m_wavelengths.push_back(l); - m_solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]); - m_rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4)); - m_mie_scattering.push_back(mie * kMieSingleScatteringAlbedo); - m_mie_extinction.push_back(mie); - m_absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]); - m_ground_albedo.push_back(kGroundAlbedo); - } - - AtmosphericModelSettings defaults; - configureAtmosphericModel(defaults); -} - -LLAtmosphere::~LLAtmosphere() -{ - // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same. - if (m_transmittance) - { - m_transmittance->setTexName(0); - } - - if (m_scattering) - { - m_scattering->setTexName(0); - } - - if (m_mie_scatter_texture) - { - m_mie_scatter_texture->setTexName(0); - } -} - -bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) -{ - // TBD - return true; -} - -LLGLTexture* LLAtmosphere::getTransmittance() -{ - if (!m_transmittance) - { - m_transmittance = new LLGLTexture; - m_transmittance->generateGLTexture(); - m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_transmittance; -} - -LLGLTexture* LLAtmosphere::getScattering() -{ - if (!m_scattering) - { - m_scattering = new LLGLTexture; - m_scattering->generateGLTexture(); - m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_scattering; -} - -LLGLTexture* LLAtmosphere::getMieScattering() -{ - if (!m_mie_scatter_texture) - { - m_mie_scatter_texture = new LLGLTexture; - m_mie_scatter_texture->generateGLTexture(); - m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_mie_scatter_texture; -} - -LLGLTexture* LLAtmosphere::getIlluminance() -{ - if (!m_illuminance) - { - m_illuminance = new LLGLTexture; - m_illuminance->generateGLTexture(); - m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_illuminance; -} diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h deleted file mode 100644 index 4b8c7d0819..0000000000 --- a/indra/llrender/llatmosphere.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file llatmosphere.h - * @brief LLAtmosphere class - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2018, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_ATMOSPHERE_H -#define LL_ATMOSPHERE_H - -#include "llglheaders.h" -#include "llgltexture.h" - -// An atmosphere layer of width 'width' (in m), and whose density is defined as -// 'exp_term' * exp('exp_scale' * h) + 'linear_term' * h + 'constant_term', -// clamped to [0,1], and where h is the altitude (in m). 'exp_term' and -// 'constant_term' are unitless, while 'exp_scale' and 'linear_term' are in -// m^-1. -class DensityLayer { - public: - DensityLayer() - : width(0.0f) - , exp_term(0.0f) - , exp_scale(0.0f) - , linear_term(0.0f) - , constant_term(0.0f) - { - } - - DensityLayer(float width, float exp_term, float exp_scale, float linear_term, float constant_term) - : width(width) - , exp_term(exp_term) - , exp_scale(exp_scale) - , linear_term(linear_term) - , constant_term(constant_term) - { - } - - bool operator==(const DensityLayer& rhs) const - { - if (width != rhs.width) - { - return false; - } - - if (exp_term != rhs.exp_term) - { - return false; - } - - if (exp_scale != rhs.exp_scale) - { - return false; - } - - if (linear_term != rhs.linear_term) - { - return false; - } - - if (constant_term != rhs.constant_term) - { - return false; - } - - return true; - } - - float width = 1024.0f; - float exp_term = 1.0f; - float exp_scale = 1.0f; - float linear_term = 1.0f; - float constant_term = 0.0f; -}; - -typedef std::vector<DensityLayer> DensityProfile; - -class AtmosphericModelSettings -{ -public: - AtmosphericModelSettings(); - - AtmosphericModelSettings( - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile); - - AtmosphericModelSettings( - F32 skyBottomRadius, - F32 skyTopRadius, - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile, - F32 sunArcRadians, - F32 mieAniso); - - bool operator==(const AtmosphericModelSettings& rhs) const; - - F32 m_skyBottomRadius; - F32 m_skyTopRadius; - DensityProfile m_rayleighProfile; - DensityProfile m_mieProfile; - DensityProfile m_absorptionProfile; - F32 m_sunArcRadians; - F32 m_mieAnisotropy; -}; - -class LLAtmosphere -{ -public: - LLAtmosphere(); - ~LLAtmosphere(); - - static void initClass(); - static void cleanupClass(); - - const LLAtmosphere& operator=(const LLAtmosphere& rhs) - { - LL_ERRS() << "Illegal operation!" << LL_ENDL; - return *this; - } - - LLGLTexture* getTransmittance(); - LLGLTexture* getScattering(); - LLGLTexture* getMieScattering(); - LLGLTexture* getIlluminance(); - - bool configureAtmosphericModel(AtmosphericModelSettings& settings); - -protected: - LLAtmosphere(const LLAtmosphere& rhs) - { - *this = rhs; - } - - LLPointer<LLGLTexture> m_transmittance; - LLPointer<LLGLTexture> m_scattering; - LLPointer<LLGLTexture> m_mie_scatter_texture; - LLPointer<LLGLTexture> m_illuminance; - - std::vector<double> m_wavelengths; - std::vector<double> m_solar_irradiance; - std::vector<double> m_rayleigh_scattering; - std::vector<double> m_mie_scattering; - std::vector<double> m_mie_extinction; - std::vector<double> m_absorption_extinction; - std::vector<double> m_ground_albedo; - - AtmosphericModelSettings m_settings; -}; - -extern LLAtmosphere* gAtmosphere; - -#endif // LL_ATMOSPHERE_H diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index fa76669258..019fb07152 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -58,9 +58,9 @@ FT_Render_Mode gFontRenderMode = FT_RENDER_MODE_NORMAL; -LLFontManager *gFontManagerp = NULL; +LLFontManager *gFontManagerp = nullptr; -FT_Library gFTLibrary = NULL; +FT_Library gFTLibrary = nullptr; //static void LLFontManager::initClass() @@ -75,7 +75,7 @@ void LLFontManager::initClass() void LLFontManager::cleanupClass() { delete gFontManagerp; - gFontManagerp = NULL; + gFontManagerp = nullptr; } LLFontManager::LLFontManager() @@ -103,6 +103,7 @@ LLFontManager::LLFontManager() LLFontManager::~LLFontManager() { FT_Done_FreeType(gFTLibrary); + unloadAllFonts(); } @@ -141,12 +142,8 @@ LLFontFreetype::LLFontFreetype() mAscender(0.f), mDescender(0.f), mLineHeight(0.f), -#ifdef LL_WINDOWS - pFileStream(NULL), - pFtStream(NULL), -#endif mIsFallback(false), - mFTFace(NULL), + mFTFace(nullptr), mRenderGlyphCount(0), mAddGlyphCount(0), mStyle(0), @@ -160,35 +157,16 @@ LLFontFreetype::~LLFontFreetype() // Clean up freetype libs. if (mFTFace) FT_Done_Face(mFTFace); - mFTFace = NULL; + mFTFace = nullptr; // Delete glyph info std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); mCharGlyphInfoMap.clear(); -#ifdef LL_WINDOWS - delete pFileStream; // closed by FT_Done_Face - delete pFtStream; -#endif delete mFontBitmapCachep; // mFallbackFonts cleaned up by LLPointer destructor } -#ifdef LL_WINDOWS -unsigned long ft_read_cb(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count) { - if (count <= 0) return count; - llifstream *file_stream = static_cast<llifstream *>(stream->descriptor.pointer); - file_stream->seekg(offset, std::ios::beg); - file_stream->read((char*)buffer, count); - return (unsigned long)file_stream->gcount(); -} - -void ft_close_cb(FT_Stream stream) { - llifstream *file_stream = static_cast<llifstream *>(stream->descriptor.pointer); - file_stream->close(); -} -#endif - bool LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 vert_dpi, F32 horz_dpi, bool is_fallback, S32 face_n) { // Don't leak face objects. This is also needed to deal with @@ -196,26 +174,21 @@ bool LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v if (mFTFace) { FT_Done_Face(mFTFace); - mFTFace = NULL; + mFTFace = nullptr; } - int error; -#ifdef LL_WINDOWS - error = ftOpenFace(filename, face_n); -#else - error = FT_New_Face( gFTLibrary, - filename.c_str(), - 0, - &mFTFace); -#endif + FT_Open_Args openArgs; + memset( &openArgs, 0, sizeof( openArgs ) ); + openArgs.memory_base = gFontManagerp->loadFont( filename, openArgs.memory_size ); + + if( !openArgs.memory_base ) + return false; + + openArgs.flags = FT_OPEN_MEMORY; + int error = FT_Open_Face( gFTLibrary, &openArgs, 0, &mFTFace ); if (error) - { -#ifdef LL_WINDOWS - clearFontStreams(); -#endif return false; - } mIsFallback = is_fallback; F32 pixels_per_em = (point_size / 72.f)*vert_dpi; // Size in inches * dpi @@ -230,10 +203,8 @@ bool LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v { // Clean up freetype libs. FT_Done_Face(mFTFace); -#ifdef LL_WINDOWS - clearFontStreams(); -#endif - mFTFace = NULL; + + mFTFace = nullptr; return false; } @@ -289,73 +260,30 @@ S32 LLFontFreetype::getNumFaces(const std::string& filename) if (mFTFace) { FT_Done_Face(mFTFace); - mFTFace = NULL; + mFTFace = nullptr; } S32 num_faces = 1; -#ifdef LL_WINDOWS - int error = ftOpenFace(filename, 0); + FT_Open_Args openArgs; + memset( &openArgs, 0, sizeof( openArgs ) ); + openArgs.memory_base = gFontManagerp->loadFont( filename, openArgs.memory_size ); + if( !openArgs.memory_base ) + return 0; + openArgs.flags = FT_OPEN_MEMORY; + int error = FT_Open_Face( gFTLibrary, &openArgs, 0, &mFTFace ); if (error) - { return 0; - } else - { num_faces = mFTFace->num_faces; - } FT_Done_Face(mFTFace); - clearFontStreams(); - mFTFace = NULL; -#endif + mFTFace = nullptr; return num_faces; } -#ifdef LL_WINDOWS -S32 LLFontFreetype::ftOpenFace(const std::string& filename, S32 face_n) -{ - S32 error = -1; - pFileStream = new llifstream(filename, std::ios::binary); - if (pFileStream->is_open()) - { - std::streampos beg = pFileStream->tellg(); - pFileStream->seekg(0, std::ios::end); - std::streampos end = pFileStream->tellg(); - std::size_t file_size = end - beg; - pFileStream->seekg(0, std::ios::beg); - - pFtStream = new LLFT_Stream(); - pFtStream->base = 0; - pFtStream->pos = 0; - pFtStream->size = static_cast<unsigned long>(file_size); - pFtStream->descriptor.pointer = pFileStream; - pFtStream->read = ft_read_cb; - pFtStream->close = ft_close_cb; - - FT_Open_Args args; - args.flags = FT_OPEN_STREAM; - args.stream = (FT_StreamRec*)pFtStream; - error = FT_Open_Face(gFTLibrary, &args, face_n, &mFTFace); - } - return error; -} - -void LLFontFreetype::clearFontStreams() -{ - if (pFileStream) - { - pFileStream->close(); - } - delete pFileStream; - delete pFtStream; - pFileStream = NULL; - pFtStream = NULL; -} -#endif - void LLFontFreetype::addFallbackFont(const LLPointer<LLFontFreetype>& fallback_font, const char_functor_t& functor) { @@ -379,7 +307,7 @@ F32 LLFontFreetype::getDescenderHeight() const F32 LLFontFreetype::getXAdvance(llwchar wch) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; // Return existing info only if it is current @@ -403,7 +331,7 @@ F32 LLFontFreetype::getXAdvance(llwchar wch) const F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; return glyph->mXAdvance; @@ -411,7 +339,7 @@ F32 LLFontFreetype::getXAdvance(const LLFontGlyphInfo* glyph) const F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; //llassert(!mIsFallback); @@ -430,7 +358,7 @@ F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const F32 LLFontFreetype::getXKerning(const LLFontGlyphInfo* left_glyph_info, const LLFontGlyphInfo* right_glyph_info) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return 0.0; U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0; @@ -453,7 +381,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch, EFontGlyphType glyph_type { if (!mFTFace) { - return NULL; + return nullptr; } llassert(!mIsFallback); @@ -544,14 +472,14 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch, EFontGlyphType glyph_type { return addGlyphFromFont(this, wch, glyph_index, glyph_type); } - return NULL; + return nullptr; } LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index, EFontGlyphType requested_glyph_type) const { LL_PROFILE_ZONE_SCOPED; - if (mFTFace == NULL) - return NULL; + if (mFTFace == nullptr) + return nullptr; llassert(!mIsFallback); fontp->renderGlyph(requested_glyph_type, glyph_index); @@ -604,7 +532,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l { U8 *buffer_data = fontp->mFTFace->glyph->bitmap.buffer; S32 buffer_row_stride = fontp->mFTFace->glyph->bitmap.pitch; - U8 *tmp_graydata = NULL; + U8 *tmp_graydata = nullptr; if (fontp->mFTFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) @@ -701,7 +629,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const void LLFontFreetype::renderGlyph(EFontGlyphType bitmap_type, U32 glyph_index) const { - if (mFTFace == NULL) + if (mFTFace == nullptr) return; FT_Int32 load_flags = FT_LOAD_FORCE_AUTOHINT; @@ -886,3 +814,58 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 } } + +namespace ll +{ + namespace fonts + { + class LoadedFont + { + public: + LoadedFont( std::string aName , std::string const &aAddress, std::size_t aSize ) + : mAddress( aAddress ) + { + mName = aName; + mSize = aSize; + mRefs = 1; + } + std::string mName; + std::string mAddress; + std::size_t mSize; + U32 mRefs; + }; + } +} + +U8 const* LLFontManager::loadFont( std::string const &aFilename, long &a_Size) +{ + a_Size = 0; + std::map< std::string, std::shared_ptr<ll::fonts::LoadedFont> >::iterator itr = m_LoadedFonts.find( aFilename ); + if( itr != m_LoadedFonts.end() ) + { + ++itr->second->mRefs; + // A possible overflow cannot happen here, as it is asserted that the size is less than std::numeric_limits<long>::max() a few lines below. + a_Size = static_cast<long>(itr->second->mSize); + return reinterpret_cast<U8 const*>(itr->second->mAddress.c_str()); + } + + auto strContent = LLFile::getContents(aFilename); + + if( strContent.empty() ) + return nullptr; + + // For fontconfig a type of long is required, std::string::size() returns size_t. I think it is safe to limit this to 2GiB and not support fonts that huge (can that even be a thing?) + llassert_always( strContent.size() < std::numeric_limits<long>::max() ); + + a_Size = static_cast<long>(strContent.size()); + + auto pCache = std::make_shared<ll::fonts::LoadedFont>( aFilename, strContent, a_Size ); + itr = m_LoadedFonts.insert( std::make_pair( aFilename, pCache ) ).first; + + return reinterpret_cast<U8 const*>(itr->second->mAddress.c_str()); +} + +void LLFontManager::unloadAllFonts() +{ + m_LoadedFonts.clear(); +} diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index eba89f5def..7173da5238 100644 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -43,15 +43,28 @@ typedef struct FT_FaceRec_* LLFT_Face; struct FT_StreamRec_; typedef struct FT_StreamRec_ LLFT_Stream; +namespace ll +{ + namespace fonts + { + class LoadedFont; + } +} + class LLFontManager { public: static void initClass(); static void cleanupClass(); + U8 const *loadFont( std::string const &aFilename, long &a_Size ); + private: LLFontManager(); ~LLFontManager(); + + void unloadAllFonts(); + std::map< std::string, std::shared_ptr<ll::fonts::LoadedFont> > m_LoadedFonts; }; struct LLFontGlyphInfo @@ -90,11 +103,6 @@ public: S32 getNumFaces(const std::string& filename); -#ifdef LL_WINDOWS - S32 ftOpenFace(const std::string& filename, S32 face_n); - void clearFontStreams(); -#endif - typedef std::function<bool(llwchar)> char_functor_t; void addFallbackFont(const LLPointer<LLFontFreetype>& fallback_font, const char_functor_t& functor = nullptr); @@ -170,11 +178,6 @@ private: LLFT_Face mFTFace; -#ifdef LL_WINDOWS - llifstream *pFileStream; - LLFT_Stream *pFtStream; -#endif - bool mIsFallback; typedef std::pair<LLPointer<LLFontFreetype>, char_functor_t> fallback_font_t; typedef std::vector<fallback_font_t> fallback_font_vector_t; diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 94daba0817..97be43cf86 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -270,7 +270,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons const LLFontGlyphInfo* next_glyph = NULL; - static constexpr S32 GLYPH_BATCH_SIZE = 30; + static constexpr U32 GLYPH_BATCH_SIZE = 30; static thread_local LLVector4a vertices[GLYPH_BATCH_SIZE * 6]; static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 6]; static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 6]; @@ -281,7 +281,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons LLColor4U emoji_color(255, 255, 255, text_color.mV[VALPHA]); std::pair<EFontGlyphType, S32> bitmap_entry = std::make_pair(EFontGlyphType::Grayscale, -1); - S32 glyph_count = 0; + U32 glyph_count = 0; for (i = begin_offset; i < begin_offset + length; i++) { llwchar wch = wstr[i]; @@ -404,7 +404,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons { // recursively render ellipses at end of string // we've already reserved enough room - gGL.pushUIMatrix(); static LLWString elipses_wstr(utf8string_to_wstring(std::string("..."))); render(elipses_wstr, 0, @@ -417,7 +416,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons right_x, false, use_color); - gGL.popUIMatrix(); } gGL.popUIMatrix(); @@ -1262,7 +1260,7 @@ void LLFontGL::renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor colors_out[index] = color; } -void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const +void LLFontGL::drawGlyph(U32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const { F32 slant_offset; slant_offset = ((style & ITALIC) ? ( -mFontFreetype->getAscenderHeight() * 0.2f) : 0.f); diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 4bb6c55c65..a257d94512 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -239,7 +239,7 @@ private: LLPointer<LLFontFreetype> mFontFreetype; void renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const; - void drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const; + void drawGlyph(U32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const; // Registry holds all instantiated fonts. static LLFontRegistry* sFontRegistry; diff --git a/indra/llrender/llfontvertexbuffer.cpp b/indra/llrender/llfontvertexbuffer.cpp index 392f235aad..963aab7121 100644 --- a/indra/llrender/llfontvertexbuffer.cpp +++ b/indra/llrender/llfontvertexbuffer.cpp @@ -31,6 +31,8 @@ #include "llvertexbuffer.h" +bool LLFontVertexBuffer::sEnableBufferCollection = true; + LLFontVertexBuffer::LLFontVertexBuffer() { } @@ -119,6 +121,11 @@ S32 LLFontVertexBuffer::render( { return static_cast<S32>(text.length()); } + if (!sEnableBufferCollection) + { + // For debug purposes and performance testing + return fontp->render(text, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color); + } if (mBufferList.empty()) { genBuffers(fontp, text, begin_offset, x, y, color, halign, valign, @@ -202,6 +209,17 @@ void LLFontVertexBuffer::renderBuffers() gGL.flush(); // deliberately empty pending verts gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.pushUIMatrix(); + + gGL.loadUIIdentity(); + + // Depth translation, so that floating text appears 'in-world' + // and is correctly occluded. + gGL.translatef(0.f, 0.f, LLFontGL::sCurDepth); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + + // Note: ellipses should technically be covered by push/load/translate of their own + // but it's more complexity, values do not change, skipping doesn't appear to break + // anything, so we can skip that until it proves to cause issues. for (LLVertexBufferData& buffer : mBufferList) { buffer.draw(); diff --git a/indra/llrender/llfontvertexbuffer.h b/indra/llrender/llfontvertexbuffer.h index 67cf2ca13c..59cb536b74 100644 --- a/indra/llrender/llfontvertexbuffer.h +++ b/indra/llrender/llfontvertexbuffer.h @@ -78,6 +78,8 @@ public: F32* right_x = NULL, bool use_ellipses = false, bool use_color = true); + + static void enableBufferCollection(bool enable) { sEnableBufferCollection = enable; } private: void genBuffers(const LLFontGL* fontp, @@ -114,6 +116,8 @@ private: F32 mLastScaleX = 1.f; F32 mLastScaleY = 1.f; LLCoordGL mLastOrigin; + + static bool sEnableBufferCollection; }; #endif diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 15fb289de3..b4fe711859 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -994,9 +994,6 @@ LLGLManager::LLGLManager() : mIsAMD(false), mIsNVIDIA(false), mIsIntel(false), -#if LL_DARWIN - mIsMobileGF(false), -#endif mHasRequirements(true), mDriverVersionMajor(1), mDriverVersionMinor(0), @@ -1038,7 +1035,6 @@ void LLGLManager::initWGL() GLH_EXT_NAME(wglGetGPUIDsAMD) = (PFNWGLGETGPUIDSAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUIDsAMD"); GLH_EXT_NAME(wglGetGPUInfoAMD) = (PFNWGLGETGPUINFOAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUInfoAMD"); } - mHasNVXGpuMemoryInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts); if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts)) { @@ -1144,7 +1140,11 @@ bool LLGLManager::initGL() // Trailing space necessary to keep "nVidia Corpor_ati_on" cards // from being recognized as ATI. // NOTE: AMD has been pretty good about not breaking this check, do not rename without good reason - if (mGLVendor.substr(0,4) == "ATI ") + if (mGLVendor.substr(0,4) == "ATI " +#if LL_LINUX + || mGLVendor.find("AMD") != std::string::npos +#endif //LL_LINUX + ) { mGLVendorShort = "AMD"; // *TODO: Fix this? @@ -1210,8 +1210,10 @@ bool LLGLManager::initGL() { LL_WARNS("RenderInit") << "VRAM Detected (AMDAssociations):" << mVRAM << LL_ENDL; } - } - else if (mHasNVXGpuMemoryInfo) + } else +#endif +#if LL_WINDOWS || LL_LINUX + if (mHasNVXGpuMemoryInfo) { GLint mem_kb = 0; glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &mem_kb); @@ -1429,6 +1431,10 @@ void LLGLManager::initExtensions() mHasTransformFeedback = mGLVersion >= 3.99f; mHasDebugOutput = mGLVersion >= 4.29f; +#if LL_WINDOWS || LL_LINUX + mHasNVXGpuMemoryInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts); +#endif + // Misc glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange); glGetIntegerv(GL_MAX_ELEMENTS_INDICES, (GLint*) &mGLMaxIndexRange); diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index f5b1e8d786..08cf662526 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -107,11 +107,6 @@ public: // hints to the render pipe U32 mDownScaleMethod = 0; // see settings.xml RenderDownScaleMethod -#if LL_DARWIN - // Needed to distinguish problem cards on older Macs that break with Materials - bool mIsMobileGF; -#endif - // Whether this version of GL is good enough for SL to use bool mHasRequirements; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp deleted file mode 100644 index eef7193c92..0000000000 --- a/indra/llrender/llpostprocess.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/** - * @file llpostprocess.cpp - * @brief LLPostProcess class implementation - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llpostprocess.h" -#include "llglslshader.h" -#include "llsdserialize.h" -#include "llrender.h" - -static LLStaticHashedString sRenderTexture("RenderTexture"); -static LLStaticHashedString sBrightness("brightness"); -static LLStaticHashedString sContrast("contrast"); -static LLStaticHashedString sContrastBase("contrastBase"); -static LLStaticHashedString sSaturation("saturation"); -static LLStaticHashedString sLumWeights("lumWeights"); -static LLStaticHashedString sNoiseTexture("NoiseTexture"); -static LLStaticHashedString sBrightMult("brightMult"); -static LLStaticHashedString sNoiseStrength("noiseStrength"); -static LLStaticHashedString sExtractLow("extractLow"); -static LLStaticHashedString sExtractHigh("extractHigh"); -static LLStaticHashedString sBloomStrength("bloomStrength"); -static LLStaticHashedString sTexelSize("texelSize"); -static LLStaticHashedString sBlurDirection("blurDirection"); -static LLStaticHashedString sBlurWidth("blurWidth"); - -LLPostProcess * gPostProcess = NULL; - -static const unsigned int NOISE_SIZE = 512; - -LLPostProcess::LLPostProcess(void) : - initialized(false), - mAllEffects(LLSD::emptyMap()), - screenW(1), screenH(1) -{ - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - mTempBloomTexture = NULL ; - - noiseTextureScale = 1.0f; - - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; - - llifstream effectsXML(pathName); - - if (effectsXML) - { - LLPointer<LLSDParser> parser = new LLSDXMLParser(); - - parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); - } - - if (!mAllEffects.has("default")) - { - LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); - - defaultEffect["enable_night_vision"] = LLSD::Boolean(false); - defaultEffect["enable_bloom"] = LLSD::Boolean(false); - defaultEffect["enable_color_filter"] = LLSD::Boolean(false); - - /// NVG Defaults - defaultEffect["brightness_multiplier"] = 3.0; - defaultEffect["noise_size"] = 25.0; - defaultEffect["noise_strength"] = 0.4; - - // TODO BTest potentially add this to tweaks? - noiseTextureScale = 1.0f; - - /// Bloom Defaults - defaultEffect["extract_low"] = 0.95; - defaultEffect["extract_high"] = 1.0; - defaultEffect["bloom_width"] = 2.25; - defaultEffect["bloom_strength"] = 1.5; - - /// Color Filter Defaults - defaultEffect["brightness"] = 1.0; - defaultEffect["contrast"] = 1.0; - defaultEffect["saturation"] = 1.0; - - LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(1.0); - contrastBase.append(0.5); - } - - setSelectedEffect("default"); - */ -} - -LLPostProcess::~LLPostProcess(void) -{ - invalidate() ; -} - -// static -void LLPostProcess::initClass(void) -{ - //this will cause system to crash at second time login - //if first time login fails due to network connection --- bao - //***llassert_always(gPostProcess == NULL); - //replaced by the following line: - if(gPostProcess) - return ; - - - gPostProcess = new LLPostProcess(); -} - -// static -void LLPostProcess::cleanupClass() -{ - delete gPostProcess; - gPostProcess = NULL; -} - -void LLPostProcess::setSelectedEffect(std::string const & effectName) -{ - mSelectedEffectName = effectName; - static_cast<LLSD &>(tweaks) = mAllEffects[effectName]; -} - -void LLPostProcess::saveEffect(std::string const & effectName) -{ - /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. - mAllEffects[effectName] = tweaks; - - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; - - llofstream effectsXML(pathName); - - LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); - - formatter->format(mAllEffects, effectsXML); - */ -} -void LLPostProcess::invalidate() -{ - mSceneRenderTexture = NULL ; - mNoiseTexture = NULL ; - mTempBloomTexture = NULL ; - initialized = false ; -} - -void LLPostProcess::apply(unsigned int width, unsigned int height) -{ - if (!initialized || width != screenW || height != screenH){ - initialize(width, height); - } - if (shadersEnabled()){ - doEffects(); - } -} - -void LLPostProcess::initialize(unsigned int width, unsigned int height) -{ - screenW = width; - screenH = height; - createTexture(mSceneRenderTexture, screenW, screenH); - initialized = true; - - checkError(); - createNightVisionShader(); - createBloomShader(); - createColorFilterShader(); - checkError(); -} - -inline bool LLPostProcess::shadersEnabled(void) -{ - return (tweaks.useColorFilter().asBoolean() || - tweaks.useNightVisionShader().asBoolean() || - tweaks.useBloomShader().asBoolean() ); - -} - -void LLPostProcess::applyShaders(void) -{ - if (tweaks.useColorFilter()){ - applyColorFilterShader(); - checkError(); - } - if (tweaks.useNightVisionShader()){ - /// If any of the above shaders have been called update the frame buffer; - if (tweaks.useColorFilter()) - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - applyNightVisionShader(); - checkError(); - } - if (tweaks.useBloomShader()){ - /// If any of the above shaders have been called update the frame buffer; - if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()) - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - applyBloomShader(); - checkError(); - } -} - -void LLPostProcess::applyColorFilterShader(void) -{ - -} - -void LLPostProcess::createColorFilterShader(void) -{ - /// Define uniform names - colorFilterUniforms[sRenderTexture] = 0; - colorFilterUniforms[sBrightness] = 0; - colorFilterUniforms[sContrast] = 0; - colorFilterUniforms[sContrastBase] = 0; - colorFilterUniforms[sSaturation] = 0; - colorFilterUniforms[sLumWeights] = 0; -} - -void LLPostProcess::applyNightVisionShader(void) -{ - -} - -void LLPostProcess::createNightVisionShader(void) -{ - /// Define uniform names - nightVisionUniforms[sRenderTexture] = 0; - nightVisionUniforms[sNoiseTexture] = 0; - nightVisionUniforms[sBrightMult] = 0; - nightVisionUniforms[sNoiseStrength] = 0; - nightVisionUniforms[sLumWeights] = 0; - - createNoiseTexture(mNoiseTexture); -} - -void LLPostProcess::applyBloomShader(void) -{ - -} - -void LLPostProcess::createBloomShader(void) -{ - createTexture(mTempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5)); - - /// Create Bloom Extract Shader - bloomExtractUniforms[sRenderTexture] = 0; - bloomExtractUniforms[sExtractLow] = 0; - bloomExtractUniforms[sExtractHigh] = 0; - bloomExtractUniforms[sLumWeights] = 0; - - /// Create Bloom Blur Shader - bloomBlurUniforms[sRenderTexture] = 0; - bloomBlurUniforms[sBloomStrength] = 0; - bloomBlurUniforms[sTexelSize] = 0; - bloomBlurUniforms[sBlurDirection] = 0; - bloomBlurUniforms[sBlurWidth] = 0; -} - -void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog) -{ - /// Find uniform locations and insert into map - glslUniforms::iterator i; - for (i = uniforms.begin(); i != uniforms.end(); ++i){ - i->second = glGetUniformLocation(prog, i->first.String().c_str()); - } -} - -void LLPostProcess::doEffects(void) -{ - /// Save GL State - glPushAttrib(GL_ALL_ATTRIB_BITS); - glPushClientAttrib(GL_ALL_ATTRIB_BITS); - - /// Copy the screen buffer to the render texture - { - U32 tex = mSceneRenderTexture->getTexName() ; - copyFrameBuffer(tex, screenW, screenH); - } - - /// Clear the frame buffer. - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - /// Change to an orthogonal view - viewOrthogonal(screenW, screenH); - - checkError(); - applyShaders(); - - LLGLSLShader::unbind(); - checkError(); - - /// Change to a perspective view - viewPerspective(); - - /// Reset GL State - glPopClientAttrib(); - glPopAttrib(); - checkError(); -} - -void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) -{ - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture); - glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0); -} - -void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) -{ - -} - -void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.ortho( 0.f, (GLfloat) width , (GLfloat) height , 0.f, -1.f, 1.f ); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - gGL.loadIdentity(); -} - -void LLPostProcess::viewPerspective(void) -{ - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - -void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height) -{ - viewPerspective(); - viewOrthogonal(width, height); -} - -void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height) -{ - std::vector<GLubyte> data(width * height * 4, 0) ; - - texture = new LLImageGL(false) ; - if(texture->createGLTexture()) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); - glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - } -} - -void LLPostProcess::createNoiseTexture(LLPointer<LLImageGL>& texture) -{ - std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE); - for (unsigned int i = 0; i < NOISE_SIZE; i++){ - for (unsigned int k = 0; k < NOISE_SIZE; k++){ - buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); - } - } - - texture = new LLImageGL(false) ; - if(texture->createGLTexture()) - { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); - LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - } -} - -bool LLPostProcess::checkError(void) -{ - GLenum glErr; - bool retCode = false; - - glErr = glGetError(); - while (glErr != GL_NO_ERROR) - { - // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; - char const * err_str_raw = (const char *) gluErrorString(glErr); - - if(err_str_raw == NULL) - { - std::ostringstream err_builder; - err_builder << "unknown error number " << glErr; - mShaderErrorString = err_builder.str(); - } - else - { - mShaderErrorString = err_str_raw; - } - - retCode = true; - glErr = glGetError(); - } - return retCode; -} - -void LLPostProcess::checkShaderError(GLuint shader) -{ - GLint infologLength = 0; - GLint charsWritten = 0; - GLchar *infoLog; - - checkError(); // Check for OpenGL errors - - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength); - - checkError(); // Check for OpenGL errors - - if (infologLength > 0) - { - infoLog = (GLchar *)malloc(infologLength); - if (infoLog == NULL) - { - /// Could not allocate infolog buffer - return; - } - glGetProgramInfoLog(shader, infologLength, &charsWritten, infoLog); - // shaderErrorLog << (char *) infoLog << std::endl; - mShaderErrorString = (char *) infoLog; - free(infoLog); - } - checkError(); // Check for OpenGL errors -} diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h deleted file mode 100644 index b5b7549efb..0000000000 --- a/indra/llrender/llpostprocess.h +++ /dev/null @@ -1,267 +0,0 @@ -/** - * @file llpostprocess.h - * @brief LLPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_POSTPROCESS_H -#define LL_POSTPROCESS_H - -#include <map> -#include <fstream> -#include "llgl.h" -#include "llglheaders.h" -#include "llstaticstringtable.h" - -class LLPostProcess -{ -public: - - typedef enum _QuadType { - QUAD_NORMAL, - QUAD_NOISE, - QUAD_BLOOM_EXTRACT, - QUAD_BLOOM_COMBINE - } QuadType; - - /// GLSL Shader Encapsulation Struct - typedef LLStaticStringTable<GLuint> glslUniforms; - - struct PostProcessTweaks : public LLSD { - inline PostProcessTweaks() : LLSD(LLSD::emptyMap()) - { - } - - inline LLSD & brightMult() { - return (*this)["brightness_multiplier"]; - } - - inline LLSD & noiseStrength() { - return (*this)["noise_strength"]; - } - - inline LLSD & noiseSize() { - return (*this)["noise_size"]; - } - - inline LLSD & extractLow() { - return (*this)["extract_low"]; - } - - inline LLSD & extractHigh() { - return (*this)["extract_high"]; - } - - inline LLSD & bloomWidth() { - return (*this)["bloom_width"]; - } - - inline LLSD & bloomStrength() { - return (*this)["bloom_strength"]; - } - - inline LLSD & brightness() { - return (*this)["brightness"]; - } - - inline LLSD & contrast() { - return (*this)["contrast"]; - } - - inline LLSD & contrastBaseR() { - return (*this)["contrast_base"][0]; - } - - inline LLSD & contrastBaseG() { - return (*this)["contrast_base"][1]; - } - - inline LLSD & contrastBaseB() { - return (*this)["contrast_base"][2]; - } - - inline LLSD & contrastBaseIntensity() { - return (*this)["contrast_base"][3]; - } - - inline LLSD & saturation() { - return (*this)["saturation"]; - } - - inline LLSD & useNightVisionShader() { - return (*this)["enable_night_vision"]; - } - - inline LLSD & useBloomShader() { - return (*this)["enable_bloom"]; - } - - inline LLSD & useColorFilter() { - return (*this)["enable_color_filter"]; - } - - - inline F32 getBrightMult() const { - return F32((*this)["brightness_multiplier"].asReal()); - } - - inline F32 getNoiseStrength() const { - return F32((*this)["noise_strength"].asReal()); - } - - inline F32 getNoiseSize() const { - return F32((*this)["noise_size"].asReal()); - } - - inline F32 getExtractLow() const { - return F32((*this)["extract_low"].asReal()); - } - - inline F32 getExtractHigh() const { - return F32((*this)["extract_high"].asReal()); - } - - inline F32 getBloomWidth() const { - return F32((*this)["bloom_width"].asReal()); - } - - inline F32 getBloomStrength() const { - return F32((*this)["bloom_strength"].asReal()); - } - - inline F32 getBrightness() const { - return F32((*this)["brightness"].asReal()); - } - - inline F32 getContrast() const { - return F32((*this)["contrast"].asReal()); - } - - inline F32 getContrastBaseR() const { - return F32((*this)["contrast_base"][0].asReal()); - } - - inline F32 getContrastBaseG() const { - return F32((*this)["contrast_base"][1].asReal()); - } - - inline F32 getContrastBaseB() const { - return F32((*this)["contrast_base"][2].asReal()); - } - - inline F32 getContrastBaseIntensity() const { - return F32((*this)["contrast_base"][3].asReal()); - } - - inline F32 getSaturation() const { - return F32((*this)["saturation"].asReal()); - } - - }; - - bool initialized; - PostProcessTweaks tweaks; - - // the map of all availible effects - LLSD mAllEffects; - -private: - LLPointer<LLImageGL> mSceneRenderTexture ; - LLPointer<LLImageGL> mNoiseTexture ; - LLPointer<LLImageGL> mTempBloomTexture ; - -public: - LLPostProcess(void); - - ~LLPostProcess(void); - - void apply(unsigned int width, unsigned int height); - void invalidate() ; - - /// Perform global initialization for this class. - static void initClass(void); - - // Cleanup of global data that's only inited once per class. - static void cleanupClass(); - - void setSelectedEffect(std::string const & effectName); - - inline std::string const & getSelectedEffect(void) const { - return mSelectedEffectName; - } - - void saveEffect(std::string const & effectName); - -private: - /// read in from file - std::string mShaderErrorString; - unsigned int screenW; - unsigned int screenH; - - float noiseTextureScale; - - /// Shader Uniforms - glslUniforms nightVisionUniforms; - glslUniforms bloomExtractUniforms; - glslUniforms bloomBlurUniforms; - glslUniforms colorFilterUniforms; - - // the name of currently selected effect in mAllEffects - // invariant: tweaks == mAllEffects[mSelectedEffectName] - std::string mSelectedEffectName; - - /// General functions - void initialize(unsigned int width, unsigned int height); - void doEffects(void); - void applyShaders(void); - bool shadersEnabled(void); - - /// Night Vision Functions - void createNightVisionShader(void); - void applyNightVisionShader(void); - - /// Bloom Functions - void createBloomShader(void); - void applyBloomShader(void); - - /// Color Filter Functions - void createColorFilterShader(void); - void applyColorFilterShader(void); - - /// OpenGL Helper Functions - void getShaderUniforms(glslUniforms & uniforms, GLuint & prog); - void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height); - void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); - void createNoiseTexture(LLPointer<LLImageGL>& texture); - bool checkError(void); - void checkShaderError(GLuint shader); - void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); - void viewOrthogonal(unsigned int width, unsigned int height); - void changeOrthogonal(unsigned int width, unsigned int height); - void viewPerspective(void); -}; - -extern LLPostProcess * gPostProcess; - - -#endif // LL_POSTPROCESS_H diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index e182b870dc..3b74d360d0 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -38,7 +38,7 @@ #include "hbxxh.h" #include "glm/gtc/type_ptr.hpp" -#if LL_WINDOWS +#if GL_ARB_debug_output && !LL_DARWIN extern void APIENTRY gl_debug_callback(GLenum source, GLenum type, GLuint id, @@ -151,7 +151,8 @@ void LLTexUnit::refreshState(void) void LLTexUnit::activate(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { @@ -163,7 +164,8 @@ void LLTexUnit::activate(void) void LLTexUnit::enable(eTextureType type) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) ) { @@ -180,7 +182,8 @@ void LLTexUnit::enable(eTextureType type) void LLTexUnit::disable(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; if (mCurrTexType != TT_NONE) { @@ -216,7 +219,7 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) { gGL.flush(); - LLImageGL* gl_tex = NULL ; + LLImageGL* gl_tex = NULL; if (texture != NULL && (gl_tex = texture->getGLTexture())) { @@ -231,8 +234,8 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture); if(gl_tex->updateBindStats()) { - texture->setActive() ; - texture->updateBindStatsForTester() ; + texture->setActive(); + texture->updateBindStatsForTester(); } mHasMipMaps = gl_tex->mHasMipMaps; if (gl_tex->mTexOptionsDirty) @@ -246,9 +249,9 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) else { //if deleted, will re-generate it immediately - texture->forceImmediateUpdate() ; + texture->forceImmediateUpdate(); - gl_tex->forceUpdateBindStats() ; + gl_tex->forceUpdateBindStats(); return texture->bindDefaultImage(mIndex); } } @@ -276,24 +279,27 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind, S32 usename) { stop_glerror(); - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } U32 texname = usename ? usename : texture->getTexName(); - if(!texture) + if (!texture) { LL_DEBUGS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } - if(!texname) + if (!texname) { if(LLImageGL::sDefaultGLTexture && LLImageGL::sDefaultGLTexture->getTexName()) { - return bind(LLImageGL::sDefaultGLTexture) ; + return bind(LLImageGL::sDefaultGLTexture); } stop_glerror(); - return false ; + return false; } if ((mCurrTexture != texname) || forceBind) @@ -326,7 +332,10 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind, S32 bool LLTexUnit::bind(LLCubeMap* cubeMap) { - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } gGL.flush(); @@ -366,7 +375,10 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) // LLRenderTarget is unavailible on the mapserver since it uses FBOs. bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { - if (mIndex < 0) return false; + if (mIndex < 0) + { + return false; + } gGL.flush(); @@ -391,7 +403,7 @@ bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) return false; } - if(mCurrTexture != texture) + if (mCurrTexture != texture) { gGL.flush(); @@ -401,6 +413,7 @@ bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) glBindTexture(sGLTextureType[type], texture); mHasMipMaps = hasMips; } + return true; } @@ -408,7 +421,8 @@ void LLTexUnit::unbind(eTextureType type) { stop_glerror(); - if (mIndex < 0) return; + if (mIndex < 0) + return; //always flush and activate for consistency // some code paths assume unbind always flushes and sets the active texture @@ -454,7 +468,8 @@ void LLTexUnit::unbindFast(eTextureType type) void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) { - if (mIndex < 0 || mCurrTexture == 0) return; + if (mIndex < 0 || mCurrTexture == 0) + return; gGL.flush(); @@ -470,7 +485,8 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode) void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option) { - if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) return; + if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) + return; gGL.flush(); @@ -525,7 +541,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) { - switch(src) + switch (src) { // All four cases should return the same value. case TBS_PREV_COLOR: @@ -563,14 +579,14 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) { - switch(src) + switch (src) { // All four cases should return the same value. case TBS_PREV_COLOR: case TBS_TEX_COLOR: case TBS_VERT_COLOR: case TBS_CONST_COLOR: - return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; + return isAlpha ? GL_SRC_ALPHA : GL_SRC_COLOR; // All four cases should return the same value. case TBS_PREV_ALPHA: @@ -584,7 +600,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) case TBS_ONE_MINUS_TEX_COLOR: case TBS_ONE_MINUS_VERT_COLOR: case TBS_ONE_MINUS_CONST_COLOR: - return (isAlpha) ? GL_ONE_MINUS_SRC_ALPHA : GL_ONE_MINUS_SRC_COLOR; + return isAlpha ? GL_ONE_MINUS_SRC_ALPHA : GL_ONE_MINUS_SRC_COLOR; // All four cases should return the same value. case TBS_ONE_MINUS_PREV_ALPHA: @@ -595,7 +611,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) default: LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << LL_ENDL; - return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; + return isAlpha ? GL_SRC_ALPHA : GL_SRC_COLOR; } } @@ -605,7 +621,7 @@ void LLTexUnit::setColorScale(S32 scale) { mCurrColorScale = scale; gGL.flush(); - glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale ); + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, scale); } } @@ -615,7 +631,7 @@ void LLTexUnit::setAlphaScale(S32 scale) { mCurrAlphaScale = scale; gGL.flush(); - glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale ); + glTexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale); } } @@ -623,7 +639,8 @@ void LLTexUnit::setAlphaScale(S32 scale) // texture unit based on the currently set active texture in opengl. void LLTexUnit::debugTextureUnit(void) { - if (mIndex < 0) return; + if (mIndex < 0) + return; GLint activeTexture; glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture); @@ -645,16 +662,16 @@ LLLightState::LLLightState(S32 index) { if (mIndex == 0) { - mDiffuse.set(1,1,1,1); - mDiffuseB.set(0,0,0,0); - mSpecular.set(1,1,1,1); + mDiffuse.set(1, 1, 1, 1); + mDiffuseB.set(0, 0, 0, 0); + mSpecular.set(1, 1, 1, 1); } mSunIsPrimary = true; - mAmbient.set(0,0,0,1); - mPosition.set(0,0,1,0); - mSpotDirection.set(0,0,-1); + mAmbient.set(0, 0, 0, 1); + mPosition.set(0, 0, 1, 0); + mSpotDirection.set(0, 0, -1); } void LLLightState::enable() @@ -849,7 +866,7 @@ LLRender::~LLRender() bool LLRender::init(bool needs_vertex_buffer) { -#if LL_WINDOWS +#if GL_ARB_debug_output && !LL_DARWIN if (gGLManager.mHasDebugOutput && gDebugGL) { //setup debug output callback //glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE); @@ -886,6 +903,7 @@ bool LLRender::init(bool needs_vertex_buffer) { initVertexBuffer(); } + return true; } @@ -1119,7 +1137,6 @@ void LLRender::syncMatrices() } } - if (shader->mFeatures.hasLighting || shader->mFeatures.calculatesLighting || shader->mFeatures.calculatesAtmospherics) { //also sync light state syncLightState(); @@ -1132,91 +1149,78 @@ void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::translate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::translate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); + mMatHash[mMatrixMode]++; } void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::scale(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::scale(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::vec3(x, y, z)); + mMatHash[mMatrixMode]++; } void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::ortho(left, right, bottom, top, zNear, zFar); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::ortho(left, right, bottom, top, zNear, zFar); + mMatHash[mMatrixMode]++; } void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::rotate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::radians(a), glm::vec3(x,y,z)); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::rotate(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]], glm::radians(a), glm::vec3(x,y,z)); + mMatHash[mMatrixMode]++; } void LLRender::pushMatrix() { flush(); + if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1) { - if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1) - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]]; - ++mMatIdx[mMatrixMode]; - } - else - { - LL_WARNS() << "Matrix stack overflow." << LL_ENDL; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]]; + ++mMatIdx[mMatrixMode]; + } + else + { + LL_WARNS() << "Matrix stack overflow." << LL_ENDL; } } void LLRender::popMatrix() { flush(); + + if (mMatIdx[mMatrixMode] > 0) { - if (mMatIdx[mMatrixMode] > 0) - { - --mMatIdx[mMatrixMode]; - mMatHash[mMatrixMode]++; - } - else - { - LL_WARNS() << "Matrix stack underflow." << LL_ENDL; - } + --mMatIdx[mMatrixMode]; + mMatHash[mMatrixMode]++; + } + else + { + LL_WARNS() << "Matrix stack underflow." << LL_ENDL; } } void LLRender::loadMatrix(const GLfloat* m) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::make_mat4((GLfloat*) m); - mMatHash[mMatrixMode]++; - } + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::make_mat4((GLfloat*) m); + mMatHash[mMatrixMode]++; } void LLRender::multMatrix(const GLfloat* m) { flush(); - { - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::make_mat4(m); - mMatHash[mMatrixMode]++; - } + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] *= glm::make_mat4(m); + mMatHash[mMatrixMode]++; } void LLRender::matrixMode(eMatrixMode mode) @@ -1254,12 +1258,10 @@ void LLRender::loadIdentity() { flush(); - { - llassert_always(mMatrixMode < NUM_MATRIX_MODES) ; + llassert_always(mMatrixMode < NUM_MATRIX_MODES); - mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::identity<glm::mat4>(); - mMatHash[mMatrixMode]++; - } + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = glm::identity<glm::mat4>(); + mMatHash[mMatrixMode]++; } const glm::mat4& LLRender::getModelviewMatrix() @@ -1279,9 +1281,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) LL_ERRS() << "Need to push a UI translation frame before offsetting" << LL_ENDL; } - mUIOffset.back().mV[0] += x; - mUIOffset.back().mV[1] += y; - mUIOffset.back().mV[2] += z; + mUIOffset.back().add(LLVector4a(x, y, z)); } void LLRender::scaleUI(F32 x, F32 y, F32 z) @@ -1291,14 +1291,14 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) LL_ERRS() << "Need to push a UI transformation frame before scaling." << LL_ENDL; } - mUIScale.back().scaleVec(LLVector3(x,y,z)); + mUIScale.back().mul(LLVector4a(x, y, z)); } void LLRender::pushUIMatrix() { if (mUIOffset.empty()) { - mUIOffset.emplace_back(0.f,0.f,0.f); + mUIOffset.emplace_back(0.f); } else { @@ -1307,7 +1307,7 @@ void LLRender::pushUIMatrix() if (mUIScale.empty()) { - mUIScale.emplace_back(1.f,1.f,1.f); + mUIScale.emplace_back(1.f); } else { @@ -1329,18 +1329,20 @@ LLVector3 LLRender::getUITranslation() { if (mUIOffset.empty()) { - return LLVector3(0,0,0); + return LLVector3::zero; } - return mUIOffset.back(); + + return LLVector3(mUIOffset.back().getF32ptr()); } LLVector3 LLRender::getUIScale() { if (mUIScale.empty()) { - return LLVector3(1,1,1); + return LLVector3::all_one; } - return mUIScale.back(); + + return LLVector3(mUIScale.back().getF32ptr()); } @@ -1350,8 +1352,9 @@ void LLRender::loadUIIdentity() { LL_ERRS() << "Need to push UI translation frame before clearing offset." << LL_ENDL; } - mUIOffset.back().setVec(0,0,0); - mUIScale.back().setVec(1,1,1); + + mUIOffset.back().clear(); + mUIScale.back().splat(1); } void LLRender::setColorMask(bool writeColor, bool writeAlpha) @@ -1445,7 +1448,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, flush(); glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], - sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); + sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); } } @@ -1455,11 +1458,9 @@ LLTexUnit* LLRender::getTexUnit(U32 index) { return &mTexUnits[index]; } - else - { - LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; - return &mDummyTexUnit; - } + + LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; + return &mDummyTexUnit; } LLLightState* LLRender::getLight(U32 index) @@ -1488,11 +1489,9 @@ bool LLRender::verifyTexUnitActive(U32 unitToVerify) { return true; } - else - { - LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; - return false; - } + + LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; + return false; } void LLRender::clearErrors() @@ -1509,6 +1508,7 @@ void LLRender::beginList(std::list<LLVertexBufferData> *list) { LL_ERRS() << "beginList called while another list is open." << LL_ENDL; } + llassert(LLGLSLShader::sCurBoundShaderPtr == &gUIProgram); flush(); sBufferDataList = list; @@ -1581,7 +1581,7 @@ void LLRender::flush() if (mMode == LLRender::TRIANGLES) { - if (mCount%3 != 0) + if (mCount % 3 != 0) { count -= (mCount % 3); LL_WARNS() << "Incomplete triangle requested." << LL_ENDL; @@ -1590,7 +1590,7 @@ void LLRender::flush() if (mMode == LLRender::LINES) { - if (mCount%2 != 0) + if (mCount % 2 != 0) { count -= (mCount % 2); LL_WARNS() << "Incomplete line requested." << LL_ENDL; @@ -1601,7 +1601,6 @@ void LLRender::flush() if (mBuffer) { - LLVertexBuffer *vb; U32 attribute_mask = LLGLSLShader::sCurBoundShaderPtr->mAttributeMask; @@ -1708,6 +1707,7 @@ LLVertexBuffer* LLRender::bufferfromCache(U32 attribute_mask, U32 count) } } } + return vb; } @@ -1755,14 +1755,26 @@ void LLRender::resetStriders(S32 count) void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { - //the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] + // the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095] if (mCount > 2048) - { //break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below + { // break when buffer gets reasonably full to keep GL command buffers happy and avoid overflow below switch (mMode) { - case LLRender::POINTS: flush(); break; - case LLRender::TRIANGLES: if (mCount%3==0) flush(); break; - case LLRender::LINES: if (mCount%2 == 0) flush(); break; + case LLRender::POINTS: + flush(); + break; + case LLRender::TRIANGLES: + if (mCount % 3 == 0) + { + flush(); + } + break; + case LLRender::LINES: + if (mCount % 2 == 0) + { + flush(); + } + break; } } @@ -1772,23 +1784,64 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) return; } - if (mUIOffset.empty()) + LLVector4a vert(x, y, z); + transform(vert); + mVerticesp[mCount] = vert; + + mCount++; + mVerticesp[mCount] = vert; + mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +} + +void LLRender::transform(LLVector3& vert) +{ + if (!mUIOffset.empty()) { - mVerticesp[mCount].set(x,y,z); + vert += LLVector3(mUIOffset.back().getF32ptr()); + vert *= LLVector3(mUIScale.back().getF32ptr()); } - else +} + +void LLRender::transform(LLVector4a& vert) +{ + if (!mUIOffset.empty()) { - LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back()); - mVerticesp[mCount].set(vert.mV[VX], vert.mV[VY], vert.mV[VZ]); + vert.add(mUIOffset.back()); + vert.mul(mUIScale.back()); } +} - mCount++; - mVerticesp[mCount] = mVerticesp[mCount-1]; - mColorsp[mCount] = mColorsp[mCount-1]; - mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; +void LLRender::untransform(LLVector3& vert) +{ + if (!mUIOffset.empty()) + { + vert /= LLVector3(mUIScale.back().getF32ptr()); + vert -= LLVector3(mUIOffset.back().getF32ptr()); + } } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) +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<LLVector4a>& verts) +{ + vertexBatchPreTransformed(verts.data(), verts.size()); +} + +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, std::size_t vert_count) { if (mCount + vert_count > 4094) { @@ -1801,15 +1854,17 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count) mVerticesp[mCount] = verts[i]; mCount++; - mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; - mColorsp[mCount] = mColorsp[mCount-1]; + mTexcoordsp[mCount] = mTexcoordsp[mCount - 1]; + mColorsp[mCount] = mColorsp[mCount - 1]; } - if( mCount > 0 ) // ND: Guard against crashes if mCount is zero, yes it can happen - mVerticesp[mCount] = mVerticesp[mCount-1]; + if (mCount > 0) // ND: Guard against crashes if mCount is zero, yes it can happen + { + mVerticesp[mCount] = mVerticesp[mCount - 1]; + } } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count) +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, std::size_t vert_count) { if (mCount + vert_count > 4094) { @@ -1833,7 +1888,7 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 } } -void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count) +void LLRender::vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U* colors, std::size_t vert_count) { if (mCount + vert_count > 4094) { @@ -1860,22 +1915,22 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLCo void LLRender::vertex2i(const GLint& x, const GLint& y) { - vertex3f((GLfloat) x, (GLfloat) y, 0); + vertex3f((GLfloat)x, (GLfloat)y, 0); } void LLRender::vertex2f(const GLfloat& x, const GLfloat& y) { - vertex3f(x,y,0); + vertex3f(x, y, 0); } void LLRender::vertex2fv(const GLfloat* v) { - vertex3f(v[0], v[1], 0); + vertex3f(v[VX], v[VY], 0); } void LLRender::vertex3fv(const GLfloat* v) { - vertex3f(v[0], v[1], v[2]); + vertex3f(v[VX], v[VY], v[VZ]); } void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y) @@ -1890,46 +1945,47 @@ void LLRender::texCoord2i(const GLint& x, const GLint& y) void LLRender::texCoord2fv(const GLfloat* tc) { - texCoord2f(tc[0], tc[1]); + texCoord2f(tc[VX], tc[VY]); } void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a) { - if (!LLGLSLShader::sCurBoundShaderPtr || LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR) + if (!LLGLSLShader::sCurBoundShaderPtr || + LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR) { - mColorsp[mCount].set(r,g,b,a); + mColorsp[mCount].set(r, g, b, a); } else { //not using shaders or shader reads color from a uniform - diffuseColor4ub(r,g,b,a); + diffuseColor4ub(r, g, b, a); } } void LLRender::color4ubv(const GLubyte* c) { - color4ub(c[0], c[1], c[2], c[3]); + color4ub(c[VX], c[VY], c[VZ], c[VW]); } void LLRender::color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a) { - color4ub((GLubyte) (llclamp(r, 0.f, 1.f)*255), - (GLubyte) (llclamp(g, 0.f, 1.f)*255), - (GLubyte) (llclamp(b, 0.f, 1.f)*255), - (GLubyte) (llclamp(a, 0.f, 1.f)*255)); + color4ub((GLubyte) (llclamp(r, 0.f, 1.f) * 255), + (GLubyte) (llclamp(g, 0.f, 1.f) * 255), + (GLubyte) (llclamp(b, 0.f, 1.f) * 255), + (GLubyte) (llclamp(a, 0.f, 1.f) * 255)); } void LLRender::color4fv(const GLfloat* c) { - color4f(c[0],c[1],c[2],c[3]); + color4f(c[VX], c[VY], c[VZ], c[VW]); } void LLRender::color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b) { - color4f(r,g,b,1); + color4f(r, g, b, 1); } void LLRender::color3fv(const GLfloat* c) { - color4f(c[0],c[1],c[2],1); + color4f(c[VX], c[VY], c[VZ], 1); } void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) @@ -1939,7 +1995,7 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r, g, b, 1.f); } } @@ -1950,7 +2006,7 @@ void LLRender::diffuseColor3fv(const F32* c) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0], c[1], c[2], 1.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[VX], c[VY], c[VZ], 1.f); } } @@ -1961,7 +2017,7 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r,g,b,a); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r, g, b, a); } } @@ -1983,7 +2039,7 @@ void LLRender::diffuseColor4ubv(const U8* c) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0]/255.f, c[1]/255.f, c[2]/255.f, c[3]/255.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, c[0] / 255.f, c[1] / 255.f, c[2] / 255.f, c[3] / 255.f); } } @@ -1994,11 +2050,10 @@ void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) if (shader) { - shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r/255.f, g/255.f, b/255.f, a/255.f); + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r / 255.f, g / 255.f, b / 255.f, a / 255.f); } } - void LLRender::debugTexUnits(void) { LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL; @@ -2009,7 +2064,7 @@ void LLRender::debugTexUnits(void) { if (i == mCurrTextureUnitIndex) active_enabled = "true"; LL_INFOS("TextureUnit") << "TexUnit: " << i << " Enabled" << LL_ENDL; - LL_INFOS("TextureUnit") << "Enabled As: " ; + LL_INFOS("TextureUnit") << "Enabled As: "; switch (getTexUnit(i)->mCurrTexType) { case LLTexUnit::TT_TEXTURE: @@ -2094,10 +2149,10 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec) y.splat(vec.y); z.splat(vec.z); - s.splat<3>(mat[0].data); - t.splat<3>(mat[1].data); - p.splat<3>(mat[2].data); - q.splat<3>(mat[3].data); + s.splat<3>(mat[VX].data); + t.splat<3>(mat[VY].data); + p.splat<3>(mat[VZ].data); + q.splat<3>(mat[VW].data); s.mul(x); t.mul(y); @@ -2106,12 +2161,12 @@ glm::vec3 mul_mat4_vec3(const glm::mat4& mat, const glm::vec3& vec) t.add(p); q.add(t); - x.mul(mat[0].data); - y.mul(mat[1].data); - z.mul(mat[2].data); + x.mul(mat[VX].data); + y.mul(mat[VY].data); + z.mul(mat[VZ].data); x.add(y); - z.add(mat[3].data); + z.add(mat[VW].data); LLVector4a res; res.load3(glm::value_ptr(vec)); res.setAdd(x, z); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index fc7c5ccc18..8c7126420e 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -46,6 +46,7 @@ #include <array> #include <list> +#include <vector> class LLVertexBuffer; class LLCubeMap; @@ -449,9 +450,16 @@ public: void diffuseColor4ubv(const U8* c); void diffuseColor4ub(U8 r, U8 g, U8 b, U8 a); - 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 transform(LLVector3& vert); + void transform(LLVector4a& vert); + void untransform(LLVector3& vert); + + void batchTransform(LLVector4a* verts, U32 vert_count); + + void vertexBatchPreTransformed(const std::vector<LLVector4a>& verts); + void vertexBatchPreTransformed(const LLVector4a* verts, std::size_t vert_count); + void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, std::size_t vert_count); + void vertexBatchPreTransformed(const LLVector4a* verts, const LLVector2* uvs, const LLColor4U*, std::size_t vert_count); void setColorMask(bool writeColor, bool writeAlpha); void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha); @@ -525,8 +533,8 @@ private: eBlendFactor mCurrBlendAlphaSFactor; eBlendFactor mCurrBlendAlphaDFactor; - std::vector<LLVector3> mUIOffset; - std::vector<LLVector3> mUIScale; + std::vector<LLVector4a> mUIOffset; + std::vector<LLVector4a> mUIScale; }; extern F32 gGLModelView[16]; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 20ad0275bd..971241ed05 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -450,7 +450,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex gGL.color4fv(color.mV); - constexpr S32 NUM_VERTICES = 9 * 2 * 3; // 9 quads, 2 triangles per quad, 3 vertices per triangle + constexpr U32 NUM_VERTICES = 9 * 2 * 3; // 9 quads, 2 triangles per quad, 3 vertices per triangle static thread_local LLVector2 uv[NUM_VERTICES]; static thread_local LLVector4a pos[NUM_VERTICES]; @@ -1712,10 +1712,10 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV); gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mLeft* width_vec + center_draw_rect.mTop * height_vec).mV); + gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV); - gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop); - gGL.vertex3fv((center_draw_rect.mRight* width_vec + center_draw_rect.mTop * height_vec).mV); + gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop); + gGL.vertex3fv((center_draw_rect.mRight* width_vec + height_vec).mV); gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop); gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 38bc5ff331..c72f8fa2ba 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -51,6 +51,7 @@ void check_framebuffer_status() } bool LLRenderTarget::sUseFBO = false; +bool LLRenderTarget::sClearOnInvalidate = false; U32 LLRenderTarget::sCurFBO = 0; @@ -473,6 +474,13 @@ void LLRenderTarget::clear(U32 mask_in) } } +void LLRenderTarget::invalidate(U32 mask_in) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + if (!sClearOnInvalidate) { return; } + clear(mask_in); +} + U32 LLRenderTarget::getTexture(U32 attachment) const { if (attachment >= mTex.size()) @@ -584,7 +592,6 @@ void LLRenderTarget::swapFBORefs(LLRenderTarget& other) llassert(!other.isBoundInStack()); // Must be same type - llassert(sUseFBO == other.sUseFBO); llassert(mResX == other.mResX); llassert(mResY == other.mResY); llassert(mInternalFormat == other.mInternalFormat); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index cd3290cf66..f066534cf4 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -63,6 +63,7 @@ class LLRenderTarget public: // Whether or not to use FBO implementation static bool sUseFBO; + static bool sClearOnInvalidate; static U32 sBytesAllocated; static U32 sCurFBO; static U32 sCurResX; @@ -128,11 +129,17 @@ public: // Asserts that this target is not currently bound in the stack void bindTarget(); - //clear render targer, clears depth buffer if present, + //clear render target, clears depth buffer if present, //uses scissor rect if in copy-to-texture mode // asserts that this target is currently bound void clear(U32 mask = 0xFFFFFFFF); + //same as clear, except may be a no-op depending on configuration + //useful to indicate the buffer is about to be overwritten and we + //don't care about its previous contents + //depending on the GPU, one may be more expensive than the other + void invalidate(U32 mask = 0xFFFFFFFF); + //get applied viewport void getViewport(S32* viewport); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 150277c8df..6097b09d96 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1300,9 +1300,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("shadow_matrix"); mReservedUniforms.push_back("env_mat"); mReservedUniforms.push_back("shadow_clip"); - mReservedUniforms.push_back("sun_wash"); - mReservedUniforms.push_back("shadow_noise"); - mReservedUniforms.push_back("blur_size"); mReservedUniforms.push_back("ssao_radius"); mReservedUniforms.push_back("ssao_max_radius"); mReservedUniforms.push_back("ssao_factor"); @@ -1318,8 +1315,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("moon_dir"); mReservedUniforms.push_back("shadow_res"); mReservedUniforms.push_back("proj_shadow_res"); - mReservedUniforms.push_back("depth_cutoff"); - mReservedUniforms.push_back("norm_cutoff"); mReservedUniforms.push_back("shadow_target_width"); llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH + 1); @@ -1369,9 +1364,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("noiseMap"); mReservedUniforms.push_back("lightFunc"); mReservedUniforms.push_back("lightMap"); - mReservedUniforms.push_back("bloomMap"); mReservedUniforms.push_back("projectionMap"); - mReservedUniforms.push_back("norm_mat"); mReservedUniforms.push_back("specular_color"); mReservedUniforms.push_back("env_intensity"); @@ -1450,10 +1443,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("sun_size"); mReservedUniforms.push_back("fog_color"); - mReservedUniforms.push_back("transmittance_texture"); - mReservedUniforms.push_back("scattering_texture"); - mReservedUniforms.push_back("single_mie_scattering_texture"); - mReservedUniforms.push_back("irradiance_texture"); mReservedUniforms.push_back("blend_factor"); mReservedUniforms.push_back("moisture_level"); mReservedUniforms.push_back("droplet_radius"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 0eb9db6715..1bae0cd8a0 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -157,9 +157,6 @@ public: DEFERRED_SHADOW_MATRIX, // "shadow_matrix" DEFERRED_ENV_MAT, // "env_mat" DEFERRED_SHADOW_CLIP, // "shadow_clip" - DEFERRED_SUN_WASH, // "sun_wash" - DEFERRED_SHADOW_NOISE, // "shadow_noise" - DEFERRED_BLUR_SIZE, // "blur_size" DEFERRED_SSAO_RADIUS, // "ssao_radius" DEFERRED_SSAO_MAX_RADIUS, // "ssao_max_radius" DEFERRED_SSAO_FACTOR, // "ssao_factor" @@ -175,8 +172,6 @@ public: DEFERRED_MOON_DIR, // "moon_dir" DEFERRED_SHADOW_RES, // "shadow_res" DEFERRED_PROJ_SHADOW_RES, // "proj_shadow_res" - DEFERRED_DEPTH_CUTOFF, // "depth_cutoff" - DEFERRED_NORM_CUTOFF, // "norm_cutoff" DEFERRED_SHADOW_TARGET_WIDTH, // "shadow_target_width" DEFERRED_SSR_ITR_COUNT, // "iterationCount" @@ -221,9 +216,7 @@ public: DEFERRED_NOISE, // "noiseMap" DEFERRED_LIGHTFUNC, // "lightFunc" DEFERRED_LIGHT, // "lightMap" - DEFERRED_BLOOM, // "bloomMap" DEFERRED_PROJECTION, // "projectionMap" - DEFERRED_NORM_MATRIX, // "norm_mat" SPECULAR_COLOR, // "specular_color" ENVIRONMENT_INTENSITY, // "env_intensity" @@ -301,13 +294,7 @@ public: SUN_SIZE, // "sun_size" FOG_COLOR, // "fog_color" - // precomputed textures - TRANSMITTANCE_TEX, // "transmittance_texture" - SCATTER_TEX, // "scattering_texture" - SINGLE_MIE_SCATTER_TEX, // "single_mie_scattering_texture" - ILLUMINANCE_TEX, // "irradiance_texture" BLEND_FACTOR, // "blend_factor" - MOISTURE_LEVEL, // "moisture_level" DROPLET_RADIUS, // "droplet_radius" ICE_LEVEL, // "ice_level" diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 6f4828397a..12ae36f4bb 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -604,7 +604,7 @@ public: static LLVBOPool* sVBOPool = nullptr; -void LLVertexBufferData::draw() +void LLVertexBufferData::drawWithMatrix() { if (!mVB) { @@ -642,6 +642,28 @@ void LLVertexBufferData::draw() gGL.popMatrix(); } +void LLVertexBufferData::draw() +{ + if (!mVB) + { + llassert(false); + // Not supposed to happen, check buffer generation + return; + } + + if (mTexName) + { + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTexName); + } + else + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } + + mVB->setBuffer(); + mVB->drawArrays(mMode, 0, mCount); +} + //============================================================================ //static diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index d4c6fbaf18..375ad76fb8 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -77,6 +77,7 @@ public: , mModelView(projection) , mTexture0(texture0) {} + void drawWithMatrix(); void draw(); LLPointer<LLVertexBuffer> mVB; U8 mMode; diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index cf3569683e..3fdcf9f7f2 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -126,7 +126,7 @@ public: void setSelected(bool is_selected); - bool getCollapsible() { return mCollapsible; }; + bool getCollapsible() const { return mCollapsible; }; void setCollapsible(bool collapsible) { mCollapsible = collapsible; }; void changeOpenClose(bool is_open); @@ -181,7 +181,7 @@ public: void setHeaderVisible(bool value); - bool getHeaderVisible() { return mHeaderVisible;} + bool getHeaderVisible() const { return mHeaderVisible;} S32 mExpandedHeight; // Height of expanded ctrl. // Used to restore height after expand. diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 135f128692..4068741978 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -36,8 +36,8 @@ // Constants // -const bool RADIO_STYLE = true; -const bool CHECK_STYLE = false; +constexpr bool RADIO_STYLE = true; +constexpr bool CHECK_STYLE = false; // // Classes @@ -94,7 +94,7 @@ public: // LLUICtrl interface virtual void setValue(const LLSD& value ); virtual LLSD getValue() const; - bool get() { return (bool)getValue().asBoolean(); } + bool get() const { return (bool)getValue().asBoolean(); } void set(bool value) { setValue(value); } virtual void setTentative(bool b); @@ -106,7 +106,7 @@ public: virtual void onCommit(); // LLCheckBoxCtrl interface - virtual bool toggle() { return mButton->toggleState(); } // returns new state + virtual bool toggle() { return mButton->toggleState(); } // returns new state void setBtnFocus() { mButton->setFocus(true); } diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index a1c16ccdec..f3876ef695 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -365,7 +365,7 @@ void LLComboBox::setValue(const LLSD& value) if (LLScrollListItem* item = mList->getFirstSelected()) { LLSD item_value = item->getValue(); - if (item_value.asStringRef() == value.asStringRef()) + if (item_value.asString() == value.asString()) return; } diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index c6dd401e85..2675d21c22 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -65,21 +65,21 @@ protected: public: ~LLContainerView(); - /*virtual*/ bool postBuild(); - /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); + bool postBuild() override; + bool addChild(LLView* view, S32 tab_group = 0) override; - /*virtual*/ bool handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); + bool handleDoubleClick(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; - /*virtual*/ void draw(); - /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. + void draw() override; + void reshape(S32 width, S32 height, bool called_from_parent = true) override; + LLRect getRequiredRect() override; // Return the height of this object, given the set options. void setLabel(const std::string& label); void showLabel(bool show) { mShowLabel = show; } void setDisplayChildren(bool displayChildren); - bool getDisplayChildren() { return mDisplayChildren; } + bool getDisplayChildren() const { return mDisplayChildren; } void setScrollContainer(LLScrollContainer* scroll) {mScrollContainer = scroll;} private: diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 3effc977db..9c516e23a4 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -112,8 +112,8 @@ public: virtual bool overlapsScreenChannel() { return mOverlapsScreenChannel && getVisible() && isDocked(); } virtual void setOverlapsScreenChannel(bool overlaps) { mOverlapsScreenChannel = overlaps; } - bool getUniqueDocking() { return mUniqueDocking; } - bool getUseTongue() { return mUseTongue; } + bool getUniqueDocking() const { return mUniqueDocking; } + bool getUseTongue() const { return mUseTongue; } void setUseTongue(bool use_tongue) { mUseTongue = use_tongue;} private: diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 11dbad8c09..1a00c03856 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -156,7 +156,7 @@ void LLDockControl::repositionDockable() } } -bool LLDockControl::isDockVisible() +bool LLDockControl::isDockVisible() const { bool res = true; diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 7e31330713..b6ac9c19dd 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -61,19 +61,19 @@ public: void off(); void forceRecalculatePosition(); void setDock(LLView* dockWidget); - LLView* getDock() + LLView* getDock() const { return mDockWidgetHandle.get(); } void repositionDockable(); void drawToungue(); - bool isDockVisible(); + bool isDockVisible() const; // gets a rect that bounds possible positions for a dockable control (EXT-1111) void getAllowedRect(LLRect& rect); - S32 getTongueWidth() { return mDockTongue->getWidth(); } - S32 getTongueHeight() { return mDockTongue->getHeight(); } + S32 getTongueWidth() const { return mDockTongue->getWidth(); } + S32 getTongueHeight() const { return mDockTongue->getHeight(); } private: virtual void moveDockable(); diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index a522e63243..73211d5292 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -66,7 +66,7 @@ public: void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } - LLRect getButtonsRect() { return mButtonsRect; } + LLRect getButtonsRect() const { return mButtonsRect; } void setTitleVisible(bool visible); virtual void setTitle( const std::string& title ) = 0; diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 686827d94c..685219c9f6 100644 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h @@ -49,7 +49,7 @@ protected: LLFilterEditor(const Params&); friend class LLUICtrlFactory; - /*virtual*/ void handleKeystroke(); + void handleKeystroke() override; }; #endif // LL_FILTEREDITOR_H diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index 2711e8088d..dc912bccf4 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -85,12 +85,12 @@ void LLFlashTimer::stopFlashing() mCurrentTickCount = 0; } -bool LLFlashTimer::isFlashingInProgress() +bool LLFlashTimer::isFlashingInProgress() const { return mIsFlashingInProgress; } -bool LLFlashTimer::isCurrentlyHighlighted() +bool LLFlashTimer::isCurrentlyHighlighted() const { return mIsCurrentlyHighlighted; } diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index 988b577ed2..7e55da4fb1 100644 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -51,8 +51,8 @@ public: void startFlashing(); void stopFlashing(); - bool isFlashingInProgress(); - bool isCurrentlyHighlighted(); + bool isFlashingInProgress() const; + bool isCurrentlyHighlighted() const; /* * Use this instead of deleting this object. * The next call to tick() will return true and that will destroy this object. diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 53f39766c6..b8c833f4fd 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1337,7 +1337,7 @@ void LLFlatListViewEx::updateNoItemsMessage(const std::string& filter_string) } } -bool LLFlatListViewEx::getForceShowingUnmatchedItems() +bool LLFlatListViewEx::getForceShowingUnmatchedItems() const { return mForceShowingUnmatchedItems; } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 6d75e9f282..112c330a15 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -129,7 +129,7 @@ public: LLRect getRequiredRect() { return getItemsRect(); } /** Returns distance between items */ - const S32 getItemsPad() { return mItemPad; } + const S32 getItemsPad() const { return mItemPad; } /** * Adds and item and LLSD value associated with it to the list at specified position @@ -264,7 +264,7 @@ public: void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ - U32 numSelected() const {return static_cast<U32>(mSelectedItemPairs.size()); } + U32 numSelected() const { return static_cast<U32>(mSelectedItemPairs.size()); } /** Get number of (visible) items in the list */ U32 size(const bool only_visible_items = true) const; @@ -294,8 +294,8 @@ public: void scrollToShowFirstSelectedItem(); - void selectFirstItem (); - void selectLastItem (); + void selectFirstItem(); + void selectLastItem(); virtual S32 notify(const LLSD& info) ; @@ -478,7 +478,7 @@ public: void setNoItemsMsg(const std::string& msg) { mNoItemsMsg = msg; } void setNoFilteredItemsMsg(const std::string& msg) { mNoFilteredItemsMsg = msg; } - bool getForceShowingUnmatchedItems(); + bool getForceShowingUnmatchedItems() const; void setForceShowingUnmatchedItems(bool show); @@ -486,7 +486,7 @@ public: * Sets up new filter string and filters the list. */ void setFilterSubString(const std::string& filter_str, bool notify_parent); - std::string getFilterSubString() { return mFilterSubString; } + std::string getFilterSubString() const { return mFilterSubString; } /** * Filters the list, rearranges and notifies parent about shape changes. diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 4b904f09e0..fd07b2ec5d 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2165,7 +2165,7 @@ void LLFloater::setCanDrag(bool can_drag) } } -bool LLFloater::getCanDrag() +bool LLFloater::getCanDrag() const { return mDragHandle->getEnabled(); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 9be2240f6f..5bdbcdfcf8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -46,24 +46,24 @@ class LLMultiFloater; class LLFloater; -const bool RESIZE_YES = true; -const bool RESIZE_NO = false; +constexpr bool RESIZE_YES = true; +constexpr bool RESIZE_NO = false; -const bool DRAG_ON_TOP = false; -const bool DRAG_ON_LEFT = true; +constexpr bool DRAG_ON_TOP = false; +constexpr bool DRAG_ON_LEFT = true; -const bool MINIMIZE_YES = true; -const bool MINIMIZE_NO = false; +constexpr bool MINIMIZE_YES = true; +constexpr bool MINIMIZE_NO = false; -const bool CLOSE_YES = true; -const bool CLOSE_NO = false; +constexpr bool CLOSE_YES = true; +constexpr bool CLOSE_NO = false; -const bool ADJUST_VERTICAL_YES = true; -const bool ADJUST_VERTICAL_NO = false; +constexpr bool ADJUST_VERTICAL_YES = true; +constexpr bool ADJUST_VERTICAL_NO = false; -const F32 CONTEXT_CONE_IN_ALPHA = 0.f; -const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -const F32 CONTEXT_CONE_FADE_TIME = .08f; +constexpr F32 CONTEXT_CONE_IN_ALPHA = 0.f; +constexpr F32 CONTEXT_CONE_OUT_ALPHA = 1.f; +constexpr F32 CONTEXT_CONE_FADE_TIME = .08f; namespace LLFloaterEnums { @@ -228,7 +228,7 @@ public: /*virtual*/ void setIsChrome(bool is_chrome); /*virtual*/ void setRect(const LLRect &rect); void setIsSingleInstance(bool is_single_instance); - bool getIsSingleInstance() { return mSingleInstance; } + bool getIsSingleInstance() const { return mSingleInstance; } void initFloater(const Params& p); @@ -274,17 +274,17 @@ public: static bool isShown(const LLFloater* floater); static bool isVisible(const LLFloater* floater); static bool isMinimized(const LLFloater* floater); - bool isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts + bool isFirstLook() const { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts virtual bool isFrontmost(); - bool isDependent() { return !mDependeeHandle.isDead(); } + bool isDependent() const { return !mDependeeHandle.isDead(); } void setCanMinimize(bool can_minimize); void setCanClose(bool can_close); void setCanTearOff(bool can_tear_off); virtual void setCanResize(bool can_resize); void setCanDrag(bool can_drag); - bool getCanDrag(); + bool getCanDrag() const; void setHost(LLMultiFloater* host); - bool isResizable() const { return mResizable; } + bool isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; } @@ -347,7 +347,7 @@ public: virtual void setDocked(bool docked, bool pop_on_undock = true); virtual void setTornOff(bool torn_off) { mTornOff = torn_off; } - bool isTornOff() {return mTornOff;} + bool isTornOff() const { return mTornOff; } void setOpenPositioning(LLFloaterEnums::EOpenPositioning pos) {mPositioning = pos;} @@ -423,7 +423,6 @@ protected: private: void setForeground(bool b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters - void createMinimizeButton(); void buildButtons(const Params& p); // Images and tooltips are named in the XML, but we want to look them diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h index 42e7178cbc..7c975edaea 100644 --- a/indra/llui/llfloaterreglistener.h +++ b/indra/llui/llfloaterreglistener.h @@ -30,7 +30,6 @@ #define LL_LLFLOATERREGLISTENER_H #include "lleventapi.h" -#include <string> class LLSD; diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index 7a49501318..73190fc984 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -54,7 +54,7 @@ protected: LLFlyoutButton(const Params&); friend class LLUICtrlFactory; public: - virtual void draw(); + void draw() override; void setToggleState(bool state); diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 1fa0ac137e..89fee5c9f1 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -97,7 +97,7 @@ public: LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; } bool childHasKeyboardFocus( const LLView* parent ) const; void removeKeyboardFocusWithoutCallback( const LLFocusableElement* focus ); - bool getKeystrokesOnly() { return mKeystrokesOnly; } + bool getKeystrokesOnly() const { return mKeystrokesOnly; } void setKeystrokesOnly(bool keystrokes_only) { mKeystrokesOnly = keystrokes_only; } F32 getFocusFlashAmt() const; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 62ef2a0626..e78dbf1e77 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -124,11 +124,11 @@ public: void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } - bool getAllowMultiSelect() { return mAllowMultiSelect; } - bool getAllowDrag() { return mAllowDrag; } + bool getAllowMultiSelect() const { return mAllowMultiSelect; } + bool getAllowDrag() const { return mAllowDrag; } void setSingleFolderMode(bool is_single_mode) { mSingleFolderMode = is_single_mode; } - bool isSingleFolderMode() { return mSingleFolderMode; } + bool isSingleFolderMode() const { return mSingleFolderMode; } // Close all folders in the view void closeAllFolders(); @@ -142,7 +142,7 @@ public: virtual S32 getItemHeight() const; void arrangeAll() { mArrangeGeneration++; } - S32 getArrangeGeneration() { return mArrangeGeneration; } + S32 getArrangeGeneration() const { return mArrangeGeneration; } // applies filters to control visibility of items virtual void filter( LLFolderViewFilter& filter); @@ -227,27 +227,27 @@ public: void setShowSelectionContext(bool show) { mShowSelectionContext = show; } bool getShowSelectionContext(); void setShowSingleSelection(bool show); - bool getShowSingleSelection() { return mShowSingleSelection; } - F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } - bool getUseEllipses() { return mUseEllipses; } - S32 getSelectedCount() { return (S32)mSelectedItems.size(); } + bool getShowSingleSelection() const { return mShowSingleSelection; } + F32 getSelectionFadeElapsedTime() const { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } + bool getUseEllipses() const { return mUseEllipses; } + S32 getSelectedCount() const { return (S32)mSelectedItems.size(); } - void update(); // needs to be called periodically (e.g. once per frame) + void update(); // needs to be called periodically (e.g. once per frame) - bool needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } - bool needsAutoRename() { return mNeedsAutoRename; } + bool needsAutoSelect() const { return mNeedsAutoSelect && !mAutoSelectOverride; } + bool needsAutoRename() const { return mNeedsAutoRename; } void setNeedsAutoRename(bool val) { mNeedsAutoRename = val; } void setPinningSelectedItem(bool val) { mPinningSelectedItem = val; } void setAutoSelectOverride(bool val) { mAutoSelectOverride = val; } - bool showItemLinkOverlays() { return mShowItemLinkOverlays; } + bool showItemLinkOverlays() const { return mShowItemLinkOverlays; } void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } void setEnableRegistrar(LLUICtrl::EnableCallbackRegistry::ScopedRegistrar* registrar) { mEnableRegistrar = registrar; } void setForceArrange(bool force) { mForceArrange = force; } - LLPanel* getParentPanel() { return mParentPanel.get(); } + LLPanel* getParentPanel() const { return mParentPanel.get(); } // DEBUG only void dumpSelectionInformation(); @@ -255,7 +255,7 @@ public: void setShowEmptyMessage(bool show_msg) { mShowEmptyMessage = show_msg; } - bool useLabelSuffix() { return mUseLabelSuffix; } + bool useLabelSuffix() const { return mUseLabelSuffix; } virtual void updateMenu(); void finishRenamingItem( void ); @@ -390,7 +390,7 @@ public: virtual ~LLSelectFirstFilteredItem() {} virtual void doFolder(LLFolderViewFolder* folder); virtual void doItem(LLFolderViewItem* item); - bool wasItemSelected() { return mItemSelected || mFolderSelected; } + bool wasItemSelected() const { return mItemSelected || mFolderSelected; } protected: bool mItemSelected; bool mFolderSelected; diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index cc8a7d934c..234d0dc7f9 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -282,7 +282,7 @@ public: // Does not need filter update virtual void refreshSuffix(); - bool isSingleFolderMode() { return mSingleFolderMode; } + bool isSingleFolderMode() const { return mSingleFolderMode; } // LLView functionality virtual bool handleRightMouseDown( S32 x, S32 y, MASK mask ); @@ -415,9 +415,6 @@ public: // doesn't delete it. virtual void extractItem( LLFolderViewItem* item, bool deparent_model = true); - // This function is called by a child that needs to be resorted. - void resort(LLFolderViewItem* item); - void setAutoOpenCountdown(F32 countdown) { mAutoOpenCountdown = countdown; } // folders can be opened. This will usually be called by internal diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 7bf43c22c1..2bea8fb4ed 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -170,7 +170,7 @@ std::string LLKeywords::getAttribute(std::string_view key) return (it != mAttributes.end()) ? it->second : ""; } -LLUIColor LLKeywords::getColorGroup(std::string_view key_in) +LLUIColor LLKeywords::getColorGroup(std::string_view key_in) const { std::string color_group = "ScriptText"; if (key_in == "functions") diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 328561c92a..5892238593 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -111,8 +111,8 @@ public: ~LLKeywords(); void clearLoaded() { mLoaded = false; } - LLUIColor getColorGroup(std::string_view key_in); - bool isLoaded() const { return mLoaded; } + LLUIColor getColorGroup(std::string_view key_in) const; + bool isLoaded() const { return mLoaded; } void findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 1c59938f90..fe0591ce4b 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -36,8 +36,8 @@ #include "lliconctrl.h" #include "boost/foreach.hpp" -static const F32 MIN_FRACTIONAL_SIZE = 0.00001f; -static const F32 MAX_FRACTIONAL_SIZE = 1.f; +static constexpr F32 MIN_FRACTIONAL_SIZE = 0.00001f; +static constexpr F32 MAX_FRACTIONAL_SIZE = 1.f; static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel"); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 8459921c60..9e3536aaff 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -75,9 +75,6 @@ public: /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); - - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); - typedef enum e_animate { NO_ANIMATE, @@ -86,7 +83,7 @@ public: void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); void collapsePanel(LLPanel* panel, bool collapsed = true); - S32 getNumPanels() { return static_cast<S32>(mPanels.size()); } + S32 getNumPanels() const { return static_cast<S32>(mPanels.size()); } void updateLayout(); @@ -190,7 +187,6 @@ public: bool isCollapsed() const { return mCollapsed;} void setOrientation(LLView::EOrientation orientation); - void storeOriginalDim(); void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 12fe800acb..7533f76f1d 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -306,8 +306,6 @@ public: S32 calcCursorPos(S32 mouse_x); bool handleSpecialKey(KEY key, MASK mask); bool handleSelectionKey(KEY key, MASK mask); - bool handleControlKey(KEY key, MASK mask); - S32 handleCommitKey(KEY key, MASK mask); void updateTextPadding(); // Draw the background image depending on enabled/focused state. @@ -444,7 +442,7 @@ private: mText = ed->getText(); } - void doRollback( LLLineEditor* ed ) + void doRollback(LLLineEditor* ed) const { ed->mCursorPos = mCursorPos; ed->mScrollHPos = mScrollHPos; @@ -455,7 +453,7 @@ private: ed->mPrevText = mText; } - std::string getText() { return mText; } + std::string getText() const { return mText; } private: std::string mText; diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index a77ae7dae7..3f96b28246 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -65,8 +65,8 @@ public: boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); - /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleKeyHere(KEY key, MASK mask ); + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; void hideMenu(); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 88608b20ab..e31cb184e5 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -439,8 +439,6 @@ protected: public: virtual ~LLMenuGL( void ); - void parseChildXML(LLXMLNodePtr child, LLView* parent); - // LLView Functionality /*virtual*/ bool handleUnicodeCharHere( llwchar uni_char ); /*virtual*/ bool handleHover( S32 x, S32 y, MASK mask ); diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index a7f9b8b2d9..f53e22c349 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -390,7 +390,7 @@ LLFloater* LLMultiFloater::getActiveFloater() return (LLFloater*)mTabContainer->getCurrentPanel(); } -S32 LLMultiFloater::getFloaterCount() +S32 LLMultiFloater::getFloaterCount() const { return mTabContainer->getTabCount(); } diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index eb0f917695..e0cd58aa3f 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -66,7 +66,7 @@ public: virtual LLFloater* getActiveFloater(); virtual bool isFloaterFlashing(LLFloater* floaterp); - virtual S32 getFloaterCount(); + virtual S32 getFloaterCount() const; virtual void setFloaterFlashing(LLFloater* floaterp, bool flashing); virtual bool closeAllFloaters(); //Returns false if the floater could not be closed due to pending confirmation dialogs diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index b2bfc8bc84..af255bcc8f 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -117,10 +117,10 @@ public: /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; /*virtual*/ void draw() override; - S32 getMaxNumSliders() { return mMaxNumSliders; } - S32 getCurNumSliders() { return static_cast<S32>(mValue.size()); } - F32 getOverlapThreshold() { return mOverlapThreshold; } - bool canAddSliders() { return mValue.size() < mMaxNumSliders; } + S32 getMaxNumSliders() const { return mMaxNumSliders; } + S32 getCurNumSliders() const { return static_cast<S32>(mValue.size()); } + F32 getOverlapThreshold() const { return mOverlapThreshold; } + bool canAddSliders() const { return mValue.size() < mMaxNumSliders; } protected: diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index dec6cb48b9..2c2bc5e4d9 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -124,10 +124,10 @@ public: F32 getMinValue() const { return mMultiSlider->getMinValue(); } F32 getMaxValue() const { return mMultiSlider->getMaxValue(); } - S32 getMaxNumSliders() { return mMultiSlider->getMaxNumSliders(); } - S32 getCurNumSliders() { return mMultiSlider->getCurNumSliders(); } - F32 getOverlapThreshold() { return mMultiSlider->getOverlapThreshold(); } - bool canAddSliders() { return mMultiSlider->canAddSliders(); } + S32 getMaxNumSliders() const { return mMultiSlider->getMaxNumSliders(); } + S32 getCurNumSliders() const { return mMultiSlider->getCurNumSliders(); } + F32 getOverlapThreshold() const { return mMultiSlider->getOverlapThreshold(); } + bool canAddSliders() const { return mMultiSlider->canAddSliders(); } void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; } @@ -147,7 +147,6 @@ public: static void onEditorCommit(LLUICtrl* ctrl, const LLSD& userdata); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); private: void updateText(); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 9d59b99349..eca13cbb3c 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -248,7 +248,6 @@ public: LLNotificationForm(const LLSD& sd); LLNotificationForm(const std::string& name, const Params& p); - void fromLLSD(const LLSD& sd); LLSD asLLSD() const; S32 getNumElements() { return static_cast<S32>(mFormData.size()); } @@ -267,8 +266,8 @@ public: bool getIgnored(); void setIgnored(bool ignored); - EIgnoreType getIgnoreType() { return mIgnore; } - std::string getIgnoreMessage() { return mIgnoreMsg; } + EIgnoreType getIgnoreType()const { return mIgnore; } + std::string getIgnoreMessage() const { return mIgnoreMsg; } private: LLSD mFormData; @@ -972,8 +971,6 @@ private: /*virtual*/ void initSingleton() override; /*virtual*/ void cleanupSingleton() override; - void loadPersistentNotifications(); - bool expirationFilter(LLNotificationPtr pNotification); bool expirationHandler(const LLSD& payload); bool uniqueFilter(LLNotificationPtr pNotification); diff --git a/indra/llui/llprogressbar.h b/indra/llui/llprogressbar.h index 0d5d32cf21..7245bbf1cf 100644 --- a/indra/llui/llprogressbar.h +++ b/indra/llui/llprogressbar.h @@ -48,9 +48,9 @@ public: LLProgressBar(const Params&); virtual ~LLProgressBar(); - void setValue(const LLSD& value); + void setValue(const LLSD& value) override; - /*virtual*/ void draw(); + void draw() override; private: F32 mPercentDone; diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index 4b0f435834..68bf0fd95e 100644 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -61,7 +61,7 @@ public: void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; } void setEnableSnapping(bool enable) { mSnappingEnabled = enable; } void setAllowDoubleClickSnapping(bool allow) { mAllowDoubleClickSnapping = allow; } - bool canResize() { return getEnabled() && mMaxSize > mMinSize; } + bool canResize() const { return getEnabled() && mMaxSize > mMinSize; } void setResizeListener(boost::function<void(void*)> listener) {mResizeListener = listener;} void setImagePanel(LLPanel * panelp); LLPanel * getImagePanel() const; diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 9cc4123544..caec33405c 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -50,10 +50,10 @@ protected: LLResizeHandle(const LLResizeHandle::Params&); friend class LLUICtrlFactory; public: - virtual void draw(); - virtual bool handleHover(S32 x, S32 y, MASK mask); - virtual bool handleMouseDown(S32 x, S32 y, MASK mask); - virtual bool handleMouseUp(S32 x, S32 y, MASK mask); + void draw() override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } @@ -71,8 +71,8 @@ private: const ECorner mCorner; }; -const S32 RESIZE_HANDLE_HEIGHT = 11; -const S32 RESIZE_HANDLE_WIDTH = 11; +constexpr S32 RESIZE_HANDLE_HEIGHT = 11; +constexpr S32 RESIZE_HANDLE_WIDTH = 11; #endif // LL_RESIZEHANDLE_H diff --git a/indra/llui/llrngwriter.h b/indra/llui/llrngwriter.h index 33ec049a1a..2c39472607 100644 --- a/indra/llui/llrngwriter.h +++ b/indra/llui/llrngwriter.h @@ -37,7 +37,7 @@ public: void writeRNG(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace); void addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block); - /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; } + std::string getCurrentElementName() override { return LLStringUtil::null; } LLRNGWriter(); diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index e7ff5c8424..7dded3c0b7 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -105,7 +105,7 @@ public: virtual const LLSD getAltValue() const; virtual void setValue(const LLSD& value) { } virtual void setAltValue(const LLSD& value) { } - virtual const std::string &getToolTip() const { return mToolTip; } + virtual const std::string& getToolTip() const { return mToolTip; } virtual void setToolTip(const std::string &str) { mToolTip = str; } virtual bool getVisible() const { return true; } virtual void setWidth(S32 width) { mWidth = width; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index ea2caaa1c0..8998d965fb 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -490,12 +490,12 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const // returns first matching item LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const { - const std::string& string_val = sd.asStringRef(); + std::string string_val = sd.asString(); for (LLScrollListItem* item : mItemList) { // assumes string representation is good enough for comparison - if (item->getValue().asStringRef() == string_val) + if (item->getValue().asString() == string_val) { return item; } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index c24784338a..1f04100306 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -165,7 +165,6 @@ public: void deleteAllItems() { clearRows(); } // Sets an array of column descriptors - void setColumnHeadings(const LLSD& headings); void sortByColumnIndex(U32 column, bool ascending); // LLCtrlListInterface functions @@ -318,7 +317,7 @@ public: void setAllowKeyboardMovement(bool b) { mAllowKeyboardMovement = b; } void setMaxSelectable(U32 max_selected) { mMaxSelectable = max_selected; } - S32 getMaxSelectable() { return mMaxSelectable; } + S32 getMaxSelectable() const { return mMaxSelectable; } virtual S32 getScrollPos() const; @@ -334,7 +333,7 @@ public: // support right-click context menus for avatar/group lists enum ContextMenuType { MENU_NONE, MENU_AVATAR, MENU_GROUP }; void setContextMenu(const ContextMenuType &menu) { mContextMenuType = menu; } - ContextMenuType getContextMenuType() { return mContextMenuType; } + ContextMenuType getContextMenuType() const { return mContextMenuType; } // Overridden from LLView /*virtual*/ void draw(); @@ -362,7 +361,6 @@ public: virtual void fitContents(S32 max_width, S32 max_height); virtual LLRect getRequiredRect(); - static bool rowPreceeds(LLScrollListItem *new_row, LLScrollListItem *test_row); LLRect getItemListRect() { return mItemListRect; } @@ -384,7 +382,6 @@ public: * then display all items. */ void setPageLines(S32 page_lines ); - void setCollapseEmptyColumns(bool collapse); LLScrollListItem* hitItem(S32 x,S32 y); virtual void scrollToShowSelected(); @@ -401,7 +398,7 @@ public: void setNumDynamicColumns(S32 num) { mNumDynamicWidthColumns = num; } void updateStaticColumnWidth(LLScrollListColumn* col, S32 new_width); - S32 getTotalStaticColumnWidth() { return mTotalStaticColumnWidth; } + S32 getTotalStaticColumnWidth() const { return mTotalStaticColumnWidth; } std::string getSortColumnName(); bool getSortAscending() { return mSortColumns.empty() ? true : mSortColumns.back().second; } diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 311377a61f..23ce8fd955 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -132,7 +132,6 @@ public: static void onEditorCommit(LLUICtrl* ctrl, const LLSD& userdata); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); protected: virtual std::string _getSearchText() const diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index 58b38dc630..4ba8c97c63 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -94,7 +94,6 @@ public: void onEditorCommit(const LLSD& data); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); static void onEditorLostFocus(LLFocusableElement* caller, void *userdata); - static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); void onUpBtn(const LLSD& data); void onDownBtn(const LLSD& data); diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index c36a138566..bbbf0b3a19 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -67,7 +67,7 @@ public: void setStat(const std::string& stat_name); void setRange(F32 bar_min, F32 bar_max); - void getRange(F32& bar_min, F32& bar_max) { bar_min = mTargetMinBar; bar_max = mTargetMaxBar; } + void getRange(F32& bar_min, F32& bar_max) const { bar_min = mTargetMinBar; bar_max = mTargetMaxBar; } /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index d97051247e..0af717d447 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -36,7 +36,6 @@ #include "llglheaders.h" #include "lltracerecording.h" #include "lltracethreadrecorder.h" -//#include "llviewercontrol.h" /////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index c254821870..6d9e3d1064 100644 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -99,9 +99,7 @@ public: void setMin(const F32 min); void setMax(const F32 max); - virtual void draw(); - - /*virtual*/ void setValue(const LLSD& value); + void draw() override; private: LLTrace::StatType<LLTrace::CountAccumulator>* mNewStatFloatp; @@ -133,9 +131,6 @@ private: }; typedef std::vector<Threshold> threshold_vec_t; threshold_vec_t mThresholds; - //S32 mNumThresholds; - //F32 mThresholds[4]; - //LLColor4 mThresholdColors[4]; }; #endif // LL_LLSTATGRAPH_H diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index b5187f886d..a396773057 100644 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -29,7 +29,6 @@ #include "llstatbar.h" #include "llcontainerview.h" -#include <vector> class LLStatBar; diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index f1d57a2273..aafcfbc143 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -66,9 +66,9 @@ LLStyle* LLStyle::makeCopy() const copy->mDropShadow = mDropShadow; copy->mFontName = mFontName; copy->mLink = mLink; - copy->mColor = mColor; - copy->mReadOnlyColor = mReadOnlyColor; - copy->mSelectedColor = mSelectedColor; + copy->mColor.set(mColor.get()); + copy->mReadOnlyColor.set(mReadOnlyColor.get()); + copy->mSelectedColor.set(mSelectedColor.get()); copy->mFont = mFont; copy->mImagep = mImagep; copy->mAlpha = mAlpha; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 595ab0bd2b..5e0985c79c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1370,17 +1370,17 @@ LLPanel* LLTabContainer::getCurrentPanel() return NULL; } -S32 LLTabContainer::getCurrentPanelIndex() +S32 LLTabContainer::getCurrentPanelIndex() const { return mCurrentTabIdx; } -S32 LLTabContainer::getTabCount() +S32 LLTabContainer::getTabCount() const { return static_cast<S32>(mTabList.size()); } -LLPanel* LLTabContainer::getPanelByIndex(S32 index) +LLPanel* LLTabContainer::getPanelByIndex(S32 index) const { if (index >= 0 && index < (S32)mTabList.size()) { @@ -1389,7 +1389,7 @@ LLPanel* LLTabContainer::getPanelByIndex(S32 index) return NULL; } -S32 LLTabContainer::getIndexForPanel(LLPanel* panel) +S32 LLTabContainer::getIndexForPanel(LLPanel* panel) const { for (S32 index = 0; index < (S32)mTabList.size(); index++) { @@ -1401,7 +1401,7 @@ S32 LLTabContainer::getIndexForPanel(LLPanel* panel) return -1; } -S32 LLTabContainer::getPanelIndexByTitle(std::string_view title) +S32 LLTabContainer::getPanelIndexByTitle(std::string_view title) const { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 40f272ffa8..4ac7e73d25 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -182,15 +182,15 @@ public: void removeTabPanel( LLPanel* child ); void lockTabs(S32 num_tabs = 0); void unlockTabs(); - S32 getNumLockedTabs() { return mLockedTabCount; } + S32 getNumLockedTabs() const { return mLockedTabCount; } void enableTabButton(S32 which, bool enable); void deleteAllTabs(); LLPanel* getCurrentPanel(); - S32 getCurrentPanelIndex(); - S32 getTabCount(); - LLPanel* getPanelByIndex(S32 index); - S32 getIndexForPanel(LLPanel* panel); - S32 getPanelIndexByTitle(std::string_view title); + S32 getCurrentPanelIndex() const; + S32 getTabCount() const; + LLPanel* getPanelByIndex(S32 index) const; + S32 getIndexForPanel(LLPanel* panel) const; + S32 getPanelIndexByTitle(std::string_view title) const; LLPanel* getPanelByName(std::string_view name); S32 getTotalTabWidth() const; void setCurrentTabName(const std::string& name); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index b3fde84f5f..5cc0f03bd3 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -146,7 +146,6 @@ public: /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } /*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; } /*virtual*/ LLKeywordToken* getToken() const { return mToken; } - /*virtual*/ bool getToolTip( std::string& msg ) const; /*virtual*/ void setToolTip(const std::string& tooltip); /*virtual*/ void dump() const; @@ -451,7 +450,7 @@ public: virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style /*virtual*/ const std::string& getText() const override; void setMaxTextLength(S32 length) { mMaxTextByteLength = length; } - S32 getMaxTextLength() { return mMaxTextByteLength; } + S32 getMaxTextLength() const { return mMaxTextByteLength; } // wide-char versions void setWText(const LLWString& text); @@ -490,10 +489,10 @@ public: LLRect getTextBoundingRect(); LLRect getVisibleDocumentRect() const; - S32 getVPad() { return mVPad; } - S32 getHPad() { return mHPad; } - F32 getLineSpacingMult() { return mLineSpacingMult; } - S32 getLineSpacingPixels() { return mLineSpacingPixels; } // only for multiline + S32 getVPad() const { return mVPad; } + S32 getHPad() const { return mHPad; } + F32 getLineSpacingMult() const { return mLineSpacingMult; } + S32 getLineSpacingPixels() const { return mLineSpacingPixels; } // only for multiline S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round, bool hit_past_end_of_line = true) const; LLRect getLocalRectFromDocIndex(S32 pos) const; @@ -503,7 +502,7 @@ public: bool getReadOnly() const { return mReadOnly; } void setSkipLinkUnderline(bool skip_link_underline) { mSkipLinkUnderline = skip_link_underline; } - bool getSkipLinkUnderline() { return mSkipLinkUnderline; } + bool getSkipLinkUnderline() const { return mSkipLinkUnderline; } void setParseURLs(bool parse_urls) { mParseHTML = parse_urls; } @@ -517,8 +516,8 @@ public: void endOfLine(); void startOfDoc(); void endOfDoc(); - void changePage( S32 delta ); - void changeLine( S32 delta ); + void changePage(S32 delta); + void changeLine(S32 delta); bool scrolledToStart(); bool scrolledToEnd(); @@ -680,7 +679,6 @@ protected: void appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params = LLStyle::Params()); void appendAndHighlightTextImpl(const std::string &new_text, LLTextParser::EHighlightPosition highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only, std::string tooltip = LLStringUtil::null); - S32 normalizeUri(std::string& uri); protected: // virtual diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index a3cde45cd0..69a7567a44 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -46,32 +46,32 @@ protected: friend class LLUICtrlFactory; public: - virtual ~LLTextBox(); + ~LLTextBox() override; - /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleHover(S32 x, S32 y, MASK mask) override; - /*virtual*/ void setEnabled(bool enabled); + void setEnabled(bool enabled) override; - /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() ); + void setText(const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params()) override; - void setRightAlign() { mHAlign = LLFontGL::RIGHT; } - void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } - void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); + void setRightAlign() { mHAlign = LLFontGL::RIGHT; } + void setHAlign(LLFontGL::HAlign align) { mHAlign = align; } + void setClickedCallback(boost::function<void(void*)> cb, void* userdata = NULL); - void reshapeToFitText(bool called_from_parent = false); + void reshapeToFitText(bool called_from_parent = false); - S32 getTextPixelWidth(); - S32 getTextPixelHeight(); + S32 getTextPixelWidth(); + S32 getTextPixelHeight(); - /*virtual*/ LLSD getValue() const; - /*virtual*/ bool setTextArg( const std::string& key, const LLStringExplicit& text ); + LLSD getValue() const override; + bool setTextArg(const std::string& key, const LLStringExplicit& text) override; - void setShowCursorHand(bool show_cursor) { mShowCursorHand = show_cursor; } + void setShowCursorHand(bool show_cursor) { mShowCursorHand = show_cursor; } protected: - void onUrlLabelUpdated(const std::string &url, const std::string &label); + void onUrlLabelUpdated(const std::string& url, const std::string& label); LLUIString mText; callback_t mClickedCallback; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index c8cde90032..ecac800def 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1594,9 +1594,7 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string) } } - -template <> -void LLTextEditor::pasteTextWithLinebreaks<LLWString>(const LLWString & clean_string) +void LLTextEditor::pasteTextWithLinebreaksImpl(const LLWString & clean_string) { std::basic_string<llwchar>::size_type start = 0; std::basic_string<llwchar>::size_type pos = clean_string.find('\n',start); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 765c88a933..6d45a72deb 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -201,7 +201,6 @@ public: const LLUUID& getSourceID() const { return mSourceID; } const LLTextSegmentPtr getPreviousSegment() const; - const LLTextSegmentPtr getLastSegment() const; void getSelectedSegments(segment_vec_t& segments) const; void setShowContextMenu(bool show) { mShowContextMenu = show; } @@ -217,8 +216,6 @@ protected: void showContextMenu(S32 x, S32 y); void drawPreeditMarker(); - void assignEmbedded(const std::string &s); - void removeCharOrTab(); void indentSelectedLines( S32 spaces ); @@ -238,7 +235,6 @@ protected: void autoIndent(); - void findEmbeddedItemSegments(S32 start, S32 end); void getSegmentsInRange(segment_vec_t& segments, S32 start, S32 end, bool include_partial) const; virtual llwchar pasteEmbeddedItem(llwchar ext_char) { return ext_char; } @@ -307,16 +303,15 @@ private: // Methods // void pasteHelper(bool is_primary); - void cleanStringForPaste(LLWString & clean_string); + void cleanStringForPaste(LLWString& clean_string); public: template <typename STRINGTYPE> void pasteTextWithLinebreaks(const STRINGTYPE& clean_string) { - pasteTextWithLinebreaks<LLWString>(ll_convert(clean_string)); + pasteTextWithLinebreaksImpl(ll_convert(clean_string)); } - template <> - void pasteTextWithLinebreaks<LLWString>(const LLWString & clean_string); + void pasteTextWithLinebreaksImpl(const LLWString& clean_string); private: void onKeyStroke(); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index c57c979525..5556406fbd 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -68,7 +68,7 @@ public: void reshape(S32 width, S32 height, bool called_from_parent = true); void setEnabled(bool enabled); void setCommandId(const LLCommandId& id) { mId = id; } - LLCommandId getCommandId() { return mId; } + LLCommandId getCommandId() const { return mId; } void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } @@ -256,7 +256,7 @@ public: // Methods used in loading and saving toolbar settings void setButtonType(LLToolBarEnums::ButtonType button_type); - LLToolBarEnums::ButtonType getButtonType() { return mButtonType; } + LLToolBarEnums::ButtonType getButtonType() const { return mButtonType; } command_id_list_t& getCommandsList() { return mButtonCommands; } void clearCommandsList(); diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 86525c2f7e..74f03618cf 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -390,22 +390,22 @@ void LLToolTip::draw() } } -bool LLToolTip::isFading() +bool LLToolTip::isFading() const { return mFadeTimer.getStarted(); } -F32 LLToolTip::getVisibleTime() +F32 LLToolTip::getVisibleTime() const { return mVisibleTimer.getStarted() ? mVisibleTimer.getElapsedTimeF32() : 0.f; } -bool LLToolTip::hasClickCallback() +bool LLToolTip::hasClickCallback() const { return mHasClickCallback; } -void LLToolTip::getToolTipMessage(std::string & message) +void LLToolTip::getToolTipMessage(std::string& message) const { if (mTextBox) { diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 8515504e3b..760acddd6f 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -44,15 +44,15 @@ public: Params(); }; LLToolTipView(const LLToolTipView::Params&); - /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleMiddleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ bool handleScrollWheel( S32 x, S32 y, S32 clicks ); + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + bool handleScrollWheel( S32 x, S32 y, S32 clicks ) override; void drawStickyRect(); - /*virtual*/ void draw(); + void draw() override; }; class LLToolTip : public LLPanel @@ -98,20 +98,20 @@ public: Params(); }; - /*virtual*/ void draw(); - /*virtual*/ bool handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void setVisible(bool visible); + void draw() override; + bool handleHover(S32 x, S32 y, MASK mask) override; + void onMouseLeave(S32 x, S32 y, MASK mask) override; + void setVisible(bool visible) override; - bool isFading(); - F32 getVisibleTime(); - bool hasClickCallback(); + bool isFading() const; + F32 getVisibleTime() const; + bool hasClickCallback() const; LLToolTip(const Params& p); virtual void initFromParams(const LLToolTip::Params& params); - void getToolTipMessage(std::string & message); - bool isTooltipPastable() { return mIsTooltipPastable; } + void getToolTipMessage(std::string & message) const; + bool isTooltipPastable() const { return mIsTooltipPastable; } protected: void updateTextBox(); diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 375cd539b7..051ecc4405 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -156,7 +156,7 @@ public: sanitizeRange(); } - S32 clamp(S32 input) + S32 clamp(S32 input) const { if (input < mMin) return mMin; if (input > mMax) return mMax; @@ -170,8 +170,8 @@ public: sanitizeRange(); } - S32 getMin() { return mMin; } - S32 getMax() { return mMax; } + S32 getMin() const { return mMin; } + S32 getMax() const { return mMax; } bool operator==(const RangeS32& other) const { @@ -225,7 +225,7 @@ public: mValue = clamp(value); } - S32 get() + S32 get() const { return mValue; } @@ -255,7 +255,7 @@ public: static std::string getLanguage(); // static for lldateutil_test compatibility //helper functions (should probably move free standing rendering helper functions here) - LLView* getRootView() { return mRootView; } + LLView* getRootView() const { return mRootView; } void setRootView(LLView* view) { mRootView = view; } /** * Walk the LLView tree to resolve a path @@ -298,7 +298,7 @@ public: LLControlGroup& getControlControlGroup (std::string_view controlname); F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); } void resetMouseIdleTimer() { mMouseIdleTimer.reset(); } - LLWindow* getWindow() { return mWindow; } + LLWindow* getWindow() const { return mWindow; } void addPopup(LLView*); void removePopup(LLView*); diff --git a/indra/llui/lluiconstants.h b/indra/llui/lluiconstants.h index 5fdfd37c6e..a317c66008 100644 --- a/indra/llui/lluiconstants.h +++ b/indra/llui/lluiconstants.h @@ -28,23 +28,23 @@ #define LL_LLUICONSTANTS_H // spacing for small font lines of text, like LLTextBoxes -const S32 LINE = 16; +constexpr S32 LINE = 16; // spacing for larger lines of text -const S32 LINE_BIG = 24; +constexpr S32 LINE_BIG = 24; // default vertical padding -const S32 VPAD = 4; +constexpr S32 VPAD = 4; // default horizontal padding -const S32 HPAD = 4; +constexpr S32 HPAD = 4; // Account History, how far to look into past -const S32 SUMMARY_INTERVAL = 7; // one week -const S32 SUMMARY_MAX = 8; // -const S32 DETAILS_INTERVAL = 1; // one day -const S32 DETAILS_MAX = 30; // one month -const S32 TRANSACTIONS_INTERVAL = 1;// one day -const S32 TRANSACTIONS_MAX = 30; // one month +constexpr S32 SUMMARY_INTERVAL = 7; // one week +constexpr S32 SUMMARY_MAX = 8; // +constexpr S32 DETAILS_INTERVAL = 1; // one day +constexpr S32 DETAILS_MAX = 30; // one month +constexpr S32 TRANSACTIONS_INTERVAL = 1;// one day +constexpr S32 TRANSACTIONS_MAX = 30; // one month #endif diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 2c73ff6b57..b95c221d68 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -39,9 +39,9 @@ #include "llviewmodel.h" // *TODO move dependency to .cpp file #include "llsearchablecontrol.h" -const bool TAKE_FOCUS_YES = true; -const bool TAKE_FOCUS_NO = false; -const S32 DROP_SHADOW_FLOATER = 5; +constexpr bool TAKE_FOCUS_YES = true; +constexpr bool TAKE_FOCUS_NO = false; +constexpr S32 DROP_SHADOW_FLOATER = 5; class LLUICtrl : public LLView, public boost::signals2::trackable diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 75e7e396bc..91221dc7f3 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -184,7 +184,7 @@ fail: template<class T> static T* getDefaultWidget(std::string_view name) { - typename T::Params widget_params; + typename T::Params widget_params{}; widget_params.name = std::string(name); return create<T>(widget_params); } diff --git a/indra/llui/llundo.h b/indra/llui/llundo.h index dc40702be0..990745e530 100644 --- a/indra/llui/llundo.h +++ b/indra/llui/llundo.h @@ -42,7 +42,7 @@ public: LLUndoAction(): mClusterID(0) {}; virtual ~LLUndoAction(){}; private: - S32 mClusterID; + S32 mClusterID; }; LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ); @@ -51,8 +51,8 @@ public: LLUndoAction *getNextAction(bool setClusterBegin = true); bool undoAction(); bool redoAction(); - bool canUndo() { return (mNextAction != mFirstAction); } - bool canRedo() { return (mNextAction != mLastAction); } + bool canUndo() const { return (mNextAction != mFirstAction); } + bool canRedo() const { return (mNextAction != mLastAction); } void flushActions(); diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 0f54b66299..ac9741a7ad 100644 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -45,8 +45,6 @@ class LLUrlAction { public: - LLUrlAction(); - /// load a Url in the user's preferred web browser static void openURL(std::string url); diff --git a/indra/llui/llurlmatch.h b/indra/llui/llurlmatch.h index ba822fbda6..887796bb37 100644 --- a/indra/llui/llurlmatch.h +++ b/indra/llui/llurlmatch.h @@ -31,7 +31,6 @@ //#include "linden_common.h" #include <string> -#include <vector> #include "llstyle.h" /// diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index 64cfec3960..c22af0dbc4 100644 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -34,7 +34,6 @@ #include "llstring.h" #include <string> -#include <vector> class LLKeyBindingToStringHandler; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 710ec3d05e..97212a9d2d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -54,17 +54,17 @@ class LLSD; -const U32 FOLLOWS_NONE = 0x00; -const U32 FOLLOWS_LEFT = 0x01; -const U32 FOLLOWS_RIGHT = 0x02; -const U32 FOLLOWS_TOP = 0x10; -const U32 FOLLOWS_BOTTOM = 0x20; -const U32 FOLLOWS_ALL = 0x33; +constexpr U32 FOLLOWS_NONE = 0x00; +constexpr U32 FOLLOWS_LEFT = 0x01; +constexpr U32 FOLLOWS_RIGHT = 0x02; +constexpr U32 FOLLOWS_TOP = 0x10; +constexpr U32 FOLLOWS_BOTTOM = 0x20; +constexpr U32 FOLLOWS_ALL = 0x33; -const bool MOUSE_OPAQUE = true; -const bool NOT_MOUSE_OPAQUE = false; +constexpr bool MOUSE_OPAQUE = true; +constexpr bool NOT_MOUSE_OPAQUE = false; -const U32 GL_NAME_UI_RESERVED = 2; +constexpr U32 GL_NAME_UI_RESERVED = 2; // maintains render state during traversal of UI tree @@ -241,7 +241,7 @@ public: void setUseBoundingRect( bool use_bounding_rect ); bool getUseBoundingRect() const; - ECursorType getHoverCursor() { return mHoverCursor; } + ECursorType getHoverCursor() const { return mHoverCursor; } static F32 getTooltipTimeout(); virtual const std::string getToolTip() const; @@ -265,7 +265,7 @@ public: void setDefaultTabGroup(S32 d) { mDefaultTabGroup = d; } S32 getDefaultTabGroup() const { return mDefaultTabGroup; } - S32 getLastTabGroup() { return mLastTabGroup; } + S32 getLastTabGroup() const { return mLastTabGroup; } bool isInVisibleChain() const; bool isInEnabledChain() const; diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index 1f118a0d20..a4bb748b77 100644 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h @@ -92,7 +92,6 @@ public: private: void drawOnePixelLines(); void drawTwoPixelLines(); - void drawTextures(); EBevel mBevel; EStyle mStyle; diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 9e752e8090..5636c068d8 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -61,7 +61,7 @@ public: std::string get_xui(); void update_xui(std::string xui); - bool getLoggingStatus(){return logEvents;}; + bool getLoggingStatus() const { return logEvents; } void setEventLoggingOn(); void setEventLoggingOff(); diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index 61a78b2398..fbfda04585 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -78,20 +78,20 @@ public: }; - virtual ~LLVirtualTrackball(); - /*virtual*/ bool postBuild(); + ~LLVirtualTrackball() override; + bool postBuild() override; - virtual bool handleHover(S32 x, S32 y, MASK mask); - virtual bool handleMouseUp(S32 x, S32 y, MASK mask); - virtual bool handleMouseDown(S32 x, S32 y, MASK mask); - virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual bool handleKeyHere(KEY key, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleRightMouseDown(S32 x, S32 y, MASK mask) override; + bool handleKeyHere(KEY key, MASK mask) override; - virtual void draw(); + void draw() override; - virtual void setValue(const LLSD& value); - void setValue(F32 x, F32 y, F32 z, F32 w); - virtual LLSD getValue() const; + void setValue(const LLSD& value) override; + void setValue(F32 x, F32 y, F32 z, F32 w); + LLSD getValue() const override; void setRotation(const LLQuaternion &value); LLQuaternion getRotation() const; @@ -102,7 +102,6 @@ public: protected: friend class LLUICtrlFactory; LLVirtualTrackball(const Params&); - void onEditChange(); protected: LLTextBox* mNLabel; diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index da29188943..ee230cd2f6 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -49,7 +49,7 @@ public: }; void show(LLNotificationPtr); - /*virtual*/ void draw(); + void draw() override; void hide(); bool isShown() const; diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h index bc41213c13..646771f387 100644 --- a/indra/llui/llxyvector.h +++ b/indra/llui/llxyvector.h @@ -65,18 +65,18 @@ public: }; - virtual ~LLXYVector(); - /*virtual*/ bool postBuild(); + ~LLXYVector() override; + bool postBuild() override; - virtual bool handleHover(S32 x, S32 y, MASK mask); - virtual bool handleMouseUp(S32 x, S32 y, MASK mask); - virtual bool handleMouseDown(S32 x, S32 y, MASK mask); + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleMouseUp(S32 x, S32 y, MASK mask) override; + bool handleMouseDown(S32 x, S32 y, MASK mask) override; - virtual void draw(); + void draw() override; - virtual void setValue(const LLSD& value); - void setValue(F32 x, F32 y); - virtual LLSD getValue() const; + void setValue(const LLSD& value) override; + void setValue(F32 x, F32 y); + LLSD getValue() const override; protected: friend class LLUICtrlFactory; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 378e633cd2..4016f420e8 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -421,7 +421,7 @@ LLWindow* LLWindowManager::createWindow( fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth); #elif LL_SDL new_window = new LLWindowSDL(callbacks, - title, x, y, width, height, flags, + title, name, x, y, width, height, flags, fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples); #elif LL_WINDOWS new_window = new LLWindowWin32(callbacks, diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 89f0d152c6..eb8e2dbc3c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -59,9 +59,6 @@ extern bool gDebugWindowProc; const S32 MAX_NUM_RESOLUTIONS = 200; -// static variable for ATI mouse cursor crash work-around: -static bool ATIbug = false; - // // LLWindowSDL // @@ -113,250 +110,8 @@ Display* LLWindowSDL::get_SDL_Display(void) } #endif // LL_X11 -#if LL_X11 - -// Clipboard handing via native X11, base on the implementation in Cool VL by Henri Beauchamp - -namespace -{ - std::array<Atom, 3> gSupportedAtoms; - - Atom XA_CLIPBOARD; - Atom XA_TARGETS; - Atom PVT_PASTE_BUFFER; - long const MAX_PASTE_BUFFER_SIZE = 16383; - - void filterSelectionRequest( XEvent aEvent ) - { - auto *display = LLWindowSDL::getSDLDisplay(); - auto &request = aEvent.xselectionrequest; - - XSelectionEvent reply { SelectionNotify, aEvent.xany.serial, aEvent.xany.send_event, display, - request.requestor, request.selection, request.target, - request.property,request.time }; - - if (request.target == XA_TARGETS) - { - XChangeProperty(display, request.requestor, request.property, - XA_ATOM, 32, PropModeReplace, - (unsigned char *) &gSupportedAtoms.front(), gSupportedAtoms.size()); - } - else if (std::find(gSupportedAtoms.begin(), gSupportedAtoms.end(), request.target) != - gSupportedAtoms.end()) - { - std::string utf8; - if (request.selection == XA_PRIMARY) - utf8 = wstring_to_utf8str(gWindowImplementation->getPrimaryText()); - else - utf8 = wstring_to_utf8str(gWindowImplementation->getSecondaryText()); - - XChangeProperty(display, request.requestor, request.property, - request.target, 8, PropModeReplace, - (unsigned char *) utf8.c_str(), utf8.length()); - } - else if (request.selection == XA_CLIPBOARD) - { - // Did not have what they wanted, so no property set - reply.property = None; - } - else - return; - - XSendEvent(request.display, request.requestor, False, NoEventMask, (XEvent *) &reply); - XSync(display, False); - } - - void filterSelectionClearRequest( XEvent aEvent ) - { - auto &request = aEvent.xselectionrequest; - if (request.selection == XA_PRIMARY) - gWindowImplementation->clearPrimaryText(); - else if (request.selection == XA_CLIPBOARD) - gWindowImplementation->clearSecondaryText(); - } - - int x11_clipboard_filter(void*, SDL_Event *evt) - { - Display *display = LLWindowSDL::getSDLDisplay(); - if (!display) - return 1; - - if (evt->type != SDL_SYSWMEVENT) - return 1; - - auto xevent = evt->syswm.msg->msg.x11.event; - - if (xevent.type == SelectionRequest) - filterSelectionRequest( xevent ); - else if (xevent.type == SelectionClear) - filterSelectionClearRequest( xevent ); - return 1; - } - - bool grab_property(Display* display, Window window, Atom selection, Atom target) - { - if( !display ) - return false; - - maybe_lock_display(); - - XDeleteProperty(display, window, PVT_PASTE_BUFFER); - XFlush(display); - - XConvertSelection(display, selection, target, PVT_PASTE_BUFFER, window, CurrentTime); - - // Unlock the connection so that the SDL event loop may function - maybe_unlock_display(); - - const auto start{ SDL_GetTicks() }; - const auto end{ start + 1000 }; - - XEvent xevent {}; - bool response = false; - - do - { - SDL_Event event {}; - - // Wait for an event - SDL_WaitEvent(&event); - - // If the event is a window manager event - if (event.type == SDL_SYSWMEVENT) - { - xevent = event.syswm.msg->msg.x11.event; - - if (xevent.type == SelectionNotify && xevent.xselection.requestor == window) - response = true; - } - } while (!response && SDL_GetTicks() < end ); - - return response && xevent.xselection.property != None; - } -} - -void LLWindowSDL::initialiseX11Clipboard() -{ - if (!mSDL_Display) - return; - - SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); - SDL_SetEventFilter(x11_clipboard_filter, nullptr); - - maybe_lock_display(); - - XA_CLIPBOARD = XInternAtom(mSDL_Display, "CLIPBOARD", False); - - gSupportedAtoms[0] = XInternAtom(mSDL_Display, "UTF8_STRING", False); - gSupportedAtoms[1] = XInternAtom(mSDL_Display, "COMPOUND_TEXT", False); - gSupportedAtoms[2] = XA_STRING; - - // TARGETS atom - XA_TARGETS = XInternAtom(mSDL_Display, "TARGETS", False); - - // SL_PASTE_BUFFER atom - PVT_PASTE_BUFFER = XInternAtom(mSDL_Display, "FS_PASTE_BUFFER", False); - - maybe_unlock_display(); -} - -bool LLWindowSDL::getSelectionText( Atom aSelection, Atom aType, LLWString &text ) -{ - if( !mSDL_Display ) - return false; - - if( !grab_property(mSDL_Display, mSDL_XWindowID, aSelection,aType ) ) - return false; - - maybe_lock_display(); - - Atom type; - int format{}; - unsigned long len{},remaining {}; - unsigned char* data = nullptr; - int res = XGetWindowProperty(mSDL_Display, mSDL_XWindowID, - PVT_PASTE_BUFFER, 0, MAX_PASTE_BUFFER_SIZE, False, - AnyPropertyType, &type, &format, &len, - &remaining, &data); - if (data && len) - { - text = LLWString( - utf8str_to_wstring(reinterpret_cast< char const *>( data ) ) - ); - XFree(data); - } - - maybe_unlock_display(); - return res == Success; -} - -bool LLWindowSDL::getSelectionText(Atom selection, LLWString& text) -{ - if (!mSDL_Display) - return false; - - maybe_lock_display(); - - Window owner = XGetSelectionOwner(mSDL_Display, selection); - if (owner == None) - { - if (selection == XA_PRIMARY) - { - owner = DefaultRootWindow(mSDL_Display); - selection = XA_CUT_BUFFER0; - } - else - { - maybe_unlock_display(); - return false; - } - } - - maybe_unlock_display(); - - for( Atom atom : gSupportedAtoms ) - { - if(getSelectionText(selection, atom, text ) ) - return true; - } - - return false; -} - -bool LLWindowSDL::setSelectionText(Atom selection, const LLWString& text) -{ - maybe_lock_display(); - - if (selection == XA_PRIMARY) - { - std::string utf8 = wstring_to_utf8str(text); - XStoreBytes(mSDL_Display, utf8.c_str(), utf8.length() + 1); - mPrimaryClipboard = text; - } - else - mSecondaryClipboard = text; - - XSetSelectionOwner(mSDL_Display, selection, mSDL_XWindowID, CurrentTime); - - auto owner = XGetSelectionOwner(mSDL_Display, selection); - - maybe_unlock_display(); - - return owner == mSDL_XWindowID; -} - -Display* LLWindowSDL::getSDLDisplay() -{ - if (gWindowImplementation) - return gWindowImplementation->mSDL_Display; - return nullptr; -} - -#endif - - LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, - const std::string& title, S32 x, S32 y, S32 width, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl, @@ -390,7 +145,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, mOriginalAspectRatio = 1024.0 / 768.0; if (title.empty()) - mWindowTitle = "SDL Window"; // *FIX: (?) + mWindowTitle = "Second Life"; else mWindowTitle = title; @@ -409,10 +164,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, // Stash an object pointer for OSMessageBox() gWindowImplementation = this; -#if LL_X11 mFlashing = false; - initialiseX11Clipboard(); -#endif // LL_X11 mKeyVirtualKey = 0; mKeyModifiers = KMOD_NONE; @@ -434,145 +186,6 @@ static SDL_Surface *Load_BMP_Resource(const char *basename) return SDL_LoadBMP(path_buffer); } -#if LL_X11 -// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM -// on this machine. It works by searching /var/log/var/log/Xorg.?.log or -// /var/log/XFree86.?.log for a ': (VideoRAM ?|Memory): (%d+) kB' regex, where -// '?' is the X11 display number derived from $DISPLAY -static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) -{ - const int line_buf_size = 1000; - char line_buf[line_buf_size]; - while (fgets(line_buf, line_buf_size, fp)) - { - //LL_DEBUGS() << "XLOG: " << line_buf << LL_ENDL; - - // Why the ad-hoc parser instead of using a regex? Our - // favourite regex implementation - libboost_regex - is - // quite a heavy and troublesome dependency for the client, so - // it seems a shame to introduce it for such a simple task. - // *FIXME: libboost_regex is a dependency now anyway, so we may - // as well use it instead of this hand-rolled nonsense. - const char *part1_template = prefix_str; - const char part2_template[] = " kB"; - char *part1 = strstr(line_buf, part1_template); - if (part1) // found start of matching line - { - part1 = &part1[strlen(part1_template)]; // -> after - char *part2 = strstr(part1, part2_template); - if (part2) // found end of matching line - { - // now everything between part1 and part2 is - // supposed to be numeric, describing the - // number of kB of Video RAM supported - int rtn = 0; - for (; part1 < part2; ++part1) - { - if (*part1 < '0' || *part1 > '9') - { - // unexpected char, abort parse - rtn = 0; - break; - } - rtn *= 10; - rtn += (*part1) - '0'; - } - if (rtn > 0) - { - // got the kB number. return it now. - return rtn; - } - } - } - } - return 0; // 'could not detect' -} - -static int x11_detect_VRAM_kb() -{ - std::string x_log_location("/var/log/"); - std::string fname; - int rtn = 0; // 'could not detect' - int display_num = 0; - FILE *fp; - char *display_env = getenv("DISPLAY"); // e.g. :0 or :0.0 or :1.0 etc - // parse DISPLAY number so we can go grab the right log file - if (display_env[0] == ':' && - display_env[1] >= '0' && display_env[1] <= '9') - { - display_num = display_env[1] - '0'; - } - - // *TODO: we could be smarter and see which of Xorg/XFree86 has the - // freshest time-stamp. - - // Try Xorg log first - fname = x_log_location; - fname += "Xorg."; - fname += ('0' + display_num); - fname += ".log"; - fp = fopen(fname.c_str(), "r"); - if (fp) - { - LL_INFOS() << "Looking in " << fname - << " for VRAM info..." << LL_ENDL; - rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: "); - fclose(fp); - if (0 == rtn) - { - fp = fopen(fname.c_str(), "r"); - if (fp) - { - rtn = x11_detect_VRAM_kb_fp(fp, ": Video RAM: "); - fclose(fp); - if (0 == rtn) - { - fp = fopen(fname.c_str(), "r"); - if (fp) - { - rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: "); - fclose(fp); - } - } - } - } - } - else - { - LL_INFOS() << "Could not open " << fname - << " - skipped." << LL_ENDL; - // Try old XFree86 log otherwise - fname = x_log_location; - fname += "XFree86."; - fname += ('0' + display_num); - fname += ".log"; - fp = fopen(fname.c_str(), "r"); - if (fp) - { - LL_INFOS() << "Looking in " << fname - << " for VRAM info..." << LL_ENDL; - rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: "); - fclose(fp); - if (0 == rtn) - { - fp = fopen(fname.c_str(), "r"); - if (fp) - { - rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: "); - fclose(fp); - } - } - } - else - { - LL_INFOS() << "Could not open " << fname - << " - skipped." << LL_ENDL; - } - } - return rtn; -} -#endif // LL_X11 - void LLWindowSDL::setTitle(const std::string title) { SDL_SetWindowTitle( mWindow, title.c_str() ); @@ -690,6 +303,10 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b width = 1024; if (height == 0) width = 768; + if (x == 0) + x = SDL_WINDOWPOS_UNDEFINED; + if (y == 0) + y = SDL_WINDOWPOS_UNDEFINED; mFullscreen = fullscreen; @@ -703,51 +320,54 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b mSDLFlags = sdlflags; + // Setup default backing colors GLint redBits{8}, greenBits{8}, blueBits{8}, alphaBits{8}; + GLint depthBits{24}, stencilBits{8}; - GLint depthBits{(bits <= 16) ? 16 : 24}, stencilBits{8}; - - if (getenv("LL_GL_NO_STENCIL")) - stencilBits = 0; - - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, redBits); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, greenBits); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, blueBits); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits ); - - // We need stencil support for a few (minor) things. - if (stencilBits) - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits); - // *FIX: try to toggle vsync here? + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if (mFSAASamples > 0) + U32 context_flags = 0; + if (gDebugGL) { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples); + context_flags |= SDL_GL_CONTEXT_DEBUG_FLAG; } - + SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, context_flags); SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); - mWindow = SDL_CreateWindow( mWindowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, mSDLFlags ); - if( mWindow ) + // Create the window + mWindow = SDL_CreateWindow(mWindowTitle.c_str(), x, y, width, height, mSDLFlags); + if (mWindow == nullptr) { - mContext = SDL_GL_CreateContext( mWindow ); + LL_WARNS() << "Window creation failure. SDL: " << SDL_GetError() << LL_ENDL; + setupFailure("Window creation error", "Error", OSMB_OK); + return false; + } - if( mContext == 0 ) - { - LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; - setupFailure("GL Context creation error creation error", "Error", OSMB_OK); - return false; - } - // SDL_GL_SetSwapInterval(1); - mSurface = SDL_GetWindowSurface( mWindow ); + // Create the context + mContext = SDL_GL_CreateContext(mWindow); + if(!mContext) + { + LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; + setupFailure("GL Context creation error", "Error", OSMB_OK); + return false; } + if (SDL_GL_MakeCurrent(mWindow, mContext) != 0) + { + LL_WARNS() << "Failed to make context current. SDL: " << SDL_GetError() << LL_ENDL; + setupFailure("GL Context failed to set current failure", "Error", OSMB_OK); + return false; + } - if( mFullscreen ) + mSurface = SDL_GetWindowSurface(mWindow); + if(mFullscreen) { if (mSurface) { @@ -788,40 +408,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b } } - // Set the application icon. - SDL_Surface *bmpsurface; - bmpsurface = Load_BMP_Resource("ll_icon.BMP"); - if (bmpsurface) - { - SDL_SetWindowIcon(mWindow, bmpsurface); - SDL_FreeSurface(bmpsurface); - bmpsurface = NULL; - } - - // Detect video memory size. -# if LL_X11 - gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024; - if (gGLManager.mVRAM != 0) - { - LL_INFOS() << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL; - } else -# endif // LL_X11 - { - // fallback to letting SDL detect VRAM. - // note: I've not seen SDL's detection ever actually find - // VRAM != 0, but if SDL *does* detect it then that's a bonus. - gGLManager.mVRAM = 0; - if (gGLManager.mVRAM != 0) - { - LL_INFOS() << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL; - } - } - // If VRAM is not detected, that is handled later - - // *TODO: Now would be an appropriate time to check for some - // explicitly unsupported cards. - //const char* RENDERER = (const char*) glGetString(GL_RENDERER); - SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits); SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits); SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueBits); @@ -855,6 +441,20 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b return false; } + LL_PROFILER_GPU_CONTEXT; + + // Enable vertical sync + toggleVSync(enable_vsync); + + // Set the application icon. + SDL_Surface* bmpsurface = Load_BMP_Resource("ll_icon.BMP"); + if (bmpsurface) + { + SDL_SetWindowIcon(mWindow, bmpsurface); + SDL_FreeSurface(bmpsurface); + bmpsurface = NULL; + } + #if LL_X11 /* Grab the window manager specific information */ SDL_SysWMinfo info; @@ -880,7 +480,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b } #endif // LL_X11 - SDL_StartTextInput(); //make sure multisampling is disabled by default glDisable(GL_MULTISAMPLE_ARB); @@ -889,6 +488,43 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b return true; } +void* LLWindowSDL::createSharedContext() +{ + SDL_GLContext pContext = SDL_GL_CreateContext(mWindow); + if (pContext) + { + LL_DEBUGS() << "Creating shared OpenGL context successful!" << LL_ENDL; + return (void*)pContext; + } + + LL_WARNS() << "Creating shared OpenGL context failed!" << LL_ENDL; + return nullptr; +} + +void LLWindowSDL::makeContextCurrent(void* contextPtr) +{ + SDL_GL_MakeCurrent(mWindow, contextPtr); + LL_PROFILER_GPU_CONTEXT; +} + +void LLWindowSDL::destroySharedContext(void* contextPtr) +{ + SDL_GL_DeleteContext(contextPtr); +} + +void LLWindowSDL::toggleVSync(bool enable_vsync) +{ + if (!enable_vsync) + { + LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL; + SDL_GL_SetSwapInterval(0); + } + else + { + LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL; + SDL_GL_SetSwapInterval(1); + } +} // changing fullscreen resolution, or switching between windowed and fullscreen mode. bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp) @@ -901,7 +537,7 @@ bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool if(needsRebuild) { destroyContext(); - result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, enable_vsync); + result = createContext(0, 0, size.mX, size.mY, 32, fullscreen, enable_vsync); if (result) { gGLManager.initGL(); @@ -921,7 +557,13 @@ void LLWindowSDL::destroyContext() { LL_INFOS() << "destroyContext begins" << LL_ENDL; + // Stop unicode input SDL_StopTextInput(); + + // Clean up remaining GL state before blowing away window + LL_INFOS() << "shutdownGL begins" << LL_ENDL; + gGLManager.shutdownGL(); + #if LL_X11 mSDL_Display = NULL; mSDL_XWindowID = None; @@ -929,18 +571,38 @@ void LLWindowSDL::destroyContext() Unlock_Display = NULL; #endif // LL_X11 - // Clean up remaining GL state before blowing away window - LL_INFOS() << "shutdownGL begins" << LL_ENDL; - gGLManager.shutdownGL(); + LL_INFOS() << "Destroying SDL cursors" << LL_ENDL; + quitCursors(); + + if (mContext) + { + LL_INFOS() << "Destroying SDL GL Context" << LL_ENDL; + SDL_GL_DeleteContext(mContext); + mContext = nullptr; + } + else + { + LL_INFOS() << "SDL GL Context already destroyed" << LL_ENDL; + } + + if (mWindow) + { + LL_INFOS() << "Destroying SDL Window" << LL_ENDL; + SDL_DestroyWindow(mWindow); + mWindow = nullptr; + } + else + { + LL_INFOS() << "SDL Window already destroyed" << LL_ENDL; + } + LL_INFOS() << "destroyContext end" << LL_ENDL; + LL_INFOS() << "SDL_QuitSS/VID begins" << LL_ENDL; SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... - - mWindow = NULL; } LLWindowSDL::~LLWindowSDL() { - quitCursors(); destroyContext(); if(mSupportedResolutions != NULL) @@ -954,27 +616,38 @@ LLWindowSDL::~LLWindowSDL() void LLWindowSDL::show() { - // *FIX: What to do with SDL? + if (mWindow) + { + SDL_ShowWindow(mWindow); + } } void LLWindowSDL::hide() { - // *FIX: What to do with SDL? + if (mWindow) + { + SDL_HideWindow(mWindow); + } } //virtual void LLWindowSDL::minimize() { - // *FIX: What to do with SDL? + if (mWindow) + { + SDL_MinimizeWindow(mWindow); + } } //virtual void LLWindowSDL::restore() { - // *FIX: What to do with SDL? + if (mWindow) + { + SDL_RestoreWindow(mWindow); + } } - // close() destroys all OS-specific code associated with a window. // Usually called from LLWindowManager::destroyWindow() void LLWindowSDL::close() @@ -1000,43 +673,53 @@ bool LLWindowSDL::isValid() bool LLWindowSDL::getVisible() { bool result = false; - - // *FIX: This isn't really right... - // Then what is? if (mWindow) { - result = true; + Uint32 flags = SDL_GetWindowFlags(mWindow); + if (flags & SDL_WINDOW_SHOWN) + { + result = true; + } } - - return(result); + return result; } bool LLWindowSDL::getMinimized() { bool result = false; - - if (mWindow && (1 == mIsMinimized)) + if (mWindow) { - result = true; + Uint32 flags = SDL_GetWindowFlags(mWindow); + if (flags & SDL_WINDOW_MINIMIZED) + { + result = true; + } } - return(result); + return result; } bool LLWindowSDL::getMaximized() { bool result = false; - if (mWindow) { - // TODO + Uint32 flags = SDL_GetWindowFlags(mWindow); + if (flags & SDL_WINDOW_MAXIMIZED) + { + result = true; + } } - return(result); + return result; } bool LLWindowSDL::maximize() { - // TODO + if (mWindow) + { + SDL_MaximizeWindow(mWindow); + return true; + } return false; } @@ -1047,10 +730,12 @@ bool LLWindowSDL::getFullscreen() bool LLWindowSDL::getPosition(LLCoordScreen *position) { - // *FIX: can anything be done with this? - position->mX = 0; - position->mY = 0; - return true; + if (mWindow) + { + SDL_GetWindowPosition(mWindow, &position->mX, &position->mY); + return true; + } + return false; } bool LLWindowSDL::getSize(LLCoordScreen *size) @@ -1079,13 +764,13 @@ bool LLWindowSDL::getSize(LLCoordWindow *size) bool LLWindowSDL::setPosition(const LLCoordScreen position) { - if(mWindow) + if (mWindow) { - // *FIX: (?) - //MacMoveWindow(mWindow, position.mX, position.mY, false); + SDL_SetWindowPosition(mWindow, position.mX, position.mY); + return true; } - return true; + return false; } template< typename T > bool setSizeImpl( const T& newSize, SDL_Window *pWin ) @@ -1126,8 +811,9 @@ void LLWindowSDL::swapBuffers() { if (mWindow) { - SDL_GL_SwapWindow( mWindow ); + SDL_GL_SwapWindow(mWindow); } + LL_PROFILER_GPU_COLLECT; } U32 LLWindowSDL::getFSAASamples() @@ -1142,22 +828,33 @@ void LLWindowSDL::setFSAASamples(const U32 samples) F32 LLWindowSDL::getGamma() { - return 1/mGamma; + return 1.f / mGamma; } bool LLWindowSDL::restoreGamma() { - //CGDisplayRestoreColorSyncSettings(); - // SDL_SetGamma(1.0f, 1.0f, 1.0f); + if (mWindow) + { + Uint16 ramp[256]; + SDL_CalculateGammaRamp(1.f, ramp); + SDL_SetWindowGammaRamp(mWindow, ramp, ramp, ramp); + } return true; } bool LLWindowSDL::setGamma(const F32 gamma) { - mGamma = gamma; - if (mGamma == 0) mGamma = 0.1f; - mGamma = 1/mGamma; - // SDL_SetGamma(mGamma, mGamma, mGamma); + if (mWindow) + { + Uint16 ramp[256]; + + mGamma = gamma; + if (mGamma == 0) mGamma = 0.1f; + mGamma = 1.f / mGamma; + + SDL_CalculateGammaRamp(mGamma, ramp); + SDL_SetWindowGammaRamp(mWindow, ramp, ramp, ramp); + } return true; } @@ -1166,10 +863,8 @@ bool LLWindowSDL::isCursorHidden() return mCursorHidden; } - - // Constrains the mouse to the window. -void LLWindowSDL::setMouseClipping( bool b ) +void LLWindowSDL::setMouseClipping(bool b) { //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF); } @@ -1179,18 +874,10 @@ void LLWindowSDL::setMinSize(U32 min_width, U32 min_height, bool enforce_immedia { LLWindow::setMinSize(min_width, min_height, enforce_immediately); -#if LL_X11 - // Set the minimum size limits for X11 window - // so the window manager doesn't allow resizing below those limits. - XSizeHints* hints = XAllocSizeHints(); - hints->flags |= PMinSize; - hints->min_width = mMinWindowWidth; - hints->min_height = mMinWindowHeight; - - XSetWMNormalHints(mSDL_Display, mSDL_XWindowID, hints); - - XFree(hints); -#endif + if (mWindow && min_width > 0 && min_height > 0) + { + SDL_SetWindowMinimumSize(mWindow, mMinWindowWidth, mMinWindowHeight); + } } bool LLWindowSDL::setCursorPosition(const LLCoordWindow position) @@ -1218,7 +905,6 @@ bool LLWindowSDL::getCursorPosition(LLCoordWindow *position) //Point cursor_point; LLCoordScreen screen_pos; - //GetMouse(&cursor_point); int x, y; SDL_GetMouseState(&x, &y); @@ -1333,85 +1019,70 @@ void LLWindowSDL::afterDialog() } } - -#if LL_X11 -// set/reset the XWMHints flag for 'urgency' that usually makes the icon flash -void LLWindowSDL::x11_set_urgent(bool urgent) -{ - if (mSDL_Display && !mFullscreen) - { - XWMHints *wm_hints; - - LL_INFOS() << "X11 hint for urgency, " << urgent << LL_ENDL; - - maybe_lock_display(); - wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID); - if (!wm_hints) - wm_hints = XAllocWMHints(); - - if (urgent) - wm_hints->flags |= XUrgencyHint; - else - wm_hints->flags &= ~XUrgencyHint; - - XSetWMHints(mSDL_Display, mSDL_XWindowID, wm_hints); - XFree(wm_hints); - XSync(mSDL_Display, False); - maybe_unlock_display(); - } -} -#endif // LL_X11 - void LLWindowSDL::flashIcon(F32 seconds) { - if (getMinimized()) - { -#if !LL_X11 - LL_INFOS() << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL; -#else - LL_INFOS() << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL; + LL_INFOS() << "LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL; - F32 remaining_time = mFlashTimer.getRemainingTimeF32(); - if (remaining_time < seconds) - remaining_time = seconds; - mFlashTimer.reset(); - mFlashTimer.setTimerExpirySec(remaining_time); + F32 remaining_time = mFlashTimer.getRemainingTimeF32(); + if (remaining_time < seconds) + remaining_time = seconds; + mFlashTimer.reset(); + mFlashTimer.setTimerExpirySec(remaining_time); - x11_set_urgent(true); - mFlashing = true; -#endif // LL_X11 - } + SDL_FlashWindow(mWindow, SDL_FLASH_UNTIL_FOCUSED); + mFlashing = true; } bool LLWindowSDL::isClipboardTextAvailable() { - return mSDL_Display && XGetSelectionOwner(mSDL_Display, XA_CLIPBOARD) != None; + return SDL_HasClipboardText() == SDL_TRUE; } bool LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { - return getSelectionText(XA_CLIPBOARD, dst); + if (isClipboardTextAvailable()) + { + char* data = SDL_GetClipboardText(); + if (data) + { + dst = LLWString(utf8str_to_wstring(data)); + SDL_free(data); + return true; + } + } + return false; } -bool LLWindowSDL::copyTextToClipboard(const LLWString &s) +bool LLWindowSDL::copyTextToClipboard(const LLWString& text) { - return setSelectionText(XA_CLIPBOARD, s); + const std::string utf8 = wstring_to_utf8str(text); + return SDL_SetClipboardText(utf8.c_str()) == 0; // success == 0 } bool LLWindowSDL::isPrimaryTextAvailable() { - LLWString text; - return getSelectionText(XA_PRIMARY, text) && !text.empty(); + return SDL_HasPrimarySelectionText() == SDL_TRUE; } bool LLWindowSDL::pasteTextFromPrimary(LLWString &dst) { - return getSelectionText(XA_PRIMARY, dst); + if (isPrimaryTextAvailable()) + { + char* data = SDL_GetPrimarySelectionText(); + if (data) + { + dst = LLWString(utf8str_to_wstring(data)); + SDL_free(data); + return true; + } + } + return false; } -bool LLWindowSDL::copyTextToPrimary(const LLWString &s) +bool LLWindowSDL::copyTextToPrimary(const LLWString& text) { - return setSelectionText(XA_PRIMARY, s); + const std::string utf8 = wstring_to_utf8str(text); + return SDL_SetPrimarySelectionText(utf8.c_str()) == 0; // success == 0 } LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) @@ -1512,9 +1183,6 @@ bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to) return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } - - - void LLWindowSDL::setupFailure(const std::string& text, const std::string& caption, U32 type) { destroyContext(); @@ -1549,47 +1217,24 @@ bool LLWindowSDL::SDLReallyCaptureInput(bool capture) bool newGrab = wantGrab; -#if LL_X11 if (!mFullscreen) /* only bother if we're windowed anyway */ { - if (mSDL_Display) + int result; + if (wantGrab == true) { - /* we dirtily mix raw X11 with SDL so that our pointer - isn't (as often) constrained to the limits of the - window while grabbed, which feels nicer and - hopefully eliminates some reported 'sticky pointer' - problems. We use raw X11 instead of - SDL_WM_GrabInput() because the latter constrains - the pointer to the window and also steals all - *keyboard* input from the window manager, which was - frustrating users. */ - int result; - if (wantGrab == true) - { - maybe_lock_display(); - result = XGrabPointer(mSDL_Display, mSDL_XWindowID, - True, 0, GrabModeAsync, - GrabModeAsync, - None, None, CurrentTime); - maybe_unlock_display(); - if (GrabSuccess == result) - newGrab = true; - else - newGrab = false; - } + result = SDL_CaptureMouse(SDL_TRUE); + if (0 == result) + newGrab = true; else - { newGrab = false; - - maybe_lock_display(); - XUngrabPointer(mSDL_Display, CurrentTime); - // Make sure the ungrab happens RIGHT NOW. - XSync(mSDL_Display, False); - maybe_unlock_display(); - } + } + else + { + newGrab = false; + result = SDL_CaptureMouse(SDL_FALSE); } } -#endif // LL_X11 + // return boolean success for whether we ended up in the desired state return capture == newGrab; } @@ -1719,7 +1364,7 @@ void check_vm_bloat() last_rss_size = this_rss_size; last_vm_size = this_vm_size; - finally: +finally: if (NULL != ptr) { free(ptr); @@ -1755,11 +1400,6 @@ void LLWindowSDL::processMiscNativeEvents() void LLWindowSDL::gatherInput() { - const Uint32 CLICK_THRESHOLD = 300; // milliseconds - static int leftClick = 0; - static int rightClick = 0; - static Uint32 lastLeftDown = 0; - static Uint32 lastRightDown = 0; SDL_Event event; // Handle all outstanding SDL events @@ -1768,13 +1408,21 @@ void LLWindowSDL::gatherInput() switch (event.type) { case SDL_MOUSEWHEEL: + { if( event.wheel.y != 0 ) + { mCallbacks->handleScrollWheel(this, -event.wheel.y); + } + if (event.wheel.x != 0) + { + mCallbacks->handleScrollHWheel(this, -event.wheel.x); + } break; + } case SDL_MOUSEMOTION: { - LLCoordWindow winCoord(event.button.x, event.button.y); + LLCoordWindow winCoord(event.motion.x, event.motion.y); LLCoordGL openGlCoord; convertCoords(winCoord, &openGlCoord); MASK mask = gKeyboard->currentMask(true); @@ -1847,64 +1495,30 @@ void LLWindowSDL::gatherInput() case SDL_MOUSEBUTTONDOWN: { - bool isDoubleClick = false; LLCoordWindow winCoord(event.button.x, event.button.y); LLCoordGL openGlCoord; convertCoords(winCoord, &openGlCoord); MASK mask = gKeyboard->currentMask(true); - if (event.button.button == SDL_BUTTON_LEFT) // SDL doesn't manage double clicking... - { - Uint32 now = SDL_GetTicks(); - if ((now - lastLeftDown) > CLICK_THRESHOLD) - leftClick = 1; - else - { - if (++leftClick >= 2) - { - leftClick = 0; - isDoubleClick = true; - } - } - lastLeftDown = now; - } - else if (event.button.button == SDL_BUTTON_RIGHT) - { - Uint32 now = SDL_GetTicks(); - if ((now - lastRightDown) > CLICK_THRESHOLD) - rightClick = 1; - else - { - if (++rightClick >= 2) - { - rightClick = 0; - isDoubleClick = true; - } - } - lastRightDown = now; - } - if (event.button.button == SDL_BUTTON_LEFT) // left { - if (isDoubleClick) + if (event.button.clicks >= 2) mCallbacks->handleDoubleClick(this, openGlCoord, mask); else mCallbacks->handleMouseDown(this, openGlCoord, mask); } - else if (event.button.button == SDL_BUTTON_RIGHT) // right { mCallbacks->handleRightMouseDown(this, openGlCoord, mask); } - else if (event.button.button == SDL_BUTTON_MIDDLE) // middle { mCallbacks->handleMiddleMouseDown(this, openGlCoord, mask); } - else if (event.button.button == 4) // mousewheel up...thanks to X11 for making SDL consider these "buttons". - mCallbacks->handleScrollWheel(this, -1); - else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons". - mCallbacks->handleScrollWheel(this, 1); + else + { + mCallbacks->handleOtherMouseDown(this, openGlCoord, mask, event.button.button); + } break; } @@ -1917,64 +1531,65 @@ void LLWindowSDL::gatherInput() MASK mask = gKeyboard->currentMask(true); if (event.button.button == SDL_BUTTON_LEFT) // left + { mCallbacks->handleMouseUp(this, openGlCoord, mask); + } else if (event.button.button == SDL_BUTTON_RIGHT) // right + { mCallbacks->handleRightMouseUp(this, openGlCoord, mask); + } else if (event.button.button == SDL_BUTTON_MIDDLE) // middle + { mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask); - // don't handle mousewheel here... + } + else + { + mCallbacks->handleOtherMouseUp(this, openGlCoord, mask, event.button.button); + } break; } - case SDL_WINDOWEVENT: // *FIX: handle this? + case SDL_WINDOWEVENT: { - if( event.window.event == SDL_WINDOWEVENT_RESIZED - /* || event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED*/ ) // <FS:ND> SDL_WINDOWEVENT_SIZE_CHANGED is followed by SDL_WINDOWEVENT_RESIZED, so handling one shall be enough - { - LL_INFOS() << "Handling a resize event: " << event.window.data1 << "x" << event.window.data2 << LL_ENDL; - - S32 width = llmax(event.window.data1, (S32)mMinWindowWidth); - S32 height = llmax(event.window.data2, (S32)mMinWindowHeight); - mSurface = SDL_GetWindowSurface( mWindow ); - - // *FIX: I'm not sure this is necessary! - // <FS:ND> I think is is not - // SDL_SetWindowSize(mWindow, width, height); - // - - mCallbacks->handleResize(this, width, height); - } - else if( event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ) // <FS:ND> What about SDL_WINDOWEVENT_ENTER (mouse focus) - { - // We have to do our own state massaging because SDL - // can send us two unfocus events in a row for example, - // which confuses the focus code [SL-24071]. - mHaveInputFocus = true; - - mCallbacks->handleFocus(this); - } - else if( event.window.event == SDL_WINDOWEVENT_FOCUS_LOST ) // <FS:ND> What about SDL_WINDOWEVENT_LEAVE (mouse focus) + switch(event.window.event) { - // We have to do our own state massaging because SDL - // can send us two unfocus events in a row for example, - // which confuses the focus code [SL-24071]. - mHaveInputFocus = false; + //case SDL_WINDOWEVENT_SIZE_CHANGED: <FS:ND> SDL_WINDOWEVENT_SIZE_CHANGED is followed by SDL_WINDOWEVENT_RESIZED, so handling one shall be enough + case SDL_WINDOWEVENT_RESIZED: + { + LL_INFOS() << "Handling a resize event: " << event.window.data1 << "x" << event.window.data2 << LL_ENDL; + S32 width = llmax(event.window.data1, (S32)mMinWindowWidth); + S32 height = llmax(event.window.data2, (S32)mMinWindowHeight); - mCallbacks->handleFocusLost(this); - } - else if( event.window.event == SDL_WINDOWEVENT_MINIMIZED || - event.window.event == SDL_WINDOWEVENT_MAXIMIZED || - event.window.event == SDL_WINDOWEVENT_RESTORED || - event.window.event == SDL_WINDOWEVENT_EXPOSED || - event.window.event == SDL_WINDOWEVENT_SHOWN ) - { - mIsMinimized = (event.window.event == SDL_WINDOWEVENT_MINIMIZED); + mSurface = SDL_GetWindowSurface(mWindow); + mCallbacks->handleResize(this, width, height); + break; + } + case SDL_WINDOWEVENT_LEAVE: + mCallbacks->handleMouseLeave(this); + break; + case SDL_WINDOWEVENT_FOCUS_GAINED: + mCallbacks->handleFocus(this); + break; + case SDL_WINDOWEVENT_FOCUS_LOST: + mCallbacks->handleFocusLost(this); + break; + case SDL_WINDOWEVENT_EXPOSED: + case SDL_WINDOWEVENT_SHOWN: + case SDL_WINDOWEVENT_HIDDEN: + case SDL_WINDOWEVENT_MINIMIZED: + case SDL_WINDOWEVENT_MAXIMIZED: + case SDL_WINDOWEVENT_RESTORED: + { + Uint32 flags = SDL_GetWindowFlags(mWindow); + bool minimized = (flags & SDL_WINDOW_MINIMIZED); + bool hidden = (flags & SDL_WINDOW_HIDDEN); - mCallbacks->handleActivate(this, !mIsMinimized); - LL_INFOS() << "SDL deiconification state switched to " << mIsMinimized << LL_ENDL; + mCallbacks->handleActivate(this, !minimized || !hidden); + LL_INFOS() << "SDL deiconification state switched to " << minimized << LL_ENDL; + break; + } } - break; } case SDL_QUIT: @@ -1993,20 +1608,18 @@ void LLWindowSDL::gatherInput() updateCursor(); -#if LL_X11 // This is a good time to stop flashing the icon if our mFlashTimer has // expired. if (mFlashing && mFlashTimer.hasExpired()) { - x11_set_urgent(false); + SDL_FlashWindow(mWindow, SDL_FLASH_CANCEL); mFlashing = false; } -#endif // LL_X11 } static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty) { - SDL_Cursor *sdlcursor = NULL; + SDL_Cursor *sdlcursor = nullptr; SDL_Surface *bmpsurface; // Load cursor pixel data from BMP file @@ -2080,12 +1693,6 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty void LLWindowSDL::updateCursor() { - if (ATIbug) { - // cursor-updating is very flaky when this bug is - // present; do nothing. - return; - } - if (mCurrentCursor != mNextCursor) { if (mNextCursor < UI_CURSOR_COUNT) @@ -2097,10 +1704,13 @@ void LLWindowSDL::updateCursor() sdlcursor = mSDLCursors[UI_CURSOR_ARROW]; if (sdlcursor) SDL_SetCursor(sdlcursor); - } else { + + mCurrentCursor = mNextCursor; + } + else + { LL_WARNS() << "Tried to set invalid cursor number " << mNextCursor << LL_ENDL; } - mCurrentCursor = mNextCursor; } } @@ -2110,24 +1720,24 @@ void LLWindowSDL::initCursors() // Blank the cursor pointer array for those we may miss. for (i=0; i<UI_CURSOR_COUNT; ++i) { - mSDLCursors[i] = NULL; + mSDLCursors[i] = nullptr; } // Pre-make an SDL cursor for each of the known cursor types. // We hardcode the hotspots - to avoid that we'd have to write // a .cur file loader. // NOTE: SDL doesn't load RLE-compressed BMP files. - mSDLCursors[UI_CURSOR_ARROW] = makeSDLCursorFromBMP("llarrow.BMP",0,0); - mSDLCursors[UI_CURSOR_WAIT] = makeSDLCursorFromBMP("wait.BMP",12,15); - mSDLCursors[UI_CURSOR_HAND] = makeSDLCursorFromBMP("hand.BMP",7,10); - mSDLCursors[UI_CURSOR_IBEAM] = makeSDLCursorFromBMP("ibeam.BMP",15,16); - mSDLCursors[UI_CURSOR_CROSS] = makeSDLCursorFromBMP("cross.BMP",16,14); - mSDLCursors[UI_CURSOR_SIZENWSE] = makeSDLCursorFromBMP("sizenwse.BMP",14,17); - mSDLCursors[UI_CURSOR_SIZENESW] = makeSDLCursorFromBMP("sizenesw.BMP",17,17); - mSDLCursors[UI_CURSOR_SIZEWE] = makeSDLCursorFromBMP("sizewe.BMP",16,14); - mSDLCursors[UI_CURSOR_SIZENS] = makeSDLCursorFromBMP("sizens.BMP",17,16); - mSDLCursors[UI_CURSOR_SIZEALL] = makeSDLCursorFromBMP("sizeall.BMP", 17, 17); - mSDLCursors[UI_CURSOR_NO] = makeSDLCursorFromBMP("llno.BMP",8,8); - mSDLCursors[UI_CURSOR_WORKING] = makeSDLCursorFromBMP("working.BMP",12,15); + mSDLCursors[UI_CURSOR_ARROW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW); + mSDLCursors[UI_CURSOR_WAIT] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT); + mSDLCursors[UI_CURSOR_HAND] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); + mSDLCursors[UI_CURSOR_IBEAM] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM); + mSDLCursors[UI_CURSOR_CROSS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR); + mSDLCursors[UI_CURSOR_SIZENWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE); + mSDLCursors[UI_CURSOR_SIZENESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW); + mSDLCursors[UI_CURSOR_SIZEWE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE); + mSDLCursors[UI_CURSOR_SIZENS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS); + mSDLCursors[UI_CURSOR_SIZEALL] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL); + mSDLCursors[UI_CURSOR_NO] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO); + mSDLCursors[UI_CURSOR_WORKING] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAITARROW); mSDLCursors[UI_CURSOR_TOOLGRAB] = makeSDLCursorFromBMP("lltoolgrab.BMP",2,13); mSDLCursors[UI_CURSOR_TOOLLAND] = makeSDLCursorFromBMP("lltoolland.BMP",1,6); mSDLCursors[UI_CURSOR_TOOLFOCUS] = makeSDLCursorFromBMP("lltoolfocus.BMP",8,5); @@ -2160,11 +1770,6 @@ void LLWindowSDL::initCursors() mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_END] = makeSDLCursorFromBMP("lltoolpathfindingpathend.BMP", 16, 16); mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD] = makeSDLCursorFromBMP("lltoolpathfindingpathendadd.BMP", 16, 16); mSDLCursors[UI_CURSOR_TOOLNO] = makeSDLCursorFromBMP("llno.BMP",8,8); - - if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) { - LL_INFOS() << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << LL_ENDL; - ATIbug = true; - } } void LLWindowSDL::quitCursors() @@ -2214,7 +1819,7 @@ void LLWindowSDL::hideCursor() // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; mCursorHidden = true; mHideCursorPermanent = true; - SDL_ShowCursor(0); + SDL_ShowCursor(SDL_DISABLE); } else { @@ -2229,7 +1834,7 @@ void LLWindowSDL::showCursor() // LL_INFOS() << "showCursor: showing" << LL_ENDL; mCursorHidden = false; mHideCursorPermanent = false; - SDL_ShowCursor(1); + SDL_ShowCursor(SDL_ENABLE); } else { @@ -2347,62 +1952,6 @@ LLSD LLWindowSDL::getNativeKeyData() return result; } -#if LL_LINUX || LL_SOLARIS -// extracted from spawnWebBrowser for clarity and to eliminate -// compiler confusion regarding close(int fd) vs. LLWindow::close() -void exec_cmd(const std::string& cmd, const std::string& arg) -{ - char* const argv[] = {(char*)cmd.c_str(), (char*)arg.c_str(), NULL}; - fflush(NULL); - pid_t pid = fork(); - if (pid == 0) - { // child - // disconnect from stdin/stdout/stderr, or child will - // keep our output pipe undesirably alive if it outlives us. - // close(0); - // close(1); - // close(2); - // <FS:TS> Reopen stdin, stdout, and stderr to /dev/null. - // It's good practice to always have those file - // descriptors open to something, lest the exec'd - // program actually try to use them. - FILE *result; - result = freopen("/dev/null","r",stdin); - if (result == NULL) - { - LL_WARNS() << "Error reopening stdin for web browser: " - << strerror(errno) << LL_ENDL; - } - result = freopen("/dev/null","w",stdout); - if (result == NULL) - { - LL_WARNS() << "Error reopening stdout for web browser: " - << strerror(errno) << LL_ENDL; - } - result = freopen("/dev/null","w",stderr); - if (result == NULL) - { - LL_WARNS() << "Error reopening stderr for web browser: " - << strerror(errno) << LL_ENDL; - } - // end ourself by running the command - execv(cmd.c_str(), argv); /* Flawfinder: ignore */ - // if execv returns at all, there was a problem. - LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL; - _exit(1); // _exit because we don't want atexit() clean-up! - } else { - if (pid > 0) - { - // parent - wait for child to die - int childExitStatus; - waitpid(pid, &childExitStatus, 0); - } else { - LL_WARNS() << "fork failure." << LL_ENDL; - } - } -} -#endif - // Open a URL with the user's default web browser. // Must begin with protocol identifier. void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) @@ -2426,35 +1975,14 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL; -#if LL_LINUX -# if LL_X11 - if (mSDL_Display) + if (SDL_OpenURL(escaped_url.c_str()) != 0) { - maybe_lock_display(); - // Just in case - before forking. - XSync(mSDL_Display, False); - maybe_unlock_display(); + LL_WARNS() << "spawn_web_browser failed with error: " << SDL_GetError() << LL_ENDL; } -# endif // LL_X11 - - std::string cmd, arg; - cmd = gDirUtilp->getAppRODataDir(); - cmd += gDirUtilp->getDirDelimiter(); - cmd += "etc"; - cmd += gDirUtilp->getDirDelimiter(); - cmd += "launch_url.sh"; - arg = escaped_url; - exec_cmd(cmd, arg); -#endif // LL_LINUX LL_INFOS() << "spawn_web_browser returning." << LL_ENDL; } -void LLWindowSDL::openFile(const std::string& file_name) -{ - spawnWebBrowser("file://"+file_name,true); -} - void *LLWindowSDL::getPlatformWindow() { return NULL; @@ -2465,15 +1993,10 @@ void LLWindowSDL::bringToFront() // This is currently used when we are 'launched' to a specific // map position externally. LL_INFOS() << "bringToFront" << LL_ENDL; -#if LL_X11 - if (mSDL_Display && !mFullscreen) + if (mWindow && !mFullscreen) { - maybe_lock_display(); - XRaiseWindow(mSDL_Display, mSDL_XWindowID); - XSync(mSDL_Display, False); - maybe_unlock_display(); + SDL_RaiseWindow(mWindow); } -#endif // LL_X11 } //static @@ -2577,44 +2100,6 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() return rtns; } - -void* LLWindowSDL::createSharedContext() -{ - auto *pContext = SDL_GL_CreateContext(mWindow); - if ( pContext) - { - SDL_GL_SetSwapInterval(0); - SDL_GL_MakeCurrent(mWindow, mContext); - - LLCoordScreen size; - if (getSize(&size)) - setSize(size); - - LL_DEBUGS() << "Creating shared OpenGL context successful!" << LL_ENDL; - - return (void*)pContext; - } - - LL_WARNS() << "Creating shared OpenGL context failed!" << LL_ENDL; - - return nullptr; -} - -void LLWindowSDL::makeContextCurrent(void* contextPtr) -{ - LL_PROFILER_GPU_CONTEXT; - SDL_GL_MakeCurrent( mWindow, contextPtr ); -} - -void LLWindowSDL::destroySharedContext(void* contextPtr) -{ - SDL_GL_DeleteContext( contextPtr ); -} - -void LLWindowSDL::toggleVSync(bool enable_vsync) -{ -} - void LLWindowSDL::setLanguageTextInput(const LLCoordGL& position) { LLCoordWindow win_pos; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 10769bb3ba..7ad30d41ce 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -176,8 +176,6 @@ public: void spawnWebBrowser(const std::string &escaped_url, bool async) override; - void openFile(const std::string &file_name); - void setTitle(const std::string title) override; static std::vector<std::string> getDynamicFallbackFontList(); @@ -211,7 +209,7 @@ public: protected: LLWindowSDL(LLWindowCallbacks *callbacks, - const std::string &title, int x, int y, int width, int height, U32 flags, + const std::string &title, const std::string& name, int x, int y, int width, int height, U32 flags, bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl, bool ignore_pixel_depth, U32 fsaa_samples); @@ -247,8 +245,6 @@ protected: void setupFailure(const std::string &text, const std::string &caption, U32 type); - void fixWindowSize(void); - U32 SDLCheckGrabbyKeys(U32 keysym, bool gain); bool SDLReallyCaptureInput(bool capture); @@ -280,45 +276,15 @@ protected: friend class LLWindowManager; private: -#if LL_X11 - - void x11_set_urgent(bool urgent); - bool mFlashing; LLTimer mFlashTimer; -#endif //LL_X11 - U32 mKeyVirtualKey; U32 mKeyModifiers; std::string mInputType; -public: -#if LL_X11 - - static Display *getSDLDisplay(); - - LLWString const &getPrimaryText() const { return mPrimaryClipboard; } - - LLWString const &getSecondaryText() const { return mSecondaryClipboard; } - - void clearPrimaryText() { mPrimaryClipboard.clear(); } - - void clearSecondaryText() { mSecondaryClipboard.clear(); } private: void tryFindFullscreenSize(int &aWidth, int &aHeight); - - void initialiseX11Clipboard(); - - bool getSelectionText(Atom selection, LLWString &text); - - bool getSelectionText(Atom selection, Atom type, LLWString &text); - - bool setSelectionText(Atom selection, const LLWString &text); - -#endif - LLWString mPrimaryClipboard; - LLWString mSecondaryClipboard; }; class LLSplashScreenSDL : public LLSplashScreen diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index 9bb3bad035..f31708c4d7 100644 --- a/indra/media_plugins/base/media_plugin_base.cpp +++ b/indra/media_plugins/base/media_plugin_base.cpp @@ -169,6 +169,8 @@ void MediaPluginBase::sendStatus() #if LL_LINUX +#include <dlfcn.h> + size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol ) { gSymbolsToGrab.emplace_back(aSymbol); @@ -177,25 +179,22 @@ size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol ) bool SymbolGrabber::grabSymbols(std::vector< std::string > const &aDSONames) { - std::cerr << "SYMBOLS: " << gSymbolsToGrab.size() << std::endl; - if (sSymsGrabbed) return true; - //attempt to load the shared libraries - apr_pool_create(&sSymDSOMemoryPool, nullptr); - for( std::vector< std::string >::const_iterator itr = aDSONames.begin(); itr != aDSONames.end(); ++itr ) { - apr_dso_handle_t *pDSO(NULL); - std::string strDSO{ *itr }; - if( APR_SUCCESS == apr_dso_load( &pDSO, strDSO.c_str(), sSymDSOMemoryPool )) - sLoadedLibraries.push_back( pDSO ); + auto pDSO = dlopen( itr->c_str(), RTLD_NOW ); - for( auto i = 0; i < gSymbolsToGrab.size(); ++i ) + if( pDSO ) { - if( !*gSymbolsToGrab[i].mPPFunc ) - apr_dso_sym( gSymbolsToGrab[i].mPPFunc, pDSO, gSymbolsToGrab[i].mName ); + sLoadedLibraries.push_back(pDSO); + + for (auto i = 0; i < gSymbolsToGrab.size(); ++i) + { + if (!*gSymbolsToGrab[i].mPPFunc) + *gSymbolsToGrab[i].mPPFunc = dlsym(pDSO, gSymbolsToGrab[i].mName); + } } } diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h index a084fc9834..98e9ce0316 100644 --- a/indra/media_plugins/base/media_plugin_base.h +++ b/indra/media_plugins/base/media_plugin_base.h @@ -38,7 +38,7 @@ struct SymbolToGrab { bool mRequired; char const *mName; - apr_dso_handle_sym_t *mPPFunc; + void **mPPFunc; }; class SymbolGrabber @@ -52,8 +52,7 @@ private: std::vector< SymbolToGrab > gSymbolsToGrab; bool sSymsGrabbed = false; - apr_pool_t *sSymDSOMemoryPool = nullptr; - std::vector<apr_dso_handle_t *> sLoadedLibraries; + std::vector<void *> sLoadedLibraries; }; extern SymbolGrabber gSymbolGrabber; @@ -63,7 +62,7 @@ extern SymbolGrabber gSymbolGrabber; #define LL_GRAB_SYM(SYMBOL_GRABBER, REQUIRED, SYMBOL_NAME, RETURN, ...) \ RETURN (*ll##SYMBOL_NAME)(__VA_ARGS__) = nullptr; \ size_t gRegistered##SYMBOL_NAME = SYMBOL_GRABBER.registerSymbol( \ - { REQUIRED, #SYMBOL_NAME , (apr_dso_handle_sym_t*)&ll##SYMBOL_NAME} \ + { REQUIRED, #SYMBOL_NAME , (void**)&ll##SYMBOL_NAME} \ ); #endif diff --git a/indra/media_plugins/cef/volume_catcher.h b/indra/media_plugins/cef/volume_catcher.h index 6933854e8e..ead0511149 100644 --- a/indra/media_plugins/cef/volume_catcher.h +++ b/indra/media_plugins/cef/volume_catcher.h @@ -49,7 +49,9 @@ public: #endif private: +#if LL_LINUX || LL_WINDOWS VolumeCatcherImpl *pimpl; +#endif }; #endif // VOLUME_CATCHER_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 04ce88f0c6..5b38fcfe62 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -271,7 +271,6 @@ set(viewer_SOURCE_FILES llfloaterpay.cpp llfloaterperformance.cpp llfloaterperms.cpp - llfloaterpostprocess.cpp llfloaterprofile.cpp llfloaterpreference.cpp llfloaterpreferencesgraphicsadvanced.cpp @@ -946,7 +945,6 @@ set(viewer_HEADER_FILES llfloaterpay.h llfloaterperformance.h llfloaterperms.h - llfloaterpostprocess.h llfloaterprofile.h llfloaterpreference.h llfloaterpreferencesgraphicsadvanced.h @@ -1872,7 +1870,7 @@ else (WINDOWS) # Linux set_target_properties(${VIEWER_BINARY_NAME} PROPERTIES - LINK_FLAGS_RELEASE "${LINK_FLAGS_RELEASE} -Wl,--Map=${VIEWER_BINARY_NAME}.MAP" + LINK_FLAGS_RELEASE "${LINK_FLAGS_RELEASE} -no-pie -Wl,--Map=${VIEWER_BINARY_NAME}.MAP" ) endif (WINDOWS) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6fe13d4665..60d8c6db76 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7413,6 +7413,17 @@ <key>Value</key> <integer>-1</integer> </map> + <key>RenderBufferClearOnInvalidate</key> + <map> + <key>Comment</key> + <string>Whether to call glClear on render buffers that will be fully overwritten with new contents</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderCompressTextures</key> <map> <key>Comment</key> @@ -9647,6 +9658,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>CollectFontVertexBuffers</key> + <map> + <key>Comment</key> + <string>When enabled some UI elements with cache buffers generated by fonts and reuse them. When disabled general cahce will be used with a significant overhead for hash, but it regenerates vertices each frame so it's always up to date.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <real>1</real> + </map> <key>ShowMyComplexityChanges</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 23a3ca4911..41ff2913e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -30,7 +30,6 @@ out vec4 frag_color; uniform sampler2D lightMap; uniform float dist_factor; -uniform float blur_size; uniform vec2 delta; uniform vec2 screen_res; uniform vec3 kern[4]; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 0a0fa0a374..4a26b8924a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -30,8 +30,6 @@ out vec4 frag_color; uniform sampler2D diffuseRect; uniform sampler2D depthMap; -uniform float depth_cutoff; -uniform float norm_cutoff; uniform float focal_distance; uniform float blur_constant; uniform float tan_pixel_angle; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 4ed778371f..809ad2f0bd 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -33,7 +33,6 @@ uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal uniform sampler2D lightFunc; uniform vec3 env_mat[3]; -uniform float sun_wash; uniform int light_count; uniform vec4 light[LIGHT_COUNT]; // .w = size; see C++ fullscreen_lights.push_back() uniform vec4 light_col[LIGHT_COUNT]; // .a = falloff diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 6c13757149..41a19ea1b6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -33,7 +33,6 @@ uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal uniform sampler2D lightFunc; uniform vec3 env_mat[3]; -uniform float sun_wash; // light params uniform vec3 color; @@ -46,7 +45,6 @@ in vec3 trans_center; uniform vec2 screen_res; uniform mat4 inv_proj; -uniform vec4 viewport; void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 4231d8580e..a34e97c171 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -39,9 +39,6 @@ uniform sampler2D lightMap; uniform sampler2D lightFunc; -uniform float blur_size; -uniform float blur_fidelity; - #if defined(HAS_SSAO) uniform float ssao_irradiance_scale; uniform float ssao_irradiance_max; diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index bc4d36d10d..e99aa5ace4 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -47,7 +47,6 @@ uniform float near_clip; uniform float far_clip; uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 6f7f553cec..dc5d1ff6c4 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -28,27 +28,27 @@ version 29 // list all RenderAnisotropic 1 1 -RenderAvatarCloth 1 1 RenderAvatarLODFactor 1 1.0 RenderAvatarPhysicsLODFactor 1 1.0 RenderAvatarMaxNonImpostors 1 16 RenderAvatarMaxComplexity 1 350000 RenderAutoMuteSurfaceAreaLimit 1 1000.0 RenderCubeMap 1 1 -RenderDelayVBUpdate 1 0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 RenderFogRatio 1 4.0 RenderGamma 1 0 RenderGlowResolutionPow 1 9 -RenderGround 1 1 RenderMaxPartCount 1 8192 RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 4 +RenderLocalLightCount 1 4096 +RenderTransparentWater 1 1 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 2 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 -RenderTransparentWater 1 1 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 3 RenderTreeLODFactor 1 1.0 RenderVBOEnable 1 1 RenderVBOMappingDisable 1 1 @@ -61,48 +61,26 @@ Disregard128DefaultDrawDistance 1 1 Disregard96DefaultDrawDistance 1 1 RenderCompressTextures 1 1 RenderShaderLightingMaxLevel 1 3 +RenderReflectionProbeLevel 1 3 RenderDeferred 1 1 RenderDeferredSSAO 1 1 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 -RenderFSAASamples 1 16 +RenderUseStreamVBO 1 1 +RenderFSAAType 1 2 +RenderFSAASamples 1 3 RenderMaxTextureIndex 1 16 +RenderGLContextCoreProfile 1 1 +RenderGLMultiThreadedTextures 1 0 +RenderGLMultiThreadedMedia 1 0 +RenderReflectionProbeResolution 1 128 +RenderScreenSpaceReflections 1 1 RenderMirrors 1 1 - -// -// Low Graphics Settings (fixed function) -// -list LowFixedFunction -RenderAnisotropic 1 0 -RenderAvatarCloth 1 0 -RenderAvatarLODFactor 1 0 -RenderAvatarPhysicsLODFactor 1 0 -RenderAvatarMaxNonImpostors 1 3 -RenderAvatarMaxComplexity 1 25000 -RenderFarClip 1 64 -RenderFlexTimeFactor 1 0 -RenderGlowResolutionPow 1 8 -RenderLocalLights 1 0 -RenderMaxPartCount 1 0 -RenderObjectBump 1 0 -RenderReflectionDetail 1 0 -RenderTerrainDetail 1 0 -RenderTerrainLODFactor 1 1 -RenderTransparentWater 1 0 -RenderTreeLODFactor 1 0 -RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 0 -RenderDeferred 1 0 -RenderDeferredSSAO 1 0 -RenderUseAdvancedAtmospherics 1 0 -RenderShadowDetail 1 0 -WLSkyDetail 1 48 -RenderFSAASamples 1 0 -RenderMirrors 1 0 -RenderHeroProbeResolution 1 256 -RenderHeroProbeDistance 1 4 -RenderHeroProbeUpdateRate 1 6 +RenderHeroProbeResolution 1 2048 +RenderHeroProbeDistance 1 16 +RenderHeroProbeUpdateRate 1 4 RenderHeroProbeConservativeUpdateMultiplier 1 16 +RenderDownScaleMethod 1 1 +RenderCASSharpness 1 1 // @@ -110,7 +88,6 @@ RenderHeroProbeConservativeUpdateMultiplier 1 16 // list Low RenderAnisotropic 1 0 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0 RenderAvatarPhysicsLODFactor 1 0 RenderAvatarMaxNonImpostors 1 3 @@ -118,276 +95,260 @@ RenderAvatarMaxComplexity 1 35000 RenderFarClip 1 64 RenderFlexTimeFactor 1 0 RenderGlowResolutionPow 1 8 -RenderLocalLights 1 0 +RenderLocalLightCount 1 8 RenderMaxPartCount 1 0 -RenderObjectBump 1 0 -RenderReflectionDetail 1 0 +RenderTransparentWater 1 0 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 0 RenderTerrainDetail 1 0 RenderTerrainLODFactor 1 1 -RenderTransparentWater 1 0 +RenderTerrainPBRDetail 1 -4 +RenderTerrainPBRPlanarSampleCount 1 1 RenderTreeLODFactor 1 0 RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 0 -RenderDeferred 1 0 RenderDeferredSSAO 1 0 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 -WLSkyDetail 1 48 +WLSkyDetail 1 96 +RenderFSAAType 1 0 RenderFSAASamples 1 0 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 0 RenderMirrors 1 0 RenderHeroProbeResolution 1 256 RenderHeroProbeDistance 1 4 -RenderHeroProbeUpdateRate 1 6 +RenderHeroProbeUpdateRate 1 6 RenderHeroProbeConservativeUpdateMultiplier 1 16 +RenderCASSharpness 1 0 // // Medium Low Graphics Settings // list LowMid RenderAnisotropic 1 0 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 +RenderAvatarMaxNonImpostors 1 5 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 RenderMaxPartCount 1 2048 -RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 0 +RenderLocalLightCount 1 256 +RenderTransparentWater 1 0 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 1.0 -RenderTransparentWater 1 1 +RenderTerrainPBRDetail 1 -1 +RenderTerrainPBRPlanarSampleCount 1 1 RenderTreeLODFactor 1 0.5 RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 0 -RenderDeferred 1 0 RenderDeferredSSAO 1 0 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 -WLSkyDetail 1 48 +WLSkyDetail 1 96 +RenderFSAAType 1 0 RenderFSAASamples 1 0 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 0 RenderMirrors 1 0 RenderHeroProbeResolution 1 256 RenderHeroProbeDistance 1 6 RenderHeroProbeUpdateRate 1 3 RenderHeroProbeConservativeUpdateMultiplier 1 16 +RenderCASSharpness 1 0 // // Medium Graphics Settings (standard) // list Mid RenderAnisotropic 1 1 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 -RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 0 +RenderLocalLightCount 1 512 +RenderTransparentWater 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 -RenderTransparentWater 1 1 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 1 -RenderDeferred 1 0 +RenderVolumeLODFactor 1 1.25 RenderDeferredSSAO 1 0 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 0 -WLSkyDetail 1 48 -RenderFSAASamples 1 2 +WLSkyDetail 1 96 +RenderFSAAType 1 1 +RenderFSAASamples 1 1 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 0 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 1 RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 6 RenderHeroProbeUpdateRate 1 3 RenderHeroProbeConservativeUpdateMultiplier 1 16 +RenderCASSharpness 1 0 // -// Medium High Graphics Settings (deferred enabled) +// Medium High Graphics Settings // list MidHigh RenderAnisotropic 1 1 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 -RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 0 +RenderLocalLightCount 1 1024 +RenderTransparentWater 1 0 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 -RenderTransparentWater 1 1 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 1 -RenderDeferred 1 1 -RenderUseAdvancedAtmospherics 1 0 +RenderVolumeLODFactor 1 1.375 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 -WLSkyDetail 1 48 -RenderFSAASamples 1 2 +WLSkyDetail 1 96 +RenderFSAAType 1 1 +RenderFSAASamples 1 1 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 1 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 2 RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 6 RenderHeroProbeUpdateRate 1 2 RenderHeroProbeConservativeUpdateMultiplier 1 8 +RenderCASSharpness 1 0 // -// High Graphics Settings (deferred + SSAO) +// High Graphics Settings (SSAO + sun shadows) // list High RenderAnisotropic 1 1 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 -RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 0 +RenderLocalLightCount 1 2048 +RenderTransparentWater 1 1 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 -RenderTransparentWater 1 1 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 3 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 1 -RenderDeferred 1 1 +RenderVolumeLODFactor 1 1.5 RenderDeferredSSAO 1 1 -RenderUseAdvancedAtmospherics 1 0 -RenderShadowDetail 1 0 -WLSkyDetail 1 48 +RenderShadowDetail 1 1 +WLSkyDetail 1 96 +RenderFSAAType 1 2 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 1 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 3 RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 8 RenderHeroProbeUpdateRate 1 2 RenderHeroProbeConservativeUpdateMultiplier 1 8 +RenderCASSharpness 1 0.4 // -// High Ultra Graphics Settings (deferred + SSAO + shadows) +// High Ultra Graphics Settings (deferred + SSAO + all shadows) // list HighUltra RenderAnisotropic 1 1 -RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 RenderMaxPartCount 1 4096 -RenderObjectBump 1 1 -RenderLocalLights 1 1 -RenderReflectionDetail 1 0 +RenderLocalLightCount 1 4096 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 3 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 -WindLightUseAtmosShaders 1 1 -RenderDeferred 1 1 +RenderVolumeLODFactor 1 1.75 RenderDeferredSSAO 1 1 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 -WLSkyDetail 1 48 +WLSkyDetail 1 96 +RenderFSAAType 1 2 RenderFSAASamples 1 2 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 1 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 3 RenderMirrors 1 0 -RenderHeroProbeResolution 1 512 +RenderHeroProbeResolution 1 1024 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 RenderHeroProbeConservativeUpdateMultiplier 1 4 +RenderCASSharpness 1 0.4 // // Ultra graphics (REALLY PURTY!) // list Ultra RenderAnisotropic 1 1 -RenderAvatarCloth 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 -RenderLocalLights 1 1 +RenderLocalLightCount 1 8192 RenderMaxPartCount 1 8192 -RenderObjectBump 1 1 -RenderReflectionDetail 1 4 RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 +RenderTerrainPBRDetail 1 0 +RenderTerrainPBRPlanarSampleCount 1 3 RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderVolumeLODFactor 1 2.0 WindLightUseAtmosShaders 1 1 WLSkyDetail 1 128 -RenderDeferred 1 1 RenderDeferredSSAO 1 1 -RenderUseAdvancedAtmospherics 1 0 RenderShadowDetail 1 2 -RenderFSAASamples 1 2 +RenderFSAAType 1 2 +RenderFSAASamples 1 3 +RenderReflectionsEnabled 1 1 +RenderReflectionProbeDetail 1 1 +RenderScreenSpaceReflections 1 0 +RenderReflectionProbeLevel 1 3 RenderMirrors 1 0 -RenderHeroProbeResolution 1 1024 +RenderHeroProbeResolution 1 2048 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 RenderHeroProbeConservativeUpdateMultiplier 1 4 +RenderCASSharpness 1 0.4 // // Class Unknown Hardware (unknown) // list Unknown -RenderVBOEnable 1 0 RenderShadowDetail 1 0 -RenderDeferred 1 0 RenderDeferredSSAO 1 0 -RenderUseAdvancedAtmospherics 1 0 - -// -// Class 0 Hardware (just old) -// -list Class0 -RenderVBOEnable 1 1 - -// -// Class 1 Hardware -// -list Class1 -RenderVBOEnable 1 1 - -// -// Class 2 Hardware -// -list Class2 -RenderVBOEnable 1 1 - -// -// Class 3 Hardware -// -list Class3 -RenderVBOEnable 1 1 - -// -// Class 4 Hardware -// -list Class4 -RenderVBOEnable 1 1 - -// -// Class 5 Hardware -// -list Class5 -RenderVBOEnable 1 1 +RenderMirrors 1 0 // // VRAM > 512MB @@ -396,339 +357,41 @@ list VRAMGT512 RenderCompressTextures 1 0 // -// No Pixel Shaders available -// -list NoPixelShaders -RenderAvatarCloth 0 0 -RenderReflectionDetail 0 0 -WindLightUseAtmosShaders 0 0 -RenderDeferred 0 0 -RenderDeferredSSAO 0 0 -RenderUseAdvancedAtmospherics 0 0 -RenderShadowDetail 0 0 - -// -// No Vertex Shaders available -// -list NoVertexShaders -RenderAvatarCloth 0 0 -RenderReflectionDetail 0 0 -WindLightUseAtmosShaders 0 0 -RenderDeferred 0 0 -RenderDeferredSSAO 0 0 -RenderUseAdvancedAtmospherics 0 0 -RenderShadowDetail 0 0 - -// -// GL_ARB_map_buffer_range exists -// -list MapBufferRange -RenderVBOMappingDisable 1 1 - - -// // "Default" setups for safe, low, medium, high // list safe RenderAnisotropic 1 0 -RenderAvatarCloth 0 0 RenderAvatarMaxNonImpostors 1 16 RenderAvatarMaxComplexity 1 80000 -RenderObjectBump 0 0 -RenderLocalLights 1 0 +RenderLocalLightCount 1 0 RenderMaxPartCount 1 1024 RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 -RenderReflectionDetail 0 0 -WindLightUseAtmosShaders 0 0 -RenderDeferred 0 0 +RenderTransparentWater 1 0 RenderDeferredSSAO 0 0 -RenderUseAdvancedAtmospherics 0 0 RenderShadowDetail 0 0 - -// -// CPU based feature masks -// - -// 1Ghz or less (equiv) -list CPUSlow -RenderMaxPartCount 1 1024 - -// -// RAM based feature masks -// -list RAM256MB -RenderObjectBump 0 0 - -// -// Graphics card based feature masks -// -list OpenGLPre15 -RenderVBOEnable 1 0 - -list OpenGLPre30 -RenderDeferred 0 0 -RenderMaxTextureIndex 1 1 +RenderReflectionProbeDetail 0 -1 +RenderMirrors 0 0 list Intel RenderAnisotropic 1 0 -// Avoid some Intel crashes on Linux -RenderCubeMap 0 0 +RenderFSAAType 1 0 RenderFSAASamples 1 0 +RenderGLContextCoreProfile 1 0 +RenderGLMultiThreadedMedia 1 0 +RenderDownScaleMethod 1 0 -list GeForce2 -RenderAnisotropic 1 0 -RenderMaxPartCount 1 2048 -RenderTerrainDetail 1 0 -RenderVBOEnable 1 1 - -list SiS -UseOcclusion 0 0 - - -list Intel_830M -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_845G -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_855GM -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_865G -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_900 -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_915GM -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_915G -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_945GM -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_945G -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_950 -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_965 -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 -UseOcclusion 0 0 - -list Intel_G33 -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_Bear_Lake -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_Broadwater -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_Brookdale -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_Montara -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - -list Intel_Springdale -RenderTerrainDetail 1 0 -RenderVBOEnable 1 0 - - -list ATI_FireGL_5200 -RenderVBOEnable 1 0 -WindLightUseAtmosShaders 0 0 - - -list ATI_Mobility_Radeon_7xxx -RenderVBOEnable 0 0 - -list ATI_Radeon_7xxx -RenderVBOEnable 0 0 - -list ATI_All-in-Wonder_Radeon -RenderVBOEnable 0 0 - -list ATI_All-in-Wonder_7500 -RenderVBOEnable 0 0 - -list ATI_Mobility_Radeon_9600 -Disregard96DefaultDrawDistance 1 0 - - -/// tweaked ATI to 96 Draw distance - -list ATI_Radeon_9000 -Disregard96DefaultDrawDistance 1 0 -list ATI_Radeon_9200 -Disregard96DefaultDrawDistance 1 0 -list ATI_Radeon_9500 -Disregard96DefaultDrawDistance 1 0 -list ATI_Radeon_9600 -Disregard96DefaultDrawDistance 1 0 - -/// tweaked ATI to 128 draw distance - -list ATI_Radeon_X300 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X400 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X500 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X600 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X700 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X1300 -Disregard128DefaultDrawDistance 1 0 -UseStartScreen 0 0 -list ATI_Radeon_X1400 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X1500 -Disregard128DefaultDrawDistance 1 0 -UseStartScreen 0 0 -list ATI_Radeon_X1600 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_X1700 -Disregard128DefaultDrawDistance 1 0 -list ATI_Mobility_Radeon_X1xxx -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_HD_2300 -Disregard128DefaultDrawDistance 1 0 -list ATI_Radeon_HD_2400 -Disregard128DefaultDrawDistance 1 0 -list ATI_ASUS_AH24xx -Disregard128DefaultDrawDistance 1 0 - - -// Avatar hardware skinning causes invisible avatars -// on various ATI chipsets on drivers before 8.2 - -list ATIOldDriver -RenderAvatarCloth 0 0 -// Avoid driver crashes with some features on Linux with old ATI drivers -UseOcclusion 0 0 -WindLightUseAtmosShaders 0 0 - - -/// Tweaked NVIDIA - -list NVIDIA_GeForce_FX_5100 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_5200 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_5500 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_5600 -Disregard96DefaultDrawDistance 1 0 - -list NVIDIA_GeForce_FX_Go5100 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_Go5200 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_Go5300 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_Go5500 -Disregard96DefaultDrawDistance 1 0 -list NVIDIA_GeForce_FX_Go5600 -Disregard96DefaultDrawDistance 1 0 - -list NVIDIA_GeForce_6100 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_6200 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_6500 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_6600 -Disregard128DefaultDrawDistance 1 0 - -list NVIDIA_G73 -Disregard128DefaultDrawDistance 1 0 - -list NVIDIA_GeForce_Go_6100 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6200 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6500 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6600 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6700 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6800 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 -list NVIDIA_GeForce_Go_6 -RenderVBOEnable 1 0 -Disregard128DefaultDrawDistance 1 0 +list AMD +RenderGLMultiThreadedTextures 1 0 -list NVIDIA_GeForce_7000 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7100 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7200 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7300 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7400 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7500 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7600 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7700 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7800 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_7900 -RenderShaderLightingMaxLevel 1 2 +list NVIDIA +RenderGLMultiThreadedMedia 1 1 -list NVIDIA_GeForce_Go_7200 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7300 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7300_LE -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7400 -Disregard128DefaultDrawDistance 1 0 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7600 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7700 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7800 -RenderShaderLightingMaxLevel 1 2 -list NVIDIA_GeForce_Go_7900 -RenderShaderLightingMaxLevel 1 2 +list GL3 +RenderFSAAType 0 0 +RenderFSAASamples 0 0 +RenderReflectionsEnabled 0 0 +RenderReflectionProbeDetail 0 0 +RenderMirrors 0 0 +list TexUnit16orLess +RenderTerrainPBRDetail 1 -1 diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index a027aaf6d1..3019e844d2 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -4,16 +4,9 @@ ## These options are for self-assisted troubleshooting during this beta ## testing phase; you should not usually need to touch them. -## - Avoids using any FMOD STUDIO audio driver. -#export LL_BAD_FMODSTUDIO_DRIVER=x ## - Avoids using any OpenAL audio driver. #export LL_BAD_OPENAL_DRIVER=x -## - Avoids using the FMOD Studio or FMOD Ex PulseAudio audio driver. -#export LL_BAD_FMOD_PULSEAUDIO=x -## - Avoids using the FMOD Studio or FMOD Ex ALSA audio driver. -#export LL_BAD_FMOD_ALSA=x - ## - Avoids the optional OpenGL extensions which have proven most problematic ## on some hardware. Disabling this option may cause BETTER PERFORMANCE but ## may also cause CRASHES and hangs on some unstable combinations of drivers @@ -34,16 +27,10 @@ ## LL_GL_BLACKLIST which solves your problems. #export LL_GL_BLACKLIST=abcdefghijklmno -## - Some ATI/Radeon users report random X server crashes when the mouse -## cursor changes shape. If you suspect that you are a victim of this -## driver bug, try enabling this option and report whether it helps: -#export LL_ATI_MOUSE_CURSOR_BUG=x - if [ "`uname -m`" = "x86_64" ]; then echo '64-bit Linux detected.' fi - ## Everything below this line is just for advanced troubleshooters. ##------------------------------------------------------------------- @@ -55,9 +42,6 @@ fi #export LL_WRAPPER='gdb --args' #export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp' -## - Avoids an often-buggy X feature that doesn't really benefit us anyway. -export SDL_VIDEO_X11_DGAMOUSE=0 - ## - The 'scim' GTK IM module widely crashes the viewer. Avoid it. if [ "$GTK_IM_MODULE" = "scim" ]; then export GTK_IM_MODULE=xim @@ -67,13 +51,6 @@ if [ "$XMODIFIERS" = "" ]; then export XMODIFIERS="@im=fcitx" fi -## - Automatically work around the ATI mouse cursor crash bug: -## (this workaround is disabled as most fglrx users do not see the bug) -#if lsmod | grep fglrx &>/dev/null ; then -# export LL_ATI_MOUSE_CURSOR_BUG=x -#fi - - ## Nothing worth editing below this line. ##------------------------------------------------------------------- diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index d9002bf073..14e443ec4e 100644 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -87,33 +87,34 @@ LLAgentListener::LLAgentListener(LLAgent &agent) add("startAutoPilot", "Start the autopilot system using the following parameters:\n" "[\"target_global\"]: array of target global {x, y, z} position\n" - "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]\n" + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]\n" "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n" - "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]" - "[\"allow_flying\"]: allow flying during autopilot [default: True]", - //"[\"callback_pump\"]: pump to send success/failure and callback data to [default: none]\n" - //"[\"callback_data\"]: data to send back during a callback [default: none]", - &LLAgentListener::startAutoPilot); + "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]\n" + "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" + "event with [\"success\"] flag is sent to 'LLAutopilot' event pump, when auto pilot is terminated", + &LLAgentListener::startAutoPilot, + llsd::map("target_global", LLSD())); add("getAutoPilot", "Send information about current state of the autopilot system to [\"reply\"]:\n" "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n" "[\"target_global\"]: array of target global {x, y, z} position\n" "[\"leader_id\"]: uuid of target autopilot is following\n" - "[\"stop_distance\"]: target maximum distance from target\n" + "[\"stop_distance\"]: maximum stop distance from target\n" "[\"target_distance\"]: last known distance from target\n" "[\"use_rotation\"]: boolean indicating if autopilot has a target facing rotation\n" "[\"target_facing\"]: array of {x, y} target direction to face\n" "[\"rotation_threshold\"]: target maximum angle from target facing rotation\n" "[\"behavior_name\"]: name of the autopilot behavior", &LLAgentListener::getAutoPilot, - LLSDMap("reply", LLSD())); + llsd::map("reply", LLSD())); add("startFollowPilot", "[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n" "[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n" "[\"allow_flying\"]: allow flying during autopilot [default: True]\n" - "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]", - &LLAgentListener::startFollowPilot); + "[\"stop_distance\"]: maximum stop distance from target [default: autopilot guess]", + &LLAgentListener::startFollowPilot, + llsd::map("reply", LLSD())); add("setAutoPilotTarget", "Update target for currently running autopilot:\n" "[\"target_global\"]: array of target global {x, y, z} position", @@ -205,7 +206,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const //mAgent.getAvatarObject()->sitOnObject(); // shamelessly ripped from llviewermenu.cpp:handle_sit_or_stand() // *TODO - find a permanent place to share this code properly. - + Response response(LLSD(), event_data); LLViewerObject *object = NULL; if (event_data.has("obj_uuid")) { @@ -214,7 +215,13 @@ void LLAgentListener::requestSit(LLSD const & event_data) const else if (event_data.has("position")) { LLVector3 target_position = ll_vector3_from_sd(event_data["position"]); - object = findObjectClosestTo(target_position); + object = findObjectClosestTo(target_position, true); + } + else + { + //just sit on the ground + mAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); + return; } if (object && object->getPCode() == LL_PCODE_VOLUME) @@ -231,8 +238,7 @@ void LLAgentListener::requestSit(LLSD const & event_data) const } else { - LL_WARNS() << "LLAgent requestSit could not find the sit target: " - << event_data << LL_ENDL; + response.error("requestSit could not find the sit target"); } } @@ -242,7 +248,7 @@ void LLAgentListener::requestStand(LLSD const & event_data) const } -LLViewerObject * LLAgentListener::findObjectClosestTo( const LLVector3 & position ) const +LLViewerObject * LLAgentListener::findObjectClosestTo(const LLVector3 & position, bool sit_target) const { LLViewerObject *object = NULL; @@ -253,8 +259,13 @@ LLViewerObject * LLAgentListener::findObjectClosestTo( const LLVector3 & positio while (cur_index < num_objects) { LLViewerObject * cur_object = gObjectList.getObject(cur_index++); - if (cur_object) - { // Calculate distance from the target position + if (cur_object && !cur_object->isAttachment()) + { + if(sit_target && (cur_object->getPCode() != LL_PCODE_VOLUME)) + { + continue; + } + // Calculate distance from the target position LLVector3 target_diff = cur_object->getPositionRegion() - position; F32 distance_to_target = target_diff.length(); if (distance_to_target < min_distance) @@ -354,14 +365,13 @@ void LLAgentListener::getPosition(const LLSD& event_data) const void LLAgentListener::startAutoPilot(LLSD const & event_data) { - LLQuaternion target_rotation_value; LLQuaternion* target_rotation = NULL; if (event_data.has("target_rotation")) { - target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); + LLQuaternion target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); target_rotation = &target_rotation_value; } - // *TODO: Use callback_pump and callback_data + F32 rotation_threshold = 0.03f; if (event_data.has("rotation_threshold")) { @@ -381,13 +391,24 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) stop_distance = (F32)event_data["stop_distance"].asReal(); } + std::string behavior_name = LLCoros::getName(); + if (event_data.has("behavior_name")) + { + behavior_name = event_data["behavior_name"].asString(); + } + // Clear follow target, this is doing a path mFollowTarget.setNull(); + auto finish_cb = [](bool success, void*) + { + LLEventPumps::instance().obtain("LLAutopilot").post(llsd::map("success", success)); + }; + mAgent.startAutoPilotGlobal(ll_vector3d_from_sd(event_data["target_global"]), - event_data["behavior_name"], + behavior_name, target_rotation, - NULL, NULL, + finish_cb, NULL, stop_distance, rotation_threshold, allow_flying); @@ -395,7 +416,7 @@ void LLAgentListener::startAutoPilot(LLSD const & event_data) void LLAgentListener::getAutoPilot(const LLSD& event_data) const { - LLSD reply = LLSD::emptyMap(); + Response reply(LLSD(), event_data); LLSD::Boolean enabled = mAgent.getAutoPilot(); reply["enabled"] = enabled; @@ -424,12 +445,11 @@ void LLAgentListener::getAutoPilot(const LLSD& event_data) const reply["rotation_threshold"] = mAgent.getAutoPilotRotationThreshold(); reply["behavior_name"] = mAgent.getAutoPilotBehaviorName(); reply["fly"] = (LLSD::Boolean) mAgent.getFlying(); - - sendReply(reply, event_data); } void LLAgentListener::startFollowPilot(LLSD const & event_data) { + Response response(LLSD(), event_data); LLUUID target_id; bool allow_flying = true; @@ -463,6 +483,10 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) } } } + else + { + return response.error("'leader_id' or 'avatar_name' should be specified"); + } F32 stop_distance = 0.f; if (event_data.has("stop_distance")) @@ -470,13 +494,16 @@ void LLAgentListener::startFollowPilot(LLSD const & event_data) stop_distance = (F32)event_data["stop_distance"].asReal(); } - if (target_id.notNull()) + if (!gObjectList.findObject(target_id)) { - mAgent.setFlying(allow_flying); - mFollowTarget = target_id; // Save follow target so we can report distance later - - mAgent.startFollowPilot(target_id, allow_flying, stop_distance); + std::string target_info = event_data.has("leader_id") ? event_data["leader_id"] : event_data["avatar_name"]; + return response.error(stringize("Target ", std::quoted(target_info), " was not found")); } + + mAgent.setFlying(allow_flying); + mFollowTarget = target_id; // Save follow target so we can report distance later + + mAgent.startFollowPilot(target_id, allow_flying, stop_distance); } void LLAgentListener::setAutoPilotTarget(LLSD const & event_data) const diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h index 2765bb5b66..05724ff443 100644 --- a/indra/newview/llagentlistener.h +++ b/indra/newview/llagentlistener.h @@ -67,7 +67,7 @@ private: void stopAnimation(LLSD const &event_data); void getAnimationInfo(LLSD const &event_data); - LLViewerObject * findObjectClosestTo( const LLVector3 & position ) const; + LLViewerObject * findObjectClosestTo( const LLVector3 & position, bool sit_target = false ) const; private: LLAgent & mAgent; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 377fb4d486..6fd58ef1be 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -135,8 +135,8 @@ #include "stringize.h" #include "llcoros.h" #include "llexception.h" -#if !LL_LINUX #include "cef/dullahan_version.h" +#if !LL_LINUX #include "vlc/libvlc_version.h" #endif // LL_LINUX @@ -184,7 +184,6 @@ #include "lltracker.h" #include "llviewerparcelmgr.h" #include "llworldmapview.h" -#include "llpostprocess.h" #include "lldebugview.h" #include "llconsole.h" @@ -220,7 +219,6 @@ #include "llfloatersimplesnapshot.h" #include "llfloatersnapshot.h" #include "llsidepanelinventory.h" -#include "llatmosphere.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -1763,8 +1761,6 @@ void LLAppViewer::flushLFSIO() bool LLAppViewer::cleanup() { - LLAtmosphere::cleanupClass(); - //ditch LLVOAvatarSelf instance gAgentAvatarp = NULL; @@ -1972,8 +1968,6 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLAvatarAppearance); - SUBSYSTEM_CLEANUP(LLPostProcess); - LLTracker::cleanupInstance(); // *FIX: This is handled in LLAppViewerWin32::cleanup(). @@ -3444,7 +3438,6 @@ LLSD LLAppViewer::getViewerInfo() const info["VOICE_VERSION"] = LLTrans::getString("NotConnected"); } -#if !LL_LINUX std::ostringstream cef_ver_codec; cef_ver_codec << "Dullahan: "; cef_ver_codec << DULLAHAN_VERSION_MAJOR; @@ -3470,9 +3463,6 @@ LLSD LLAppViewer::getViewerInfo() const cef_ver_codec << CHROME_VERSION_PATCH; info["LIBCEF_VERSION"] = cef_ver_codec.str(); -#else - info["LIBCEF_VERSION"] = "Undefined"; -#endif #if !LL_LINUX std::ostringstream vlc_ver_codec; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 87b6ce6cb3..5379bcc985 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -732,15 +732,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) {// If we need shaders, and we're not ALREADY using the proper shader, then bind it // (this way we won't rebind shaders unnecessarily). gPipeline.bindDeferredShaderFast(*target_shader); - - if (params.mFullbright) - { // make sure the bind the exposure map for fullbright shaders so they can cancel out exposure - S32 channel = target_shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); - } - } } LLVector4 spec_color(1, 1, 1, 1); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index bf593bff07..754fcd4c17 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -300,13 +300,6 @@ void LLDrawPoolBump::beginFullbrightShiny() shader = shader->mRiggedVariant; } - // bind exposure map so fullbright shader can cancel out exposure - S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); - } - LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if (cube_map && !LLPipeline::sReflectionProbesEnabled) diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 305215f541..e6d0b036e0 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -32,7 +32,6 @@ #include "llface.h" #include "llimage.h" #include "llrender.h" -#include "llatmosphere.h" #include "llenvironment.h" #include "llglslshader.h" #include "llgl.h" diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 05bd704556..a125dcb7aa 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -54,7 +54,6 @@ #include "llregioninfomodel.h" -#include "llatmosphere.h" #include "llagent.h" #include "roles_constants.h" #include "llestateinfomodel.h" @@ -965,54 +964,6 @@ LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const return pwater; } -void LayerConfigToDensityLayer(const LLSD& layerConfig, DensityLayer& layerOut) -{ - layerOut.constant_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layerOut.exp_scale = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layerOut.exp_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layerOut.linear_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layerOut.width = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); -} - -void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky) -{ - settingsOut.m_skyBottomRadius = psky->getSkyBottomRadius(); - settingsOut.m_skyTopRadius = psky->getSkyTopRadius(); - settingsOut.m_sunArcRadians = psky->getSunArcRadians(); - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD rayleigh = psky->getRayleighConfigs(); - settingsOut.m_rayleighProfile.clear(); - for (LLSD::array_iterator itf = rayleigh.beginArray(); itf != rayleigh.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_rayleighProfile.push_back(layer); - } - - LLSD mie = psky->getMieConfigs(); - settingsOut.m_mieProfile.clear(); - for (LLSD::array_iterator itf = mie.beginArray(); itf != mie.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_mieProfile.push_back(layer); - } - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD absorption = psky->getAbsorptionConfigs(); - settingsOut.m_absorptionProfile.clear(); - for (LLSD::array_iterator itf = absorption.beginArray(); itf != absorption.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_absorptionProfile.push_back(layer); - } -} - bool LLEnvironment::canAgentUpdateParcelEnvironment() const { LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); @@ -2744,13 +2695,6 @@ bool LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mSky->update(); mBlenderSky.reset(); - if (gAtmosphere) - { - AtmosphericModelSettings settings; - LLEnvironment::getAtmosphericModelSettings(settings, psky); - gAtmosphere->configureAtmosphericModel(settings); - } - return changed; } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index f1205a72b7..217c069705 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -36,8 +36,6 @@ #include "llsettingswater.h" #include "llsettingsdaycycle.h" -#include "llatmosphere.h" - #include "llglslshader.h" #include <boost/signals2.hpp> @@ -131,8 +129,6 @@ public: LLSettingsSky::ptr_t getCurrentSky() const; LLSettingsWater::ptr_t getCurrentWater() const; - static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky); - void update(const LLViewerCamera * cam); static void updateGLVariablesForSettings(LLShaderUniforms* uniforms, const LLSettingsBase::ptr_t &psetting); diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp deleted file mode 100644 index 616c13cdc7..0000000000 --- a/indra/newview/llfloaterpostprocess.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/** - * @file llfloaterpostprocess.cpp - * @brief LLFloaterPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterpostprocess.h" - -#include "llsliderctrl.h" -#include "llcheckboxctrl.h" -#include "llnotificationsutil.h" -#include "lluictrlfactory.h" -#include "llviewerdisplay.h" -#include "llpostprocess.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llviewerwindow.h" - - -LLFloaterPostProcess::LLFloaterPostProcess(const LLSD& key) - : LLFloater(key) -{ -} - -LLFloaterPostProcess::~LLFloaterPostProcess() -{ - - -} -bool LLFloaterPostProcess::postBuild() -{ - /// Color Filter Callbacks - childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); - //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma())); - childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness"); - childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation"); - childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast"); - - childSetCommitCallback("ColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base"); - childSetCommitCallback("ColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base"); - - /// Night Vision Callbacks - childSetCommitCallback("NightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision"); - childSetCommitCallback("NightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier"); - childSetCommitCallback("NightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size"); - childSetCommitCallback("NightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength"); - - /// Bloom Callbacks - childSetCommitCallback("BloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom"); - childSetCommitCallback("BloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low"); - childSetCommitCallback("BloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width"); - childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength"); - - // Effect loading and saving. - LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); - getChild<LLComboBox>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox)); - comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1)); - - LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor"); - getChild<LLComboBox>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox)); - - syncMenu(); - return true; -} - -// Bool Toggle -void LLFloaterPostProcess::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - char const * boolVariableName = (char const *)userData; - - // check the bool - LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); - gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue(); -} - -// Float Moved -void LLFloaterPostProcess::onFloatControlMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - gPostProcess->tweaks[floatVariableName] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlRMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - gPostProcess->tweaks[floatVariableName][0] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlGMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - gPostProcess->tweaks[floatVariableName][1] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlBMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - gPostProcess->tweaks[floatVariableName][2] = sldrCtrl->getValue(); -} - -// Color Moved -void LLFloaterPostProcess::onColorControlIMoved(LLUICtrl* ctrl, void* userData) -{ - char const * floatVariableName = (char const *)userData; - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue(); -} - -void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox) -{ - LLSD::String effectName(comboBox->getSelectedValue().asString()); - - gPostProcess->setSelectedEffect(effectName); - - syncMenu(); -} - -void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox) -{ - std::string effectName(editBox->getValue().asString()); - - if (gPostProcess->mAllEffects.has(effectName)) - { - LLSD payload; - payload["effect_name"] = effectName; - LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2)); - } - else - { - gPostProcess->saveEffect(effectName); - syncMenu(); - } -} - -void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl) -{ - // get the combo box and name - LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor"); - - // set the parameter's new name - editBox->setValue(ctrl->getValue()); -} - -bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - // if they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - gPostProcess->saveEffect(notification["payload"]["effect_name"].asString()); - - syncMenu(); - } - return false; -} - -void LLFloaterPostProcess::syncMenu() -{ - // add the combo boxe contents - LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); - - comboBox->removeall(); - - LLSD::map_const_iterator currEffect; - for(currEffect = gPostProcess->mAllEffects.beginMap(); - currEffect != gPostProcess->mAllEffects.endMap(); - ++currEffect) - { - comboBox->add(currEffect->first); - } - - // set the current effect as selected. - comboBox->selectByValue(gPostProcess->getSelectedEffect()); - - /// Sync Color Filter Menu - getChild<LLUICtrl>("ColorFilterToggle")->setValue(gPostProcess->tweaks.useColorFilter()); - //getChild<LLUICtrl>("ColorFilterGamma")->setValue(gPostProcess->tweaks.gamma()); - getChild<LLUICtrl>("ColorFilterBrightness")->setValue(gPostProcess->tweaks.brightness()); - getChild<LLUICtrl>("ColorFilterSaturation")->setValue(gPostProcess->tweaks.saturation()); - getChild<LLUICtrl>("ColorFilterContrast")->setValue(gPostProcess->tweaks.contrast()); - getChild<LLUICtrl>("ColorFilterBaseR")->setValue(gPostProcess->tweaks.contrastBaseR()); - getChild<LLUICtrl>("ColorFilterBaseG")->setValue(gPostProcess->tweaks.contrastBaseG()); - getChild<LLUICtrl>("ColorFilterBaseB")->setValue(gPostProcess->tweaks.contrastBaseB()); - getChild<LLUICtrl>("ColorFilterBaseI")->setValue(gPostProcess->tweaks.contrastBaseIntensity()); - - /// Sync Night Vision Menu - getChild<LLUICtrl>("NightVisionToggle")->setValue(gPostProcess->tweaks.useNightVisionShader()); - getChild<LLUICtrl>("NightVisionBrightMult")->setValue(gPostProcess->tweaks.brightMult()); - getChild<LLUICtrl>("NightVisionNoiseSize")->setValue(gPostProcess->tweaks.noiseSize()); - getChild<LLUICtrl>("NightVisionNoiseStrength")->setValue(gPostProcess->tweaks.noiseStrength()); - - /// Sync Bloom Menu - getChild<LLUICtrl>("BloomToggle")->setValue(LLSD(gPostProcess->tweaks.useBloomShader())); - getChild<LLUICtrl>("BloomExtract")->setValue(gPostProcess->tweaks.extractLow()); - getChild<LLUICtrl>("BloomSize")->setValue(gPostProcess->tweaks.bloomWidth()); - getChild<LLUICtrl>("BloomStrength")->setValue(gPostProcess->tweaks.bloomStrength()); -} diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h deleted file mode 100644 index 50b48d8410..0000000000 --- a/indra/newview/llfloaterpostprocess.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file llfloaterpostprocess.h - * @brief LLFloaterPostProcess class definition - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERPOSTPROCESS_H -#define LL_LLFLOATERPOSTPROCESS_H - -#include "llfloater.h" - -class LLButton; -class LLComboBox; -class LLLineEditor; -class LLSliderCtrl; -class LLTabContainer; -class LLPanelPermissions; -class LLPanelObject; -class LLPanelVolume; -class LLPanelContents; -class LLPanelFace; - -/** - * Menu for adjusting the post process settings of the world - */ -class LLFloaterPostProcess : public LLFloater -{ -public: - - LLFloaterPostProcess(const LLSD& key); - virtual ~LLFloaterPostProcess(); - bool postBuild(); - - /// post process callbacks - static void onBoolToggle(LLUICtrl* ctrl, void* userData); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - void onLoadEffect(LLComboBox* comboBox); - void onSaveEffect(LLLineEditor* editBox); - void onChangeEffectName(LLUICtrl* ctrl); - - /// prompts a user when overwriting an effect - bool saveAlertCallback(const LLSD& notification, const LLSD& response); - - /// sync up sliders - void syncMenu(); -}; - -#endif diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 25438eae5e..5e5e6425b8 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -45,7 +45,9 @@ #include "llworld.h" #include "tinygltf/tiny_gltf.h" -#include <strstream> + +#include <boost/iostreams/device/array.hpp> +#include <boost/iostreams/stream.hpp> #include <unordered_set> @@ -168,7 +170,7 @@ namespace void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::string& data_in) { - std::istringstream str(data_in); + boost::iostreams::stream<boost::iostreams::array_source> str(data_in.data(), data_in.size()); LLSD data; @@ -539,8 +541,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LLSD asset; // read file into buffer - std::istrstream str(&buffer[0], static_cast<S32>(buffer.size())); - + boost::iostreams::stream<boost::iostreams::array_source> str(buffer.data(), buffer.size()); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { if (asset.has("version") && LLGLTFMaterial::isAcceptedVersion(asset["version"].asString())) diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index aa440c6cf5..2255eb236f 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -109,7 +109,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight()); - glm::vec3 win_coord = glm::project(glm::make_vec3(render_pos.mV), get_current_modelview(), get_current_projection(), viewport); + glm::vec3 win_coord = glm::project(glm::make_vec3(LLVector4(render_pos).mV), get_current_modelview(), get_current_projection(), viewport); //fonts all render orthographically, set up projection`` gGL.matrixMode(LLRender::MM_PROJECTION); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 92f09c34a0..818474a0cb 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -185,6 +185,15 @@ void LLHUDText::renderText() LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); + bool reset_buffers = false; + const F32 treshold = 0.000001f; + if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold + || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold + || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold) + { + reset_buffers = true; + mLastRenderPosition = render_position; + } F32 y_offset = (F32)mOffsetY; @@ -208,6 +217,11 @@ void LLHUDText::renderText() for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { + if (reset_buffers) + { + segment_iter->mFontBufferText.reset(); + } + const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics @@ -231,7 +245,7 @@ void LLHUDText::renderText() } text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, &mFontBuffer, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 224677736c..4c850e2d91 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -67,6 +67,8 @@ protected: LLColor4 mColor; LLFontGL::StyleFlags mStyle; const LLFontGL* mFont; + LLFontVertexBuffer mFontBuffer; + LLFontVertexBuffer mFontBufferText; private: LLWString mText; std::map<const LLFontGL*, F32> mFontWidthMap; @@ -152,6 +154,7 @@ private: const LLFontGL* mBoldFontp; LLRectf mSoftScreenRect; LLVector3 mPositionAgent; + LLVector3 mLastRenderPosition; LLVector2 mPositionOffset; LLVector2 mTargetPositionOffset; F32 mMass; @@ -162,7 +165,6 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; bool mHidden; - LLFontVertexBuffer mFontBuffer; static bool sDisplayText ; static std::set<LLPointer<LLHUDText> > sTextObjects; diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index dde238eddb..b5e494379d 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -63,8 +63,9 @@ #include "tinygltf/tiny_gltf.h" #include "lltinygltfhelper.h" -#include <strstream> +#include <boost/iostreams/device/array.hpp> +#include <boost/iostreams/stream.hpp> const std::string MATERIAL_BASE_COLOR_DEFAULT_NAME = "Base Color"; const std::string MATERIAL_NORMAL_DEFAULT_NAME = "Normal"; @@ -1245,7 +1246,7 @@ bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer) { LLSD asset; - std::istrstream str(&buffer[0], buffer.size()); + boost::iostreams::stream<boost::iostreams::array_source> str(buffer.data(), buffer.size()); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { if (asset.has("version") && LLGLTFMaterial::isAcceptedVersion(asset["version"].asString())) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 86126829fd..e4e70b02f9 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -864,7 +864,7 @@ LLMeshRepoThread::~LLMeshRepoThread() while (!mSkinInfoQ.empty()) { - delete mSkinInfoQ.front(); + llassert(mSkinInfoQ.front()->getNumRefs() == 1); mSkinInfoQ.pop_front(); } @@ -2058,13 +2058,15 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat LLSkinningUtil::initJointNums(info, gAgentAvatarp); } - // remember the skin info in the background thread so we can use it + // copy the skin info for the background thread so we can use it // to calculate per-joint bounding boxes when volumes are loaded - mSkinMap[mesh_id] = info; + mSkinMap[mesh_id] = new LLMeshSkinInfo(*info); { + // Move the LLPointer in to the skin info queue to avoid reference + // count modification after we leave the lock LLMutexLock lock(mMutex); - mSkinInfoQ.push_back(info); + mSkinInfoQ.emplace_back(std::move(info)); } } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index ea2b2ba944..b4a0f0570e 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -35,7 +35,6 @@ #include "llvirtualtrackball.h" #include "llsettingssky.h" #include "llenvironment.h" -#include "llatmosphere.h" #include "llviewercontrol.h" namespace @@ -926,13 +925,6 @@ void LLPanelSettingsSkyDensityTab::updateProfile() mSkySettings->setAbsorptionConfigs(absorption_config); mSkySettings->update(); setIsDirty(); - - if (gAtmosphere) - { - AtmosphericModelSettings atmospheric_settings; - LLEnvironment::getAtmosphericModelSettings(atmospheric_settings, mSkySettings); - gAtmosphere->configureAtmosphericModel(atmospheric_settings); - } } void LLPanelSettingsSkyDensityTab::onRayleighExponentialChanged() diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 423ca376d1..be61c44b7c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -288,7 +288,7 @@ void LLPanelEnvironmentInfo::refresh() F32Hours dayoffset(mCurrentEnvironment->mDayOffset); if (dayoffset.value() > 12.0f) - dayoffset -= daylength; + dayoffset -= F32Hours(24.0); mSliderDayLength->setValue(daylength.value()); mSliderDayOffset->setValue(dayoffset.value()); @@ -717,11 +717,6 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) F32Hours daylength(value); mCurrentEnvironment->mDayLength = daylength; - F32 offset = (F32)mSliderDayOffset->getValue().asReal(); - if (offset <= 0.0f) - { - onSldDayOffsetChanged(offset); - } setDirtyFlag(DIRTY_FLAG_DAYLENGTH); udpateApparentTimeOfDay(); @@ -735,8 +730,7 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) F32Hours dayoffset(value); if (dayoffset.value() <= 0.0f) - // if day cycle is 5 hours long, we want -1h offset to result in 4h - dayoffset += mCurrentEnvironment->mDayLength; + dayoffset += F32Hours(24.0); mCurrentEnvironment->mDayOffset = dayoffset; setDirtyFlag(DIRTY_FLAG_DAYOFFSET); @@ -928,7 +922,7 @@ void LLPanelEnvironmentInfo::udpateApparentTimeOfDay() { static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0); - if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0)) + if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0)) { mLabelApparentTime->setVisible(false); return; diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index 9f0b27139a..1c58fa6cfa 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -157,17 +157,17 @@ public: void setParcelId(const LLUUID& id) { mParcelId = id; } - LLUUID getParcelId() { return mParcelId; } + LLUUID getParcelId() const { return mParcelId; } void setSimName(const std::string& sim_name) { mSimName = sim_name; } - std::string getSimName() { return mSimName; } + std::string getSimName() const { return mSimName; } void setFromSearch(bool val) { mFromSearch = val; } - bool fromSearch() { return mFromSearch; } + bool fromSearch() const { return mFromSearch; } - bool getInfoLoaded() { return mInfoLoaded; } + bool getInfoLoaded() const { return mInfoLoaded; } void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; } @@ -175,9 +175,9 @@ public: void resetDirty() override; - bool isNew() { return mIsNew; } + bool isNew() const { return mIsNew; } - bool isNewWithErrors() { return mIsNewWithErrors; } + bool isNewWithErrors() const { return mIsNewWithErrors; } bool canClose(); @@ -191,10 +191,10 @@ public: bool getAutoRenew(); - S32 getPriceForListing() { return mPriceForListing; } + S32 getPriceForListing() const { return mPriceForListing; } void setEditMode(bool edit_mode); - bool getEditMode() {return mEditMode;} + bool getEditMode() const { return mEditMode; } static void setClickThrough( const LLUUID& classified_id, diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index fa99432603..6292cc7810 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -703,9 +703,10 @@ void LLScriptEdCore::sync() } } -bool LLScriptEdCore::hasChanged() +bool LLScriptEdCore::hasChanged() const { - if (!mEditor) return false; + if (!mEditor) + return false; return ((!mEditor->isPristine() || mEnableSave) && mHasScriptData); } diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 70ee1a4274..0bbe540207 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -143,7 +143,7 @@ public: void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;}; void setAssetID( const LLUUID& asset_id){ mAssetID = asset_id; }; - LLUUID getAssetID() { return mAssetID; } + LLUUID getAssetID() const { return mAssetID; } bool isFontSizeChecked(const LLSD &userdata); void onChangeFontSize(const LLSD &size_name); @@ -155,7 +155,7 @@ public: void onBtnDynamicHelp(); void onBtnUndoChanges(); - bool hasChanged(); + bool hasChanged() const; void selectFirstError(); @@ -211,7 +211,6 @@ class LLScriptEdContainer : public LLPreview public: LLScriptEdContainer(const LLSD& key); - LLScriptEdContainer(const LLSD& key, const bool live); bool handleKeyHere(KEY key, MASK mask); diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index f77d37f821..07e2c39379 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -256,7 +256,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box) glm::mat4 mv(get_current_modelview()); LLVector3 s = mViewerObject->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); mRadius = s.magVec(); - glm::mat4 scale = glm::scale(glm::make_vec3(s.mV)); + glm::mat4 scale = glm::scale(glm::make_vec3(LLVector4(s).mV)); if (mViewerObject->mDrawable != nullptr) { // object to agent space (no scale) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6e4a652989..83d6b57fa4 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -181,7 +181,6 @@ #include "llnamelistctrl.h" #include "llnamebox.h" #include "llnameeditor.h" -#include "llpostprocess.h" #include "llagentlanguage.h" #include "llwearable.h" #include "llinventorybridge.h" @@ -1292,10 +1291,6 @@ bool idle_startup() LLDrawable::initClass(); display_startup(); - // init the shader managers - LLPostProcess::initClass(); - display_startup(); - LLAvatarAppearance::initClass("avatar_lad.xml","avatar_skeleton.xml"); display_startup(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index cd35de12c6..1f4502323c 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -55,7 +55,6 @@ #include "llmemory.h" #include "llparcel.h" #include "llperfstats.h" -#include "llpostprocess.h" #include "llrender.h" #include "llscenemonitor.h" #include "llsdjson.h" diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index 673f51600d..2ec02f09fd 100644 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -27,8 +27,6 @@ #ifndef LL_LLVIEWERDISPLAY_H #define LL_LLVIEWERDISPLAY_H -class LLPostProcess; - void display_startup(); void display_cleanup(); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 8919e1f375..9d9961d51c 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -118,7 +118,6 @@ #include "llfloaterpay.h" #include "llfloaterperformance.h" #include "llfloaterperms.h" -#include "llfloaterpostprocess.h" #include "llfloaterpreference.h" #include "llfloaterpreferencesgraphicsadvanced.h" #include "llfloaterpreferenceviewadvanced.h" @@ -363,7 +362,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("emoji_picker", "floater_emoji_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiPicker>); LLFloaterReg::add("emoji_complete", "floater_emoji_complete.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEmojiComplete>); - LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostProcess>); LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentWater>); LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentSky>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index af719293e6..2d94b4da9f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -78,6 +78,7 @@ #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfloaterbuildoptions.h" +#include "fsyspath.h" #include "llavataractions.h" #include "lllandmarkactions.h" #include "llgroupmgr.h" @@ -90,6 +91,7 @@ #include "llinventorybridge.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llluamanager.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" #include "llpanelmaininventory.h" @@ -9354,17 +9356,6 @@ class LLWorldEnableEnvPreset : public view_listener_t } }; - -/// Post-Process callbacks -class LLWorldPostProcess : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - LLFloaterReg::showInstance("env_post_process"); - return true; - } -}; - class LLWorldCheckBanLines : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9472,6 +9463,18 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) mCostStr = std::to_string(upload_cost); } +void lua_run_script(const LLSD& userdata) +{ + std::string script_path = userdata.asString(); + if (script_path.empty()) + { + LL_WARNS() << "Script name is not specified" << LL_ENDL; + return; + } + + LLLUAmanager::runScriptFile(script_path); +} + void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) { static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml", @@ -9659,7 +9662,6 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldEnableEnvSettings(), "World.EnableEnvSettings"); view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset"); view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset"); - view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); view_listener_t::addMenu(new LLWorldCheckBanLines() , "World.CheckBanLines"); view_listener_t::addMenu(new LLWorldShowBanLines() , "World.ShowBanLines"); @@ -10074,4 +10076,6 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); + + registrar.add("Lua.RunScript", boost::bind(&lua_run_script, _2), cb_info::UNTRUSTED_BLOCK); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 41b2c4b44b..7741f1fbe7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2325,6 +2325,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega) setRotation(new_rot * mAngularVelocityRot); + if ((mFlags & FLAGS_SERVER_AUTOPILOT) && asAvatar() && asAvatar()->isSelf()) + { + gAgent.resetAxes(); + gAgent.rotate(new_rot); + gAgentCamera.resetView(); + } setChanged(ROTATED | SILHOUETTE); } @@ -5235,8 +5241,7 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) LLUUID mat_id = getRenderMaterialID(te); if (mat == nullptr && mat_id.notNull()) { - mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id); - llassert(mat == nullptr || dynamic_cast<LLFetchedGLTFMaterial*>(gGLTFMaterialList.getMaterial(mat_id)) != nullptr); + mat = gGLTFMaterialList.getMaterial(mat_id); if (mat->isFetching()) { // material is not loaded yet, rebuild draw info when the object finishes loading mat->onMaterialComplete([id=getID()] diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 2077cbdd08..019e870829 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -555,51 +555,52 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 inside_z = land.resolveHeightRegion(inside_x, inside_y); }; - auto split = [&](U32 lod, const LLVector3& start, F32 x, F32 y, F32 z, F32 part) + auto split = [&](U32 lod, const LLVector4a& start, F32 x, F32 y, F32 z, F32 part) { - 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[lod].emplace_back(new_x, new_y, new_z); + F32 new_x = start[VX] + (x - start[VX]) * part; + F32 new_y = start[VY] + (y - start[VY]) * part; + F32 new_z = start[VZ] + (z - start[VZ]) * part; + edge.pushVertex(lod, new_x, new_y, new_z, water_z); }; auto checkForSplit = [&](U32 lod) { - const std::vector<LLVector3>& vertices = edge.vertices[lod]; - const LLVector3& last_outside = vertices.back(); - F32 z0 = last_outside.mV[VZ]; + const std::vector<LLVector4a>& vertices = edge.verticesUnderWater[lod]; + const LLVector4a& last_outside = vertices.back(); + F32 z0 = last_outside[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 LLVector3& last_inside = vertices[vertices.size() - 2]; + 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); }; 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.vertices[lod].emplace_back(inside_x, inside_y, inside_z); + edge.pushVertex(lod, inside_x, inside_y, inside_z, water_z); } else { // Make the line thinner if heights differ too much - LLVector3 out(outside_x, outside_y, outside_z); - LLVector3 in(inside_x, inside_y, inside_z); LLVector3 dist(in - out); F32 coef = dist.length() / LINE_WIDTH; - edge.vertices[lod].emplace_back(out + dist / coef); + LLVector3 new_in(out + dist / coef); + edge.pushVertex(lod, new_in[VX], new_in[VY], new_in[VZ], water_z); } - edge.vertices[lod].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(lod, outside_x, outside_y, outside_z, water_z); }; // Point A simplified (first two vertices) pushTwoVertices(1); // Point A detailized (only one vertex) - edge.vertices[0].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); // Point B (two vertices) move(LINE_WIDTH); @@ -627,7 +628,23 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 pushTwoVertices(1); // Point G detailized (only one vertex) - edge.vertices[0].emplace_back(outside_x, outside_y, outside_z); + edge.pushVertex(0, outside_x, outside_y, outside_z, water_z); +} + +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()); + + 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()); + } } void LLViewerParcelOverlay::setDirty() @@ -707,6 +724,8 @@ 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. @@ -714,17 +733,22 @@ void LLViewerParcelOverlay::renderPropertyLines() cull_plane_point *= -2.f * PARCEL_GRID_STEP_METERS; cull_plane_point += camera_region; - bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build"); + bool render_hidden = !draw_underwater && + LLSelectMgr::sRenderHiddenSelections && + LLFloaterReg::instanceVisible("build"); constexpr F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; constexpr F32 PROPERTY_LINE_LOD0_DIST_SQUARED = PROPERTY_LINE_CLIP_DIST_SQUARED / 25.f; for (const Edge& edge : mEdges) { - const std::vector<LLVector3>& vertices0 = edge.vertices[0]; - LLVector3 center = (vertices0.front() + vertices0.back()) / 2; - F32 dist_squared = dist_vec_squared(center, camera_region); + const std::vector<LLVector4a>& 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); + F32 dist_squared = dist_vec_squared(center, camera_region); if (dist_squared > PROPERTY_LINE_CLIP_DIST_SQUARED) { continue; @@ -745,39 +769,27 @@ void LLViewerParcelOverlay::renderPropertyLines() gGL.color4ubv(edge.color.mV); - for (const LLVector3& vertex : edge.vertices[lod]) + if (draw_underwater) { - if (render_hidden || camera_z < water_z || vertex.mV[2] >= water_z) - { - gGL.vertex3fv(vertex.mV); - } - else - { - LLVector3 visible = vertex; - visible.mV[VZ] = water_z; - gGL.vertex3fv(visible.mV); - } + gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); } - - gGL.end(); - - if (render_hidden) + else { - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); + gGL.vertexBatchPreTransformed(edge.verticesAboveWater[lod]); - gGL.begin(LLRender::TRIANGLE_STRIP); + if (render_hidden) + { + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); - LLColor4U color = edge.color; - color.mV[VALPHA] /= 4; - gGL.color4ubv(color.mV); + LLColor4U color = edge.color; + color.mV[VALPHA] /= 4; + gGL.color4ubv(color.mV); - for (const LLVector3& vertex : edge.vertices[lod]) - { - gGL.vertex3fv(vertex.mV); + gGL.vertexBatchPreTransformed(edge.verticesUnderWater[lod]); } - - gGL.end(); } + + gGL.end(); } gGL.popMatrix(); diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 68900d16a6..7271c85701 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -116,7 +116,10 @@ private: struct Edge { - std::vector<LLVector3> vertices[2]; // 0 - detailized, 1 - simplified + void pushVertex(U32 lod, F32 x, F32 y, F32 z, F32 water_z); + // LOD: 0 - detailized, 1 - simplified + std::vector<LLVector4a> verticesAboveWater[2]; + std::vector<LLVector4a> verticesUnderWater[2]; LLColor4U color; }; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 58b541b19b..a8fe221d98 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -37,7 +37,6 @@ #include "llrender.h" #include "llenvironment.h" #include "llerrorcontrol.h" -#include "llatmosphere.h" #include "llworld.h" #include "llsky.h" @@ -731,14 +730,6 @@ std::string LLViewerShaderMgr::loadBasicShaders() S32 sum_lights_class = 3; -#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); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index ff86684499..9d4c072909 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -781,7 +781,7 @@ void send_viewer_stats(bool include_preferences) LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL; // <ND> Do those lines even do anything sane in regard of debug logging? - LL_DEBUGS("LogViewerStatsPacket"); + LL_DEBUGS("LogViewerStatsPacket") << " "; std::string filename("viewer_stats_packet.xml"); llofstream of(filename.c_str()); LLSDSerialize::toPrettyXML(body,of); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9e1cb84bd1..0f9c65893d 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2495,6 +2495,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() } } + if (need_readback) + { + readbackRawImage(); + } + // // Run raw/auxiliary data callbacks // @@ -2744,10 +2749,22 @@ void LLViewerFetchedTexture::readbackRawImage() if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && (mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() )) { + if (mRawImage.isNull()) + { + sRawCount++; + } mRawImage = new LLImageRaw(); if (!mGLTexturep->readBackRaw(-1, mRawImage, false)) { mRawImage = nullptr; + mIsRawImageValid = false; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; + sRawCount--; + } + else + { + mIsRawImageValid = true; + mRawDiscardLevel = mGLTexturep->getDiscardLevel(); } } } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index fa696d2d87..7a4cf7c85c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -195,7 +195,6 @@ #include "llviewerjoystick.h" #include "llviewermenufile.h" // LLFilePickerReplyThread #include "llviewernetwork.h" -#include "llpostprocess.h" #include "llfloaterimnearbychat.h" #include "llagentui.h" #include "llwearablelist.h" @@ -5762,11 +5761,6 @@ void LLViewerWindow::stopGL() gBox.cleanupGL(); - if(gPostProcess) - { - gPostProcess->invalidate(); - } - gTextureList.destroyGL(); stop_glerror(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8178dade8b..c8a4e4c205 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1940,10 +1940,10 @@ bool LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& if (linesegment_sphere(LLVector3(glm::value_ptr(p1)), LLVector3(glm::value_ptr(p2)), LLVector3(0,0,0), 1.f, position, norm)) { - glm::vec3 res_pos(glm::make_vec3(position.mV)); + glm::vec3 res_pos(glm::make_vec3(LLVector4(position).mV)); res_pos = mul_mat4_vec3(mat, res_pos); - glm::vec3 res_norm(glm::make_vec3(norm.mV)); + glm::vec3 res_norm(glm::make_vec3(LLVector4(norm).mV)); res_norm = glm::normalize(res_norm); res_norm = glm::mat3(norm_mat) * res_norm; diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 07e2b118d3..0f956d8350 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -218,7 +218,7 @@ LLXMLRPCTransaction::Impl::Impl mCertStore = gSavedSettings.getString("CertStore"); httpOpts->setSSLVerifyPeer(vefifySSLCert); - httpOpts->setSSLVerifyHost(vefifySSLCert ? 2 : 0); + httpOpts->setSSLVerifyHost(vefifySSLCert); // LLRefCounted starts with a 1 ref, so don't add a ref in the smart pointer httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders()); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3a811f893e..84f026699e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -35,6 +35,7 @@ #include "llviewercontrol.h" #include "llfasttimer.h" #include "llfontgl.h" +#include "llfontvertexbuffer.h" #include "llnamevalue.h" #include "llpointer.h" #include "llprimitive.h" @@ -138,7 +139,6 @@ bool gShiftFrame = false; //cached settings bool LLPipeline::WindLightUseAtmosShaders; bool LLPipeline::RenderDeferred; -F32 LLPipeline::RenderDeferredSunWash; U32 LLPipeline::RenderFSAAType; U32 LLPipeline::RenderResolutionDivisor; bool LLPipeline::RenderUIBuffer; @@ -179,7 +179,6 @@ F32 LLPipeline::CameraFocusTransitionTime; F32 LLPipeline::CameraFNumber; F32 LLPipeline::CameraFocalLength; F32 LLPipeline::CameraFieldOfView; -F32 LLPipeline::RenderShadowNoise; F32 LLPipeline::RenderShadowBlurSize; F32 LLPipeline::RenderSSAOScale; U32 LLPipeline::RenderSSAOMaxScale; @@ -192,8 +191,6 @@ F32 LLPipeline::RenderShadowBias; F32 LLPipeline::RenderSpotShadowOffset; F32 LLPipeline::RenderSpotShadowBias; LLDrawable* LLPipeline::RenderSpotLight = nullptr; -F32 LLPipeline::RenderEdgeDepthCutoff; -F32 LLPipeline::RenderEdgeNormCutoff; LLVector3 LLPipeline::RenderShadowGaussian; F32 LLPipeline::RenderShadowBlurDistFactor; bool LLPipeline::RenderDeferredAtmospheric; @@ -276,7 +273,6 @@ static LLTrace::BlockTimerStatHandle FTM_STATESORT_DRAWABLE("Sort Drawables"); static LLStaticHashedString sTint("tint"); static LLStaticHashedString sAmbiance("ambiance"); static LLStaticHashedString sAlphaScale("alpha_scale"); -static LLStaticHashedString sNormMat("norm_mat"); static LLStaticHashedString sOffset("offset"); static LLStaticHashedString sScreenRes("screenRes"); static LLStaticHashedString sDelta("delta"); @@ -501,7 +497,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("UseOcclusion"); // DEPRECATED -- connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders"); // DEPRECATED -- connectRefreshCachedSettingsSafe("RenderDeferred"); - connectRefreshCachedSettingsSafe("RenderDeferredSunWash"); connectRefreshCachedSettingsSafe("RenderFSAAType"); connectRefreshCachedSettingsSafe("RenderResolutionDivisor"); connectRefreshCachedSettingsSafe("RenderUIBuffer"); @@ -542,7 +537,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("CameraFNumber"); connectRefreshCachedSettingsSafe("CameraFocalLength"); connectRefreshCachedSettingsSafe("CameraFieldOfView"); - connectRefreshCachedSettingsSafe("RenderShadowNoise"); connectRefreshCachedSettingsSafe("RenderShadowBlurSize"); connectRefreshCachedSettingsSafe("RenderSSAOScale"); connectRefreshCachedSettingsSafe("RenderSSAOMaxScale"); @@ -554,8 +548,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderShadowBias"); connectRefreshCachedSettingsSafe("RenderSpotShadowOffset"); connectRefreshCachedSettingsSafe("RenderSpotShadowBias"); - connectRefreshCachedSettingsSafe("RenderEdgeDepthCutoff"); - connectRefreshCachedSettingsSafe("RenderEdgeNormCutoff"); connectRefreshCachedSettingsSafe("RenderShadowGaussian"); connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor"); connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric"); @@ -576,10 +568,20 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionGlossySamples"); connectRefreshCachedSettingsSafe("RenderBufferVisualization"); + connectRefreshCachedSettingsSafe("RenderBufferClearOnInvalidate"); connectRefreshCachedSettingsSafe("RenderMirrors"); connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate"); connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier"); - gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit"); + + LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl("CollectFontVertexBuffers"); + if (cntrl_ptr.notNull()) + { + cntrl_ptr->getCommitSignal()->connect([](LLControlVariable* control, const LLSD& value, const LLSD& previous) + { + LLFontVertexBuffer::enableBufferCollection(control->getValue().asBoolean()); + }); + } } LLPipeline::~LLPipeline() @@ -1009,7 +1011,6 @@ void LLPipeline::refreshCachedSettings() WindLightUseAtmosShaders = true; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); RenderDeferred = true; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); - RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); RenderFSAAType = gSavedSettings.getU32("RenderFSAAType"); RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); @@ -1050,7 +1051,6 @@ void LLPipeline::refreshCachedSettings() CameraFNumber = gSavedSettings.getF32("CameraFNumber"); CameraFocalLength = gSavedSettings.getF32("CameraFocalLength"); CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView"); - RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise"); RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize"); RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale"); RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale"); @@ -1062,8 +1062,6 @@ void LLPipeline::refreshCachedSettings() RenderShadowBias = gSavedSettings.getF32("RenderShadowBias"); RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset"); RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias"); - RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff"); - RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff"); RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian"); RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric"); @@ -1084,6 +1082,7 @@ void LLPipeline::refreshCachedSettings() RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier"); RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples"); RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization"); + LLRenderTarget::sClearOnInvalidate = gSavedSettings.getBOOL("RenderBufferClearOnInvalidate"); RenderMirrors = gSavedSettings.getBOOL("RenderMirrors"); RenderHeroProbeUpdateRate = gSavedSettings.getS32("RenderHeroProbeUpdateRate"); RenderHeroProbeConservativeUpdateMultiplier = gSavedSettings.getS32("RenderHeroProbeConservativeUpdateMultiplier"); @@ -1096,6 +1095,8 @@ void LLPipeline::refreshCachedSettings() LLVOAvatar::sMaxNonImpostors = 1; LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors); } + + LLFontVertexBuffer::enableBufferCollection(gSavedSettings.getBOOL("CollectFontVertexBuffers")); } void LLPipeline::releaseGLBuffers() @@ -3473,8 +3474,6 @@ void LLPipeline::postSort(LLCamera &camera) assertInitialized(); - LL_PUSH_CALLSTACKS(); - if (!gCubeSnapshot) { // rebuild drawable geometry @@ -3490,15 +3489,12 @@ void LLPipeline::postSort(LLCamera &camera) group->rebuildGeom(); } } - LL_PUSH_CALLSTACKS(); // rebuild groups sCull->assertDrawMapsEmpty(); rebuildPriorityGroups(); } - LL_PUSH_CALLSTACKS(); - // build render map for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { @@ -3619,7 +3615,6 @@ void LLPipeline::postSort(LLCamera &camera) std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder()); } - LL_PUSH_CALLSTACKS(); // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender && !gCubeSnapshot) { @@ -3672,7 +3667,7 @@ void LLPipeline::postSort(LLCamera &camera) forAllVisibleDrawables(renderSoundHighlights); } } - LL_PUSH_CALLSTACKS(); + // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot) { @@ -3733,7 +3728,6 @@ void LLPipeline::postSort(LLCamera &camera) LLVertexBuffer::flushBuffers(); // LLSpatialGroup::sNoDelete = false; - LL_PUSH_CALLSTACKS(); } @@ -7147,7 +7141,7 @@ void LLPipeline::copyScreenSpaceReflections(LLRenderTarget* src, LLRenderTarget* LLRenderTarget& depth_src = mRT->deferredScreen; dst->bindTarget(); - dst->clear(); + dst->invalidate(); gCopyDepthProgram.bind(); S32 diff_map = gCopyDepthProgram.getTextureChannel(LLShaderMgr::DIFFUSE_MAP); @@ -7276,7 +7270,7 @@ void LLPipeline::generateGlow(LLRenderTarget* src) void LLPipeline::applyCAS(LLRenderTarget* src, LLRenderTarget* dst) { static LLCachedControl<F32> cas_sharpness(gSavedSettings, "RenderCASSharpness", 0.4f); - if (cas_sharpness == 0.0f) + if (cas_sharpness == 0.0f || !gCASProgram.isComplete()) { gPipeline.copyRenderTarget(src, dst); return; @@ -7334,7 +7328,7 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst) // bake out texture2D with RGBL for FXAA shader mFXAAMap.bindTarget(); - mFXAAMap.clear(GL_COLOR_BUFFER_BIT); + mFXAAMap.invalidate(GL_COLOR_BUFFER_BIT); shader = &gGlowCombineFXAAProgram; shader->bind(); @@ -7433,6 +7427,7 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) LLGLSLShader& edge_shader = gSMAAEdgeDetectProgram[fsaa_quality]; dest.bindTarget(); + // SMAA utilizes discard, so the background color matters dest.clear(GL_COLOR_BUFFER_BIT); edge_shader.bind(); @@ -7476,7 +7471,7 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) LLGLSLShader& blend_weights_shader = gSMAABlendWeightsProgram[fsaa_quality]; dest.bindTarget(); - dest.clear(GL_COLOR_BUFFER_BIT); + dest.invalidate(GL_COLOR_BUFFER_BIT); blend_weights_shader.bind(); blend_weights_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); @@ -7552,7 +7547,7 @@ void LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst) LLGLSLShader& blend_shader = gSMAANeighborhoodBlendProgram[fsaa_quality]; bound_target->bindTarget(); - bound_target->clear(GL_COLOR_BUFFER_BIT); + bound_target->invalidate(GL_COLOR_BUFFER_BIT); blend_shader.bind(); blend_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); @@ -7749,8 +7744,6 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true); - gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); - gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f); gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant); @@ -8062,32 +8055,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); } - channel = shader.enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&mExposureMap); - } - - if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1) - { - shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0], - (F32) gGLViewport[1], - (F32) gGLViewport[2], - (F32) gGLViewport[3]); - } - if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX)) { shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, glm::value_ptr(mReflectionModelView)); } - channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); - if (channel > -1) - { - gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - bindLightFunc(shader); stop_glerror(); @@ -8151,34 +8123,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ bindReflectionProbes(shader); - if (gAtmosphere) - { - // bind precomputed textures necessary for calculating sun and sky luminance - channel = shader.enableTexture(LLShaderMgr::TRANSMITTANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - } - - channel = shader.enableTexture(LLShaderMgr::SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::ILLUMINANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - } - } - /*if (gCubeSnapshot) { // we only really care about the first two values, but the shader needs increasing separation between clip planes shader.uniform4f(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1.f, 64.f, 128.f, 256.f); @@ -8187,26 +8131,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { shader.uniform4fv(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1, mSunClipPlanes.mV); } - shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash); - shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise); - shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize); - - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale); - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, (GLfloat)RenderSSAOMaxScale); - - F32 ssao_factor = RenderSSAOFactor; - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor); - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0f/ssao_factor); - - LLVector3 ssao_effect = RenderSSAOEffect; - F32 matrix_diag = (ssao_effect[0] + 2.0f*ssao_effect[1])/3.0f; - F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0f; - // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by - // value factor, and scales remainder by saturation factor - F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag, - matrix_nondiag, matrix_diag, matrix_nondiag, - matrix_nondiag, matrix_nondiag, matrix_diag}; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat); //F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); F32 shadow_bias_error = RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2])/3000.f; @@ -8223,20 +8147,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, mTransformedMoonDir.mV); shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, (GLfloat)mRT->shadow[0].getWidth(), (GLfloat)mRT->shadow[0].getHeight()); shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, (GLfloat)mSpotShadow[0].getWidth(), (GLfloat)mSpotShadow[0].getHeight()); - shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); - shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLDeltaModelView)); shader.uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLInverseDeltaModelView)); shader.uniform1i(LLShaderMgr::CUBE_SNAPSHOT, gCubeSnapshot ? 1 : 0); - if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) - { - glm::mat4 norm_mat = glm::transpose(glm::inverse(get_current_modelview())); - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, glm::value_ptr(norm_mat)); - } - // auto adjust legacy sun color if needed static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true); static LLCachedControl<F32> auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f); @@ -8330,20 +8246,37 @@ void LLPipeline::renderDeferredLighting() LLGLSLShader& sun_shader = gCubeSnapshot ? gDeferredSunProbeProgram : gDeferredSunProgram; bindDeferredShader(sun_shader, deferred_light_target); mScreenTriangleVB->setBuffer(); - glClearColor(1, 1, 1, 1); - deferred_light_target->clear(GL_COLOR_BUFFER_BIT); - glClearColor(0, 0, 0, 0); + deferred_light_target->invalidate(GL_COLOR_BUFFER_BIT); sun_shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)deferred_light_target->getWidth(), (GLfloat)deferred_light_target->getHeight()); + if (RenderDeferredSSAO && !gCubeSnapshot) + { + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale); + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, (GLfloat)RenderSSAOMaxScale); + + F32 ssao_factor = RenderSSAOFactor; + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor); + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0f / ssao_factor); + + S32 channel = sun_shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); + if (channel > -1) + { + gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + } + } + { LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); } + sun_shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); + unbindDeferredShader(sun_shader); } deferred_light_target->flush(); @@ -8356,9 +8289,7 @@ void LLPipeline::renderDeferredLighting() LL_PROFILE_GPU_ZONE("soften shadow"); // blur lightmap screen_target->bindTarget(); - glClearColor(1, 1, 1, 1); - screen_target->clear(GL_COLOR_BUFFER_BIT); - glClearColor(0, 0, 0, 0); + screen_target->invalidate(GL_COLOR_BUFFER_BIT); bindDeferredShader(gDeferredBlurLightProgram); @@ -8410,7 +8341,6 @@ void LLPipeline::renderDeferredLighting() deferred_light_target->flush(); unbindDeferredShader(gDeferredBlurLightProgram); } - screen_target->bindTarget(); // clear color buffer here - zeroing alpha (glow) is important or it will accumulate against sky glClearColor(0, 0, 0, 0); @@ -8438,6 +8368,19 @@ void LLPipeline::renderDeferredLighting() soften_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + if(RenderDeferredSSAO) + { + LLVector3 ssao_effect = RenderSSAOEffect; + F32 matrix_diag = (ssao_effect[0] + 2.0f * ssao_effect[1]) / 3.0f; + F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1]) / 3.0f; + // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by + // value factor, and scales remainder by saturation factor + F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag, + matrix_nondiag, matrix_diag, matrix_nondiag, + matrix_nondiag, matrix_nondiag, matrix_diag }; + soften_shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat); + } + { LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); @@ -8670,13 +8613,12 @@ void LLPipeline::renderDeferredLighting() LLDrawable* drawablep = *iter; LLVOVolume* volume = drawablep->getVOVolume(); LLVector3 center = drawablep->getPositionAgent(); - F32* c = center.mV; F32 light_size_final = volume->getLightRadius() * 1.5f; F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF); sVisibleLightCount++; - glm::vec3 tc(glm::make_vec3(c)); + glm::vec3 tc(glm::make_vec3(LLVector4(center).mV)); tc = mul_mat4_vec3(mat, tc); setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); @@ -9060,7 +9002,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, deferred_light_target->getUsage()); shader.disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM); for (U32 i = 0; i < 4; i++) { @@ -9078,7 +9019,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) } } - shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); if (!LLPipeline::sReflectionProbesEnabled) @@ -10218,7 +10158,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) view[j] = glm::inverse(view[j]); //llassert(origin.isFinite()); - glm::vec3 origin_agent(glm::make_vec3(origin.mV)); + glm::vec3 origin_agent(glm::make_vec3(LLVector4(origin).mV)); //translate view to origin origin_agent = mul_mat4_vec3(view[j], origin_agent); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 5c9b95ef4a..c69ca863e7 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -1000,7 +1000,6 @@ public: //cached settings static bool WindLightUseAtmosShaders; static bool RenderDeferred; - static F32 RenderDeferredSunWash; static U32 RenderFSAAType; static U32 RenderResolutionDivisor; static bool RenderUIBuffer; @@ -1042,7 +1041,6 @@ public: static F32 CameraFNumber; static F32 CameraFocalLength; static F32 CameraFieldOfView; - static F32 RenderShadowNoise; static F32 RenderShadowBlurSize; static F32 RenderSSAOScale; static U32 RenderSSAOMaxScale; @@ -1055,8 +1053,6 @@ public: static F32 RenderSpotShadowOffset; static F32 RenderSpotShadowBias; static LLDrawable* RenderSpotLight; - static F32 RenderEdgeDepthCutoff; - static F32 RenderEdgeNormCutoff; static LLVector3 RenderShadowGaussian; static F32 RenderShadowBlurDistFactor; static bool RenderDeferredAtmospheric; diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua index 5cee998fcd..4a1132fe7e 100644 --- a/indra/newview/scripts/lua/require/LLAgent.lua +++ b/indra/newview/scripts/lua/require/LLAgent.lua @@ -80,4 +80,64 @@ function LLAgent.teleport(...) return leap.request('LLTeleportHandler', args).message end +-- Call with no arguments to sit on the ground. +-- Otherwise specify "obj_uuid" to sit on, +-- or region "position" {x, y, z} where to find closest object to sit on. +-- For example: LLAgent.requestSit{position=LLAgent.getRegionPosition()} +-- Your avatar should be close enough to the object you want to sit on +function LLAgent.requestSit(...) + local args = mapargs('obj_uuid,position', ...) + args.op = 'requestSit' + return leap.request('LLAgent', args) +end + +function LLAgent.requestStand() + leap.send('LLAgent', {op = 'requestStand'}) +end + +-- *************************************************************************** +-- Autopilot +-- *************************************************************************** +LLAgent.autoPilotPump = "LLAutopilot" + +-- Start the autopilot to move to "target_global" location using specified parameters +-- LLAgent.startAutoPilot{ target_global array of target global {x, y, z} position +-- [, allow_flying] allow flying during autopilot [default: true] +-- [, stop_distance] target maximum distance from target [default: autopilot guess] +-- [, behavior_name] name of the autopilot behavior [default: (script name)] +-- [, target_rotation] array of [x, y, z, w] quaternion values [default: no target] +-- [, rotation_threshold] target maximum angle from target facing rotation [default: 0.03 radians] +-- an event with "success" flag is sent to "LLAutopilot" event pump, when auto pilot is terminated +function LLAgent.startAutoPilot(...) + local args = mapargs('target_global,allow_flying,stop_distance,behavior_name,target_rotation,rotation_threshold', ...) + args.op = 'startAutoPilot' + leap.send('LLAgent', args) +end + +-- Update target location for currently running autopilot +function LLAgent.setAutoPilotTarget(target_global) + leap.send('LLAgent', {op = 'setAutoPilotTarget', target_global=target_global}) +end + +-- Start the autopilot to move to the specified target location +-- either "leader_id" (uuid of target) or "avatar_name" (avatar full name: use just first name for 'Resident') should be specified +-- "allow_flying" [default: true], "stop_distance" [default: autopilot guess] +function LLAgent.startFollowPilot(...) + local args = mapargs('leader_id,avatar_name,allow_flying,stop_distance', ...) + args.op = 'startFollowPilot' + return leap.request('LLAgent', args) +end + +-- Stop the autopilot system: "user_cancel" indicates whether or not to act as though user canceled autopilot [default: false] +function LLAgent.stopAutoPilot(...) + local args = mapargs('user_cancel', ...) + args.op = 'stopAutoPilot' + leap.send('LLAgent', args) +end + +-- Get information about current state of the autopilot +function LLAgent.getAutoPilot() + return leap.request('LLAgent', {op = 'getAutoPilot'}) +end + return LLAgent diff --git a/indra/newview/scripts/lua/require/LLChat.lua b/indra/newview/scripts/lua/require/LLChat.lua index bc0fc86d22..3ac3bab746 100644 --- a/indra/newview/scripts/lua/require/LLChat.lua +++ b/indra/newview/scripts/lua/require/LLChat.lua @@ -5,6 +5,7 @@ local LLChat = {} -- *************************************************************************** -- Nearby chat -- *************************************************************************** +LLChat.nearbyChatPump = "LLNearbyChat" -- 0 is public nearby channel, other channels are used to communicate with LSL scripts function LLChat.sendNearby(msg, channel) diff --git a/indra/newview/scripts/lua/require/LLChatListener.lua b/indra/newview/scripts/lua/require/LLListener.lua index 82b28966ce..b05f966097 100644 --- a/indra/newview/scripts/lua/require/LLChatListener.lua +++ b/indra/newview/scripts/lua/require/LLListener.lua @@ -3,29 +3,31 @@ local inspect = require 'inspect' local leap = require 'leap' local util = require 'util' -local LLChatListener = {} +local LLListener = {} local waitfor = {} local listener_name = {} -function LLChatListener:new() +function LLListener:new(pump_name) local obj = setmetatable({}, self) self.__index = self - obj.name = 'Chat_listener' + obj.name = 'Listener:' .. pump_name + obj._pump = pump_name return obj end -util.classctor(LLChatListener) +util.classctor(LLListener) -function LLChatListener:handleMessages(event_data) +function LLListener:handleMessages(event_data) print(inspect(event_data)) return true end -function LLChatListener:start() +function LLListener:start() + _pump = self._pump waitfor = leap.WaitFor(-1, self.name) function waitfor:filter(pump, data) - if pump == "LLNearbyChat" then + if _pump == pump then return data end end @@ -37,12 +39,12 @@ function LLChatListener:start() end end) - listener_name = leap.request(leap.cmdpump(), {op='listen', source='LLNearbyChat', listener="ChatListener", tweak=true}).listener + listener_name = leap.request(leap.cmdpump(), {op='listen', source=_pump, listener="LLListener", tweak=true}).listener end -function LLChatListener:stop() - leap.send(leap.cmdpump(), {op='stoplistening', source='LLNearbyChat', listener=listener_name}) +function LLListener:stop() + leap.send(leap.cmdpump(), {op='stoplistening', source=self._pump, listener=listener_name}) waitfor:close() end -return LLChatListener +return LLListener diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua index 4a4d40bee5..0f269b54e6 100644 --- a/indra/newview/scripts/lua/test_LLChatListener.lua +++ b/indra/newview/scripts/lua/test_LLChatListener.lua @@ -1,4 +1,4 @@ -local LLChatListener = require 'LLChatListener' +local LLListener = require 'LLListener' local LLChat = require 'LLChat' local UI = require 'UI' @@ -22,7 +22,7 @@ function openOrEcho(message) end end -local listener = LLChatListener() +local listener = LLListener(LLChat.nearbyChatPump) function listener:handleMessages(event_data) if string.find(event_data.message, '[LUA]') then diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua new file mode 100644 index 0000000000..09c85c140a --- /dev/null +++ b/indra/newview/scripts/lua/test_autopilot.lua @@ -0,0 +1,22 @@ +local LLAgent = require 'LLAgent' +local LLListener = require 'LLListener' + +local pos = LLAgent.getGlobalPosition() +pos[1]+=10 -- delta x +pos[2]+=5 -- delta y +LLAgent.requestStand() +LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1} + +local listener = LLListener(LLAgent.autoPilotPump) + +function listener:handleMessages(event_data) + if event_data.success then + print('Destination is reached') + LLAgent.requestSit() + else + print('Failed to reach destination') + end + return false +end + +listener:start() diff --git a/indra/newview/scripts/lua/test_top_menu.lua b/indra/newview/scripts/lua/test_top_menu.lua index 780a384c92..f877cda5eb 100644 --- a/indra/newview/scripts/lua/test_top_menu.lua +++ b/indra/newview/scripts/lua/test_top_menu.lua @@ -18,17 +18,35 @@ UI.addMenuItem{name="lua_scripts",label="Scripts", --Add menu separator to the 'LUA Menu' under added menu items UI.addMenuSeparator{parent_menu=MENU_NAME} ---Add two new menu branch 'About...' to the 'LUA Menu' -local BRANCH_NAME = "about_branch" -UI.addMenuBranch{name="about_branch",label="About...",parent_menu=MENU_NAME} +--Add 'Demo scripts...' branch to the 'LUA Menu' +local DEMO_BRANCH = "demo_scripts" +UI.addMenuBranch{name=DEMO_BRANCH,label="Demo scripts...",parent_menu=MENU_NAME} + +--Add menu items to the 'Demo scripts...' branch, which will invoke specified script on click +UI.addMenuItem{name="speedometer",label="Speedometer", + param="test_luafloater_speedometer.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +UI.addMenuItem{name="gesture_list",label="Gesture list", + param="test_luafloater_gesture_list.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +--Add one more menu separator +UI.addMenuSeparator{parent_menu=MENU_NAME} + +--Add 'About...' branch to the 'LUA Menu' +local ABOUT_BRANCH = "about_branch" +UI.addMenuBranch{name=ABOUT_BRANCH,label="About...",parent_menu=MENU_NAME} --Add two new menu items to the 'About...' branch UI.addMenuItem{name="lua_info",label="Lua...", param="https://www.lua.org/about.html", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} UI.addMenuItem{name="lua_info",label="Luau...", param="https://luau-lang.org/", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml index 4a4b7269dc..283a7b2a43 100644 --- a/indra/newview/skins/default/xui/da/notifications.xml +++ b/indra/newview/skins/default/xui/da/notifications.xml @@ -1574,6 +1574,10 @@ Klik på Acceptér for at deltage eller Afvis for at afvise invitationen. Klik p Den aktive stemme "morph" er udløbet og din normale stemme opsætning er genaktiveret. [[URL] Click here] for at forny dit abbonnement. </notification> + <notification name="VoiceEffectsWillExpire"> + En eller flere af dine stemme "morphs" vil udløbe om mindre end [INTERVAL] dage. +[[URL] Click here] for at forny dit abbonnement. + </notification> <notification name="VoiceEffectsNew"> Nye stemme "morphs" er tilgængelige! </notification> diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index 76bebedeec..6ad71e0ad1 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -2466,6 +2466,10 @@ Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice [[URL] Klicken Sie hier], um Ihr Abo zu erneuern. Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice-Morphing-Vorteil zu nutzen.</notification> + <notification name="VoiceEffectsWillExpire">Ein oder mehrere Ihrer Voice-Morph-Abos laufen in weniger als [INTERVAL] Tagen ab. +[[URL] Klicken Sie hier], um Ihr Abo zu erneuern. + +Wenn Sie Premium-Mitglied sind, [[PREMIUM_URL] klicken Sie hier], um Ihren Voice-Morphing-Vorteil zu nutzen.</notification> <notification name="VoiceEffectsNew">Neue Voice-Morph-Effekte sind erhältlich!</notification> <notification name="Cannot enter parcel: not a group member">Nur Mitglieder einer bestimmten Gruppe dürfen diesen Bereich betreten.</notification> <notification name="Cannot enter parcel: banned">Zugang zur Parzelle verweigert. Sie wurden verbannt.</notification> diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml index a9e7626dc5..486d604e9f 100644 --- a/indra/newview/skins/default/xui/de/strings.xml +++ b/indra/newview/skins/default/xui/de/strings.xml @@ -31,7 +31,6 @@ Sichtweite: [DRAW_DISTANCE] m Bandbreite: [NET_BANDWITH] kbit/s LOD-Faktor: [LOD_FACTOR] Darstellungsqualität: [RENDER_QUALITY] -Erweitertes Beleuchtungsmodell: [GPU_SHADERS] Texturspeicher: [TEXTURE_MEMORY] MB</string> <string name="AboutOSXHiDPI">HiDPI-Anzeigemodus: [HIDPI]</string> <string name="AboutLibs">J2C-Decoderversion: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/en/floater_post_process.xml b/indra/newview/skins/default/xui/en/floater_post_process.xml deleted file mode 100644 index 37339f79c8..0000000000 --- a/indra/newview/skins/default/xui/en/floater_post_process.xml +++ /dev/null @@ -1,426 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater - legacy_header_height="18" - height="400" - layout="topleft" - name="Post-Process Floater" - help_topic="post_process_floater" - title="POST-PROCESS SETTINGS" - width="400"> - <tab_container - follows="left|top" - height="400" - layout="topleft" - left="0" - name="Post-Process Tabs" - tab_position="top" - top="0" - width="400"> - <panel - border="true" - follows="left|top|right|bottom" - height="400" - label="Color Filter" - layout="topleft" - left="1" - mouse_opaque="false" - help_topic="post_process_color_filter_tab" - name="wmiColorFilterPanel" - top="0" - width="398"> - <check_box - control_name="wmiColorFilterToggle" - height="16" - label="Enable" - layout="topleft" - left="14" - name="wmiColorFilterToggle" - top="4" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiColorFilterBrightnessText" - top_pad="4" - width="355"> - Brightness - </text> - <slider - control_name="wmiColorFilterBrightness" - decimal_digits="2" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - layout="topleft" - left_delta="4" - max_val="4" - name="wmiColorFilterBrightness" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiColorFilterSaturationText" - top_pad="4" - width="355"> - Saturation - </text> - <slider - control_name="wmiColorFilterSaturation" - decimal_digits="2" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - layout="topleft" - left_delta="4" - max_val="2" - min_val="-1" - name="wmiColorFilterSaturation" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiColorFilterContrastText" - top_pad="4" - width="355"> - Contrast - </text> - <slider - control_name="wmiColorFilterContrast" - decimal_digits="2" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - layout="topleft" - left_delta="4" - max_val="4" - name="wmiColorFilterContrast" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiColorFilterBaseText" - top_pad="4" - width="355"> - Contrast Base Color - </text> - <slider - control_name="wmiColorFilterBaseR" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - label="R" - layout="topleft" - left_delta="4" - name="wmiColorFilterBaseR" - top_pad="20" - width="200" /> - <slider - control_name="wmiColorFilterBaseG" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - label="G" - layout="topleft" - left_delta="0" - name="wmiColorFilterBaseG" - top_pad="10" - width="200" /> - <slider - control_name="wmiColorFilterBaseB" - follows="left" - height="10" - increment="0.01" - initial_value="1.0" - label="B" - layout="topleft" - left_delta="0" - name="wmiColorFilterBaseB" - top_pad="10" - width="200" /> - <slider - control_name="wmiColorFilterBaseI" - follows="left" - height="10" - increment="0.01" - initial_value="0.5" - label="I" - layout="topleft" - left_delta="0" - name="wmiColorFilterBaseI" - top_pad="10" - width="200" /> - </panel> - <panel - border="true" - follows="left|top|right|bottom" - height="400" - label="Night Vision" - layout="topleft" - left_delta="0" - mouse_opaque="false" - help_topic="post_process_night_vision_tab" - name="wmiNightVisionPanel" - top_delta="-236" - width="398"> - <check_box - control_name="wmiNightVisionToggle" - height="16" - label="Enable" - layout="topleft" - left="14" - name="wmiNightVisionToggle" - top="4" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiNightVisionBrightMultText" - top_pad="5" - width="355"> - Light Amplification Multiple - </text> - <slider - control_name="wmiNightVisionBrightMult" - follows="left" - height="10" - increment="0.01" - initial_value="3.0" - layout="topleft" - left_delta="4" - max_val="10" - min_val="1" - name="wmiNightVisionBrightMult" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiNightVisionNoiseSizeText" - top_pad="4" - width="355"> - Noise Size - </text> - <slider - control_name="wmiNightVisionNoiseSize" - follows="left" - height="10" - initial_value="1" - layout="topleft" - left_delta="4" - max_val="100" - min_val="1" - name="wmiNightVisionNoiseSize" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiNightVisionNoiseStrengthText" - top_pad="4" - width="355"> - Noise Strength - </text> - <slider - control_name="wmiNightVisionNoiseStrength" - follows="left" - height="10" - increment="0.01" - initial_value="0.3" - layout="topleft" - left_delta="4" - name="wmiNightVisionNoiseStrength" - top_pad="20" - width="200" /> - </panel> - <panel - border="true" - follows="left|top|right|bottom" - height="400" - label="Bloom" - layout="topleft" - left_delta="0" - help_topic="post_process_bloom_tab" - name="wmiBloomPanel" - top_delta="-236" - width="398"> - <check_box - control_name="wmiBloomToggle" - height="16" - label="Enable" - layout="topleft" - left="14" - name="wmiBloomToggle" - top="4" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiBloomExtractText" - top_pad="5" - width="355"> - Luminosity Extraction - </text> - <slider - control_name="wmiBloomExtract" - follows="left" - height="10" - increment="0.01" - initial_value="0.9" - layout="topleft" - left_delta="4" - name="wmiBloomExtract" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiBloomSizeText" - top_pad="4" - width="355"> - Bloom Size - </text> - <slider - control_name="wmiBloomSize" - follows="left" - height="10" - increment="0.01" - initial_value="3.0" - layout="topleft" - left_delta="4" - max_val="20" - name="wmiBloomSize" - top_pad="20" - width="200" /> - <text - type="string" - length="1" - follows="left|top|right" - font="SansSerif" - height="16" - layout="topleft" - left_delta="-4" - name="wmiBloomStrengthText" - top_pad="4" - width="355"> - Bloom Strength - </text> - <slider - control_name="wmiBloomStrength" - follows="left" - height="10" - increment="0.01" - initial_value="1.2" - layout="topleft" - left_delta="4" - max_val="10" - name="wmiBloomStrength" - top_pad="20" - width="200" /> - </panel> - <panel - border="true" - follows="left|top|right|bottom" - height="400" - label="Extras" - layout="topleft" - left_delta="0" - mouse_opaque="false" - help_topic="post_process_extras_tab" - name="Extras" - top_delta="-236" - width="398"> - <button - height="20" - label="LoadEffect" - label_selected="LoadEffect" - layout="topleft" - left="15" - name="PPLoadEffect" - top="13" - width="100" /> - <button - height="20" - label="SaveEffect" - label_selected="SaveEffect" - layout="topleft" - left_delta="0" - name="PPSaveEffect" - top_pad="7" - width="100" /> - <combo_box - height="18" - layout="topleft" - left_delta="120" - name="PPEffectsCombo" - top="15" - width="150" /> - <line_editor - border_style="line" - border_thickness="1" - follows="left|right|bottom" - font="SansSerif" - height="20" - label="Effect Name" - layout="topleft" - left_delta="0" - max_length_bytes="40" - name="PPEffectNameEditor" - tab_group="1" - top_pad="22" - width="150" /> - </panel> - </tab_container> -</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 43cdf30ba0..ec2dffb5e5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -465,24 +465,6 @@ <menu_item_check.on_click function="World.AlwaysRun" /> </menu_item_check> - <menu_item_check - label="Hear Media and Sound from Avatar" - name="Hear Media and Sound from Avatar"> - <menu_item_check.on_check - control="MediaSoundsEarLocation" /> - <menu_item_check.on_click - function="Agent.ToggleHearMediaSoundFromAvatar" /> - </menu_item_check> - <menu_item_check - label="Hear Voice from Avatar" - name="Hear Voice from Avatar"> - <menu_item_check.on_check - control="VoiceEarLocation" /> - <menu_item_check.on_click - function="Agent.ToggleHearVoiceFromAvatar" /> - <menu_item_call.on_enable - control="EnableVoiceChat" /> - </menu_item_check> <menu_item_separator/> <menu_item_check label="Gestures..." @@ -580,6 +562,25 @@ </menu_item_check> <menu_item_separator/> <menu_item_check + label="Hear Media and Sound from Avatar" + name="Hear Media and Sound from Avatar"> + <menu_item_check.on_check + control="MediaSoundsEarLocation" /> + <menu_item_check.on_click + function="Agent.ToggleHearMediaSoundFromAvatar" /> + </menu_item_check> + <menu_item_check + label="Hear Voice from Avatar" + name="Hear Voice from Avatar"> + <menu_item_check.on_check + control="VoiceEarLocation" /> + <menu_item_check.on_click + function="Agent.ToggleHearVoiceFromAvatar" /> + <menu_item_call.on_enable + control="EnableVoiceChat" /> + </menu_item_check> + <menu_item_separator/> + <menu_item_check label="Gestures..." name="Gestures" shortcut="control|G"> @@ -3466,6 +3467,16 @@ function="World.EnvPreset" function="Advanced.HandleAttachedLightParticles" parameter="RenderAttachedParticles" /> </menu_item_check> + <menu_item_check + label="Collect Font Vertex Buffers" + name="Collect Font Vertex Buffers"> + <menu_item_check.on_check + function="CheckControl" + parameter="CollectFontVertexBuffers" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="CollectFontVertexBuffers" /> + </menu_item_check> <menu_item_separator /> <menu_item_check label="Enable Shader Cache" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 848d9aca7c..071f6458c5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7556,7 +7556,7 @@ Message from [NAME]: type="notify"> <unique/> This land has damage enabled. -You can be hurt here. If you die, you will be teleported to your home location. +You can be hurt here. If you die, you might be teleported to your home location or to the spawn point. </notification> <notification @@ -8860,6 +8860,25 @@ If you are a Premium Member, [[PREMIUM_URL] click here] to receive your voice mo <notification icon="notify.tga" + name="VoiceEffectsWillExpire" + sound="UISndAlert" + persist="true" + type="notify"> + <unique/> +One or more of your Voice Morphs will expire in less than [INTERVAL] days. +[[URL] Click here] to renew your subscription. + +If you are a Premium Member, [[PREMIUM_URL] click here] to receive your voice morphing perk. + <tag>fail</tag> + <tag>voice</tag> + <usetemplate + ignoretext="Warn me about voice morph expiring" + name="okignore" + yestext="OK"/> + </notification> + + <notification + icon="notify.tga" name="VoiceEffectsNew" sound="UISndAlert" persist="true" diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml index bf55e2c443..739391b965 100644 --- a/indra/newview/skins/default/xui/es/notifications.xml +++ b/indra/newview/skins/default/xui/es/notifications.xml @@ -2452,6 +2452,10 @@ Si eres un miembro Premium [[PREMIUM_URL] pulsa aquí] para recibir tu beneficio [[URL] Pulsa aquí] para renovar la suscripción. Si eres un miembro Premium [[PREMIUM_URL] pulsa aquí] para recibir tu beneficio de transformación de voz.</notification> + <notification name="VoiceEffectsWillExpire">Una o más de tus transformaciones de voz caducarán en menos de [INTERVAL] días. +[[URL] Pulsa aquí] para renovar la suscripción + +Si eres un miembro Premium [[PREMIUM_URL] pulsa aquí] para recibir tu beneficio de transformación de voz.</notification> <notification name="VoiceEffectsNew">Están disponibles nuevas transformaciones de voz.</notification> <notification name="Cannot enter parcel: not a group member">Sólo los miembros de un grupo determinado pueden visitar esta zona.</notification> <notification name="Cannot enter parcel: banned">No puedes entrar en esta parcela, se te ha prohibido el acceso.</notification> diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml index cd8e7687ae..9fcfc2daa5 100644 --- a/indra/newview/skins/default/xui/es/strings.xml +++ b/indra/newview/skins/default/xui/es/strings.xml @@ -29,7 +29,6 @@ Distancia de dibujo: [DRAW_DISTANCE]m Ancho de banda: [NET_BANDWITH]kbit/s Factor LOD: [LOD_FACTOR] Calidad de renderización: [RENDER_QUALITY] -Modelo de iluminación avanzado: [GPU_SHADERS] Memoria de textura: [TEXTURE_MEMORY]MB</string> <string name="AboutOSXHiDPI">Modo de visualización HiDPi: [HIDPI]</string> <string name="AboutLibs">Versión de descodificador J2C: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 17cf18633f..587c88faad 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -2451,6 +2451,10 @@ Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votr [[URL] Cliquez ici] pour renouveler votre abonnement. Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votre effet de voix.</notification> + <notification name="VoiceEffectsWillExpire">Au moins l'un de vos effets de voix expirera dans moins de [INTERVAL] jours. +[[URL] Cliquez ici] pour renouveler votre abonnement. + +Si vous êtes un membre Premium, [[PREMIUM_URL] cliquez ici] pour recevoir votre effet de voix.</notification> <notification name="VoiceEffectsNew">De nouveaux effets de voix sont disponibles !</notification> <notification name="Cannot enter parcel: not a group member">Seuls les membres d'un certain groupe peuvent visiter cette zone.</notification> <notification name="Cannot enter parcel: banned">Vous ne pouvez pas pénétrer sur ce terrain car l'accès vous y est interdit.</notification> diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml index 0a3fbeb603..55f6209fe1 100644 --- a/indra/newview/skins/default/xui/fr/strings.xml +++ b/indra/newview/skins/default/xui/fr/strings.xml @@ -32,7 +32,6 @@ Distance de dessin : [DRAW_DISTANCE]m Bande passante : [NET_BANDWITH] kbit/s Facteur LOD (niveau de détail) : [LOD_FACTOR] Qualité de rendu : [RENDER_QUALITY] -Modèle d’éclairage avancé : [GPU_SHADERS] Mémoire textures : [TEXTURE_MEMORY] Mo</string> <string name="AboutOSXHiDPI">Mode d'affichage HiDPI : [HIDPI]</string> <string name="AboutLibs">J2C Decoder Version: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml index 1c40e7304a..f79cc1515b 100644 --- a/indra/newview/skins/default/xui/it/notifications.xml +++ b/indra/newview/skins/default/xui/it/notifications.xml @@ -2454,6 +2454,10 @@ Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la [[URL] Fai clic qui] per rinnovare l'abbonamento. Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la manipolazione vocale.</notification> + <notification name="VoiceEffectsWillExpire">Almeno una delle tue manipolazioni vocali scadrà tra meno di [INTERVAL] giorni. +[[URL] Fai clic qui] per rinnovare l'abbonamento. + +Se sei un membro Premium, [[PREMIUM_URL] fai clic qui] per ricevere in regalo la manipolazione vocale.</notification> <notification name="VoiceEffectsNew">Sono disponibili nuove manipolazioni vocali.</notification> <notification name="Cannot enter parcel: not a group member">Soltanto i membri di un determinato gruppo possono visitare questa zona.</notification> <notification name="Cannot enter parcel: banned">Non puoi entrare nel terreno, sei stato bloccato.</notification> diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml index 178bb90ca6..f77ab1062a 100644 --- a/indra/newview/skins/default/xui/it/strings.xml +++ b/indra/newview/skins/default/xui/it/strings.xml @@ -31,7 +31,6 @@ Distanza visualizzazione: [DRAW_DISTANCE]m Larghezza banda: [NET_BANDWITH]kbit/s Fattore livello di dettaglio: [LOD_FACTOR] Qualità di rendering: [RENDER_QUALITY] -Modello illuminazione avanzato: [GPU_SHADERS] Memoria texture: [TEXTURE_MEMORY]MB</string> <string name="AboutOSXHiDPI">Modalità display HiDPI: [HIDPI]</string> <string name="AboutLibs">J2C Versione decoder: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml index fbd56e118c..123e95df04 100644 --- a/indra/newview/skins/default/xui/ja/notifications.xml +++ b/indra/newview/skins/default/xui/ja/notifications.xml @@ -4663,6 +4663,17 @@ Webページにリンクすると、他人がこの場所に簡単にアクセ voice </tag> </notification> + <notification name="VoiceEffectsWillExpire">ボイスモーフィング効果の1つ、または複数の有効期限が[INTERVAL]日以内に終了します。 +期限を延長・更新するには[[URL] ここ]をクリックしてください。 + +プレミアム会員の方は、[[PREMIUM_URL] ここ]をクリックしてボイスモーフィング特典をお受け取りください。 + <tag> + fail + </tag> + <tag> + voice + </tag> + </notification> <notification name="VoiceEffectsNew">新しいボイスモーフィング効果が登場! <tag> voice diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml index 17c11bc75f..e668c6cc20 100644 --- a/indra/newview/skins/default/xui/pl/notifications.xml +++ b/indra/newview/skins/default/xui/pl/notifications.xml @@ -3118,6 +3118,11 @@ Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrz [[URL] Kliknij tutaj] aby odnowić subskrypcję. Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrzymać swój perk Przekształceń Głosu. </notification> + <notification name="VoiceEffectsWillExpire"> + Jedno lub więcej z Twoich Przekształceń Głosu wygaśnie za mniej niż [INTERVAL] dni. +[[URL] Kliknij tutaj] aby odnowić subskrypcję. +Jeśli jesteś użytkownikiem premium, to [[PREMIUM_URL] kliknij tutaj] aby otrzymać swój perk Przekształceń Głosu. + </notification> <notification name="VoiceEffectsNew"> Nowe Przekształcenia Głosu są dostępne! </notification> diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml index 26ec6cc9dc..8032443020 100644 --- a/indra/newview/skins/default/xui/pl/strings.xml +++ b/indra/newview/skins/default/xui/pl/strings.xml @@ -49,7 +49,6 @@ Pole widzenia (Draw Distance): [DRAW_DISTANCE]m Przepustowość (Bandwidth): [NET_BANDWITH]kbit/s Mnożnik poziomu detali (LOD Factor): [LOD_FACTOR] Jakość wyświetlania (Render quality): [RENDER_QUALITY] -Zaawansowane oświetlenie (Advanced Lighting Model): [GPU_SHADERS] Pamięć tekstur (Texture memory): [TEXTURE_MEMORY]MB Pamięć podręczna dysku (Disk cache): [DISK_CACHE_INFO] </string> diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml index 0390239669..a3220bca54 100644 --- a/indra/newview/skins/default/xui/pt/notifications.xml +++ b/indra/newview/skins/default/xui/pt/notifications.xml @@ -2441,6 +2441,10 @@ Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu ap [[URL] Clique aqui] para renovar o serviço. Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu app de distorção de voz.</notification> + <notification name="VoiceEffectsWillExpire">Uma ou mais das suas distorções de voz tem vencimento em menos de [INTERVAL] dias. +[[URL] Clique aqui] para renovar o serviço. + +Se você é um Membro Premium, [[PREMIUM_URL] clique aqui] para receber o seu app de distorção de voz.</notification> <notification name="VoiceEffectsNew">Novas Distorções de voz!</notification> <notification name="Cannot enter parcel: not a group member">Só membros de um grupo podem acessar esta área.</notification> <notification name="Cannot enter parcel: banned">Você não pode entrar nessa terra, você foi banido.</notification> diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml index 6db5da2e89..4ce1e6d2ec 100644 --- a/indra/newview/skins/default/xui/pt/strings.xml +++ b/indra/newview/skins/default/xui/pt/strings.xml @@ -29,7 +29,6 @@ Estabelecer a distância: [DRAW_DISTANCE]m Largura da banda: [NET_BANDWITH]kbit/s LOD fator: [LOD_FACTOR] Qualidade de renderização: [RENDER_QUALITY] -Modelo avançado de luzes: [GPU_SHADERS] Memória de textura: [TEXTURE_MEMORY]MB</string> <string name="AboutOSXHiDPI">HiDPI modo de exibição: [HIDPI]</string> <string name="AboutLibs">Versão do J2C Decoder: [J2C_VERSION] diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml index bde18edc23..e75fd1fd82 100644 --- a/indra/newview/skins/default/xui/ru/notifications.xml +++ b/indra/newview/skins/default/xui/ru/notifications.xml @@ -3232,6 +3232,12 @@ Если вы - владелец премиум-аккаунта, [[PREMIUM_URL] щелкните здесь], чтобы получить право на анимационное изменение голоса. </notification> + <notification name="VoiceEffectsWillExpire"> + Срок действия одного или нескольких ваших типов анимационного изменения голоса истекает через [INTERVAL] дней или раньше. +[[URL] Щелкните здесь], чтобы обновить подписку. + +Если вы - владелец премиум-аккаунта, [[PREMIUM_URL] щелкните здесь], чтобы получить право на анимационное изменение голоса. + </notification> <notification name="VoiceEffectsNew"> Появились новые типы изменения голоса! </notification> diff --git a/indra/newview/skins/default/xui/ru/strings.xml b/indra/newview/skins/default/xui/ru/strings.xml index 61d836a2d1..0079309ba2 100644 --- a/indra/newview/skins/default/xui/ru/strings.xml +++ b/indra/newview/skins/default/xui/ru/strings.xml @@ -69,7 +69,6 @@ SLURL: <nolink>[SLURL]</nolink> Ширина канала: [NET_BANDWITH] кбит/с Коэффициент детализации: [LOD_FACTOR] Качество визуализации: [RENDER_QUALITY] -Расширенная модель освещения: [GPU_SHADERS] Память текстур: [TEXTURE_MEMORY] МБ </string> <string name="AboutOSXHiDPI"> diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml index 30aa0c0342..17d2969d19 100644 --- a/indra/newview/skins/default/xui/tr/notifications.xml +++ b/indra/newview/skins/default/xui/tr/notifications.xml @@ -3232,6 +3232,12 @@ Aboneliğinizi yenilemek için [[URL] buraya tıklayın]. Özel Üye iseniz, ses dönüştürme özelliğini almak için [[PREMIUM_URL] buraya tıklayın]. </notification> + <notification name="VoiceEffectsWillExpire"> + Ses Dönüşümlerinizden birinin ya da daha fazlasının süresi [INTERVAL] günden daha az bir zamanda dolacak. +Aboneliğinizi yenilemek için [[URL] buraya tıklayın]. + +Özel Üye iseniz, ses dönüştürme özelliğini almak için [[PREMIUM_URL] buraya tıklayın]. + </notification> <notification name="VoiceEffectsNew"> Yeni Ses Şekilleri kullanılabilir! </notification> diff --git a/indra/newview/skins/default/xui/tr/strings.xml b/indra/newview/skins/default/xui/tr/strings.xml index e709a4c5d6..fa2fd3a802 100644 --- a/indra/newview/skins/default/xui/tr/strings.xml +++ b/indra/newview/skins/default/xui/tr/strings.xml @@ -69,7 +69,6 @@ UI Ölçeklendirme: [UI_SCALE] Bant genişliği: [NET_BANDWITH]kbit/s LOD faktörü: [LOD_FACTOR] İşleme kalitesi: [RENDER_QUALITY] -Gelişmiş Aydınlatma Modeli: [GPU_SHADERS] Doku belleği: [TEXTURE_MEMORY]MB </string> <string name="AboutOSXHiDPI"> diff --git a/indra/newview/skins/default/xui/zh/notifications.xml b/indra/newview/skins/default/xui/zh/notifications.xml index 3ebea7dc27..4d0f1cb85b 100644 --- a/indra/newview/skins/default/xui/zh/notifications.xml +++ b/indra/newview/skins/default/xui/zh/notifications.xml @@ -3216,6 +3216,12 @@ SHA1 指紋:[MD5_DIGEST] 付費用戶請[[PREMIUM_URL] 點按這裡]領取免費變聲工具。 </notification> + <notification name="VoiceEffectsWillExpire"> + 至少一個你訂用的變聲效果將在 [INTERVAL] 天後到期。 +[[URL] 點按這裡]繼續訂用。 + +付費用戶請[[PREMIUM_URL] 點按這裡]領取免費變聲工具。 + </notification> <notification name="VoiceEffectsNew"> 新的變聲效果上市了! </notification> |