aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/ZeroMesher.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs1
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs3
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs26
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs16
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs2
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs1
9 files changed, 45 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 5b743e8..8de70ef 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -2190,7 +2190,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2190 convex = false; 2190 convex = false;
2191 try 2191 try
2192 { 2192 {
2193 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,convex); 2193 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,convex,false);
2194 } 2194 }
2195 catch 2195 catch
2196 { 2196 {
@@ -2557,7 +2557,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2557 2557
2558 try 2558 try
2559 { 2559 {
2560 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, convex); 2560 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, convex,false);
2561 } 2561 }
2562 catch 2562 catch
2563 { 2563 {
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index 460b48e..fdba6ee 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.Physics.Manager
37 { 37 {
38 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod); 38 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
39 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical); 39 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
40 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex); 40 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde);
41 IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex); 41 IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex);
42 void ReleaseMesh(IMesh mesh); 42 void ReleaseMesh(IMesh mesh);
43 void ExpireReleaseMeshs(); 43 void ExpireReleaseMeshs();
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
index 61da9f3..1411165 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Physics.Manager
67 return CreateMesh(primName, primShape, size, lod, false); 67 return CreateMesh(primName, primShape, size, lod, false);
68 } 68 }
69 69
70 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) 70 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex,bool forOde)
71 { 71 {
72 return CreateMesh(primName, primShape, size, lod, false); 72 return CreateMesh(primName, primShape, size, lod, false);
73 } 73 }
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index c03f18b..6970553 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -259,6 +259,7 @@ namespace OpenSim.Region.Physics.Meshing
259 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount) 259 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount)
260 { 260 {
261 // A vertex is 3 floats 261 // A vertex is 3 floats
262
262 vertexStride = 3 * sizeof(float); 263 vertexStride = 3 * sizeof(float);
263 264
264 // If there isn't an unmanaged array allocated yet, do it now 265 // If there isn't an unmanaged array allocated yet, do it now
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index b462713..fd4ac7f 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -702,10 +702,11 @@ namespace OpenSim.Region.Physics.Meshing
702 return CreateMesh(primName, primShape, size, lod, false); 702 return CreateMesh(primName, primShape, size, lod, false);
703 } 703 }
704 704
705 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) 705 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde)
706 { 706 {
707 return CreateMesh(primName, primShape, size, lod, false); 707 return CreateMesh(primName, primShape, size, lod, false);
708 } 708 }
709
709 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) 710 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
710 { 711 {
711#if SPAM 712#if SPAM
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
index c31ec08..a0a18c4 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
@@ -315,6 +315,32 @@ namespace OpenSim.Region.Physics.Meshing
315 return result; 315 return result;
316 } 316 }
317 317
318 public void PrepForOde()
319 {
320 // If there isn't an unmanaged array allocated yet, do it now
321 if (m_verticesPtr == IntPtr.Zero)
322 {
323 float[] vertexList = getVertexListAsFloat();
324 // Each vertex is 3 elements (floats)
325 m_vertexCount = vertexList.Length / 3;
326 int byteCount = m_vertexCount * 3 * sizeof(float);
327 m_verticesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount);
328 System.Runtime.InteropServices.Marshal.Copy(vertexList, 0, m_verticesPtr, m_vertexCount * 3);
329 }
330
331 // If there isn't an unmanaged array allocated yet, do it now
332 if (m_indicesPtr == IntPtr.Zero)
333 {
334 int[] indexList = getIndexListAsInt();
335 m_indexCount = indexList.Length;
336 int byteCount = m_indexCount * sizeof(int);
337 m_indicesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount);
338 System.Runtime.InteropServices.Marshal.Copy(indexList, 0, m_indicesPtr, m_indexCount);
339 }
340
341 releaseSourceMeshData();
342 }
343
318 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount) 344 public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount)
319 { 345 {
320 // A vertex is 3 floats 346 // A vertex is 3 floats
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
index fabadd3..dec5eb7 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
@@ -993,12 +993,12 @@ namespace OpenSim.Region.Physics.Meshing
993 993
994 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 994 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
995 { 995 {
996 return CreateMesh(primName, primShape, size, lod, false,false); 996 return CreateMesh(primName, primShape, size, lod, false,false,false);
997 } 997 }
998 998
999 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) 999 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
1000 { 1000 {
1001 return CreateMesh(primName, primShape, size, lod, false,false); 1001 return CreateMesh(primName, primShape, size, lod, false,false,false);
1002 } 1002 }
1003 1003
1004 private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f); 1004 private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f);
@@ -1039,7 +1039,7 @@ namespace OpenSim.Region.Physics.Meshing
1039 return null; 1039 return null;
1040 } 1040 }
1041 1041
1042 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) 1042 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde)
1043 { 1043 {
1044#if SPAM 1044#if SPAM
1045 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); 1045 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
@@ -1094,8 +1094,14 @@ namespace OpenSim.Region.Physics.Meshing
1094 mesh.DumpRaw(baseDir, primName, "Z extruded"); 1094 mesh.DumpRaw(baseDir, primName, "Z extruded");
1095 } 1095 }
1096 1096
1097 // trim the vertex and triangle lists to free up memory 1097 if (forOde)
1098 mesh.TrimExcess(); 1098 {
1099 // force pinned mem allocation
1100 mesh.PrepForOde();
1101 }
1102 else
1103 mesh.TrimExcess();
1104
1099 mesh.Key = key; 1105 mesh.Key = key;
1100 mesh.RefCount = 1; 1106 mesh.RefCount = 1;
1101 1107
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
index 024835c..24f76d62 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
@@ -518,7 +518,7 @@ namespace OpenSim.Region.Physics.OdePlugin
518 } 518 }
519 } 519 }
520 520
521 mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex); 521 mesh = m_mesher.CreateMesh(actor.Name, pbs, size, clod, true, convex,true);
522 } 522 }
523 523
524 repData.mesh = mesh; 524 repData.mesh = mesh;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index fc59180..d993f22 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -1384,7 +1384,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1384 IntPtr vertices, indices; 1384 IntPtr vertices, indices;
1385 int vertexCount, indexCount; 1385 int vertexCount, indexCount;
1386 int vertexStride, triStride; 1386 int vertexStride, triStride;
1387
1388 1387
1389 IMesh mesh = m_mesh; 1388 IMesh mesh = m_mesh;
1390 1389