adds releaseSourceMeshData() method to IMesh and Mesh for freeing mesh data after conversion to pinned lists.

0.6.0-stable
Dahlia Trimble 2008-08-27 23:37:14 +00:00
parent 5525a3ecb4
commit e593a333c7
2 changed files with 18 additions and 5 deletions

View File

@ -47,6 +47,7 @@ namespace OpenSim.Region.Physics.Manager
int[] getIndexListAsInt();
int[] getIndexListAsIntLocked();
float[] getVertexListAsFloatLocked();
void releaseSourceMeshData();
void releasePinned();
}
}

View File

@ -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;
}
/// <summary>
/// creates a list of index values that defines triangle faces. THIS METHOD FREES ALL NON-PINNED MESH DATA
/// </summary>
/// <returns></returns>
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
}
/// <summary>
/// frees up the source mesh data to minimize memory - call this method after calling get*Locked() functions
/// </summary>
public void releaseSourceMeshData()
{
triangles = null;
vertices = null;
primMesh = null;
}
public void Append(Mesh newMesh)
{