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());
|
Console.WriteLine("skew: " + skew.ToString() + " profileXComp: " + profileXComp.ToString());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
foreach (Vertex v in m.vertices)
|
foreach (Vertex v in m.vertices)
|
||||||
if (v != null)
|
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
|
#if SPAM
|
||||||
Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
|
Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
|
||||||
#endif
|
#endif
|
||||||
mesh = CreateBoundingBoxMesh(mesh);
|
mesh = CreateBoundingBoxMesh(mesh);
|
||||||
mesh.DumpRaw(baseDir, primName, "Z extruded");
|
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;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue