aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs26
1 files changed, 20 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 3bd15ce..8145d61 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -321,7 +321,10 @@ namespace OpenSim.Region.Physics.Meshing
321 321
322 if (primShape.SculptData.Length <= 0) 322 if (primShape.SculptData.Length <= 0)
323 { 323 {
324 m_log.ErrorFormat("[MESH]: asset data for {0} is zero length", primName); 324 // XXX: At the moment we can not log here since ODEPrim, for instance, ends up triggering this
325 // method twice - once before it has loaded sculpt data from the asset service and once afterwards.
326 // The first time will always call with unloaded SculptData if this needs to be uploaded.
327// m_log.ErrorFormat("[MESH]: asset data for {0} is zero length", primName);
325 return false; 328 return false;
326 } 329 }
327 330
@@ -699,11 +702,16 @@ namespace OpenSim.Region.Physics.Meshing
699 702
700 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 703 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
701 { 704 {
702 return CreateMesh(primName, primShape, size, lod, false); 705 return CreateMesh(primName, primShape, size, lod, false, true);
703 } 706 }
704 707
705 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)
706 { 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 {
707#if SPAM 715#if SPAM
708 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); 716 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
709#endif 717#endif
@@ -713,9 +721,12 @@ namespace OpenSim.Region.Physics.Meshing
713 721
714 // 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
715 // 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
716 key = primShape.GetMeshKey(size, lod); 724 if (shouldCache)
717 if (m_uniqueMeshes.TryGetValue(key, out mesh)) 725 {
718 return mesh; 726 key = primShape.GetMeshKey(size, lod);
727 if (m_uniqueMeshes.TryGetValue(key, out mesh))
728 return mesh;
729 }
719 730
720 if (size.X < 0.01f) size.X = 0.01f; 731 if (size.X < 0.01f) size.X = 0.01f;
721 if (size.Y < 0.01f) size.Y = 0.01f; 732 if (size.Y < 0.01f) size.Y = 0.01f;
@@ -738,7 +749,10 @@ namespace OpenSim.Region.Physics.Meshing
738 // trim the vertex and triangle lists to free up memory 749 // trim the vertex and triangle lists to free up memory
739 mesh.TrimExcess(); 750 mesh.TrimExcess();
740 751
741 m_uniqueMeshes.Add(key, mesh); 752 if (shouldCache)
753 {
754 m_uniqueMeshes.Add(key, mesh);
755 }
742 } 756 }
743 757
744 return mesh; 758 return mesh;