aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs26
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs16
2 files changed, 37 insertions, 5 deletions
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