diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index ca94034..2ae0881 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -182,7 +182,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
182 | /// <returns></returns> | 182 | /// <returns></returns> |
183 | private static Mesh CreateSimpleBoxMesh(float minX, float maxX, float minY, float maxY, float minZ, float maxZ) | 183 | private static Mesh CreateSimpleBoxMesh(float minX, float maxX, float minY, float maxY, float minZ, float maxZ) |
184 | { | 184 | { |
185 | Mesh box = new Mesh(); | 185 | Mesh box = new Mesh(true); |
186 | List<Vertex> vertices = new List<Vertex>(); | 186 | List<Vertex> vertices = new List<Vertex>(); |
187 | // bottom | 187 | // bottom |
188 | 188 | ||
@@ -357,7 +357,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
357 | int numCoords = coords.Count; | 357 | int numCoords = coords.Count; |
358 | int numFaces = faces.Count; | 358 | int numFaces = faces.Count; |
359 | 359 | ||
360 | Mesh mesh = new Mesh(); | 360 | Mesh mesh = new Mesh(true); |
361 | // Add the corresponding triangles to the mesh | 361 | // Add the corresponding triangles to the mesh |
362 | for (int i = 0; i < numFaces; i++) | 362 | for (int i = 0; i < numFaces; i++) |
363 | { | 363 | { |
@@ -1483,6 +1483,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1483 | 1483 | ||
1484 | lock (diskLock) | 1484 | lock (diskLock) |
1485 | { | 1485 | { |
1486 | Stream stream = null; | ||
1486 | try | 1487 | try |
1487 | { | 1488 | { |
1488 | if (!Directory.Exists(dir)) | 1489 | if (!Directory.Exists(dir)) |
@@ -1490,8 +1491,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1490 | Directory.CreateDirectory(dir); | 1491 | Directory.CreateDirectory(dir); |
1491 | } | 1492 | } |
1492 | 1493 | ||
1493 | using(Stream stream = File.Open(filename, FileMode.Create)) | 1494 | stream = File.Open(filename, FileMode.Create); |
1494 | ok = mesh.ToStream(stream); | 1495 | ok = mesh.ToStream(stream); |
1495 | } | 1496 | } |
1496 | catch (IOException e) | 1497 | catch (IOException e) |
1497 | { | 1498 | { |
@@ -1500,6 +1501,11 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1500 | filename, e.Message, e.StackTrace); | 1501 | filename, e.Message, e.StackTrace); |
1501 | ok = false; | 1502 | ok = false; |
1502 | } | 1503 | } |
1504 | finally | ||
1505 | { | ||
1506 | if(stream != null) | ||
1507 | stream.Dispose(); | ||
1508 | } | ||
1503 | 1509 | ||
1504 | if (!ok && File.Exists(filename)) | 1510 | if (!ok && File.Exists(filename)) |
1505 | { | 1511 | { |