From 9038218c2d67cd796242e17c7e65adbde05c8538 Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 20 Oct 2010 20:39:05 -0700 Subject: [PATCH] fix combining of multiple physics submeshes --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 72dce6ddcb..1257804cfa 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -349,6 +349,7 @@ namespace OpenSim.Region.Physics.Meshing OpenMetaverse.Vector3 posMax = ((OSDMap)subMeshMap["PositionDomain"])["Max"].AsVector3(); OpenMetaverse.Vector3 posMin = ((OSDMap)subMeshMap["PositionDomain"])["Min"].AsVector3(); + ushort faceIndexOffset = (ushort)coords.Count; byte[] posBytes = subMeshMap["Position"].AsBinary(); for (int i = 0; i < posBytes.Length; i += 6) @@ -368,9 +369,9 @@ namespace OpenSim.Region.Physics.Meshing byte[] triangleBytes = subMeshMap["TriangleList"].AsBinary(); for (int i = 0; i < triangleBytes.Length; i += 6) { - ushort v1 = Utils.BytesToUInt16(triangleBytes, i); - ushort v2 = Utils.BytesToUInt16(triangleBytes, i + 2); - ushort v3 = Utils.BytesToUInt16(triangleBytes, i + 4); + ushort v1 = (ushort)(Utils.BytesToUInt16(triangleBytes, i) + faceIndexOffset); + ushort v2 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 2) + faceIndexOffset); + ushort v3 = (ushort)(Utils.BytesToUInt16(triangleBytes, i + 4) + faceIndexOffset); Face f = new Face(v1, v2, v3); faces.Add(f); }