diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 6585e73db2..765fa76d5e 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -1,6 +1,7 @@
name: Build
on:
+ workflow_dispatch:
pull_request:
push:
branches: ["main", "release/*", "project/*"]
diff --git a/autobuild.xml b/autobuild.xml
index 643588388f..ebc0eb4ec6 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -185,54 +185,6 @@
version
5.1.0
- ndPhysicsStub
-
glod
copyright
@@ -1758,41 +1710,19 @@
platforms
- darwin64
+ common
archive
hash
- f290b000b31f9e36f2489946cbc99f5e
+ bc41438b10ac6474cf5560465a3662a64f9e65a81342e4c33f18f6694581c7ee28c9ee6f091c36e80a0b1e10c68205be71eb5f8e40fef115d2c744fc2bbfcb43
+ hash_algorithm
+ blake2b
url
- https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/59995/563653/llphysicsextensions_stub-1.0.542456-darwin64-542456.tar.bz2
+ https://github.com/AlchemyViewer/llphysicsextensions_stub/releases/download/v1.0-cb4900e/llphysicsextensions_stub-1.0-common-17836965684.tar.zst
name
- darwin64
-
- linux64
-
- archive
-
- hash
- 711f4ec769e4b5f59ba25ee43c11bcbc
- url
- https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/4724/14846/llphysicsextensions_stub-1.0.504712-linux64-504712.tar.bz2
-
- name
- linux64
-
- windows64
-
- archive
-
- hash
- 2e5f1f7046a49d8b0bc295aa878116bc
- url
- http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60043/564063/llphysicsextensions_stub-1.0.542456-windows-542456.tar.bz2
-
- name
- windows64
+ common
license
@@ -1802,7 +1732,7 @@
copyright
Copyright (c) 2010, Linden Research, Inc.
version
- 1.0.542456
+ 1.0
name
llphysicsextensions_stub
@@ -3279,6 +3209,38 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
description
Discord Social SDK
+ vhacd
+
+ platforms
+
+ common
+
+ archive
+
+ hash
+ 140d8fc952a10edb5f2d72ab405336019ef32cadfa64f0cfce76c9de4bc6268cbc87cc8cd89d3417fb78b531d441701afc8d016bafe4bd275df2707f7daf1387
+ hash_algorithm
+ blake2b
+ url
+ https://github.com/AlchemyViewer/3p-vhacd/releases/download/v4.1.0-r2/vhacd-4.1.0-r2-common-18166921729.tar.zst
+
+ name
+ common
+
+
+ license
+ BSD
+ license_file
+ LICENSES/vhacd.txt
+ copyright
+ Copyright (c) 2011, Khaled Mamou
+ version
+ 4.1.0-r2
+ name
+ vhacd
+ description
+ Voxelized Hierarchical Approximate Convex Decomposition
+
package_description
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index a6796d600c..e1ae904f47 100644
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -96,6 +96,7 @@ else (FS_PF_USER_AGENT)
message(STATUS "Compiling with standard Primfeed user-agent")
endif (FS_PF_USER_AGENT)
#
+
# [AVX Optimization]
option(USE_AVX_OPTIMIZATION "AVX optimization support" OFF)
option(USE_AVX2_OPTIMIZATION "AVX2 optimization support" OFF)
@@ -127,6 +128,9 @@ endif (USE_TRACY)
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
add_subdirectory(${LIBS_OPEN_PREFIX}llappearance)
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
+if (NOT HAVOK AND NOT HAVOK_TPV)
+ add_subdirectory(${LIBS_OPEN_PREFIX}llconvexdecomposition)
+endif ()
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
add_subdirectory(${LIBS_OPEN_PREFIX}llcorehttp)
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 1bf093f2bc..1a44d8695f 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -64,6 +64,7 @@ set(cmake_SOURCE_FILES
UI.cmake
UnixInstall.cmake
Variables.cmake
+ VHACD.cmake
ViewerMiscLibs.cmake
VisualLeakDetector.cmake
LibVLCPlugin.cmake
diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake
index 1988caaef0..626748c291 100644
--- a/indra/cmake/LLPhysicsExtensions.cmake
+++ b/indra/cmake/LLPhysicsExtensions.cmake
@@ -3,7 +3,7 @@ include(Prebuilt)
# There are three possible solutions to provide the llphysicsextensions:
# - The full source package, selected by -DHAVOK:BOOL=ON
-# - The stub source package, selected by -DHAVOK:BOOL=OFF
+# - The stub source package, selected by -DHAVOK:BOOL=OFF
# - The prebuilt package available to those with sublicenses, selected by -DHAVOK_TPV:BOOL=ON
if (INSTALL_PROPRIETARY)
@@ -23,32 +23,28 @@ if (HAVOK)
use_prebuilt_binary(llphysicsextensions_source)
set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions)
+ target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
elseif (HAVOK_TPV)
use_prebuilt_binary(llphysicsextensions_tpv)
- target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensions_tpv)
- # include paths for LLs version and ours are different.
- target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
- #
-
- # havok lib get installed to packages/lib
- link_directories( ${LIBS_PREBUILT_DIR}/lib )
- #
-
+ if(WINDOWS)
+ target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib)
+ else()
+ target_link_libraries( llphysicsextensions_impl INTERFACE ${ARCH_PREBUILT_DIRS}/libllphysicsextensions_tpv.a)
+ endif()
+ target_compile_definitions( llphysicsextensions_impl INTERFACE LL_HAVOK=1 )
else (HAVOK)
- use_prebuilt_binary( ndPhysicsStub )
-
-# Don't set this variable, there is no need to build any stub source if using ndPhysicsStub
-# set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
-#
-
- target_link_libraries( llphysicsextensions_impl INTERFACE nd_hacdConvexDecomposition hacd nd_Pathing )
-
- # include paths for LLs version and ours are different.
- target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/ )
- #
+ use_prebuilt_binary(llphysicsextensions_stub)
+ set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
+ target_link_libraries( llphysicsextensions_impl INTERFACE llphysicsextensionsstub)
+ # Hotfix pathing lib header and add missing BOOL typedef
+ file(READ ${LIBS_PREBUILT_DIR}/include/llphysicsextensions/llpathinglib.h PATHINGLIB_HEADER_CONTENTS)
+ string(FIND "${PATHINGLIB_HEADER_CONTENTS}" "typedef int BOOL;" BOOL_TYPEDEF_POS)
+ if (${BOOL_TYPEDEF_POS} EQUAL -1)
+ string(REPLACE "typedef int bool32;" "typedef int bool32;\ntypedef int BOOL;" PATHINGLIB_HEADER_CONTENTS "${PATHINGLIB_HEADER_CONTENTS}")
+ file(WRITE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions/llpathinglib.h "${PATHINGLIB_HEADER_CONTENTS}")
+ endif()
+ #
endif (HAVOK)
-# include paths for LLs version and ours are different.
-#target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
-#
\ No newline at end of file
+target_include_directories( llphysicsextensions_impl INTERFACE ${LIBS_PREBUILT_DIR}/include/llphysicsextensions)
diff --git a/indra/cmake/VHACD.cmake b/indra/cmake/VHACD.cmake
new file mode 100644
index 0000000000..9f37f32b2d
--- /dev/null
+++ b/indra/cmake/VHACD.cmake
@@ -0,0 +1,9 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+add_library(ll::vhacd INTERFACE IMPORTED)
+
+use_system_binary(vhacd)
+use_prebuilt_binary(vhacd)
+
+target_include_directories(ll::vhacd SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/vhacd/)
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 033d1438d5..8788ff652d 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -200,11 +200,11 @@ set(USE_PRECOMPILED_HEADERS ON CACHE BOOL "Enable use of precompiled header dire
# When using Havok, we have to turn OpenSim support off
if (HAVOK_TPV)
if (OPENSIM)
- message("compiling with Havok libraries, disabling OpenSim support")
+ message(STATUS "Compiling with Havok libraries - disabling OpenSim support")
endif (OPENSIM)
if (LINUX)
- message("compiling with Havok libraries is not supported on Linux - switching to HACD")
+ message(STATUS "Compiling with Havok libraries is not supported on Linux - switching to VHACD")
set(HAVOK_TPV OFF)
endif (LINUX)
diff --git a/indra/llconvexdecomposition/CMakeLists.txt b/indra/llconvexdecomposition/CMakeLists.txt
new file mode 100644
index 0000000000..7dae884db8
--- /dev/null
+++ b/indra/llconvexdecomposition/CMakeLists.txt
@@ -0,0 +1,39 @@
+# -*- cmake -*-
+
+project(llconvexdecomposition)
+
+include(00-Common)
+include(LLCommon)
+include(LLMath)
+include(VHACD)
+
+set(llconvexdecomposition_SOURCE_FILES
+ llconvexdecomposition.cpp
+ llconvexdecompositionvhacd.cpp
+ )
+
+set(llconvexdecomposition_HEADER_FILES
+ CMakeLists.txt
+ llconvexdecomposition.h
+ llconvexdecompositionvhacd.h
+ )
+
+set_source_files_properties(${llconvexdecomposition_HEADER_FILES}
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+
+list(APPEND llconvexdecomposition_SOURCE_FILES ${llconvexdecomposition_HEADER_FILES})
+
+add_library (llconvexdecomposition ${llconvexdecomposition_SOURCE_FILES})
+target_include_directories(llconvexdecomposition INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+
+target_link_libraries(llconvexdecomposition
+ llcommon
+ llmath
+ ll::vhacd)
+
+if(WINDOWS)
+ target_compile_options(llconvexdecomposition PRIVATE /bigobj)
+endif()
+
+# Add tests
+
diff --git a/indra/llconvexdecomposition/llconvexdecomposition.cpp b/indra/llconvexdecomposition/llconvexdecomposition.cpp
new file mode 100644
index 0000000000..7b9d775c53
--- /dev/null
+++ b/indra/llconvexdecomposition/llconvexdecomposition.cpp
@@ -0,0 +1,83 @@
+/**
+* @file llconvexdecomposition.cpp
+* @author falcon@lindenlab.com
+* @brief Inner implementation of LLConvexDecomposition interface
+*
+* $LicenseInfo:firstyear=2011&license=lgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, 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 "llconvexdecompositionvhacd.h"
+#include "llconvexdecomposition.h"
+
+bool LLConvexDecomposition::s_isInitialized = false;
+
+// static
+bool LLConvexDecomposition::isFunctional()
+{
+ return LLConvexDecompositionVHACD::isFunctional();
+}
+
+// static
+LLConvexDecomposition* LLConvexDecomposition::getInstance()
+{
+ if ( !s_isInitialized )
+ {
+ return nullptr;
+ }
+ else
+ {
+ return LLConvexDecompositionVHACD::getInstance();
+ }
+}
+
+// static
+LLCDResult LLConvexDecomposition::initSystem()
+{
+ LLCDResult result = LLConvexDecompositionVHACD::initSystem();
+ if ( result == LLCD_OK )
+ {
+ s_isInitialized = true;
+ }
+ return result;
+}
+
+// static
+LLCDResult LLConvexDecomposition::initThread()
+{
+ return LLConvexDecompositionVHACD::initThread();
+}
+
+// static
+LLCDResult LLConvexDecomposition::quitThread()
+{
+ return LLConvexDecompositionVHACD::quitThread();
+}
+
+// static
+LLCDResult LLConvexDecomposition::quitSystem()
+{
+ return LLConvexDecompositionVHACD::quitSystem();
+}
+
+
diff --git a/indra/llconvexdecomposition/llconvexdecomposition.h b/indra/llconvexdecomposition/llconvexdecomposition.h
new file mode 100644
index 0000000000..8008bc6e12
--- /dev/null
+++ b/indra/llconvexdecomposition/llconvexdecomposition.h
@@ -0,0 +1,231 @@
+/**
+ * @file llconvexdecomposition.cpp
+ * @brief LLConvexDecomposition interface definition
+ *
+ * $LicenseInfo:firstyear=2011&license=lgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, 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_CONVEX_DECOMPOSITION
+#define LL_CONVEX_DECOMPOSITION
+
+typedef int bool32;
+
+#if defined(_WIN32) || defined(_WIN64)
+#define LLCD_CALL __cdecl
+#else
+#define LLCD_CALL
+#endif
+
+struct LLCDParam
+{
+ enum LLCDParamType
+ {
+ LLCD_INVALID = 0,
+ LLCD_INTEGER,
+ LLCD_FLOAT,
+ LLCD_BOOLEAN,
+ LLCD_ENUM
+ };
+
+ struct LLCDEnumItem
+ {
+ const char* mName;
+ int mValue;
+ };
+
+ union LLCDValue
+ {
+ float mFloat;
+ int mIntOrEnumValue;
+ bool32 mBool;
+ };
+
+ union LLCDParamDetails
+ {
+ struct {
+ LLCDValue mLow;
+ LLCDValue mHigh;
+ LLCDValue mDelta;
+ } mRange;
+
+ struct {
+ int mNumEnums;
+ LLCDEnumItem* mEnumsArray;
+ } mEnumValues;
+ };
+
+ const char* mName;
+ const char* mDescription;
+ LLCDParamType mType;
+ LLCDParamDetails mDetails;
+ LLCDValue mDefault;
+ int mStage;
+
+ // WARNING: Only the LLConvexDecomposition implementation
+ // should change this value
+ int mReserved;
+};
+
+struct LLCDStageData
+{
+ const char* mName;
+ const char* mDescription;
+ bool32 mSupportsCallback;
+};
+
+struct LLCDMeshData
+{
+ enum IndexType
+ {
+ INT_16,
+ INT_32
+ };
+
+ const float* mVertexBase;
+ int mVertexStrideBytes;
+ int mNumVertices;
+ const void* mIndexBase;
+ IndexType mIndexType;
+ int mIndexStrideBytes;
+ int mNumTriangles;
+};
+
+struct LLCDHull
+{
+ const float* mVertexBase;
+ int mVertexStrideBytes;
+ int mNumVertices;
+};
+
+enum LLCDResult
+{
+ LLCD_OK = 0,
+ LLCD_UNKOWN_ERROR,
+ LLCD_NULL_PTR,
+ LLCD_INVALID_STAGE,
+ LLCD_UNKNOWN_PARAM,
+ LLCD_BAD_VALUE,
+ LLCD_REQUEST_OUT_OF_RANGE,
+ LLCD_INVALID_MESH_DATA,
+ LLCD_INVALID_HULL_DATA,
+ LLCD_STAGE_NOT_READY,
+ LLCD_INVALID_THREAD,
+ LLCD_NOT_IMPLEMENTED
+};
+
+// This callback will receive a string describing the current subtask being performed
+// as well as a pair of numbers indicating progress. (The values should not be interpreted
+// as a completion percentage as 'current' may be greater than 'final'.)
+// If the callback returns zero, the decomposition will be terminated
+typedef int (LLCD_CALL *llcdCallbackFunc)(const char* description, int current_progress, int final_progress);
+
+class LLConvexDecomposition
+{
+public:
+ // Obtain a pointer to the actual implementation
+ static LLConvexDecomposition* getInstance();
+
+ /// @returns false if this is the stub
+ static bool isFunctional();
+
+ static LLCDResult initSystem();
+ static LLCDResult initThread();
+ static LLCDResult quitThread();
+ static LLCDResult quitSystem();
+
+ // Generate a decomposition object handle
+ virtual void genDecomposition(int& decomp) = 0;
+ // Delete decomposition object handle
+ virtual void deleteDecomposition(int decomp) = 0;
+ // Bind given decomposition handle
+ // Commands operate on currently bound decomposition
+ virtual void bindDecomposition(int decomp) = 0;
+
+ // Sets *paramsOut to the address of the LLCDParam array and returns
+ // the number of parameters
+ virtual int getParameters(const LLCDParam** paramsOut) = 0;
+
+
+ // Sets *stagesOut to the address of the LLCDStageData array and returns
+ // the number of stages
+ virtual int getStages(const LLCDStageData** stagesOut) = 0;
+
+
+ // Set a parameter by name. Pass enum values as integers.
+ virtual LLCDResult setParam(const char* name, float val) = 0;
+ virtual LLCDResult setParam(const char* name, int val) = 0;
+ virtual LLCDResult setParam(const char* name, bool val) = 0;
+
+
+ // Set incoming mesh data. Data is copied to local buffers and will
+ // persist until the next setMeshData call
+ virtual LLCDResult setMeshData( const LLCDMeshData* data, bool vertex_based ) = 0;
+
+
+ // Register a callback to be called periodically during the specified stage
+ // See the typedef above for more information
+ virtual LLCDResult registerCallback( int stage, llcdCallbackFunc callback ) = 0;
+
+
+ // Execute the specified decomposition stage
+ virtual LLCDResult executeStage(int stage) = 0;
+ virtual LLCDResult buildSingleHull() = 0 ;
+
+
+ // Gets the number of hulls generated by the specified decompositions stage
+ virtual int getNumHullsFromStage(int stage) = 0;
+
+
+ // Populates hullOut to reference the internal copy of the requested hull
+ // The data will persist only until the next executeStage call for that stage.
+ virtual LLCDResult getHullFromStage( int stage, int hull, LLCDHull* hullOut ) = 0;
+
+ virtual LLCDResult getSingleHull( LLCDHull* hullOut ) = 0 ;
+
+
+ // TODO: Implement lock of some kind to disallow this call if data not yet ready
+ // Populates the meshDataOut to reference the utility's copy of the mesh geometry
+ // for the hull and stage specified.
+ // You must copy this data if you want to continue using it after the next executeStage
+ // call
+ virtual LLCDResult getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut) = 0;
+
+
+ // Creates a mesh from hullIn and temporarily stores it internally in the utility.
+ // The mesh data persists only until the next call to getMeshFromHull
+ virtual LLCDResult getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut ) = 0;
+
+ // Takes meshIn, generates a single convex hull from it, converts that to a mesh
+ // stored internally, and populates meshOut to reference the internally stored data.
+ // The data is persistent only until the next call to generateSingleHullMeshFromMesh
+ virtual LLCDResult generateSingleHullMeshFromMesh( LLCDMeshData* meshIn, LLCDMeshData* meshOut) = 0;
+
+ //
+ /// Debug
+ virtual void loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut) = 0;
+
+private:
+ static bool s_isInitialized;
+};
+
+#endif //LL_CONVEX_DECOMPOSITION
+
diff --git a/indra/llconvexdecomposition/llconvexdecompositionvhacd.cpp b/indra/llconvexdecomposition/llconvexdecompositionvhacd.cpp
new file mode 100644
index 0000000000..78876f9f36
--- /dev/null
+++ b/indra/llconvexdecomposition/llconvexdecompositionvhacd.cpp
@@ -0,0 +1,492 @@
+/**
+* @file llconvexdecompositionvhacd.cpp
+* @author rye@alchemyviewer.org
+* @brief A VHACD based implementation of LLConvexDecomposition
+*
+* $LicenseInfo:firstyear=2025&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2025, 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 "llmath.h"
+#include "v3math.h"
+
+#include
+#include
+
+#define ENABLE_VHACD_IMPLEMENTATION 1
+#include "VHACD.h"
+
+#include "llconvexdecompositionvhacd.h"
+
+constexpr S32 MAX_HULLS = 256;
+constexpr S32 MAX_VERTICES_PER_HULL = 256;
+
+bool LLConvexDecompositionVHACD::isFunctional()
+{
+ return true;
+}
+
+LLConvexDecomposition* LLConvexDecompositionVHACD::getInstance()
+{
+ return LLSimpleton::getInstance();
+}
+
+LLCDResult LLConvexDecompositionVHACD::initSystem()
+{
+ createInstance();
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::initThread()
+{
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::quitThread()
+{
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::quitSystem()
+{
+ deleteSingleton();
+ return LLCD_OK;
+}
+
+LLConvexDecompositionVHACD::LLConvexDecompositionVHACD()
+{
+ //Create our vhacd instance and setup default parameters
+ mVHACD = VHACD::CreateVHACD();
+
+ mVHACDParameters.m_callback = &mVHACDCallback;
+ mVHACDParameters.m_logger = &mVHACDLogger;
+
+ mDecompStages[0].mName = "Analyze";
+ mDecompStages[0].mDescription = nullptr;
+
+ LLCDParam param;
+ param.mName = "Fill Mode";
+ param.mDescription = nullptr;
+ param.mType = LLCDParam::LLCD_ENUM;
+ param.mDetails.mEnumValues.mNumEnums = 3;
+
+ static LLCDParam::LLCDEnumItem fill_enums[3];
+ fill_enums[(size_t)VHACD::FillMode::FLOOD_FILL].mName = "Flood";
+ fill_enums[(size_t)VHACD::FillMode::FLOOD_FILL].mValue = (int)VHACD::FillMode::FLOOD_FILL;
+ fill_enums[(size_t)VHACD::FillMode::SURFACE_ONLY].mName = "Surface Only";
+ fill_enums[(size_t)VHACD::FillMode::SURFACE_ONLY].mValue = (int)VHACD::FillMode::SURFACE_ONLY;
+ fill_enums[(size_t)VHACD::FillMode::RAYCAST_FILL].mName = "Raycast";
+ fill_enums[(size_t)VHACD::FillMode::RAYCAST_FILL].mValue = (int)VHACD::FillMode::RAYCAST_FILL;
+
+ param.mDetails.mEnumValues.mEnumsArray = fill_enums;
+ param.mDefault.mIntOrEnumValue = (int)VHACD::FillMode::FLOOD_FILL;
+ param.mStage = 0;
+ param.mReserved = -1;
+ mDecompParams.push_back(param);
+
+ enum EVoxelQualityLevels
+ {
+ E_LOW_QUALITY = 0,
+ E_NORMAL_QUALITY,
+ E_HIGH_QUALITY,
+ E_VERY_HIGH_QUALITY,
+ E_ULTRA_QUALITY,
+ E_MAX_QUALITY,
+ E_NUM_QUALITY_LEVELS
+ };
+
+ param.mName = "Voxel Resolution";
+ param.mDescription = nullptr;
+ param.mType = LLCDParam::LLCD_ENUM;
+ param.mDetails.mEnumValues.mNumEnums = E_NUM_QUALITY_LEVELS;
+
+ static LLCDParam::LLCDEnumItem voxel_quality_enums[E_NUM_QUALITY_LEVELS];
+ voxel_quality_enums[E_LOW_QUALITY].mName = "Low";
+ voxel_quality_enums[E_LOW_QUALITY].mValue = 200000;
+ voxel_quality_enums[E_NORMAL_QUALITY].mName = "Normal";
+ voxel_quality_enums[E_NORMAL_QUALITY].mValue = 400000;
+ voxel_quality_enums[E_HIGH_QUALITY].mName = "High";
+ voxel_quality_enums[E_HIGH_QUALITY].mValue = 800000;
+ voxel_quality_enums[E_VERY_HIGH_QUALITY].mName = "Very High";
+ voxel_quality_enums[E_VERY_HIGH_QUALITY].mValue = 1200000;
+ voxel_quality_enums[E_ULTRA_QUALITY].mName = "Ultra";
+ voxel_quality_enums[E_ULTRA_QUALITY].mValue = 1600000;
+ voxel_quality_enums[E_MAX_QUALITY].mName = "Maximum";
+ voxel_quality_enums[E_MAX_QUALITY].mValue = 2000000;
+
+ param.mDetails.mEnumValues.mEnumsArray = voxel_quality_enums;
+ param.mDefault.mIntOrEnumValue = 400000;
+ param.mStage = 0;
+ param.mReserved = -1;
+ mDecompParams.push_back(param);
+
+ param.mName = "Num Hulls";
+ param.mDescription = nullptr;
+ param.mType = LLCDParam::LLCD_FLOAT;
+ param.mDetails.mRange.mLow.mFloat = 1.f;
+ param.mDetails.mRange.mHigh.mFloat = MAX_HULLS;
+ param.mDetails.mRange.mDelta.mFloat = 1.f;
+ param.mDefault.mFloat = 8.f;
+ param.mStage = 0;
+ param.mReserved = -1;
+ mDecompParams.push_back(param);
+
+ param.mName = "Num Vertices";
+ param.mDescription = nullptr;
+ param.mType = LLCDParam::LLCD_FLOAT;
+ param.mDetails.mRange.mLow.mFloat = 3.f;
+ param.mDetails.mRange.mHigh.mFloat = MAX_VERTICES_PER_HULL;
+ param.mDetails.mRange.mDelta.mFloat = 1.f;
+ param.mDefault.mFloat = 32.f;
+ param.mStage = 0;
+ param.mReserved = -1;
+ mDecompParams.push_back(param);
+
+ param.mName = "Error Tolerance";
+ param.mDescription = nullptr;
+ param.mType = LLCDParam::LLCD_FLOAT;
+ param.mDetails.mRange.mLow.mFloat = 0.0001f;
+ param.mDetails.mRange.mHigh.mFloat = 99.f;
+ param.mDetails.mRange.mDelta.mFloat = 0.001f;
+ param.mDefault.mFloat = 1.f;
+ param.mStage = 0;
+ param.mReserved = -1;
+ mDecompParams.push_back(param);
+
+ for (const LLCDParam& param : mDecompParams)
+ {
+ const char* const name = param.mName;
+
+ switch (param.mType)
+ {
+ case LLCDParam::LLCD_FLOAT:
+ {
+ setParam(name, param.mDefault.mFloat);
+ break;
+ }
+ case LLCDParam::LLCD_ENUM:
+ case LLCDParam::LLCD_INTEGER:
+ {
+ setParam(name, param.mDefault.mIntOrEnumValue);
+ break;
+ }
+ case LLCDParam::LLCD_BOOLEAN:
+ {
+ setParam(name, (param.mDefault.mBool != 0));
+ break;
+ }
+ case LLCDParam::LLCD_INVALID:
+ default:
+ {
+ break;
+ }
+ }
+ }
+}
+
+LLConvexDecompositionVHACD::~LLConvexDecompositionVHACD()
+{
+ mBoundDecomp = nullptr;
+ mDecompData.clear();
+
+ mVHACD->Release();
+}
+
+void LLConvexDecompositionVHACD::genDecomposition(int& decomp)
+{
+ int new_decomp_id = static_cast(mDecompData.size()) + 1;
+ mDecompData[new_decomp_id] = LLDecompData();
+ decomp = new_decomp_id;
+}
+
+void LLConvexDecompositionVHACD::deleteDecomposition(int decomp)
+{
+ auto iter = mDecompData.find(decomp);
+ if (iter != mDecompData.end())
+ {
+ if (mBoundDecomp == &iter->second)
+ {
+ mBoundDecomp = nullptr;
+ }
+ mDecompData.erase(iter);
+ }
+}
+
+void LLConvexDecompositionVHACD::bindDecomposition(int decomp)
+{
+ auto iter = mDecompData.find(decomp);
+ if (iter != mDecompData.end())
+ {
+ mBoundDecomp = &iter->second;
+ }
+ else
+ {
+ LL_WARNS() << "Failed to bind unknown decomposition: " << decomp << LL_ENDL;
+ mBoundDecomp = nullptr;
+ }
+}
+
+LLCDResult LLConvexDecompositionVHACD::setParam(const char* name, float val)
+{
+ if (name == std::string("Num Hulls"))
+ {
+ mVHACDParameters.m_maxConvexHulls = llclamp(ll_round(val), 1, MAX_HULLS);
+ }
+ else if (name == std::string("Num Vertices"))
+ {
+ mVHACDParameters.m_maxNumVerticesPerCH = llclamp(ll_round(val), 3, MAX_VERTICES_PER_HULL);
+ }
+ else if (name == std::string("Error Tolerance"))
+ {
+ mVHACDParameters.m_minimumVolumePercentErrorAllowed = val;
+ }
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::setParam(const char* name, bool val)
+{
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::setParam(const char* name, int val)
+{
+ if (name == std::string("Fill Mode"))
+ {
+ mVHACDParameters.m_fillMode = (VHACD::FillMode)val;
+ }
+ else if (name == std::string("Voxel Resolution"))
+ {
+ mVHACDParameters.m_resolution = val;
+ }
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::setMeshData( const LLCDMeshData* data, bool vertex_based )
+{
+ if (!mBoundDecomp)
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ return mBoundDecomp->mSourceMesh.from(data, vertex_based);
+}
+
+LLCDResult LLConvexDecompositionVHACD::registerCallback(int stage, llcdCallbackFunc callback )
+{
+ if (stage == 0)
+ {
+ mVHACDCallback.setCallbackFunc(callback);
+ return LLCD_OK;
+ }
+ else
+ {
+ return LLCD_INVALID_STAGE;
+ }
+}
+
+LLCDResult LLConvexDecompositionVHACD::executeStage(int stage)
+{
+ if (!mBoundDecomp)
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ if (stage != 0)
+ {
+ return LLCD_INVALID_STAGE;
+ }
+
+ mBoundDecomp->mDecomposedHulls.clear();
+
+ const auto& decomp_mesh = mBoundDecomp->mSourceMesh;
+ if (!mVHACD->Compute((const double* const)decomp_mesh.mVertices.data(), static_cast(decomp_mesh.mVertices.size()), (const uint32_t* const)decomp_mesh.mIndices.data(), static_cast(decomp_mesh.mIndices.size()), mVHACDParameters))
+ {
+ return LLCD_INVALID_HULL_DATA;
+ }
+
+ uint32_t num_nulls = mVHACD->GetNConvexHulls();
+ if (num_nulls == 0)
+ {
+ return LLCD_INVALID_HULL_DATA;
+ }
+
+ for (uint32_t i = 0; num_nulls > i; ++i)
+ {
+ VHACD::IVHACD::ConvexHull ch;
+ if (!mVHACD->GetConvexHull(i, ch))
+ continue;
+
+ LLConvexMesh out_mesh;
+ out_mesh.setVertices(ch.m_points);
+ out_mesh.setIndices(ch.m_triangles);
+
+ mBoundDecomp->mDecomposedHulls.push_back(std::move(out_mesh));
+ }
+
+ mVHACD->Clean();
+
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::buildSingleHull()
+{
+ LL_INFOS() << "Building single hull mesh" << LL_ENDL;
+ if (!mBoundDecomp || mBoundDecomp->mSourceMesh.mVertices.empty())
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ mBoundDecomp->mSingleHullMesh.clear();
+
+ VHACD::QuickHull quickhull;
+ uint32_t num_tris = quickhull.ComputeConvexHull(mBoundDecomp->mSourceMesh.mVertices, MAX_VERTICES_PER_HULL);
+ if (num_tris > 0)
+ {
+ mBoundDecomp->mSingleHullMesh.setVertices(quickhull.GetVertices());
+ mBoundDecomp->mSingleHullMesh.setIndices(quickhull.GetIndices());
+
+ return LLCD_OK;
+ }
+
+ return LLCD_INVALID_MESH_DATA;
+}
+
+int LLConvexDecompositionVHACD::getNumHullsFromStage(int stage)
+{
+ if (!mBoundDecomp || stage != 0)
+ {
+ return 0;
+ }
+
+ return narrow(mBoundDecomp->mDecomposedHulls.size());
+}
+
+LLCDResult LLConvexDecompositionVHACD::getSingleHull( LLCDHull* hullOut )
+{
+ memset( hullOut, 0, sizeof(LLCDHull) );
+
+ if (!mBoundDecomp)
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ if (mBoundDecomp->mSingleHullMesh.vertices.empty())
+ {
+ return LLCD_INVALID_HULL_DATA;
+ }
+
+ mBoundDecomp->mSingleHullMesh.to(hullOut);
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::getHullFromStage( int stage, int hull, LLCDHull* hullOut )
+{
+ memset( hullOut, 0, sizeof(LLCDHull) );
+
+ if (!mBoundDecomp)
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ if (stage != 0)
+ {
+ return LLCD_INVALID_STAGE;
+ }
+
+ if (mBoundDecomp->mDecomposedHulls.empty() || mBoundDecomp->mDecomposedHulls.size() <= hull)
+ {
+ return LLCD_REQUEST_OUT_OF_RANGE;
+ }
+
+ mBoundDecomp->mDecomposedHulls[hull].to(hullOut);
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut )
+{
+ memset( meshDataOut, 0, sizeof(LLCDMeshData));
+ if (!mBoundDecomp)
+ {
+ return LLCD_NULL_PTR;
+ }
+
+ if (stage != 0)
+ {
+ return LLCD_INVALID_STAGE;
+ }
+
+ if (mBoundDecomp->mDecomposedHulls.empty() || mBoundDecomp->mDecomposedHulls.size() <= hull)
+ {
+ return LLCD_REQUEST_OUT_OF_RANGE;
+ }
+
+ mBoundDecomp->mDecomposedHulls[hull].to(meshDataOut);
+ return LLCD_OK;
+}
+
+LLCDResult LLConvexDecompositionVHACD::getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut )
+{
+ memset(meshOut, 0, sizeof(LLCDMeshData));
+
+ LLVHACDMesh inMesh(hullIn);
+
+ VHACD::QuickHull quickhull;
+ uint32_t num_tris = quickhull.ComputeConvexHull(inMesh.mVertices, MAX_VERTICES_PER_HULL);
+ if (num_tris > 0)
+ {
+ mMeshFromHullData.setVertices(quickhull.GetVertices());
+ mMeshFromHullData.setIndices(quickhull.GetIndices());
+
+ mMeshFromHullData.to(meshOut);
+ return LLCD_OK;
+ }
+
+ return LLCD_INVALID_HULL_DATA;
+}
+
+LLCDResult LLConvexDecompositionVHACD::generateSingleHullMeshFromMesh(LLCDMeshData* meshIn, LLCDMeshData* meshOut)
+{
+ memset( meshOut, 0, sizeof(LLCDMeshData) );
+
+ LLVHACDMesh inMesh(meshIn, true);
+
+ VHACD::QuickHull quickhull;
+ uint32_t num_tris = quickhull.ComputeConvexHull(inMesh.mVertices, MAX_VERTICES_PER_HULL);
+ if (num_tris > 0)
+ {
+ mSingleHullMeshFromMeshData.setVertices(quickhull.GetVertices());
+ mSingleHullMeshFromMeshData.setIndices(quickhull.GetIndices());
+
+ mSingleHullMeshFromMeshData.to(meshOut);
+ return LLCD_OK;
+ }
+
+ return LLCD_INVALID_MESH_DATA;
+}
+
+void LLConvexDecompositionVHACD::loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut)
+{
+ static LLCDMeshData meshData;
+ memset( &meshData, 0, sizeof(LLCDMeshData) );
+ *meshDataOut = &meshData;
+}
diff --git a/indra/llconvexdecomposition/llconvexdecompositionvhacd.h b/indra/llconvexdecomposition/llconvexdecompositionvhacd.h
new file mode 100644
index 0000000000..675356629c
--- /dev/null
+++ b/indra/llconvexdecomposition/llconvexdecompositionvhacd.h
@@ -0,0 +1,339 @@
+/**
+* @file llconvexdecompositionvhacd.h
+* @author rye@alchemyviewer.org
+* @brief A VHACD based implementation of LLConvexDecomposition
+*
+* $LicenseInfo:firstyear=2025&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2025, 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_CONVEX_DECOMP_UTIL_VHACD_H
+#define LL_CONVEX_DECOMP_UTIL_VHACD_H
+
+#include "llconvexdecomposition.h"
+#include "llsingleton.h"
+#include "llmath.h"
+
+#include
+
+#include "VHACD.h"
+
+class LLDecompDataVHACD;
+
+class LLConvexDecompositionVHACD : public LLSimpleton, public LLConvexDecomposition
+{
+ class VHACDCallback : public VHACD::IVHACD::IUserCallback
+ {
+ public:
+ void Update(const double overallProgress, const double stageProgress, const char* const stage, const char* operation) override
+ {
+ std::string out_msg = llformat("Stage: %s Operation: %s", stage, operation);
+ if (mCurrentStage != stage && mCurrentOperation != operation)
+ {
+ mCurrentStage = stage;
+ mCurrentOperation = operation;
+ LL_INFOS("VHACD") << out_msg << LL_ENDL;
+ }
+
+ if(mCallbackFunc)
+ {
+ mCallbackFunc(out_msg.c_str(), ll_round(static_cast(stageProgress)), ll_round(static_cast(overallProgress)));
+ }
+ }
+
+ void setCallbackFunc(llcdCallbackFunc func)
+ {
+ mCallbackFunc = func;
+ }
+
+ private:
+ std::string mCurrentStage;
+ std::string mCurrentOperation;
+ llcdCallbackFunc mCallbackFunc = nullptr;
+ };
+
+ class VHACDLogger : public VHACD::IVHACD::IUserLogger
+ {
+ void Log(const char* const msg) override
+ {
+ LL_INFOS("VHACD") << msg << LL_ENDL;
+ }
+ };
+
+public:
+
+ LLConvexDecompositionVHACD();
+ virtual ~LLConvexDecompositionVHACD();
+
+ static bool isFunctional();
+ static LLConvexDecomposition* getInstance();
+ static LLCDResult initSystem();
+ static LLCDResult initThread();
+ static LLCDResult quitThread();
+ static LLCDResult quitSystem();
+
+ void genDecomposition(int& decomp);
+ void deleteDecomposition(int decomp);
+ void bindDecomposition(int decomp);
+
+ // Sets *paramsOut to the address of the LLCDParam array and returns
+ // the length of the array
+ int getParameters(const LLCDParam** paramsOut)
+ {
+ *paramsOut = mDecompParams.data();
+ return narrow(mDecompParams.size());
+ }
+
+ int getStages(const LLCDStageData** stagesOut)
+ {
+ *stagesOut = mDecompStages.data();
+ return narrow(mDecompStages.size());
+ }
+
+ // Set a parameter by name. Returns false if out of bounds or unsupported parameter
+ LLCDResult setParam(const char* name, float val);
+ LLCDResult setParam(const char* name, int val);
+ LLCDResult setParam(const char* name, bool val);
+ LLCDResult setMeshData( const LLCDMeshData* data, bool vertex_based );
+ LLCDResult registerCallback(int stage, llcdCallbackFunc callback );
+
+ LLCDResult executeStage(int stage);
+ LLCDResult buildSingleHull();
+
+ int getNumHullsFromStage(int stage);
+
+ LLCDResult getHullFromStage( int stage, int hull, LLCDHull* hullOut );
+ LLCDResult getSingleHull( LLCDHull* hullOut ) ;
+
+ // TODO: Implement lock of some kind to disallow this call if data not yet ready
+ LLCDResult getMeshFromStage( int stage, int hull, LLCDMeshData* meshDataOut);
+ LLCDResult getMeshFromHull( LLCDHull* hullIn, LLCDMeshData* meshOut );
+
+ // For visualizing convex hull shapes in the viewer physics shape display
+ LLCDResult generateSingleHullMeshFromMesh( LLCDMeshData* meshIn, LLCDMeshData* meshOut);
+
+ /// Debug
+ void loadMeshData(const char* fileIn, LLCDMeshData** meshDataOut);
+
+private:
+ std::vector mDecompParams;
+ std::array mDecompStages;
+
+ struct LLVHACDMesh
+ {
+ using vertex_type = VHACD::Vertex;
+ using index_type = VHACD::Triangle;
+ using vertex_array_type = std::vector;
+ using index_array_type = std::vector;
+
+ LLVHACDMesh() = default;
+ LLVHACDMesh(const LLCDHull* hullIn)
+ {
+ if (hullIn)
+ {
+ from(hullIn);
+ }
+ };
+
+ LLVHACDMesh(const LLCDMeshData* meshIn, bool vertex_based)
+ {
+ if (meshIn)
+ {
+ from(meshIn, vertex_based);
+ }
+ };
+
+ void clear()
+ {
+ mVertices.clear();
+ mIndices.clear();
+ }
+
+ void setVertices(const float* data, int num_vertices, int vertex_stride_bytes)
+ {
+ vertex_array_type vertices;
+ vertices.reserve(num_vertices);
+
+ const int stride = vertex_stride_bytes / sizeof(float);
+ for (int i = 0; i < num_vertices; ++i)
+ {
+ vertices.emplace_back(data[i * stride + 0],
+ data[i * stride + 1],
+ data[i * stride + 2]);
+ }
+
+ mVertices = std::move(vertices);
+ }
+
+ void setIndices(const void* data, int num_indices, int index_stride_bytes, LLCDMeshData::IndexType type)
+ {
+ index_array_type indices;
+ indices.reserve(num_indices);
+
+ if (type == LLCDMeshData::INT_16)
+ {
+ const U16* index_data = static_cast(data);
+ const int stride = index_stride_bytes / sizeof(U16);
+ for (int i = 0; i < num_indices; ++i)
+ {
+ indices.emplace_back(index_data[i * stride + 0],
+ index_data[i * stride + 1],
+ index_data[i * stride + 2]);
+ }
+ }
+ else
+ {
+ const U32* index_data = static_cast(data);
+ const int stride = index_stride_bytes / sizeof(U32);
+ for (int i = 0; i < num_indices; ++i)
+ {
+ indices.emplace_back(index_data[i * stride + 0],
+ index_data[i * stride + 1],
+ index_data[i * stride + 2]);
+ }
+ }
+
+ mIndices = std::move(indices);
+ }
+
+ LLCDResult from(const LLCDHull* hullIn)
+ {
+ clear();
+
+ if (!hullIn || !hullIn->mVertexBase || (hullIn->mNumVertices < 3) || (hullIn->mVertexStrideBytes != 12 && hullIn->mVertexStrideBytes != 16))
+ {
+ return LLCD_INVALID_HULL_DATA;
+ }
+
+ setVertices(hullIn->mVertexBase, hullIn->mNumVertices, hullIn->mVertexStrideBytes);
+
+ return LLCD_OK;
+ }
+
+ LLCDResult from(const LLCDMeshData* meshIn, bool vertex_based)
+ {
+ clear();
+
+ if (!meshIn || !meshIn->mVertexBase || (meshIn->mNumVertices < 3) || (meshIn->mVertexStrideBytes != 12 && meshIn->mVertexStrideBytes != 16))
+ {
+ return LLCD_INVALID_MESH_DATA;
+ }
+
+ if (!vertex_based && ((meshIn->mNumTriangles < 1) || !meshIn->mIndexBase))
+ {
+ return LLCD_INVALID_MESH_DATA;
+ }
+
+ setVertices(meshIn->mVertexBase, meshIn->mNumVertices, meshIn->mVertexStrideBytes);
+ if(!vertex_based)
+ {
+ setIndices(meshIn->mIndexBase, meshIn->mNumTriangles, meshIn->mIndexStrideBytes, meshIn->mIndexType);
+ }
+
+ return LLCD_OK;
+ }
+
+ vertex_array_type mVertices;
+ index_array_type mIndices;
+ };
+
+ struct LLConvexMesh
+ {
+ using vertex_type = glm::vec3;
+ using index_type = glm::u32vec3;
+ using vertex_array_type = std::vector;
+ using index_array_type = std::vector;
+
+ LLConvexMesh() = default;
+
+ void clear()
+ {
+ vertices.clear();
+ indices.clear();
+ }
+
+ void setVertices(const std::vector& in_vertices)
+ {
+ vertices.clear();
+ vertices.reserve(in_vertices.size());
+
+ for (const auto& vertex : in_vertices)
+ {
+ vertices.emplace_back(narrow(vertex.mX), narrow(vertex.mY), narrow(vertex.mZ));
+ }
+ }
+
+ void setIndices(const std::vector& in_indices)
+ {
+ indices.clear();
+ indices.reserve(in_indices.size());
+
+ for (const auto& triangle : in_indices)
+ {
+ indices.emplace_back(narrow(triangle.mI0), narrow(triangle.mI1), narrow(triangle.mI2));
+ }
+ }
+
+ void to(LLCDHull* meshOut) const
+ {
+ meshOut->mVertexBase = (float*)vertices.data();
+ meshOut->mVertexStrideBytes = sizeof(vertex_type);
+ meshOut->mNumVertices = (int)vertices.size();
+ }
+
+ void to(LLCDMeshData* meshOut) const
+ {
+ meshOut->mVertexBase = (float*)vertices.data();
+ meshOut->mVertexStrideBytes = sizeof(vertex_type);
+ meshOut->mNumVertices = (int)vertices.size();
+
+ meshOut->mIndexType = LLCDMeshData::INT_32;
+ meshOut->mIndexBase = indices.data();
+ meshOut->mIndexStrideBytes = sizeof(index_type);
+ meshOut->mNumTriangles = (int)indices.size();
+ }
+
+ vertex_array_type vertices;
+ index_array_type indices;
+ };
+
+ struct LLDecompData
+ {
+ LLVHACDMesh mSourceMesh;
+ LLConvexMesh mSingleHullMesh;
+
+ std::vector mDecomposedHulls;
+ };
+
+ std::unordered_map mDecompData;
+
+ LLDecompData* mBoundDecomp = nullptr;
+
+ VHACD::IVHACD* mVHACD = nullptr;
+ VHACDCallback mVHACDCallback;
+ VHACDLogger mVHACDLogger;
+ VHACD::IVHACD::Parameters mVHACDParameters;
+
+ LLConvexMesh mMeshFromHullData;
+ LLConvexMesh mSingleHullMeshFromMeshData;
+};
+
+#endif //LL_CONVEX_DECOMP_UTIL_VHACD_H
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 63c4ea8ecb..fdba9b2ffa 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5762,6 +5762,8 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
{
try
{
+ // providing mIndices should help avoid unused vertices
+ // but those should have been filtered out on upload
vert_count = static_cast(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
}
catch (std::bad_alloc&)
@@ -5771,10 +5773,16 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
}
}
- if (vert_count < 65535 && vert_count != 0)
+ // Probably should be using meshopt_remapVertexBuffer instead of remaping manually
+ if (vert_count < 65535 && vert_count > 0)
{
//copy results back into volume
resizeVertices(vert_count);
+ if (mNumVertices == 0)
+ {
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ LL_ERRS("LLCoros") << "Failed to allocate memory for resizeVertices(" << vert_count << ")" << LL_ENDL;
+ }
if (!data.w.empty())
{
@@ -5787,13 +5795,27 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
{
U32 src_idx = i;
U32 dst_idx = remap[i];
- if (dst_idx >= (U32)mNumVertices)
+ if (dst_idx == U32_MAX)
+ {
+ // Unused indices? Probably need to resize mIndices
+ dst_idx = mNumVertices - 1;
+ llassert(false);
+ LL_DEBUGS_ONCE("LLVOLUME") << "U32_MAX destination index, substituting" << LL_ENDL;
+ }
+ else if (dst_idx >= (U32)mNumVertices)
{
dst_idx = mNumVertices - 1;
// Shouldn't happen, figure out what gets returned in remap and why.
llassert(false);
LL_DEBUGS_ONCE("LLVOLUME") << "Invalid destination index, substituting" << LL_ENDL;
}
+ if (src_idx >= (U32)data.p.size())
+ {
+ // data.p.size() is supposed to be equal to mNumIndices
+ src_idx = (U32)(data.p.size() - 1);
+ llassert(false);
+ LL_DEBUGS_ONCE("LLVOLUME") << "Invalid source index, substituting" << LL_ENDL;
+ }
mIndices[i] = dst_idx;
mPositions[dst_idx].load3(data.p[src_idx].mV);
@@ -5827,7 +5849,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
}
else
{
- if (vert_count == 0)
+ if (vert_count <= 0)
{
LL_WARNS_ONCE("LLVOLUME") << "meshopt_generateVertexRemapMulti failed to process a model or model was invalid" << LL_ENDL;
}
diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp
index b58a82a447..6f9d43ad70 100644
--- a/indra/llmessage/llcoproceduremanager.cpp
+++ b/indra/llmessage/llcoproceduremanager.cpp
@@ -138,7 +138,22 @@ LLCoprocedureManager::LLCoprocedureManager()
LLCoprocedureManager::~LLCoprocedureManager()
{
- close();
+ try
+ {
+ close();
+ }
+ catch (const boost::fibers::fiber_error&)
+ {
+ LL_WARNS() << "Fiber error during ~LLCoprocedureManager()" << LL_ENDL;
+ }
+ catch (const std::exception& e)
+ {
+ // Shutting down, just log it
+ LL_WARNS() << "Exception during ~LLCoprocedureManager(): " << e.what() << LL_ENDL;
+ }
+ mPropertyQueryFn.clear();
+ mPropertyDefineFn.clear();
+ mPoolMap.clear();
}
void LLCoprocedureManager::initializePool(const std::string &poolName, size_t queue_size)
@@ -365,6 +380,22 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size, s
LLCoprocedurePool::~LLCoprocedurePool()
{
+ try
+ {
+ close(); // should have been closed already, but shouldn't hurt
+ mStatusListener.disconnect();
+ mPendingCoprocs.reset();
+ mCoroMapping.clear();
+ }
+ catch (const boost::fibers::fiber_error&)
+ {
+ LL_WARNS() << "Fiber error during ~LLCoprocedurePool() " << mPoolName << LL_ENDL;
+ }
+ catch (const std::exception& e)
+ {
+ // Shutting down, just log it
+ LL_WARNS() << "Exception " << e.what() << " during ~LLCoprocedurePool() in " << mPoolName << LL_ENDL;
+ }
}
//-------------------------------------------------------------------------
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index aa34c345ff..980965f8fc 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -71,6 +71,12 @@ target_link_libraries(llprimitive
ll::glm
)
+if (TARGET llconvexdecomposition)
+ target_link_libraries(llprimitive
+ llconvexdecomposition
+ )
+endif ()
+
if(LINUX)
# GLIB uses pcre, so we need to keep it for Linux
target_link_libraries(ll::pcre)
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index cc4921416f..930222e3db 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -923,3 +923,34 @@ void LLGLTFMaterial::updateTextureTracking()
// setTEGLTFMaterialOverride is responsible for tracking
// for material overrides editor will set it
}
+
+void LLGLTFMaterial::convertTextureTransformToPBR(
+ F32 tex_scale_s,
+ F32 tex_scale_t,
+ F32 tex_offset_s,
+ F32 tex_offset_t,
+ F32 tex_rotation,
+ LLVector2& pbr_scale,
+ LLVector2& pbr_offset,
+ F32& pbr_rotation)
+{
+ pbr_scale.set(tex_scale_s, tex_scale_t);
+ pbr_rotation = -(tex_rotation) / 2.f;
+ const F32 adjusted_offset_s = tex_offset_s;
+ const F32 adjusted_offset_t = -tex_offset_t;
+ F32 center_adjust_s = 0.5f * (1.0f - tex_scale_s);
+ F32 center_adjust_t = 0.5f * (1.0f - tex_scale_t);
+
+ if (pbr_rotation != 0.0f)
+ {
+ const F32 c = cosf(pbr_rotation);
+ const F32 s = sinf(pbr_rotation);
+ const F32 tmp_s = center_adjust_s * c - center_adjust_t * s;
+ const F32 tmp_t = center_adjust_s * s + center_adjust_t * c;
+ center_adjust_s = tmp_s;
+ center_adjust_t = tmp_t;
+ }
+
+ pbr_offset.set(adjusted_offset_s + center_adjust_s,
+ adjusted_offset_t + center_adjust_t);
+}
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index 10df4c8ee1..8d45cb6185 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -214,6 +214,14 @@ public:
bool hasLocalTextures() { return !mTrackingIdToLocalTexture.empty(); }
virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id);
virtual void updateTextureTracking();
+
+ // Convert legacy TE transform values to PBR transform values.
+ static void convertTextureTransformToPBR(F32 tex_scale_s, F32 tex_scale_t,
+ F32 tex_offset_s, F32 tex_offset_t,
+ F32 tex_rotation,
+ LLVector2& pbr_scale,
+ LLVector2& pbr_offset,
+ F32& pbr_rotation);
protected:
static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value);
static F32 floatFromJson(const std::map& object, const char* key, const F32 default_value);
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index d273d6ddca..f4001fe4c3 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1314,10 +1314,10 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
}
void LLModel::setConvexHullDecomposition(
- const LLModel::convex_hull_decomposition& decomp)
+ const LLModel::convex_hull_decomposition& decomp, const std::vector& decomp_mesh)
{
mPhysics.mHull = decomp;
- mPhysics.mMesh.clear();
+ mPhysics.mMesh = decomp_mesh;
updateHullCenters();
}
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index b43f54202d..56eb0ef715 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -307,7 +307,8 @@ public:
S32 mDecompID;
void setConvexHullDecomposition(
- const convex_hull_decomposition& decomp);
+ const convex_hull_decomposition& decomp,
+ const std::vector& decomp_mesh);
void updateHullCenters();
LLVector3 mCenterOfHullCenters;
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index c0a8d5bada..e2876a9ef0 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -2216,10 +2216,14 @@ void LLFolderViewFolder::setOpen(bool openitem)
{
// navigateToFolder can destroy this view
// delay it in case setOpen was called from click or key processing
- doOnIdleOneTime([this]()
- {
- getViewModelItem()->navigateToFolder();
- });
+ LLPointer view_model_item = mViewModelItem;
+ doOnIdleOneTime([view_model_item]()
+ {
+ if (view_model_item.notNull())
+ {
+ view_model_item.get()->navigateToFolder();
+ }
+ });
}
else
{
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 828896f620..f93ad07c1f 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -374,8 +374,6 @@ void LLWebRTCImpl::terminate()
mSignalingThread->BlockingCall([this]() { mPeerConnectionFactory = nullptr; });
- mPeerConnections.clear();
-
mWorkerThread->BlockingCall(
[this]()
{
@@ -386,6 +384,14 @@ void LLWebRTCImpl::terminate()
mDeviceModule = nullptr;
mTaskQueueFactory = nullptr;
});
+
+ // In case peer connections still somehow have jobs in workers,
+ // only clear connections up after clearing workers.
+ mNetworkThread = nullptr;
+ mWorkerThread = nullptr;
+ mSignalingThread = nullptr;
+
+ mPeerConnections.clear();
webrtc::LogMessage::RemoveLogToStream(mLogSink);
}
@@ -635,6 +641,13 @@ void LLWebRTCImpl::OnDevicesUpdated()
void LLWebRTCImpl::setTuningMode(bool enable)
{
mTuningMode = enable;
+ if (!mTuningMode
+ && !mMute
+ && mPeerCustomProcessor
+ && mPeerCustomProcessor->getGain() != mGain)
+ {
+ mPeerCustomProcessor->setGain(mGain);
+ }
mWorkerThread->PostTask(
[this]
{
@@ -766,6 +779,7 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn
std::find(mPeerConnections.begin(), mPeerConnections.end(), peer_connection);
if (it != mPeerConnections.end())
{
+ // Todo: make sure conection had no jobs in workers
mPeerConnections.erase(it);
if (mPeerConnections.empty())
{
@@ -785,7 +799,8 @@ LLWebRTCPeerConnectionImpl::LLWebRTCPeerConnectionImpl() :
mWebRTCImpl(nullptr),
mPeerConnection(nullptr),
mMute(MUTE_INITIAL),
- mAnswerReceived(false)
+ mAnswerReceived(false),
+ mPendingJobs(0)
{
}
@@ -793,6 +808,10 @@ LLWebRTCPeerConnectionImpl::~LLWebRTCPeerConnectionImpl()
{
mSignalingObserverList.clear();
mDataObserverList.clear();
+ if (mPendingJobs > 0)
+ {
+ RTC_LOG(LS_ERROR) << __FUNCTION__ << "Destroying a connection that has " << std::to_string(mPendingJobs) << " unfinished jobs that might cause workers to crash";
+ }
}
//
@@ -804,8 +823,10 @@ void LLWebRTCPeerConnectionImpl::init(LLWebRTCImpl * webrtc_impl)
mWebRTCImpl = webrtc_impl;
mPeerConnectionFactory = mWebRTCImpl->getPeerConnectionFactory();
}
+
void LLWebRTCPeerConnectionImpl::terminate()
{
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this]()
{
@@ -848,7 +869,9 @@ void LLWebRTCPeerConnectionImpl::terminate()
observer->OnPeerConnectionClosed();
}
}
+ mPendingJobs--;
});
+ mPeerConnectionFactory.release();
}
void LLWebRTCPeerConnectionImpl::setSignalingObserver(LLWebRTCSignalingObserver *observer) { mSignalingObserverList.emplace_back(observer); }
@@ -869,6 +892,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
RTC_DCHECK(!mPeerConnection);
mAnswerReceived = false;
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this,options]()
{
@@ -890,6 +914,13 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
config.set_max_port(60100);
webrtc::PeerConnectionDependencies pc_dependencies(this);
+ if (mPeerConnectionFactory == nullptr)
+ {
+ RTC_LOG(LS_ERROR) << __FUNCTION__ << "Error creating peer connection, factory doesn't exist";
+ // Too early?
+ mPendingJobs--;
+ return;
+ }
auto error_or_peer_connection = mPeerConnectionFactory->CreatePeerConnectionOrError(config, std::move(pc_dependencies));
if (error_or_peer_connection.ok())
{
@@ -902,6 +933,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
{
observer->OnRenegotiationNeeded();
}
+ mPendingJobs--;
return;
}
@@ -964,6 +996,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions offerOptions;
mPeerConnection->CreateOffer(this, offerOptions);
+ mPendingJobs--;
});
return true;
@@ -1006,6 +1039,7 @@ void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
{
RTC_LOG(LS_INFO) << __FUNCTION__ << " Remote SDP: " << sdp;
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this, sdp]()
{
@@ -1015,6 +1049,7 @@ void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
mPeerConnection->SetRemoteDescription(webrtc::CreateSessionDescription(webrtc::SdpType::kAnswer, sdp),
webrtc::scoped_refptr(this));
}
+ mPendingJobs--;
});
}
@@ -1037,6 +1072,7 @@ void LLWebRTCPeerConnectionImpl::setMute(bool mute)
mMute = new_state;
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this, force_reset, enable]()
{
@@ -1060,6 +1096,7 @@ void LLWebRTCPeerConnectionImpl::setMute(bool mute)
track->set_enabled(enable);
}
}
+ mPendingJobs--;
}
});
}
@@ -1081,6 +1118,7 @@ void LLWebRTCPeerConnectionImpl::resetMute()
void LLWebRTCPeerConnectionImpl::setReceiveVolume(float volume)
{
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this, volume]()
{
@@ -1099,11 +1137,13 @@ void LLWebRTCPeerConnectionImpl::setReceiveVolume(float volume)
}
}
}
+ mPendingJobs--;
});
}
void LLWebRTCPeerConnectionImpl::setSendVolume(float volume)
{
+ mPendingJobs++;
mWebRTCImpl->PostSignalingTask(
[this, volume]()
{
@@ -1114,6 +1154,7 @@ void LLWebRTCPeerConnectionImpl::setSendVolume(float volume)
track->GetSource()->SetVolume(volume*5.0);
}
}
+ mPendingJobs--;
});
}
@@ -1190,11 +1231,13 @@ void LLWebRTCPeerConnectionImpl::OnConnectionChange(webrtc::PeerConnectionInterf
{
case webrtc::PeerConnectionInterface::PeerConnectionState::kConnected:
{
+ mPendingJobs++;
mWebRTCImpl->PostWorkerTask([this]() {
for (auto &observer : mSignalingObserverList)
{
observer->OnAudioEstablished(this);
}
+ mPendingJobs--;
});
break;
}
@@ -1452,11 +1495,13 @@ void LLWebRTCPeerConnectionImpl::sendData(const std::string& data, bool binary)
{
webrtc::CopyOnWriteBuffer cowBuffer(data.data(), data.length());
webrtc::DataBuffer buffer(cowBuffer, binary);
+ mPendingJobs++;
mWebRTCImpl->PostNetworkTask([this, buffer]() {
if (mDataChannel)
{
mDataChannel->Send(buffer);
}
+ mPendingJobs--;
});
}
}
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h
index df06cb88fa..01cfb17ced 100644
--- a/indra/llwebrtc/llwebrtc_impl.h
+++ b/indra/llwebrtc/llwebrtc_impl.h
@@ -422,6 +422,9 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceO
~LLWebRTCImpl()
{
delete mLogSink;
+
+ // Explicit cleanup for the sake of debugging and crash stacks
+ mPeerCustomProcessor = nullptr;
}
void init();
@@ -669,6 +672,8 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface,
// data
std::vector mDataObserverList;
webrtc::scoped_refptr mDataChannel;
+
+ std::atomic mPendingJobs;
};
}
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 3e2827daa5..1f74594434 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -2228,10 +2228,6 @@ if (WINDOWS)
list(APPEND viewer_SOURCE_FILES ${viewer_INSTALLER_FILES})
endif (WINDOWS)
-if (HAVOK OR HAVOK_TPV)
- set(LLSTARTUP_COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS} -DLL_HAVOK")
-endif (HAVOK OR HAVOK_TPV)
-
if( DEFINED LLSTARTUP_COMPILE_FLAGS )
# progress view disables/enables icons based on available packages
set_source_files_properties(llprogressview.cpp PROPERTIES COMPILE_FLAGS "${LLSTARTUP_COMPILE_FLAGS}")
@@ -2601,6 +2597,10 @@ if( TARGET ll::nvapi )
target_link_libraries(${VIEWER_BINARY_NAME} ll::nvapi )
endif()
+if ( TARGET llconvexdecomposition )
+ target_link_libraries(${VIEWER_BINARY_NAME} llconvexdecomposition )
+endif ()
+
if (LINUX)
# put these additional libraries in the viewer build target here as it didn't
# work to put them in via their cmake/* files
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 20a9e2760b..9e724c771a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -11312,7 +11312,7 @@ Change of this parameter will affect the layout of buttons in notification toast
RenderMaxOpenGLVersion
Comment
- Maximum OpenGL version to attempt use (minimum 3.1 maximum 4.6). Requires restart.
+ Maximum OpenGL version to attempt use (minimum 3.1 maximum 4.6). Requires restart. Windows only.
Persist
1
Type
diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp
index 085346556a..70fdf8f0b0 100644
--- a/indra/newview/gltf/llgltfloader.cpp
+++ b/indra/newview/gltf/llgltfloader.cpp
@@ -412,17 +412,14 @@ void LLGLTFLoader::processNodeHierarchy(S32 node_idx, std::map
// Process this node's mesh if it has one
if (node.mMesh >= 0 && node.mMesh < mGLTFAsset.mMeshes.size())
{
- LLMatrix4 transformation;
- material_map mats;
-
- LLModel* pModel = new LLModel(volume_params, 0.f);
- const LL::GLTF::Mesh& mesh = mGLTFAsset.mMeshes[node.mMesh];
-
- // Get base mesh name and track usage
- std::string base_name = getLodlessLabel(mesh);
+ // Get base node name and track usage
+ // Potentially multiple nodes can reuse the same mesh and Collada used
+ // node name instead of mesh name, so for consistency use node name if
+ // avaliable, node index otherwise.
+ std::string base_name = getLodlessLabel(node);
if (base_name.empty())
{
- base_name = "mesh_" + std::to_string(node.mMesh);
+ base_name = "node_" + std::to_string(node_idx);
}
S32 instance_count = mesh_name_counts[base_name]++;
@@ -433,6 +430,12 @@ void LLGLTFLoader::processNodeHierarchy(S32 node_idx, std::map
base_name = base_name + "_copy_" + std::to_string(instance_count);
}
+ LLMatrix4 transformation;
+ material_map mats;
+
+ LLModel* pModel = new LLModel(volume_params, 0.f);
+ const LL::GLTF::Mesh& mesh = mGLTFAsset.mMeshes[node.mMesh];
+
if (populateModelFromMesh(pModel, base_name, mesh, node, mats) &&
(LLModel::NO_ERRORS == pModel->getStatus()) &&
validate_model(pModel))
@@ -1818,13 +1821,13 @@ size_t LLGLTFLoader::getSuffixPosition(const std::string &label)
return -1;
}
-std::string LLGLTFLoader::getLodlessLabel(const LL::GLTF::Mesh& mesh)
+std::string LLGLTFLoader::getLodlessLabel(const LL::GLTF::Node& node)
{
- size_t ext_pos = getSuffixPosition(mesh.mName);
+ size_t ext_pos = getSuffixPosition(node.mName);
if (ext_pos != -1)
{
- return mesh.mName.substr(0, ext_pos);
+ return node.mName.substr(0, ext_pos);
}
- return mesh.mName;
+ return node.mName;
}
diff --git a/indra/newview/gltf/llgltfloader.h b/indra/newview/gltf/llgltfloader.h
index e8b91996c7..7aa1a94c20 100644
--- a/indra/newview/gltf/llgltfloader.h
+++ b/indra/newview/gltf/llgltfloader.h
@@ -170,7 +170,7 @@ private:
void notifyUnsupportedExtension(bool unsupported);
static size_t getSuffixPosition(const std::string& label);
- static std::string getLodlessLabel(const LL::GLTF::Mesh& mesh);
+ static std::string getLodlessLabel(const LL::GLTF::Node& mesh);
// bool mPreprocessGLTF;
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 2df954de14..d40586057d 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1542,6 +1542,27 @@ void wear_on_avatar_cb(const LLUUID& inv_item, bool do_replace = false)
}
}
+bool needs_to_replace(LLViewerInventoryItem* item_to_wear, bool & first_for_object, std::vector& first_for_type, bool replace)
+{
+ bool res = false;
+ LLAssetType::EType type = item_to_wear->getType();
+ if (type == LLAssetType::AT_OBJECT)
+ {
+ res = first_for_object && replace;
+ first_for_object = false;
+ }
+ else if (type == LLAssetType::AT_CLOTHING)
+ {
+ LLWearableType::EType wtype = item_to_wear->getWearableType();
+ if (wtype >= 0 && wtype < LLWearableType::WT_COUNT)
+ {
+ res = first_for_type[wtype] && replace;
+ first_for_type[wtype] = false;
+ }
+ }
+ return res;
+}
+
void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
bool do_update,
bool replace,
@@ -1550,7 +1571,8 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
LL_DEBUGS("UIUsage") << "wearItemsOnAvatar" << LL_ENDL;
LLUIUsage::instance().logCommand("Avatar.WearItem");
- bool first = true;
+ bool first_for_object = true;
+ std::vector first_for_type(LLWearableType::WT_COUNT, true);
LLInventoryObject::const_object_list_t items_to_link;
@@ -1558,9 +1580,6 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
it != item_ids_to_wear.end();
++it)
{
- replace = first && replace;
- first = false;
-
const LLUUID& item_id_to_wear = *it;
if (item_id_to_wear.isNull())
@@ -1579,8 +1598,9 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getLibraryRootFolderID()))
{
LL_DEBUGS("Avatar") << "inventory item in library, will copy and wear "
- << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
- LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(wear_on_avatar_cb,_1,replace));
+ << item_to_wear->getName() << " id " << item_id_to_wear << LL_ENDL;
+ bool replace_item = needs_to_replace(item_to_wear, first_for_object, first_for_type, replace);
+ LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(wear_on_avatar_cb, _1, replace_item));
copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(),
item_to_wear->getUUID(), LLUUID::null, std::string(), cb);
continue;
@@ -1627,7 +1647,8 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
}
LLWearableType::EType type = item_to_wear->getWearableType();
S32 wearable_count = gAgentWearables.getWearableCount(type);
- if ((replace && wearable_count != 0) || !gAgentWearables.canAddWearable(type))
+ bool replace_item = needs_to_replace(item_to_wear, first_for_object, first_for_type, replace);
+ if ((replace_item && wearable_count != 0) || !gAgentWearables.canAddWearable(type))
{
LLUUID item_id = gAgentWearables.getWearableItemID(item_to_wear->getWearableType(),
wearable_count-1);
@@ -1659,7 +1680,13 @@ void LLAppearanceMgr::wearItemsOnAvatar(const uuid_vec_t& item_ids_to_wear,
case LLAssetType::AT_OBJECT:
{
- rez_attachment(item_to_wear, NULL, replace);
+ // Note that this will replace only first attachment regardless of attachment point,
+ // so if user is wearing two items over other two on different attachment points,
+ // only one will be replaced.
+ // Unfortunately we have no way to determine attachment point from inventory item.
+ // We might want to forbid wearing multiple objects with replace option in future.
+ bool replace_item = needs_to_replace(item_to_wear, first_for_object, first_for_type, replace);
+ rez_attachment(item_to_wear, NULL, replace_item);
}
break;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 37d0bfd509..c4e116773f 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -6462,7 +6462,10 @@ void LLAppViewer::idleNetwork()
add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects);
// Retransmit unacknowledged packets.
- gXferManager->retransmitUnackedPackets();
+ if (gXferManager)
+ {
+ gXferManager->retransmitUnackedPackets();
+ }
gAssetStorage->checkForTimeouts();
gViewerThrottle.setBufferLoadRate(gMessageSystem->getBufferLoadRate());
gViewerThrottle.updateDynamicThrottle();
diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp
index 558fc92018..a05f725673 100644
--- a/indra/newview/llfetchedgltfmaterial.cpp
+++ b/indra/newview/llfetchedgltfmaterial.cpp
@@ -222,6 +222,14 @@ void LLFetchedGLTFMaterial::updateTextureTracking()
}
}
+void LLFetchedGLTFMaterial::clearFetchedTextures()
+{
+ mBaseColorTexture = nullptr;
+ mNormalTexture = nullptr;
+ mMetallicRoughnessTexture = nullptr;
+ mEmissiveTexture = nullptr;
+}
+
void LLFetchedGLTFMaterial::materialBegin()
{
llassert(!mFetching);
diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h
index 4a33b9f05f..074e3fef41 100644
--- a/indra/newview/llfetchedgltfmaterial.h
+++ b/indra/newview/llfetchedgltfmaterial.h
@@ -67,6 +67,7 @@ public:
LLPointer mNormalTexture;
LLPointer mMetallicRoughnessTexture;
LLPointer mEmissiveTexture;
+ void clearFetchedTextures();
std::set mTextureEntires;
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index a7756d61c0..7899712334 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -134,12 +134,15 @@ void LLFloaterFixedEnvironment::onClose(bool app_quitting)
{
doCloseInventoryFloater(app_quitting);
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
- LLEnvironment::instance().setCurrentEnvironmentSelection(LLEnvironment::ENV_LOCAL);
- LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
+ if (!app_quitting)
+ {
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
+ LLEnvironment::instance().setCurrentEnvironmentSelection(LLEnvironment::ENV_LOCAL);
+ LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
- mSettings.reset();
- syncronizeTabs();
+ mSettings.reset();
+ syncronizeTabs();
+ }
}
void LLFloaterFixedEnvironment::refresh()
diff --git a/indra/newview/llfloatermarketplace.cpp b/indra/newview/llfloatermarketplace.cpp
index 889daf84ab..4abea64302 100644
--- a/indra/newview/llfloatermarketplace.cpp
+++ b/indra/newview/llfloatermarketplace.cpp
@@ -27,10 +27,11 @@
#include "llviewerprecompiledheaders.h"
#include "llfloatermarketplace.h"
+#include "llviewercontrol.h"
#include "lluictrlfactory.h"
LLFloaterMarketplace::LLFloaterMarketplace(const LLSD& key)
- : LLFloater(key)
+ : LLFloaterWebContent(key)
{
}
@@ -38,10 +39,25 @@ LLFloaterMarketplace::~LLFloaterMarketplace()
{
}
+// just to override LLFloaterWebContent
+void LLFloaterMarketplace::onClose(bool app_quitting)
+{
+}
+
bool LLFloaterMarketplace::postBuild()
{
- enableResizeCtrls(true, true, false);
+ LLFloaterWebContent::postBuild();
+ mWebBrowser = getChild("marketplace_contents");
+ mWebBrowser->addObserver(this);
+
return true;
}
-
+void LLFloaterMarketplace::openMarketplace()
+{
+ std::string url = gSavedSettings.getString("MarketplaceURL");
+ if (mCurrentURL != url)
+ {
+ mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+ }
+}
diff --git a/indra/newview/llfloatermarketplace.h b/indra/newview/llfloatermarketplace.h
index 2ae4d0d64a..9524c94eee 100644
--- a/indra/newview/llfloatermarketplace.h
+++ b/indra/newview/llfloatermarketplace.h
@@ -27,14 +27,20 @@
#pragma once
#include "llfloater.h"
+#include "llfloaterwebcontent.h"
class LLFloaterMarketplace:
- public LLFloater
+ public LLFloaterWebContent
{
friend class LLFloaterReg;
+
+public:
+ void openMarketplace();
+
private:
LLFloaterMarketplace(const LLSD& key);
~LLFloaterMarketplace();
bool postBuild() override;
+ void onClose(bool app_quitting) override;
};
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 022bed0925..bad15b3333 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -328,7 +328,7 @@ bool LLFloaterModelPreview::postBuild()
//
// Show an alert dialog if using the Opensim viewer as functionality will be limited without Havok
-#ifndef HAVOK_TPV
+#if !LL_HAVOK
LLSD args;
args["FEATURE"] = getString("no_havok");
LLNotificationsUtil::add("NoHavok", args);
@@ -1136,8 +1136,13 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data)
gMeshRepo.mDecompThread->submitRequest(request);
}
}
-
- if (stage == "Decompose")
+ if (stage == "Analyze")
+ {
+ sInstance->setStatusMessage(sInstance->getString("decomposing"));
+ sInstance->childSetVisible("Analyze", false);
+ sInstance->childSetVisible("analyze_cancel", true);
+ }
+ else if (stage == "Decompose")
{
sInstance->setStatusMessage(sInstance->getString("decomposing"));
sInstance->childSetVisible("Decompose", false);
@@ -1320,6 +1325,7 @@ void LLFloaterModelPreview::initDecompControls()
childSetCommitCallback("simplify_cancel", onPhysicsStageCancel, NULL);
childSetCommitCallback("decompose_cancel", onPhysicsStageCancel, NULL);
+ childSetCommitCallback("analyze_cancel", onPhysicsStageCancel, NULL);
childSetCommitCallback("physics_lod_combo", onPhysicsUseLOD, NULL);
childSetCommitCallback("physics_browse", onPhysicsBrowse, NULL);
@@ -2214,7 +2220,7 @@ void LLFloaterModelPreview::DecompRequest::completed()
{ //called from the main thread
if (mContinue)
{
- mModel->setConvexHullDecomposition(mHull);
+ mModel->setConvexHullDecomposition(mHull, mHullMesh);
if (sInstance)
{
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index 535be11ae2..49f21d035a 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -69,7 +69,7 @@ class LLSearchHandler : public LLCommandHandler {
LLSearchHandler gSearchHandler;
LLFloaterSearch::LLFloaterSearch(const LLSD& key)
- : LLFloater(key)
+ : LLFloaterWebContent(key)
{
mSearchType.insert("standard");
mSearchType.insert("land");
@@ -89,6 +89,12 @@ LLFloaterSearch::~LLFloaterSearch()
void LLFloaterSearch::onOpen(const LLSD& tokens)
{
initiateSearch(tokens);
+ mWebBrowser->setFocus(true);
+}
+
+// just to override LLFloaterWebContent
+void LLFloaterSearch::onClose(bool app_quitting)
+{
}
void LLFloaterSearch::initiateSearch(const LLSD& tokens)
@@ -179,7 +185,11 @@ void LLFloaterSearch::initiateSearch(const LLSD& tokens)
bool LLFloaterSearch::postBuild()
{
- enableResizeCtrls(true, true, false);
+ LLFloaterWebContent::postBuild();
+ mWebBrowser = getChild("search_contents");
+ mWebBrowser->addObserver(this);
+ getChildView("address")->setEnabled(false);
+ getChildView("popexternal")->setEnabled(false);
// This call is actioned by the preload code in llViewerWindow
// that creates the search floater during the login process
diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h
index e8a2be4797..6d93474f4a 100644
--- a/indra/newview/llfloatersearch.h
+++ b/indra/newview/llfloatersearch.h
@@ -27,13 +27,15 @@
#pragma once
#include "llfloater.h"
+#include "llfloaterwebcontent.h"
class LLFloaterSearch:
- public LLFloater {
+ public LLFloaterWebContent {
friend class LLFloaterReg;
public:
void onOpen(const LLSD& key) override;
+ void onClose(bool app_quitting) override;
private:
LLFloaterSearch(const LLSD& key);
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 47385e5e51..c947e3394d 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -959,6 +959,10 @@ void LLIMModel::LLIMSession::initVoiceChannel(const LLSD& voiceChannelInfo)
{
if (mVoiceChannel)
{
+ if (!voiceChannelInfo.isMap())
+ {
+ LL_WARNS() << "initVoiceChannel called without voiceChannelInfo" << LL_ENDL;
+ }
if (mVoiceChannel->isThisVoiceChannel(voiceChannelInfo))
{
return;
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index a7a5830291..ee131c3980 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -261,6 +261,7 @@
// mDecompositionRequests mMutex rw.repo.mMutex, ro.repo.none [5]
// mPhysicsShapeRequests mMutex rw.repo.mMutex, ro.repo.none [5]
// mDecompositionQ mMutex rw.repo.mLoadedMutex, rw.main.mLoadedMutex [5] (was: [0])
+// mPhysicsQ mMutex rw.repo.mLoadedMutex, rw.main.mLoadedMutex [5] (was: [0])
// mHeaderReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
// mLODReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
// mUnavailableQ mMutex rw.repo.none [0], ro.main.none [5], rw.main.mLoadedMutex
@@ -1014,6 +1015,12 @@ LLMeshRepoThread::~LLMeshRepoThread()
mDecompositionQ.pop_front();
}
+ while (!mPhysicsQ.empty())
+ {
+ delete mPhysicsQ.front();
+ mPhysicsQ.pop_front();
+ }
+
delete mHttpRequest;
mHttpRequest = nullptr;
delete mMutex;
@@ -2672,7 +2679,7 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_
{
LLMutexLock lock(mLoadedMutex);
- mDecompositionQ.push_back(d);
+ mPhysicsQ.push_back(d);
}
return MESH_OK;
}
@@ -3483,13 +3490,14 @@ void LLMeshRepoThread::notifyLoadedMeshes()
}
}
- if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || ! mDecompositionQ.empty())
+ if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || !mDecompositionQ.empty() || !mPhysicsQ.empty())
{
if (mLoadedMutex->trylock())
{
std::deque> skin_info_q;
std::deque skin_info_unavail_q;
std::list decomp_q;
+ std::list physics_q;
if (! mSkinInfoQ.empty())
{
@@ -3506,6 +3514,11 @@ void LLMeshRepoThread::notifyLoadedMeshes()
decomp_q.swap(mDecompositionQ);
}
+ if (!mPhysicsQ.empty())
+ {
+ physics_q.swap(mPhysicsQ);
+ }
+
mLoadedMutex->unlock();
// Process the elements free of the lock
@@ -3522,9 +3535,15 @@ void LLMeshRepoThread::notifyLoadedMeshes()
while (! decomp_q.empty())
{
- gMeshRepo.notifyDecompositionReceived(decomp_q.front());
+ gMeshRepo.notifyDecompositionReceived(decomp_q.front(), false);
decomp_q.pop_front();
}
+
+ while (!physics_q.empty())
+ {
+ gMeshRepo.notifyDecompositionReceived(physics_q.front(), true);
+ physics_q.pop_front();
+ }
}
}
@@ -4837,13 +4856,13 @@ void LLMeshRepository::notifySkinInfoUnavailable(const LLUUID& mesh_id)
}
}
-void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decomp)
+void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decomp, bool physics_mesh)
{
- decomposition_map::iterator iter = mDecompositionMap.find(decomp->mMeshID);
+ LLUUID decomp_id = decomp->mMeshID; // Copy to avoid invalidation in below deletion
+ decomposition_map::iterator iter = mDecompositionMap.find(decomp_id);
if (iter == mDecompositionMap.end())
{ //just insert decomp into map
- mDecompositionMap[decomp->mMeshID] = decomp;
- mLoadingDecompositions.erase(decomp->mMeshID);
+ mDecompositionMap[decomp_id] = decomp;
sCacheBytesDecomps += decomp->sizeBytes();
}
else
@@ -4851,10 +4870,17 @@ void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decom
sCacheBytesDecomps -= iter->second->sizeBytes();
iter->second->merge(decomp);
sCacheBytesDecomps += iter->second->sizeBytes();
-
- mLoadingDecompositions.erase(decomp->mMeshID);
delete decomp;
}
+
+ if (physics_mesh)
+ {
+ mLoadingPhysicsShapes.erase(decomp_id);
+ }
+ else
+ {
+ mLoadingDecompositions.erase(decomp_id);
+ }
}
void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume, S32 lod)
@@ -5001,7 +5027,6 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
std::unordered_set::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
if (iter == mLoadingPhysicsShapes.end())
{ //no request pending for this skin info
- // *FIXME: Nothing ever deletes entries, can't be right
mLoadingPhysicsShapes.insert(mesh_id);
mPendingPhysicsShapeRequests.push(mesh_id);
}
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index a74d1f4a9b..866a20af91 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -531,6 +531,9 @@ public:
// list of completed Decomposition info requests
std::list mDecompositionQ;
+ // list of completed Physics Mesh info requests
+ std::list mPhysicsQ;
+
//queue of requested headers
std::queue mHeaderReqQ;
@@ -902,7 +905,7 @@ public:
void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 request_lod, S32 volume_lod);
void notifySkinInfoReceived(LLMeshSkinInfo* info);
void notifySkinInfoUnavailable(const LLUUID& info);
- void notifyDecompositionReceived(LLModel::Decomposition* info);
+ void notifyDecompositionReceived(LLModel::Decomposition* info, bool physics_mesh);
S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
static S32 getActualMeshLOD(LLMeshHeader& header, S32 lod);
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index a1b066a06c..f3294b958d 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -3387,7 +3387,7 @@ void LLModelPreview::updateStatusMessages()
// physStatusIcon->setImage(img);
// }
//}
-#ifndef HAVOK_TPV
+#if !LL_HAVOK
has_physics_error |= PhysicsError::NOHAVOK;
#endif
@@ -3627,7 +3627,16 @@ void LLModelPreview::updateStatusMessages()
//enable = enable && !use_hull && fmp->childGetValue("physics_optimize").asBoolean();
//enable/disable "analysis" UI
- LLPanel* panel = fmp->getChild("physics analysis");
+#if LL_HAVOK
+ LLPanel* panel = fmp->getChild("physics simplification");
+ panel->setVisible(true);
+
+ panel = fmp->getChild("physics analysis havok");
+ panel->setVisible(true);
+#else
+ LLPanel* panel = fmp->getChild("physics analysis vhacd");
+ panel->setVisible(true);
+#endif
LLView* child = panel->getFirstChild();
while (child)
{
@@ -3651,6 +3660,8 @@ void LLModelPreview::updateStatusMessages()
fmp->childSetVisible("simplify_cancel", false);
fmp->childSetVisible("Decompose", true);
fmp->childSetVisible("decompose_cancel", false);
+ fmp->childSetVisible("Analyze", true);
+ fmp->childSetVisible("analyze_cancel", false);
if (phys_hulls > 0)
{
@@ -3660,6 +3671,7 @@ void LLModelPreview::updateStatusMessages()
if (phys_tris || phys_hulls > 0)
{
fmp->childEnable("Decompose");
+ fmp->childEnable("Analyze");
}
}
else
diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp
index 41bfd644d0..1d04ebd145 100644
--- a/indra/newview/llpathfindingpathtool.cpp
+++ b/indra/newview/llpathfindingpathtool.cpp
@@ -230,11 +230,7 @@ LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const
F32 LLPathfindingPathTool::getCharacterWidth() const
{
-#ifdef HAVOK_TPV
return mFinalPathData.mCharacterWidth;
-#else
- return (F32)mFinalPathData.mCharacterWidth;
-#endif
}
void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth)
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 2c6549f036..8375f333de 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2140,9 +2140,96 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
asset_id = BLANK_MATERIAL_ASSET_ID;
}
}
+
+ // If this face already has the target material ID, do nothing.
+ // This prevents re-sending the same ID on OK, which can cause the server
+ // to drop overrides when queueApply is invoked with the OLD id.
+ if (objectp->getRenderMaterialID(te) == asset_id)
+ {
+ return true;
+ }
+
+ // Preserve existing texture transforms when switching to PBR material
+ LLTextureEntry* tep = objectp->getTE(te);
+ bool should_preserve_transforms = false;
+ LLGLTFMaterial* preserved_override = nullptr;
+
+ if (tep && asset_id.notNull())
+ {
+ // Only preserve transforms from existing GLTF material override
+ // Do not fall back to texture entry transforms when switching between PBR materials
+ LLGLTFMaterial* existing_override = tep->getGLTFMaterialOverride();
+ if (existing_override)
+ {
+ // Check if existing override has non-default transforms
+ const LLGLTFMaterial::TextureTransform& existing_transform = existing_override->mTextureTransform[0];
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+
+ if (existing_transform.mScale != default_transform.mScale ||
+ existing_transform.mOffset != default_transform.mOffset ||
+ existing_transform.mRotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from current PBR material
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ preserved_override->mTextureTransform[i].mScale = existing_transform.mScale;
+ preserved_override->mTextureTransform[i].mOffset = existing_transform.mOffset;
+ preserved_override->mTextureTransform[i].mRotation = existing_transform.mRotation;
+ }
+ should_preserve_transforms = true;
+ }
+ // If existing override has default transforms, don't preserve anything
+ }
+ else
+ {
+ // No existing PBR material override - check texture entry transforms
+ // This handles the case of switching from Blinn-Phong to PBR material
+ F32 existing_scale_s, existing_scale_t, existing_offset_s, existing_offset_t, existing_rotation;
+ tep->getScale(&existing_scale_s, &existing_scale_t);
+ tep->getOffset(&existing_offset_s, &existing_offset_t);
+ existing_rotation = tep->getRotation();
+
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+ if (existing_scale_s != default_transform.mScale.mV[0] || existing_scale_t != default_transform.mScale.mV[1] ||
+ existing_offset_s != default_transform.mOffset.mV[0] || existing_offset_t != default_transform.mOffset.mV[1] ||
+ existing_rotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from texture entry
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ LLVector2 pbr_scale, pbr_offset;
+ F32 pbr_rotation;
+ LLGLTFMaterial::convertTextureTransformToPBR(
+ existing_scale_s, existing_scale_t,
+ existing_offset_s, existing_offset_t,
+ existing_rotation,
+ pbr_scale, pbr_offset, pbr_rotation);
+ preserved_override->mTextureTransform[i].mScale = pbr_scale;
+ preserved_override->mTextureTransform[i].mOffset = pbr_offset;
+ preserved_override->mTextureTransform[i].mRotation = pbr_rotation;
+ }
+ should_preserve_transforms = true;
+ }
+ }
+ }
+
objectp->clearTEWaterExclusion(te);
// Blank out most override data on the object and send to server
objectp->setRenderMaterialID(te, asset_id);
+ if (should_preserve_transforms && preserved_override)
+ {
+ // Apply material with preserved transforms
+ LLGLTFMaterialList::queueApply(objectp, te, asset_id, preserved_override);
+ // Update local state
+ objectp->setRenderMaterialID(te, asset_id, false, true);
+ tep->setGLTFMaterialOverride(preserved_override);
+ }
+ else
+ {
+ objectp->setRenderMaterialID(te, asset_id);
+ }
return true;
}
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 533d176f42..712c8a96bf 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -42,6 +42,7 @@
#include "llpanelpresetscamerapulldown.h"
#include "llpanelpresetspulldown.h"
#include "llpanelvolumepulldown.h"
+#include "llfloatermarketplace.h"
#include "llfloaterregioninfo.h"
#include "llfloaterscriptdebug.h"
#include "llhints.h"
@@ -971,7 +972,11 @@ void LLStatusBar::onClickBuyCurrency()
void LLStatusBar::onClickShop()
{
- LLFloaterReg::toggleInstanceOrBringToFront("marketplace");
+ LLFloaterReg::showInstanceOrBringToFront("marketplace");
+ if (LLFloaterMarketplace* marketplace = LLFloaterReg::getTypedInstance("marketplace"))
+ {
+ marketplace->openMarketplace();
+ }
}
void LLStatusBar::onMouseEnterPresetsCamera()
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 9b8c9d0356..74aafe1058 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -1866,9 +1866,17 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mIsPreviewDisabled(false)
{
mCaptionHeight = p.show_caption ? BTN_HEIGHT_SMALL : 0; // leave some room underneath the image for the caption
- // Default of defaults is white image for diff tex
- //
- setBlankImageAssetID(IMG_WHITE);
+
+ if (mInventoryPickType == PICK_MATERIAL)
+ {
+ setBlankImageAssetID(BLANK_MATERIAL_ASSET_ID);
+ }
+ else
+ {
+ // Default of defaults is white image for diff tex
+ //
+ setBlankImageAssetID(IMG_WHITE);
+ }
setAllowNoTexture(p.allow_no_texture);
setCanApplyImmediately(p.can_apply_immediately);
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 14316f7f7e..2dc898d437 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -29,6 +29,8 @@
// library headers
#include "llnotificationsutil.h"
+#include
+#include
// project headers
#include "llagent.h"
#include "llagentcamera.h"
@@ -1311,7 +1313,89 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj,
asset_id = BLANK_MATERIAL_ASSET_ID;
}
- hit_obj->setRenderMaterialID(hit_face, asset_id);
+ // Preserve existing texture transforms when switching to PBR material
+ LLTextureEntry* tep = hit_obj->getTE(hit_face);
+ F32 existing_scale_s = LLGLTFMaterial::TextureTransform().mScale.mV[0];
+ F32 existing_scale_t = LLGLTFMaterial::TextureTransform().mScale.mV[1];
+ F32 existing_offset_s = LLGLTFMaterial::TextureTransform().mOffset.mV[0];
+ F32 existing_offset_t = LLGLTFMaterial::TextureTransform().mOffset.mV[1];
+ F32 existing_rotation = LLGLTFMaterial::TextureTransform().mRotation;
+ bool should_preserve_transforms = false;
+ LLGLTFMaterial* preserved_override = nullptr;
+
+ if (tep && asset_id.notNull())
+ {
+ // Only preserve transforms from existing GLTF material override
+ // Do not fall back to texture entry transforms when switching between PBR materials
+ LLGLTFMaterial* existing_override = tep->getGLTFMaterialOverride();
+ if (existing_override)
+ {
+ // Check if existing override has non-default transforms
+ const LLGLTFMaterial::TextureTransform& existing_transform = existing_override->mTextureTransform[0];
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+
+ if (existing_transform.mScale != default_transform.mScale ||
+ existing_transform.mOffset != default_transform.mOffset ||
+ existing_transform.mRotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from current PBR material
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ preserved_override->mTextureTransform[i].mScale = existing_transform.mScale;
+ preserved_override->mTextureTransform[i].mOffset = existing_transform.mOffset;
+ preserved_override->mTextureTransform[i].mRotation = existing_transform.mRotation;
+ }
+ should_preserve_transforms = true;
+ }
+ // If existing override has default transforms, don't preserve anything
+ }
+ else
+ {
+ // No existing PBR material override - check texture entry transforms
+ // This handles the case of switching from Blinn-Phong to PBR material
+ F32 existing_scale_s, existing_scale_t, existing_offset_s, existing_offset_t, existing_rotation;
+ tep->getScale(&existing_scale_s, &existing_scale_t);
+ tep->getOffset(&existing_offset_s, &existing_offset_t);
+ existing_rotation = tep->getRotation();
+
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+ if (existing_scale_s != default_transform.mScale.mV[0] || existing_scale_t != default_transform.mScale.mV[1] ||
+ existing_offset_s != default_transform.mOffset.mV[0] || existing_offset_t != default_transform.mOffset.mV[1] ||
+ existing_rotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from texture entry
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ LLVector2 pbr_scale, pbr_offset;
+ F32 pbr_rotation;
+ LLGLTFMaterial::convertTextureTransformToPBR(
+ existing_scale_s, existing_scale_t,
+ existing_offset_s, existing_offset_t,
+ existing_rotation,
+ pbr_scale, pbr_offset, pbr_rotation);
+ preserved_override->mTextureTransform[i].mScale = pbr_scale;
+ preserved_override->mTextureTransform[i].mOffset = pbr_offset;
+ preserved_override->mTextureTransform[i].mRotation = pbr_rotation;
+ }
+ should_preserve_transforms = true;
+ }
+ }
+ }
+
+ if (should_preserve_transforms && preserved_override)
+ {
+ // Apply material with preserved transforms
+ LLGLTFMaterialList::queueApply(hit_obj, hit_face, asset_id, preserved_override);
+ // Update local state
+ hit_obj->setRenderMaterialID(hit_face, asset_id, false, true);
+ tep->setGLTFMaterialOverride(preserved_override);
+ }
+ else
+ {
+ hit_obj->setRenderMaterialID(hit_face, asset_id);
+ }
dialog_refresh_all();
@@ -1347,7 +1431,134 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj,
asset_id = BLANK_MATERIAL_ASSET_ID;
}
- hit_obj->setRenderMaterialIDs(asset_id);
+ // Preserve existing texture transforms when switching to PBR material for all faces
+ std::vector> preserved_transforms(hit_obj->getNumTEs());
+
+ if (asset_id.notNull())
+ {
+ for (S32 te = 0; te < hit_obj->getNumTEs(); ++te)
+ {
+ LLTextureEntry* tep = hit_obj->getTE(te);
+ if (!tep) continue;
+
+ bool should_preserve = false;
+ LLGLTFMaterial* preserved_override = nullptr;
+
+ // Only preserve transforms from existing GLTF material override
+ // Do not fall back to texture entry transforms when switching between PBR materials
+ LLGLTFMaterial* existing_override = tep->getGLTFMaterialOverride();
+ if (existing_override)
+ {
+ // Check if existing override has non-default transforms
+ const LLGLTFMaterial::TextureTransform& existing_transform = existing_override->mTextureTransform[0];
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+
+ if (existing_transform.mScale != default_transform.mScale ||
+ existing_transform.mOffset != default_transform.mOffset ||
+ existing_transform.mRotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from current PBR material
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ preserved_override->mTextureTransform[i].mScale = existing_transform.mScale;
+ preserved_override->mTextureTransform[i].mOffset = existing_transform.mOffset;
+ preserved_override->mTextureTransform[i].mRotation = existing_transform.mRotation;
+ }
+ should_preserve = true;
+ }
+ else
+ {
+ // Existing override has default transforms, fall back to texture entry
+ F32 existing_scale_s, existing_scale_t, existing_offset_s, existing_offset_t, existing_rotation;
+ tep->getScale(&existing_scale_s, &existing_scale_t);
+ tep->getOffset(&existing_offset_s, &existing_offset_t);
+ existing_rotation = tep->getRotation();
+
+ if (existing_scale_s != default_transform.mScale.mV[0] || existing_scale_t != default_transform.mScale.mV[1] ||
+ existing_offset_s != default_transform.mOffset.mV[0] || existing_offset_t != default_transform.mOffset.mV[1] ||
+ existing_rotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from texture entry
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ LLVector2 pbr_scale, pbr_offset;
+ F32 pbr_rotation;
+ LLGLTFMaterial::convertTextureTransformToPBR(
+ existing_scale_s, existing_scale_t,
+ existing_offset_s, existing_offset_t,
+ existing_rotation,
+ pbr_scale, pbr_offset, pbr_rotation);
+ preserved_override->mTextureTransform[i].mScale = pbr_scale;
+ preserved_override->mTextureTransform[i].mOffset = pbr_offset;
+ preserved_override->mTextureTransform[i].mRotation = pbr_rotation;
+ }
+ should_preserve = true;
+ }
+ }
+ }
+ else
+ {
+ // No existing PBR material override - check texture entry transforms
+ // This handles the case of switching from Blinn-Phong to PBR material
+ F32 existing_scale_s, existing_scale_t, existing_offset_s, existing_offset_t, existing_rotation;
+ tep->getScale(&existing_scale_s, &existing_scale_t);
+ tep->getOffset(&existing_offset_s, &existing_offset_t);
+ existing_rotation = tep->getRotation();
+
+ const LLGLTFMaterial::TextureTransform& default_transform = LLGLTFMaterial::TextureTransform();
+ if (existing_scale_s != default_transform.mScale.mV[0] || existing_scale_t != default_transform.mScale.mV[1] ||
+ existing_offset_s != default_transform.mOffset.mV[0] || existing_offset_t != default_transform.mOffset.mV[1] ||
+ existing_rotation != default_transform.mRotation)
+ {
+ // Preserve non-default transforms from texture entry
+ preserved_override = new LLGLTFMaterial();
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ {
+ LLVector2 pbr_scale, pbr_offset;
+ F32 pbr_rotation;
+ LLGLTFMaterial::convertTextureTransformToPBR(
+ existing_scale_s, existing_scale_t,
+ existing_offset_s, existing_offset_t,
+ existing_rotation,
+ pbr_scale, pbr_offset, pbr_rotation);
+ preserved_override->mTextureTransform[i].mScale = pbr_scale;
+ preserved_override->mTextureTransform[i].mOffset = pbr_offset;
+ preserved_override->mTextureTransform[i].mRotation = pbr_rotation;
+ }
+ should_preserve = true;
+ }
+ }
+
+ preserved_transforms[te] = std::make_pair(should_preserve, preserved_override);
+ }
+ }
+
+ // Apply materials with preserved transforms
+ if (asset_id.notNull())
+ {
+ for (S32 te = 0; te < hit_obj->getNumTEs(); ++te)
+ {
+ LLGLTFMaterial* preserved_override = preserved_transforms[te].second;
+ if (preserved_override)
+ {
+ // Apply material with preserved transforms
+ LLGLTFMaterialList::queueApply(hit_obj, te, asset_id, preserved_override);
+ // Update local state
+ hit_obj->setRenderMaterialID(te, asset_id, false, true);
+ hit_obj->getTE(te)->setGLTFMaterialOverride(preserved_override);
+ }
+ else
+ {
+ hit_obj->setRenderMaterialID(te, asset_id, false, true);
+ }
+ }
+ }
+ else
+ {
+ hit_obj->setRenderMaterialIDs(asset_id);
+ }
dialog_refresh_all();
// send the update to the simulator
hit_obj->sendTEUpdate();
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 80c9ef871a..7f813d0b85 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -940,7 +940,23 @@ class LLFileUploadModel : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- LLFloaterModelPreview::showModelPreview();
+ if (LLConvexDecomposition::isFunctional())
+ {
+ LLFloaterModelPreview::showModelPreview();
+ }
+ else
+ {
+ if (gGLManager.mIsApple)
+ {
+ LLNotificationsUtil::add("ModelUploaderMissingPhysicsApple");
+ }
+ else
+ {
+ // TPV?
+ LLNotificationsUtil::add("ModelUploaderMissingPhysics");
+ LLFloaterModelPreview::showModelPreview();
+ }
+ }
return true;
}
};
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 61629d2c91..416f4b1e3a 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -5259,11 +5259,10 @@ void LLViewerObject::setNumTEs(const U8 num_tes)
if (base_material && override_material)
{
tep->setGLTFMaterialOverride(new LLGLTFMaterial(*override_material));
-
- LLGLTFMaterial* render_material = new LLFetchedGLTFMaterial();
- *render_material = *base_material;
- render_material->applyOverride(*override_material);
- tep->setGLTFRenderMaterial(render_material);
+ }
+ if (base_material)
+ {
+ initRenderMaterial(i);
}
}
}
@@ -5449,6 +5448,9 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
});
}
getTE(te)->setGLTFMaterial(mat);
+ initRenderMaterial(te);
+ mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial();
+ llassert(mat == nullptr || dynamic_cast(getTE(te)->getGLTFRenderMaterial()) != nullptr);
}
else if (mat_id.isNull() && mat != nullptr)
{
@@ -5838,6 +5840,42 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
return retval;
}
+// Set render material if there are overrides or if the base material is has a
+// baked texture. Otherwise, set it to null.
+// If you are setting the material override and not sending an update message,
+// you should probably call this function.
+S32 LLViewerObject::initRenderMaterial(U8 te)
+{
+ LL_PROFILE_ZONE_SCOPED;
+
+ LLTextureEntry* tep = getTE(te);
+ if (!tep) { return 0; }
+ const LLFetchedGLTFMaterial* base_material = static_cast(tep->getGLTFMaterial());
+ llassert(base_material);
+ if (!base_material) { return 0; }
+ const LLGLTFMaterial* override_material = tep->getGLTFMaterialOverride();
+ LLFetchedGLTFMaterial* render_material = nullptr;
+ bool need_render_material = override_material;
+ if (!need_render_material)
+ {
+ for (const LLUUID& texture_id : base_material->mTextureId)
+ {
+ if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(texture_id))
+ {
+ need_render_material = true;
+ break;
+ }
+ }
+ }
+ if (need_render_material)
+ {
+ render_material = new LLFetchedGLTFMaterial(*base_material);
+ if (override_material) { render_material->applyOverride(*override_material); }
+ render_material->clearFetchedTextures();
+ }
+ return tep->setGLTFRenderMaterial(render_material);
+}
+
S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_mat)
{
LL_PROFILE_ZONE_SCOPED;
@@ -5871,22 +5909,13 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma
if (retval)
{
+ retval = initRenderMaterial(te) | retval;
if (override_mat)
{
- LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat);
- render_mat->applyOverride(*override_mat);
- tep->setGLTFRenderMaterial(render_mat);
- retval = TEM_CHANGE_TEXTURE;
-
for (LLGLTFMaterial::local_tex_map_t::value_type &val : override_mat->mTrackingIdToLocalTexture)
{
LLLocalBitmapMgr::getInstance()->associateGLTFMaterial(val.first, override_mat);
}
-
- }
- else if (tep->setGLTFRenderMaterial(nullptr))
- {
- retval = TEM_CHANGE_TEXTURE;
}
}
@@ -7824,26 +7853,16 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat
// the overrides have not changed due to being only texture
// transforms. Re-apply the overrides to the render material here,
// if present.
- const LLGLTFMaterial* override_material = tep->getGLTFMaterialOverride();
- if (override_material)
+ // Also, sometimes, the material has baked textures, which requires
+ // a copy unique to this object.
+ // Currently, we do not deduplicate render materials.
+ new_material->onMaterialComplete([obj_id = getID(), te]()
{
- new_material->onMaterialComplete([obj_id = getID(), te]()
- {
- LLViewerObject* obj = gObjectList.findObject(obj_id);
- if (!obj) { return; }
- LLTextureEntry* tep = obj->getTE(te);
- if (!tep) { return; }
- const LLGLTFMaterial* new_material = tep->getGLTFMaterial();
- if (!new_material) { return; }
- const LLGLTFMaterial* override_material = tep->getGLTFMaterialOverride();
- if (!override_material) { return; }
- LLGLTFMaterial* render_material = new LLFetchedGLTFMaterial();
- *render_material = *new_material;
- render_material->applyOverride(*override_material);
- tep->setGLTFRenderMaterial(render_material);
- });
+ LLViewerObject* obj = gObjectList.findObject(obj_id);
+ if (!obj) { return; }
+ obj->initRenderMaterial(te);
+ });
}
- }
// [FIRE-35138] Update the saved GLTF material since we got an update
if (material_changed)
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 11af8de290..e94b0e8cb9 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -413,6 +413,7 @@ public:
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
/*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
+ S32 initRenderMaterial(const U8 te);
virtual S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* mat);
// Used by Materials update functions to properly kick off rebuilds
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 151b90b4c8..c072c9fb81 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2039,7 +2039,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
p.ignore_pixel_depth,
0,
max_core_count,
- max_gl_version, //don't use window level anti-aliasing
+ max_gl_version, //don't use window level anti-aliasing, windows only
useLegacyCursors); // Legacy cursor setting from main program
if (NULL == mWindow)
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 8ef59f1047..dda573c844 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -291,9 +291,8 @@ void LLWebRTCVoiceClient::terminate()
LL_INFOS("Voice") << "Terminating WebRTC" << LL_ENDL;
mVoiceEnabled = false;
+ sShuttingDown = true; // so that coroutines won't post more work.
llwebrtc::terminate();
-
- sShuttingDown = true;
}
//---------------------------------------------------
@@ -2669,6 +2668,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
void LLVoiceWebRTCSpatialConnection::requestVoiceConnection()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
+ if (LLWebRTCVoiceClient::isShuttingDown())
+ {
+ mOutstandingRequests--;
+ return;
+ }
LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID);
@@ -3276,6 +3280,12 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE;
+ if (LLWebRTCVoiceClient::isShuttingDown())
+ {
+ mOutstandingRequests--;
+ return;
+ }
+
LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID);
LL_DEBUGS("Voice") << "Requesting voice connection." << LL_ENDL;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index f033f1c119..d377132220 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -7088,7 +7088,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
&& te->getShiny()
&& can_be_shiny)
{ //shiny
- if (tex && tex->getPrimaryFormat() == GL_ALPHA) // [FIRE-34534] guard additional cases of tex == null
+ if (tex && tex->getPrimaryFormat() == GL_ALPHA)
{ //invisiprim+shiny
if (!facep->getViewerObject()->isAttachment() && !facep->getViewerObject()->isRiggedMesh())
{
@@ -7128,7 +7128,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
else
{ //not alpha and not shiny
- if (!is_alpha && tex && tex->getPrimaryFormat() == GL_ALPHA) // FIRE-34540 bugsplat crash caused by tex==nullptr. This stops the crash, but should we continue and leave the face unregistered instead of falling through?
+ if (!is_alpha && tex && tex->getPrimaryFormat() == GL_ALPHA)
{ //invisiprim
if (!facep->getViewerObject()->isAttachment() && !facep->getViewerObject()->isRiggedMesh())
{
diff --git a/indra/newview/skins/default/xui/az/floater_model_preview.xml b/indra/newview/skins/default/xui/az/floater_model_preview.xml
index ade7698b3c..786b5aa416 100644
--- a/indra/newview/skins/default/xui/az/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/az/floater_model_preview.xml
@@ -136,7 +136,7 @@
-
+
Addım 2. Analiz
Üsul:
Keyfiyyət:
diff --git a/indra/newview/skins/default/xui/da/floater_model_preview.xml b/indra/newview/skins/default/xui/da/floater_model_preview.xml
index 5c89ef2919..4a1fa9ac6d 100644
--- a/indra/newview/skins/default/xui/da/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/da/floater_model_preview.xml
@@ -191,7 +191,7 @@
-
+
diff --git a/indra/newview/skins/default/xui/de/floater_marketplace.xml b/indra/newview/skins/default/xui/de/floater_marketplace.xml
new file mode 100644
index 0000000000..a7ab7144a2
--- /dev/null
+++ b/indra/newview/skins/default/xui/de/floater_marketplace.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indra/newview/skins/default/xui/de/floater_model_preview.xml b/indra/newview/skins/default/xui/de/floater_model_preview.xml
index f34a5f2f80..8221d391f0 100644
--- a/indra/newview/skins/default/xui/de/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/de/floater_model_preview.xml
@@ -282,7 +282,7 @@
-
+
Schritt 2: Zu Hüllen konvertieren (optional)
@@ -299,6 +299,28 @@
+
+
+ Schritt 2: Zu Hüllen konvertieren (optional)
+
+
+ Füllmodus:
+
+
+ Aufösung:
+
+
+ Hüllen pro Mesh:
+
+
+ Kanten pro Mesh:
+
+
+ Fehlertoleranz:
+
+
+
+
Schritt 3: Vereinfachen
diff --git a/indra/newview/skins/default/xui/de/floater_search.xml b/indra/newview/skins/default/xui/de/floater_search.xml
index aa35ef2e71..1a1ecbc30e 100644
--- a/indra/newview/skins/default/xui/de/floater_search.xml
+++ b/indra/newview/skins/default/xui/de/floater_search.xml
@@ -1,2 +1,14 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml
index 838632e864..bf290baeed 100644
--- a/indra/newview/skins/default/xui/de/notifications.xml
+++ b/indra/newview/skins/default/xui/de/notifications.xml
@@ -881,6 +881,14 @@ Erwartet wurde [VALIDS]
Sounddatei konnte nicht hochgeladen werden:
[FILE]
+
+ Das Hochladen von Modellen wird derzeit auf Apple Silicon-Systemen nicht verfügbar, wird jedoch in einem späteren Release unterstützt.
+
+Workaround: Im Finder auf die [APP_NAME] App rechtsklicken, dann "Info anzeigen" wählen und anschließend "Mit Rosette öffnen" aktivieren.
+
+
+ Physik-Bibliothek ist nicht vorhanden - einzelne Funktionen für das Hochladen des Modells funktionieren möglicherweise nicht oder nicht korrekt.
+
Die Datei ist anscheinend keine RIFF WAVE-Datei:
[FILE]
diff --git a/indra/newview/skins/default/xui/en/floater_marketplace.xml b/indra/newview/skins/default/xui/en/floater_marketplace.xml
index 60247f076e..b3bea48600 100644
--- a/indra/newview/skins/default/xui/en/floater_marketplace.xml
+++ b/indra/newview/skins/default/xui/en/floater_marketplace.xml
@@ -1,26 +1,201 @@
-
+ legacy_header_height="18"
+ can_minimize="true"
+ can_close="true"
+ can_resize="true"
+ height="775"
+ layout="topleft"
+ min_height="500"
+ min_width="600"
+ name="Marketplace"
+ save_rect="true"
+ single_instance="true"
+ save_visibility="true"
+ title="Marketplace"
+ tab_stop="true"
+ width="780">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
index 5b5fb300b8..e8cecbc739 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -45,7 +45,7 @@
Simplifying...
TBD
One or more textures in this model were scaled to be within the allowed limits.
-
+
Skinning disabled due to too many joints: [JOINTS], maximum: [MAX]
Rigged to unrecognized joint name [NAME]
@@ -831,7 +831,7 @@
help_topic="upload_model_physics"
label="Physics"
name="physics_panel">
-
+
-->
-
+
-
+
+
+ Step 2: Convert to hulls (optional)
+
+
+ Fill Mode:
+
+
+ Resolution:
+
+
+ Hulls per Mesh:
+
+
+ Vertices per hull:
+
+
+ Error tolerance:
+
+
+
+
+
+
+
+
+
+
+ width="589"
+ visible="false">
-
+
-
-
+
ステップ2:分析
diff --git a/indra/newview/skins/default/xui/pl/floater_model_preview.xml b/indra/newview/skins/default/xui/pl/floater_model_preview.xml
index 5814763e75..3c1a998e14 100644
--- a/indra/newview/skins/default/xui/pl/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_model_preview.xml
@@ -158,7 +158,7 @@
-
+
Krok 2: Konwersja na powłoki (opcjonalne)
diff --git a/indra/newview/skins/default/xui/pt/floater_model_preview.xml b/indra/newview/skins/default/xui/pt/floater_model_preview.xml
index 94c7d38bfa..995766bc33 100644
--- a/indra/newview/skins/default/xui/pt/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/pt/floater_model_preview.xml
@@ -179,7 +179,7 @@
-
+
Etapa 2: Analisar
diff --git a/indra/newview/skins/default/xui/ru/floater_model_preview.xml b/indra/newview/skins/default/xui/ru/floater_model_preview.xml
index bb54e2582b..c22503d314 100644
--- a/indra/newview/skins/default/xui/ru/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/ru/floater_model_preview.xml
@@ -139,7 +139,7 @@
-
+
2 этап. Анализ
Метод:
Качество:
diff --git a/indra/newview/skins/default/xui/tr/floater_model_preview.xml b/indra/newview/skins/default/xui/tr/floater_model_preview.xml
index 0429ba05ad..49ed89ece2 100644
--- a/indra/newview/skins/default/xui/tr/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/tr/floater_model_preview.xml
@@ -179,7 +179,7 @@
-
+
2. Adım: Çözümle
diff --git a/indra/newview/skins/default/xui/zh/floater_model_preview.xml b/indra/newview/skins/default/xui/zh/floater_model_preview.xml
index 3cbb26fb9b..7d012dfd12 100644
--- a/indra/newview/skins/default/xui/zh/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/zh/floater_model_preview.xml
@@ -341,7 +341,7 @@
-
+
步驟 2:分析