aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index d96de4a..42231b5 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 {
@@ -927,8 +928,11 @@ namespace OpenSim.Region.Physics.Meshing
927 if (shouldCache) 928 if (shouldCache)
928 { 929 {
929 key = primShape.GetMeshKey(size, lod); 930 key = primShape.GetMeshKey(size, lod);
930 if (m_uniqueMeshes.TryGetValue(key, out mesh)) 931 lock (m_uniqueMeshes)
931 return mesh; 932 {
933 if (m_uniqueMeshes.TryGetValue(key, out mesh))
934 return mesh;
935 }
932 } 936 }
933 937
934 if (size.X < 0.01f) size.X = 0.01f; 938 if (size.X < 0.01f) size.X = 0.01f;
@@ -954,7 +958,10 @@ namespace OpenSim.Region.Physics.Meshing
954 958
955 if (shouldCache) 959 if (shouldCache)
956 { 960 {
957 m_uniqueMeshes.Add(key, mesh); 961 lock (m_uniqueMeshes)
962 {
963 m_uniqueMeshes.Add(key, mesh);
964 }
958 } 965 }
959 } 966 }
960 967