From 1b2828f5d859d2941167b0457158142e683efe39 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 24 Sep 2009 10:00:31 -0700 Subject: Meshmerizer stores dictionary of unique Meshes keyed on construction parameters. CreateMesh() returns a Mesh from the dictionary or creates a new Mesh if it has not been created before. Meshes are never purged from the dictionary. The raw Mesh data is discarded once the memory is pinned for ODE use. All copies of the same prim/mesh use the same pinned memory. ONLY IMPLEMENTED AND TESTED WITH MESHMERIZER AND ODE Signed-off-by: dahlia --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 673ae39..032b5df 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -82,7 +82,6 @@ namespace OpenSim.Region.Physics.OdePlugin // private float m_tensor = 5f; private int body_autodisable_frames = 20; - private IMesh primMesh = null; private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom @@ -814,14 +813,10 @@ namespace OpenSim.Region.Physics.OdePlugin } } - IMesh oldMesh = primMesh; + float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory + int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage - primMesh = mesh; - - float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory - int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage - - primMesh.releaseSourceMeshData(); // free up the original mesh data to save memory + mesh.releaseSourceMeshData(); // free up the original mesh data to save memory int VertexCount = vertexList.GetLength(0)/3; int IndexCount = indexList.GetLength(0); @@ -847,12 +842,6 @@ namespace OpenSim.Region.Physics.OdePlugin return; } - if (oldMesh != null) - { - oldMesh.releasePinned(); - oldMesh = null; - } - // if (IsPhysical && Body == (IntPtr) 0) // { // Recreate the body -- cgit v1.1