diff options
author | Dan Lake | 2009-09-24 10:00:31 -0700 |
---|---|---|
committer | dahlia | 2009-09-24 18:20:59 -0700 |
commit | 1b2828f5d859d2941167b0457158142e683efe39 (patch) | |
tree | c1cdac03732aed67c8d99ce6692f99c806c8d1c4 /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | modify BulletDotNETPrim.cs in preparation for Mantis #4181 (diff) | |
download | opensim-SC_OLD-1b2828f5d859d2941167b0457158142e683efe39.zip opensim-SC_OLD-1b2828f5d859d2941167b0457158142e683efe39.tar.gz opensim-SC_OLD-1b2828f5d859d2941167b0457158142e683efe39.tar.bz2 opensim-SC_OLD-1b2828f5d859d2941167b0457158142e683efe39.tar.xz |
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 <dahliaTrimble@gmailDotCom>
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 17 |
1 files changed, 3 insertions, 14 deletions
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 | |||
82 | 82 | ||
83 | // private float m_tensor = 5f; | 83 | // private float m_tensor = 5f; |
84 | private int body_autodisable_frames = 20; | 84 | private int body_autodisable_frames = 20; |
85 | private IMesh primMesh = null; | ||
86 | 85 | ||
87 | 86 | ||
88 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | 87 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom |
@@ -814,14 +813,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
814 | } | 813 | } |
815 | } | 814 | } |
816 | 815 | ||
817 | IMesh oldMesh = primMesh; | 816 | float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory |
817 | int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage | ||
818 | 818 | ||
819 | primMesh = mesh; | 819 | mesh.releaseSourceMeshData(); // free up the original mesh data to save memory |
820 | |||
821 | float[] vertexList = primMesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory | ||
822 | int[] indexList = primMesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage | ||
823 | |||
824 | primMesh.releaseSourceMeshData(); // free up the original mesh data to save memory | ||
825 | 820 | ||
826 | int VertexCount = vertexList.GetLength(0)/3; | 821 | int VertexCount = vertexList.GetLength(0)/3; |
827 | int IndexCount = indexList.GetLength(0); | 822 | int IndexCount = indexList.GetLength(0); |
@@ -847,12 +842,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
847 | return; | 842 | return; |
848 | } | 843 | } |
849 | 844 | ||
850 | if (oldMesh != null) | ||
851 | { | ||
852 | oldMesh.releasePinned(); | ||
853 | oldMesh = null; | ||
854 | } | ||
855 | |||
856 | // if (IsPhysical && Body == (IntPtr) 0) | 845 | // if (IsPhysical && Body == (IntPtr) 0) |
857 | // { | 846 | // { |
858 | // Recreate the body | 847 | // Recreate the body |