From e593a333c75baeaf5e188a3fc8a4c48641686cd6 Mon Sep 17 00:00:00 2001
From: Dahlia Trimble
Date: Wed, 27 Aug 2008 23:37:14 +0000
Subject: adds releaseSourceMeshData() method to IMesh and Mesh for freeing
mesh data after conversion to pinned lists.
---
OpenSim/Region/Physics/Manager/IMesher.cs | 1 +
OpenSim/Region/Physics/Meshing/Mesh.cs | 22 +++++++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index 0042c40..fa13787 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 3f82bc9..394dcf3 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)
{
--
cgit v1.1