diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 3f40170d2a..5465035c58 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 76ef88b440..b191dbc9e8 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) {