aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs39
1 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
index dc87a78..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)
@@ -425,17 +431,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
425 Vector3 size = repData.size; 431 Vector3 size = repData.size;
426 432
427 int clod = (int)LevelOfDetail.High; 433 int clod = (int)LevelOfDetail.High;
428 bool convex;
429 byte shapetype = repData.shapetype; 434 byte shapetype = repData.shapetype;
430 if (shapetype == 0) 435 bool convex = shapetype == 2;
431 convex = false;
432 else
433 {
434 convex = true;
435 // sculpts pseudo convex
436 if (pbs.SculptEntry && pbs.SculptType != (byte)SculptType.Mesh)
437 clod = (int)LevelOfDetail.Low;
438 }
439 436
440 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex); 437 mesh = m_mesher.GetMesh(actor.Name, pbs, size, clod, true, convex);
441 438
@@ -563,10 +560,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
563 560
564 private void CalculateBasicPrimVolume(ODEPhysRepData repData) 561 private void CalculateBasicPrimVolume(ODEPhysRepData repData)
565 { 562 {
566 PrimitiveBaseShape _pbs = repData.pbs;
567 Vector3 _size = repData.size; 563 Vector3 _size = repData.size;
568 564
569 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;
570 float tmp; 573 float tmp;
571 574
572 float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; 575 float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f;