From 1d91613679bd8471051818e2acede4786d08ab4f Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Thu, 19 Jun 2008 17:21:17 +0000
Subject: * Patch from Dahlia - 0001576: Exception of type
 'System.OutOfMemoryException' was thrown .Void set_Capacity(Int32), with
 regards to sphere mesh.   Thanks Dahlia! * Also allows a sphere to be hollow
 with no cuts or dimples. (walking around inside the sphere).

---
 OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index dfcf99a..bf6b70c 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -1500,6 +1500,7 @@ namespace OpenSim.Region.Physics.Meshing
                         && primShape.PathTwistBegin == 0
                         && primShape.ProfileBegin == 0
                         && primShape.ProfileEnd == 0
+                        && primShape.ProfileHollow == 0
                         ) // simple sphere, revert to geodesic shape
 
                 )
@@ -1547,6 +1548,9 @@ namespace OpenSim.Region.Physics.Meshing
                     fProfileEndAngle = 180.0f - 0.0036f * (float)primShape.ProfileEnd;
                     if (fProfileBeginAngle < fProfileEndAngle)
                         fProfileEndAngle -= 360.0f;
+                    // a cut starting at 0 degrees with a hollow causes an infinite loop so move the start angle
+                    // past it into the empty part of the circle to avoid this condition
+                    if (fProfileBeginAngle == 0.0f) fProfileBeginAngle = -10.0f;
 
 #if SPAM
                     Console.WriteLine("Sphere dimple: fProfileBeginAngle: " + fProfileBeginAngle.ToString() + " fProfileEndAngle: " + fProfileEndAngle.ToString());
-- 
cgit v1.1