aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs31
1 files changed, 24 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index d56ddc8..0e29ccc 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -224,6 +224,14 @@ namespace OpenSim.Region.Physics.Meshing
224 for (int i = 0; i < lodBytes.Length; i++) 224 for (int i = 0; i < lodBytes.Length; i++)
225 hash = djb2(hash, lodBytes[i]); 225 hash = djb2(hash, lodBytes[i]);
226 226
227 // include sculpt UUID
228 if (pbs.SculptEntry)
229 {
230 scaleBytes = pbs.SculptTexture.GetBytes();
231 for (int i = 0; i < scaleBytes.Length; i++)
232 hash = djb2(hash, scaleBytes[i]);
233 }
234
227 return hash; 235 return hash;
228 } 236 }
229 237
@@ -330,7 +338,7 @@ namespace OpenSim.Region.Physics.Meshing
330 bool invert = ((primShape.SculptType & 64) != 0); 338 bool invert = ((primShape.SculptType & 64) != 0);
331 339
332 sculptMesh = new PrimMesher.SculptMesh((Bitmap)idata, sculptType, (int)lod, false, mirror, invert); 340 sculptMesh = new PrimMesher.SculptMesh((Bitmap)idata, sculptType, (int)lod, false, mirror, invert);
333 341
334 idata.Dispose(); 342 idata.Dispose();
335 343
336 sculptMesh.DumpRaw(baseDir, primName, "primMesh"); 344 sculptMesh.DumpRaw(baseDir, primName, "primMesh");
@@ -389,7 +397,7 @@ namespace OpenSim.Region.Physics.Meshing
389 primMesh.pathCutBegin = pathBegin; 397 primMesh.pathCutBegin = pathBegin;
390 primMesh.pathCutEnd = pathEnd; 398 primMesh.pathCutEnd = pathEnd;
391 399
392 if (primShape.PathCurve == (byte)Extrusion.Straight) 400 if (primShape.PathCurve == (byte)Extrusion.Straight || primShape.PathCurve == (byte) Extrusion.Flexible)
393 { 401 {
394 primMesh.twistBegin = primShape.PathTwistBegin * 18 / 10; 402 primMesh.twistBegin = primShape.PathTwistBegin * 18 / 10;
395 primMesh.twistEnd = primShape.PathTwist * 18 / 10; 403 primMesh.twistEnd = primShape.PathTwist * 18 / 10;
@@ -484,12 +492,18 @@ namespace OpenSim.Region.Physics.Meshing
484 492
485 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical) 493 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
486 { 494 {
495 Mesh mesh = null;
496 ulong key = 0;
497
487 // If this mesh has been created already, return it instead of creating another copy 498 // If this mesh has been created already, return it instead of creating another copy
488 // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory 499 // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
489 ulong key = GetMeshKey(primShape, size, lod); 500
490 Mesh mesh = null; 501 if (! primShape.SculptEntry)
491 if (m_uniqueMeshes.TryGetValue(key, out mesh)) 502 {
492 return mesh; 503 key = GetMeshKey(primShape, size, lod);
504 if (m_uniqueMeshes.TryGetValue(key, out mesh))
505 return mesh;
506 }
493 507
494 if (size.X < 0.01f) size.X = 0.01f; 508 if (size.X < 0.01f) size.X = 0.01f;
495 if (size.Y < 0.01f) size.Y = 0.01f; 509 if (size.Y < 0.01f) size.Y = 0.01f;
@@ -512,7 +526,10 @@ namespace OpenSim.Region.Physics.Meshing
512 // trim the vertex and triangle lists to free up memory 526 // trim the vertex and triangle lists to free up memory
513 mesh.TrimExcess(); 527 mesh.TrimExcess();
514 } 528 }
515 m_uniqueMeshes.Add(key, mesh); 529
530 if (!primShape.SculptEntry)
531 m_uniqueMeshes.Add(key, mesh);
532
516 return mesh; 533 return mesh;
517 } 534 }
518 } 535 }