Trim out nulls from mesh vertex and triangle lists to try and save more memory
parent
da68f18a6b
commit
b42770bf7a
|
@ -1858,7 +1858,6 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
Console.WriteLine("skew: " + skew.ToString() + " profileXComp: " + profileXComp.ToString());
|
||||
#endif
|
||||
|
||||
|
||||
foreach (Vertex v in m.vertices)
|
||||
if (v != null)
|
||||
{
|
||||
|
@ -2173,14 +2172,31 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
// }
|
||||
//}
|
||||
|
||||
if (mesh != null && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
|
||||
{
|
||||
if (mesh != null)
|
||||
if (size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
|
||||
{
|
||||
#if SPAM
|
||||
Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
|
||||
#endif
|
||||
mesh = CreateBoundingBoxMesh(mesh);
|
||||
mesh.DumpRaw(baseDir, primName, "Z extruded");
|
||||
}
|
||||
mesh = CreateBoundingBoxMesh(mesh);
|
||||
mesh.DumpRaw(baseDir, primName, "Z extruded");
|
||||
|
||||
// trim the vertex and triangle lists to free up memory
|
||||
//mesh.vertices.TrimExcess();
|
||||
//mesh.triangles.TrimExcess();
|
||||
|
||||
int vertCount = 0;
|
||||
foreach (Vertex v in mesh.vertices)
|
||||
if (v != null)
|
||||
vertCount++;
|
||||
mesh.vertices.Capacity = vertCount;
|
||||
|
||||
int triCount = 0;
|
||||
foreach (Triangle t in mesh.triangles)
|
||||
if ( t != null )
|
||||
triCount++;
|
||||
mesh.triangles.Capacity = triCount;
|
||||
}
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue