diff options
author | Melanie | 2012-11-30 01:54:13 +0000 |
---|---|---|
committer | Melanie | 2012-11-30 01:54:13 +0000 |
commit | 56b2bc71017ebec9fe4b7ecd358819c8d7499f76 (patch) | |
tree | eea2b7a38ef1c191e41928f12cefe2254a4454e0 /OpenSim/Region/Physics/Meshing | |
parent | Merge branch 'master' into careminster (diff) | |
parent | BulletSim: add expanded call to IMesher/Meshmerizer which enables/disables me... (diff) | |
download | opensim-SC-56b2bc71017ebec9fe4b7ecd358819c8d7499f76.zip opensim-SC-56b2bc71017ebec9fe4b7ecd358819c8d7499f76.tar.gz opensim-SC-56b2bc71017ebec9fe4b7ecd358819c8d7499f76.tar.bz2 opensim-SC-56b2bc71017ebec9fe4b7ecd358819c8d7499f76.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Physics/Manager/IMesher.cs
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 9262a9e..d181b78 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -702,16 +702,21 @@ 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, bool convex, bool forOde) | 708 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde) |
709 | { | 709 | { |
710 | return CreateMesh(primName, primShape, size, lod, false); | 710 | return CreateMesh(primName, primShape, size, lod, false); |
711 | } | 711 | } |
712 | 712 | ||
713 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) | 713 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) |
714 | { | 714 | { |
715 | return CreateMesh(primName, primShape, size, lod, isPhysical, true); | ||
716 | } | ||
717 | |||
718 | public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache) | ||
719 | { | ||
715 | #if SPAM | 720 | #if SPAM |
716 | m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); | 721 | m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); |
717 | #endif | 722 | #endif |
@@ -721,9 +726,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
721 | 726 | ||
722 | // If this mesh has been created already, return it instead of creating another copy | 727 | // If this mesh has been created already, return it instead of creating another copy |
723 | // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory | 728 | // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory |
724 | key = primShape.GetMeshKey(size, lod); | 729 | if (shouldCache) |
725 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | 730 | { |
726 | return mesh; | 731 | key = primShape.GetMeshKey(size, lod); |
732 | if (m_uniqueMeshes.TryGetValue(key, out mesh)) | ||
733 | return mesh; | ||
734 | } | ||
727 | 735 | ||
728 | if (size.X < 0.01f) size.X = 0.01f; | 736 | if (size.X < 0.01f) size.X = 0.01f; |
729 | if (size.Y < 0.01f) size.Y = 0.01f; | 737 | if (size.Y < 0.01f) size.Y = 0.01f; |
@@ -746,7 +754,10 @@ namespace OpenSim.Region.Physics.Meshing | |||
746 | // trim the vertex and triangle lists to free up memory | 754 | // trim the vertex and triangle lists to free up memory |
747 | mesh.TrimExcess(); | 755 | mesh.TrimExcess(); |
748 | 756 | ||
749 | m_uniqueMeshes.Add(key, mesh); | 757 | if (shouldCache) |
758 | { | ||
759 | m_uniqueMeshes.Add(key, mesh); | ||
760 | } | ||
750 | } | 761 | } |
751 | 762 | ||
752 | return mesh; | 763 | return mesh; |