aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs40
1 files changed, 37 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
index 4c40175..44c8972 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
@@ -1061,6 +1061,42 @@ namespace OpenSim.Region.Physics.Meshing
1061 1061
1062 private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f); 1062 private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f);
1063 1063
1064 public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex)
1065 {
1066 Mesh mesh = null;
1067
1068 if (size.X < 0.01f) size.X = 0.01f;
1069 if (size.Y < 0.01f) size.Y = 0.01f;
1070 if (size.Z < 0.01f) size.Z = 0.01f;
1071
1072 AMeshKey key = GetMeshUniqueKey(primShape, size, (byte)lod, convex);
1073 lock (m_uniqueMeshes)
1074 {
1075 m_uniqueMeshes.TryGetValue(key, out mesh);
1076
1077 if (mesh != null)
1078 {
1079 mesh.RefCount++;
1080 return mesh;
1081 }
1082 }
1083
1084 // try to find a identical mesh on meshs recently released
1085 lock (m_uniqueReleasedMeshes)
1086 {
1087 m_uniqueReleasedMeshes.TryGetValue(key, out mesh);
1088 if (mesh != null)
1089 {
1090 m_uniqueReleasedMeshes.Remove(key);
1091 lock (m_uniqueMeshes)
1092 m_uniqueMeshes.Add(key, mesh);
1093 mesh.RefCount = 1;
1094 return mesh;
1095 }
1096 }
1097 return null;
1098 }
1099
1064 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) 1100 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex)
1065 { 1101 {
1066#if SPAM 1102#if SPAM
@@ -1068,15 +1104,13 @@ namespace OpenSim.Region.Physics.Meshing
1068#endif 1104#endif
1069 1105
1070 Mesh mesh = null; 1106 Mesh mesh = null;
1071// ulong key = 0;
1072
1073 1107
1074 if (size.X < 0.01f) size.X = 0.01f; 1108 if (size.X < 0.01f) size.X = 0.01f;
1075 if (size.Y < 0.01f) size.Y = 0.01f; 1109 if (size.Y < 0.01f) size.Y = 0.01f;
1076 if (size.Z < 0.01f) size.Z = 0.01f; 1110 if (size.Z < 0.01f) size.Z = 0.01f;
1077 1111
1078 // try to find a identical mesh on meshs in use 1112 // try to find a identical mesh on meshs in use
1079// key = primShape.GetMeshKey(size, lod, convex); 1113
1080 AMeshKey key = GetMeshUniqueKey(primShape,size,(byte)lod, convex); 1114 AMeshKey key = GetMeshUniqueKey(primShape,size,(byte)lod, convex);
1081 1115
1082 lock (m_uniqueMeshes) 1116 lock (m_uniqueMeshes)