aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorDahlia Trimble2008-07-11 20:32:58 +0000
committerDahlia Trimble2008-07-11 20:32:58 +0000
commitb42770bf7a2915e6e551660872006a4b08900d4a (patch)
tree1f309056ab2bb0e91cf964205ad3b81a1667f00e /OpenSim/Region/Physics
parent* Guard against a null point passed to RemoveClientCircuit (odd that this hap... (diff)
downloadopensim-SC-b42770bf7a2915e6e551660872006a4b08900d4a.zip
opensim-SC-b42770bf7a2915e6e551660872006a4b08900d4a.tar.gz
opensim-SC-b42770bf7a2915e6e551660872006a4b08900d4a.tar.bz2
opensim-SC-b42770bf7a2915e6e551660872006a4b08900d4a.tar.xz
Trim out nulls from mesh vertex and triangle lists to try and save more memory
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs28
1 files changed, 22 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 55a1bec..df850a0 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -1858,7 +1858,6 @@ namespace OpenSim.Region.Physics.Meshing
1858 Console.WriteLine("skew: " + skew.ToString() + " profileXComp: " + profileXComp.ToString()); 1858 Console.WriteLine("skew: " + skew.ToString() + " profileXComp: " + profileXComp.ToString());
1859#endif 1859#endif
1860 1860
1861
1862 foreach (Vertex v in m.vertices) 1861 foreach (Vertex v in m.vertices)
1863 if (v != null) 1862 if (v != null)
1864 { 1863 {
@@ -2173,14 +2172,31 @@ namespace OpenSim.Region.Physics.Meshing
2173 // } 2172 // }
2174 //} 2173 //}
2175 2174
2176 if (mesh != null && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh) 2175 if (mesh != null)
2177 { 2176 if (size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh)
2177 {
2178#if SPAM 2178#if SPAM
2179 Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" ); 2179 Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" );
2180#endif 2180#endif
2181 mesh = CreateBoundingBoxMesh(mesh); 2181 mesh = CreateBoundingBoxMesh(mesh);
2182 mesh.DumpRaw(baseDir, primName, "Z extruded"); 2182 mesh.DumpRaw(baseDir, primName, "Z extruded");
2183 } 2183
2184 // trim the vertex and triangle lists to free up memory
2185 //mesh.vertices.TrimExcess();
2186 //mesh.triangles.TrimExcess();
2187
2188 int vertCount = 0;
2189 foreach (Vertex v in mesh.vertices)
2190 if (v != null)
2191 vertCount++;
2192 mesh.vertices.Capacity = vertCount;
2193
2194 int triCount = 0;
2195 foreach (Triangle t in mesh.triangles)
2196 if ( t != null )
2197 triCount++;
2198 mesh.triangles.Capacity = triCount;
2199 }
2184 2200
2185 return mesh; 2201 return mesh;
2186 } 2202 }