summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-09-18 13:44:22 -0700
committerGitHub <noreply@github.com>2024-09-18 13:44:22 -0700
commit1dcbae822d4b3dfae43e8d6c6a512773e83b588d (patch)
tree074f1d178192e4f8907b2f6d226c9c7359e2fbec
parentb31fd167c00a288656ea82d239a9ce379f382c22 (diff)
parent9890b5b2e7f24a8ad52456d80ddfec0e4e505d96 (diff)
Merge pull request #2600 from secondlife/brad/1016-cherry-pick
cherry-pick viewer#1016 Incorrect behavior of Physics Shapes rendering
-rw-r--r--.git-blame-ignore-revs2
-rw-r--r--indra/newview/llphysicsshapebuilderutil.cpp53
-rw-r--r--indra/newview/llphysicsshapebuilderutil.h2
3 files changed, 47 insertions, 10 deletions
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 0851d20be0..e06ef89a99 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -9,3 +9,5 @@ a0b3021bdcf76859054fda8e30abb3ed47749e83
1b67dd855c41f5a0cda7ec2a68d98071986ca703
6cc7dd09d5e69cf57e6de7fb568a0ad2693f9c9a
e2e37cced861b98de8c1a7c9c0d3a50d2d90e433
+# multiple problems
+5370a6d323e14d7b4e32a3f41ef78f7744e361c5
diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp
index 37534feadc..eb0df1194e 100644
--- a/indra/newview/llphysicsshapebuilderutil.cpp
+++ b/indra/newview/llphysicsshapebuilderutil.cpp
@@ -28,6 +28,26 @@
#include "llphysicsshapebuilderutil.h"
+#include "llmeshrepository.h"
+
+bool LLPhysicsVolumeParams::hasDecomposition() const
+ {
+ if (!isMeshSculpt())
+ {
+ return false;
+ }
+
+ LLUUID mesh_id = getSculptID();
+ if (mesh_id.isNull())
+ {
+ return false;
+ }
+
+ LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
+
+ return decomp != NULL;
+}
+
/* static */
void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut)
{
@@ -200,19 +220,32 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara
{
specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
}
- else if (volume_params.isMeshSculpt() &&
- // Check overall dimensions, not individual triangles.
- (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
- scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
- scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
- ) )
+ else if (volume_params.isMeshSculpt())
{
- // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
- specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ // Check overall dimensions, not individual triangles.
+ if (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ || scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ || scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ )
+ {
+ if (volume_params.hasDecomposition())
+ {
+ specOut.mType = PhysicsShapeSpecification::USER_MESH;
+ }
+ else
+ {
+ // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
+ specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ }
+ }
+ else
+ {
+ specOut.mType = PhysicsShapeSpecification::USER_MESH;
+ }
}
- else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy)
+ else if ( volume_params.isSculpt() )
{
- specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT;
+ specOut.mType = PhysicsShapeSpecification::SCULPT;
}
else // Resort to mesh
{
diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h
index 33c2d0a8b6..01c173523b 100644
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -79,6 +79,8 @@ public:
bool shouldForceConvex() const { return mForceConvex; }
+ bool hasDecomposition() const;
+
private:
bool mForceConvex;
};