diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index d67d4d2..ef6482a 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -84,7 +84,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
84 | private List<List<Vector3>> mConvexHulls = null; | 84 | private List<List<Vector3>> mConvexHulls = null; |
85 | private List<Vector3> mBoundingHull = null; | 85 | private List<Vector3> mBoundingHull = null; |
86 | 86 | ||
87 | private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); | 87 | // Mesh cache. Static so it can be shared across instances of this class |
88 | private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); | ||
88 | 89 | ||
89 | public Meshmerizer(IConfigSource config) | 90 | public Meshmerizer(IConfigSource config) |
90 | { | 91 | { |
@@ -937,8 +938,11 @@ namespace OpenSim.Region.Physics.Meshing | |||
937 | if (shouldCache) | 938 | if (shouldCache) |
938 | { | 939 | { |
939 | key = primShape.GetMeshKey(size, lod); | 940 | key = primShape.GetMeshKey(size, lod); |
940 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | 941 | lock (m_uniqueMeshes) |
941 | return mesh; | 942 | { |
943 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | ||
944 | return mesh; | ||
945 | } | ||
942 | } | 946 | } |
943 | 947 | ||
944 | if (size.X < 0.01f) size.X = 0.01f; | 948 | if (size.X < 0.01f) size.X = 0.01f; |
@@ -964,7 +968,10 @@ namespace OpenSim.Region.Physics.Meshing | |||
964 | 968 | ||
965 | if (shouldCache) | 969 | if (shouldCache) |
966 | { | 970 | { |
967 | m_uniqueMeshes.Add(key, mesh); | 971 | lock (m_uniqueMeshes) |
972 | { | ||
973 | m_uniqueMeshes.Add(key, mesh); | ||
974 | } | ||
968 | } | 975 | } |
969 | } | 976 | } |
970 | 977 | ||