diff options
author | BlueWall | 2012-12-03 20:17:00 -0500 |
---|---|---|
committer | BlueWall | 2012-12-03 20:17:00 -0500 |
commit | 0c7d6adef158d5cb25d8eb60287c5cb0cceaa953 (patch) | |
tree | f766959f3442b78aa9202a4f61cf127508245345 /OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |
parent | XmlRpcGridRouter (diff) | |
parent | BulletSim: Reduce idle region physics overhead where there are MANY (diff) | |
download | opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.zip opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.gz opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.bz2 opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 6fa91ab..8145d61 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -702,11 +702,16 @@ namespace OpenSim.Region.Physics.Meshing | |||
702 | 702 | ||
703 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) | 703 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) |
704 | { | 704 | { |
705 | return CreateMesh(primName, primShape, size, lod, false); | 705 | return CreateMesh(primName, primShape, size, lod, false, true); |
706 | } | 706 | } |
707 | 707 | ||
708 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) | 708 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
709 | { | 709 | { |
710 | return CreateMesh(primName, primShape, size, lod, isPhysical, true); | ||
711 | } | ||
712 | |||
713 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache) | ||
714 | { | ||
710 | #if SPAM | 715 | #if SPAM |
711 | m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); | 716 | m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); |
712 | #endif | 717 | #endif |
@@ -716,9 +721,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
716 | 721 | ||
717 | // If this mesh has been created already, return it instead of creating another copy | 722 | // If this mesh has been created already, return it instead of creating another copy |
718 | // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory | 723 | // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory |
719 | key = primShape.GetMeshKey(size, lod); | 724 | if (shouldCache) |
720 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | 725 | { |
721 | return mesh; | 726 | key = primShape.GetMeshKey(size, lod); |
727 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | ||
728 | return mesh; | ||
729 | } | ||
722 | 730 | ||
723 | if (size.X < 0.01f) size.X = 0.01f; | 731 | if (size.X < 0.01f) size.X = 0.01f; |
724 | if (size.Y < 0.01f) size.Y = 0.01f; | 732 | if (size.Y < 0.01f) size.Y = 0.01f; |
@@ -741,7 +749,10 @@ namespace OpenSim.Region.Physics.Meshing | |||
741 | // trim the vertex and triangle lists to free up memory | 749 | // trim the vertex and triangle lists to free up memory |
742 | mesh.TrimExcess(); | 750 | mesh.TrimExcess(); |
743 | 751 | ||
744 | m_uniqueMeshes.Add(key, mesh); | 752 | if (shouldCache) |
753 | { | ||
754 | m_uniqueMeshes.Add(key, mesh); | ||
755 | } | ||
745 | } | 756 | } |
746 | 757 | ||
747 | return mesh; | 758 | return mesh; |