From 7137b234b4e99d8d19e83dfb5268674c72f46479 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 3 Oct 2012 19:33:28 +0100 Subject: introduce a ODEMeshWorker class, should be pure cosmetic changes for now --- OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs | 40 +++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs') 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 private static Vector3 m_MeshUnitSize = new Vector3(0.5f, 0.5f, 0.5f); + public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) + { + Mesh mesh = null; + + if (size.X < 0.01f) size.X = 0.01f; + if (size.Y < 0.01f) size.Y = 0.01f; + if (size.Z < 0.01f) size.Z = 0.01f; + + AMeshKey key = GetMeshUniqueKey(primShape, size, (byte)lod, convex); + lock (m_uniqueMeshes) + { + m_uniqueMeshes.TryGetValue(key, out mesh); + + if (mesh != null) + { + mesh.RefCount++; + return mesh; + } + } + + // try to find a identical mesh on meshs recently released + lock (m_uniqueReleasedMeshes) + { + m_uniqueReleasedMeshes.TryGetValue(key, out mesh); + if (mesh != null) + { + m_uniqueReleasedMeshes.Remove(key); + lock (m_uniqueMeshes) + m_uniqueMeshes.Add(key, mesh); + mesh.RefCount = 1; + return mesh; + } + } + return null; + } + public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) { #if SPAM @@ -1068,15 +1104,13 @@ namespace OpenSim.Region.Physics.Meshing #endif Mesh mesh = null; -// ulong key = 0; - if (size.X < 0.01f) size.X = 0.01f; if (size.Y < 0.01f) size.Y = 0.01f; if (size.Z < 0.01f) size.Z = 0.01f; // try to find a identical mesh on meshs in use -// key = primShape.GetMeshKey(size, lod, convex); + AMeshKey key = GetMeshUniqueKey(primShape,size,(byte)lod, convex); lock (m_uniqueMeshes) -- cgit v1.1