diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 0042c40ee0..fa137872f7 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.Physics.Manager int[] getIndexListAsInt(); int[] getIndexListAsIntLocked(); float[] getVertexListAsFloatLocked(); + void releaseSourceMeshData(); void releasePinned(); } } diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs index 3f82bc939c..394dcf3ba0 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/Physics/Meshing/Mesh.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.Physics.Meshing result[resultIndex] = c.Z; } - primMesh.coords = null; + //primMesh.coords = null; pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned); } return result; @@ -218,18 +218,20 @@ namespace OpenSim.Region.Physics.Meshing result[resultIndex++] = f.v2; result[resultIndex] = f.v3; } - primMesh.faces = null; + //primMesh.faces = null; } return result; } + /// + /// creates a list of index values that defines triangle faces. THIS METHOD FREES ALL NON-PINNED MESH DATA + /// + /// public int[] getIndexListAsIntLocked() { int[] result = getIndexListAsInt(); pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); - //triangles = null; - //vertices = null; - //primMesh = null; + return result; } @@ -240,6 +242,16 @@ namespace OpenSim.Region.Physics.Meshing } + /// + /// frees up the source mesh data to minimize memory - call this method after calling get*Locked() functions + /// + public void releaseSourceMeshData() + { + triangles = null; + vertices = null; + primMesh = null; + } + public void Append(Mesh newMesh) {