Exclude sculpt proxies from mesh caching
parent
6878b26b0d
commit
0cbd9eee2f
|
@ -224,6 +224,14 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
for (int i = 0; i < lodBytes.Length; i++)
|
for (int i = 0; i < lodBytes.Length; i++)
|
||||||
hash = djb2(hash, lodBytes[i]);
|
hash = djb2(hash, lodBytes[i]);
|
||||||
|
|
||||||
|
// include sculpt UUID
|
||||||
|
if (pbs.SculptEntry)
|
||||||
|
{
|
||||||
|
scaleBytes = pbs.SculptTexture.GetBytes();
|
||||||
|
for (int i = 0; i < scaleBytes.Length; i++)
|
||||||
|
hash = djb2(hash, scaleBytes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +338,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
bool invert = ((primShape.SculptType & 64) != 0);
|
bool invert = ((primShape.SculptType & 64) != 0);
|
||||||
|
|
||||||
sculptMesh = new PrimMesher.SculptMesh((Bitmap)idata, sculptType, (int)lod, false, mirror, invert);
|
sculptMesh = new PrimMesher.SculptMesh((Bitmap)idata, sculptType, (int)lod, false, mirror, invert);
|
||||||
|
|
||||||
idata.Dispose();
|
idata.Dispose();
|
||||||
|
|
||||||
sculptMesh.DumpRaw(baseDir, primName, "primMesh");
|
sculptMesh.DumpRaw(baseDir, primName, "primMesh");
|
||||||
|
@ -484,12 +492,18 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
|
|
||||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
||||||
{
|
{
|
||||||
|
Mesh mesh = null;
|
||||||
|
ulong key = 0;
|
||||||
|
|
||||||
// If this mesh has been created already, return it instead of creating another copy
|
// If this mesh has been created already, return it instead of creating another copy
|
||||||
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
|
// For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory
|
||||||
ulong key = GetMeshKey(primShape, size, lod);
|
|
||||||
Mesh mesh = null;
|
if (! primShape.SculptEntry)
|
||||||
if (m_uniqueMeshes.TryGetValue(key, out mesh))
|
{
|
||||||
return mesh;
|
key = GetMeshKey(primShape, size, lod);
|
||||||
|
if (m_uniqueMeshes.TryGetValue(key, out mesh))
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
|
|
||||||
if (size.X < 0.01f) size.X = 0.01f;
|
if (size.X < 0.01f) size.X = 0.01f;
|
||||||
if (size.Y < 0.01f) size.Y = 0.01f;
|
if (size.Y < 0.01f) size.Y = 0.01f;
|
||||||
|
@ -512,7 +526,10 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
// trim the vertex and triangle lists to free up memory
|
// trim the vertex and triangle lists to free up memory
|
||||||
mesh.TrimExcess();
|
mesh.TrimExcess();
|
||||||
}
|
}
|
||||||
m_uniqueMeshes.Add(key, mesh);
|
|
||||||
|
if (!primShape.SculptEntry)
|
||||||
|
m_uniqueMeshes.Add(key, mesh);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue