aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorDahlia Trimble2008-08-27 23:37:14 +0000
committerDahlia Trimble2008-08-27 23:37:14 +0000
commite593a333c75baeaf5e188a3fc8a4c48641686cd6 (patch)
tree56cc6b6c6365df28281ba02691e557f015f3698e /OpenSim/Region/Physics
parentThank you, salahazar, for a patch that corrects the behavior of (diff)
downloadopensim-SC-e593a333c75baeaf5e188a3fc8a4c48641686cd6.zip
opensim-SC-e593a333c75baeaf5e188a3fc8a4c48641686cd6.tar.gz
opensim-SC-e593a333c75baeaf5e188a3fc8a4c48641686cd6.tar.bz2
opensim-SC-e593a333c75baeaf5e188a3fc8a4c48641686cd6.tar.xz
adds releaseSourceMeshData() method to IMesh and Mesh for freeing mesh data after conversion to pinned lists.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs1
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs22
2 files changed, 18 insertions, 5 deletions
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
47 int[] getIndexListAsInt(); 47 int[] getIndexListAsInt();
48 int[] getIndexListAsIntLocked(); 48 int[] getIndexListAsIntLocked();
49 float[] getVertexListAsFloatLocked(); 49 float[] getVertexListAsFloatLocked();
50 void releaseSourceMeshData();
50 void releasePinned(); 51 void releasePinned();
51 } 52 }
52} 53}
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
185 result[resultIndex] = c.Z; 185 result[resultIndex] = c.Z;
186 186
187 } 187 }
188 primMesh.coords = null; 188 //primMesh.coords = null;
189 pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned); 189 pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
190 } 190 }
191 return result; 191 return result;
@@ -218,18 +218,20 @@ namespace OpenSim.Region.Physics.Meshing
218 result[resultIndex++] = f.v2; 218 result[resultIndex++] = f.v2;
219 result[resultIndex] = f.v3; 219 result[resultIndex] = f.v3;
220 } 220 }
221 primMesh.faces = null; 221 //primMesh.faces = null;
222 } 222 }
223 return result; 223 return result;
224 } 224 }
225 225
226 /// <summary>
227 /// creates a list of index values that defines triangle faces. THIS METHOD FREES ALL NON-PINNED MESH DATA
228 /// </summary>
229 /// <returns></returns>
226 public int[] getIndexListAsIntLocked() 230 public int[] getIndexListAsIntLocked()
227 { 231 {
228 int[] result = getIndexListAsInt(); 232 int[] result = getIndexListAsInt();
229 pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); 233 pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned);
230 //triangles = null; 234
231 //vertices = null;
232 //primMesh = null;
233 return result; 235 return result;
234 } 236 }
235 237
@@ -240,6 +242,16 @@ namespace OpenSim.Region.Physics.Meshing
240 242
241 } 243 }
242 244
245 /// <summary>
246 /// frees up the source mesh data to minimize memory - call this method after calling get*Locked() functions
247 /// </summary>
248 public void releaseSourceMeshData()
249 {
250 triangles = null;
251 vertices = null;
252 primMesh = null;
253 }
254
243 255
244 public void Append(Mesh newMesh) 256 public void Append(Mesh newMesh)
245 { 257 {