aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
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/ODEMeshWorker.cs
parentubOde remove ols pseudo convex for sculpts (diff)
downloadopensim-SC-d71d13f72be9a342869406aae4139f38e01ef05f.zip
opensim-SC-d71d13f72be9a342869406aae4139f38e01ef05f.tar.gz
opensim-SC-d71d13f72be9a342869406aae4139f38e01ef05f.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs28
1 files changed, 20 insertions, 8 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;