aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs47
1 files changed, 23 insertions, 24 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
index 5b1510f..d9ea4a4 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs
@@ -588,38 +588,37 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
588 Mesh mesh = new Mesh(); 588 Mesh mesh = new Mesh();
589 mesh.releaseBuildingMeshData(); 589 mesh.releaseBuildingMeshData();
590 590
591 BinaryReader br = new BinaryReader(st);
592
593 bool ok = true; 591 bool ok = true;
594 try 592 using(BinaryReader br = new BinaryReader(st))
595 { 593 {
596 mesh.m_vertexCount = br.ReadInt32(); 594 try
597 mesh.m_indexCount = br.ReadInt32(); 595 {
596 mesh.m_vertexCount = br.ReadInt32();
597 mesh.m_indexCount = br.ReadInt32();
598 598
599 int n = 3 * mesh.m_vertexCount; 599 int n = 3 * mesh.m_vertexCount;
600 mesh.vertices = new float[n]; 600 mesh.vertices = new float[n];
601 for (int i = 0; i < n; i++) 601 for (int i = 0; i < n; i++)
602 mesh.vertices[i] = br.ReadSingle(); 602 mesh.vertices[i] = br.ReadSingle();
603 603
604 mesh.indexes = new int[mesh.m_indexCount]; 604 mesh.indexes = new int[mesh.m_indexCount];
605 for (int i = 0; i < mesh.m_indexCount; i++) 605 for (int i = 0; i < mesh.m_indexCount; i++)
606 mesh.indexes[i] = br.ReadInt32(); 606 mesh.indexes[i] = br.ReadInt32();
607 607
608 mesh.m_obb.X = br.ReadSingle(); 608 mesh.m_obb.X = br.ReadSingle();
609 mesh.m_obb.Y = br.ReadSingle(); 609 mesh.m_obb.Y = br.ReadSingle();
610 mesh.m_obb.Z = br.ReadSingle(); 610 mesh.m_obb.Z = br.ReadSingle();
611 611
612 mesh.m_obboffset.X = br.ReadSingle(); 612 mesh.m_obboffset.X = br.ReadSingle();
613 mesh.m_obboffset.Y = br.ReadSingle(); 613 mesh.m_obboffset.Y = br.ReadSingle();
614 mesh.m_obboffset.Z = br.ReadSingle(); 614 mesh.m_obboffset.Z = br.ReadSingle();
615 } 615 }
616 catch 616 catch
617 { 617 {
618 ok = false; 618 ok = false;
619 }
619 } 620 }
620 621
621 br.Close();
622
623 if (ok) 622 if (ok)
624 { 623 {
625 mesh.pinMemory(); 624 mesh.pinMemory();