aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde
diff options
context:
space:
mode:
authorUbitUmarov2017-07-22 01:31:39 +0100
committerUbitUmarov2017-07-22 01:31:39 +0100
commitd71d13f72be9a342869406aae4139f38e01ef05f (patch)
tree2fff4283d477dc6eefbc142102df0cd9b1cbb26f /OpenSim/Region/PhysicsModules/ubOde
parentubOde remove ols pseudo convex for sculpts (diff)
downloadopensim-SC_OLD-d71d13f72be9a342869406aae4139f38e01ef05f.zip
opensim-SC_OLD-d71d13f72be9a342869406aae4139f38e01ef05f.tar.gz
opensim-SC_OLD-d71d13f72be9a342869406aae4139f38e01ef05f.tar.bz2
opensim-SC_OLD-d71d13f72be9a342869406aae4139f38e01ef05f.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs28
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs10
2 files changed, 25 insertions, 13 deletions
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
62 public byte shapetype; 62 public byte shapetype;
63 public bool hasOBB; 63 public bool hasOBB;
64 public bool hasMeshVolume; 64 public bool hasMeshVolume;
65 public bool isTooSmall;
65 public MeshState meshState; 66 public MeshState meshState;
66 public UUID? assetID; 67 public UUID? assetID;
67 public meshWorkerCmnds comand; 68 public meshWorkerCmnds comand;
@@ -69,16 +70,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
69 70
70 public class ODEMeshWorker 71 public class ODEMeshWorker
71 { 72 {
72
73 private ILog m_log; 73 private ILog m_log;
74 private ODEScene m_scene; 74 private ODEScene m_scene;
75 private IMesher m_mesher; 75 private IMesher m_mesher;
76 76
77 public bool meshSculptedPrim = true; 77 public bool meshSculptedPrim = true;
78 public bool forceSimplePrimMeshing = false;
79 public float meshSculptLOD = 32; 78 public float meshSculptLOD = 32;
80 public float MeshSculptphysicalLOD = 32; 79 public float MeshSculptphysicalLOD = 32;
81 80 public float MinSizeToMeshmerize = 0.1f;
82 81
83 private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>(); 82 private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>();
84 private bool m_running; 83 private bool m_running;
@@ -93,9 +92,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
93 92
94 if (pConfig != null) 93 if (pConfig != null)
95 { 94 {
96 forceSimplePrimMeshing = pConfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing);
97 meshSculptedPrim = pConfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim); 95 meshSculptedPrim = pConfig.GetBoolean("mesh_sculpted_prim", meshSculptedPrim);
98 meshSculptLOD = pConfig.GetFloat("mesh_lod", meshSculptLOD); 96 meshSculptLOD = pConfig.GetFloat("mesh_lod", meshSculptLOD);
97 MinSizeToMeshmerize = pConfig.GetFloat("mesh_min_size", MinSizeToMeshmerize);
99 MeshSculptphysicalLOD = pConfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD); 98 MeshSculptphysicalLOD = pConfig.GetFloat("mesh_physical_lod", MeshSculptphysicalLOD);
100 } 99 }
101 m_running = true; 100 m_running = true;
@@ -288,6 +287,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
288 { 287 {
289 PrimitiveBaseShape pbs = repData.pbs; 288 PrimitiveBaseShape pbs = repData.pbs;
290 // check sculpts or meshs 289 // check sculpts or meshs
290
291 Vector3 scale = pbs.Scale;
292 if(scale.X <= MinSizeToMeshmerize &&
293 scale.Y <= MinSizeToMeshmerize &&
294 scale.Z <= MinSizeToMeshmerize)
295 {
296 repData.isTooSmall = true;
297 return false;
298 }
299
291 if (pbs.SculptEntry) 300 if (pbs.SculptEntry)
292 { 301 {
293 if (meshSculptedPrim) 302 if (meshSculptedPrim)
@@ -299,9 +308,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
299 return false; 308 return false;
300 } 309 }
301 310
302 if (forceSimplePrimMeshing)
303 return true;
304
305 // convex shapes have no holes 311 // convex shapes have no holes
306 ushort profilehollow = pbs.ProfileHollow; 312 ushort profilehollow = pbs.ProfileHollow;
307 if(repData.shapetype == 2) 313 if(repData.shapetype == 2)
@@ -554,10 +560,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
554 560
555 private void CalculateBasicPrimVolume(ODEPhysRepData repData) 561 private void CalculateBasicPrimVolume(ODEPhysRepData repData)
556 { 562 {
557 PrimitiveBaseShape _pbs = repData.pbs;
558 Vector3 _size = repData.size; 563 Vector3 _size = repData.size;
559 564
560 float volume = _size.X * _size.Y * _size.Z; // default 565 float volume = _size.X * _size.Y * _size.Z; // default
566 if(repData.isTooSmall)
567 {
568 repData.volume = volume;
569 return;
570 }
571
572 PrimitiveBaseShape _pbs = repData.pbs;
561 float tmp; 573 float tmp;
562 574
563 float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; 575 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
1733 return true; 1733 return true;
1734 } 1734 }
1735 1735
1736 private void CreateGeom() 1736 private void CreateGeom(bool OverrideToBox)
1737 { 1737 {
1738 bool hasMesh = false; 1738 bool hasMesh = false;
1739 1739
@@ -1742,7 +1742,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1742 if ((m_meshState & MeshState.MeshNoColide) != 0) 1742 if ((m_meshState & MeshState.MeshNoColide) != 0)
1743 m_NoColide = true; 1743 m_NoColide = true;
1744 1744
1745 else if(m_mesh != null) 1745 else if(!OverrideToBox && m_mesh != null)
1746 { 1746 {
1747 if (GetMeshGeom()) 1747 if (GetMeshGeom())
1748 hasMesh = true; 1748 hasMesh = true;
@@ -1755,7 +1755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1755 { 1755 {
1756 IntPtr geo = IntPtr.Zero; 1756 IntPtr geo = IntPtr.Zero;
1757 1757
1758 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 1758 if (!OverrideToBox && _pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1
1759 && _size.X == _size.Y && _size.Y == _size.Z) 1759 && _size.X == _size.Y && _size.Y == _size.Z)
1760 { // it's a sphere 1760 { // it's a sphere
1761 try 1761 try
@@ -3180,7 +3180,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3180 3180
3181 primVolume = repData.volume; 3181 primVolume = repData.volume;
3182 3182
3183 CreateGeom(); 3183 CreateGeom(repData.isTooSmall);
3184 3184
3185 if (prim_geom != IntPtr.Zero) 3185 if (prim_geom != IntPtr.Zero)
3186 { 3186 {
@@ -3256,7 +3256,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3256 3256
3257 primVolume = repData.volume; 3257 primVolume = repData.volume;
3258 3258
3259 CreateGeom(); 3259 CreateGeom(repData.isTooSmall);
3260 3260
3261 if (prim_geom != IntPtr.Zero) 3261 if (prim_geom != IntPtr.Zero)
3262 { 3262 {