aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-10-09 04:31:50 +0100
committerUbitUmarov2012-10-09 04:31:50 +0100
commit87175412882e8e4b7cd9d92d6a9be8546ec7e9e9 (patch)
treed857ccfd8dedc965033ee42b9678c4b175bcdd62 /OpenSim/Region/Physics/UbitMeshing/Mesh.cs
parenttemporary debug code (diff)
downloadopensim-SC-87175412882e8e4b7cd9d92d6a9be8546ec7e9e9.zip
opensim-SC-87175412882e8e4b7cd9d92d6a9be8546ec7e9e9.tar.gz
opensim-SC-87175412882e8e4b7cd9d92d6a9be8546ec7e9e9.tar.bz2
opensim-SC-87175412882e8e4b7cd9d92d6a9be8546ec7e9e9.tar.xz
force allocation of mesh data on creation ( messy code version )
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing/Mesh.cs')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs26
1 files changed, 26 insertions, 0 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