From 98c64f1aa9b8d824b9cf5921632ef784a3c5be1f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Jul 2017 00:00:46 +0100 Subject: ubOde remove ols pseudo convex for sculpts --- OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/ubOde') diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index dc87a78..3f40170 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs @@ -425,17 +425,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde Vector3 size = repData.size; int clod = (int)LevelOfDetail.High; - bool convex; byte shapetype = repData.shapetype; - if (shapetype == 0) - convex = false; - else - { - convex = true; - // sculpts pseudo convex - if (pbs.SculptEntry && pbs.SculptType != (byte)SculptType.Mesh) - clod = (int)LevelOfDetail.Low; - } + bool convex = shapetype == 2; mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex); -- cgit v1.1 From d71d13f72be9a342869406aae4139f38e01ef05f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Jul 2017 01:31:39 +0100 Subject: ubOde: represent small objects as a box. A object is small is all scale dimensions are less or equal to option MinSizeToMeshmerize (in ODEPhysicsSettings) with default of 0.1. This is needed because this objects hit narrow phase with high overlaps alot more, and so have high cpu cost. --- .../Region/PhysicsModules/ubOde/ODEMeshWorker.cs | 28 +++++++++++++++------- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 10 ++++---- 2 files changed, 25 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/ubOde') diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 3f40170..5465035 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs @@ -62,6 +62,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public byte shapetype; public bool hasOBB; public bool hasMeshVolume; + public bool isTooSmall; public MeshState meshState; public UUID? assetID; public meshWorkerCmnds comand; @@ -69,16 +70,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde public class ODEMeshWorker { - private ILog m_log; private ODEScene m_scene; private IMesher m_mesher; public bool meshSculptedPrim = true; - public bool forceSimplePrimMeshing = false; public float meshSculptLOD = 32; public float MeshSculptphysicalLOD = 32; - + public float MinSizeToMeshmerize = 0.1f; private OpenSim.Framework.BlockingQueue workQueue = new OpenSim.Framework.BlockingQueue(); private bool m_running; @@ -93,9 +92,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (pConfig != null) { - forceSimplePrimMeshing = pConfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); meshSculptedPrim = pConfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); meshSculptLOD = pConfig.GetFloat("mesh_lod", meshSculptLOD); + MinSizeToMeshmerize = pConfig.GetFloat("mesh_min_size", MinSizeToMeshmerize); MeshSculptphysicalLOD = pConfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); } m_running = true; @@ -288,6 +287,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde { PrimitiveBaseShape pbs = repData.pbs; // check sculpts or meshs + + Vector3 scale = pbs.Scale; + if(scale.X <= MinSizeToMeshmerize && + scale.Y <= MinSizeToMeshmerize && + scale.Z <= MinSizeToMeshmerize) + { + repData.isTooSmall = true; + return false; + } + if (pbs.SculptEntry) { if (meshSculptedPrim) @@ -299,9 +308,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde return false; } - if (forceSimplePrimMeshing) - return true; - // convex shapes have no holes ushort profilehollow = pbs.ProfileHollow; if(repData.shapetype == 2) @@ -554,10 +560,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void CalculateBasicPrimVolume(ODEPhysRepData repData) { - PrimitiveBaseShape _pbs = repData.pbs; Vector3 _size = repData.size; float volume = _size.X * _size.Y * _size.Z; // default + if(repData.isTooSmall) + { + repData.volume = volume; + return; + } + + PrimitiveBaseShape _pbs = repData.pbs; float tmp; float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 76ef88b..b191dbc 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -1733,7 +1733,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - private void CreateGeom() + private void CreateGeom(bool OverrideToBox) { bool hasMesh = false; @@ -1742,7 +1742,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if ((m_meshState & MeshState.MeshNoColide) != 0) m_NoColide = true; - else if(m_mesh != null) + else if(!OverrideToBox && m_mesh != null) { if (GetMeshGeom()) hasMesh = true; @@ -1755,7 +1755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { IntPtr geo = IntPtr.Zero; - if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 + if (!OverrideToBox && _pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 && _size.X == _size.Y && _size.Y == _size.Z) { // it's a sphere try @@ -3180,7 +3180,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde primVolume = repData.volume; - CreateGeom(); + CreateGeom(repData.isTooSmall); if (prim_geom != IntPtr.Zero) { @@ -3256,7 +3256,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde primVolume = repData.volume; - CreateGeom(); + CreateGeom(repData.isTooSmall); if (prim_geom != IntPtr.Zero) { -- cgit v1.1 From 3ae210d36f22b139b082fd6a691cf7f89df2d8f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Jul 2017 02:04:02 +0100 Subject: ubOde: let small spheres still be spheres --- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/PhysicsModules/ubOde') diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index b191dbc..aa208e2 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -1755,7 +1755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { IntPtr geo = IntPtr.Zero; - if (!OverrideToBox && _pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 + if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 && _size.X == _size.Y && _size.Y == _size.Z) { // it's a sphere try -- cgit v1.1