diff options
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing/Mesh.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitMeshing/Mesh.cs | 26 |
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 |