summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-03-25 15:50:47 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-03-26 23:09:26 +0200
commitaa892d2c35d1f03ad49aceba0f89f0ab3d40c315 (patch)
tree9aa4eeef1eb60fd131d23e7fe1a63b15d9e55a30
parenteeb43b604ccb3348907bd06c0135e7824879fe57 (diff)
viewer#1016 Incorrect behavior of Physics Shapes rendering
-rw-r--r--indra/newview/llphysicsshapebuilderutil.cpp53
-rw-r--r--indra/newview/llphysicsshapebuilderutil.h2
2 files changed, 45 insertions, 10 deletions
diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp
index 9603ee6329..a79cc984c1 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 b3b100296f..24e68fcf77 100644
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -78,6 +78,8 @@ public:
bool shouldForceConvex() const { return mForceConvex; }
+ bool hasDecomposition() const;
+
private:
bool mForceConvex;
};