mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
let viewers pre cache materials, again
This commit is contained in:
@@ -753,33 +753,44 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
return asset;
|
||||
}
|
||||
|
||||
private byte[] CacheGet = null;
|
||||
private object CacheGetLock = new object();
|
||||
private double CacheGetTime = 0;
|
||||
|
||||
public void RenderMaterialsGetCap(IOSHttpRequest request, IOSHttpResponse response)
|
||||
{
|
||||
//OSDMap resp = new OSDMap();
|
||||
//OSDArray allOsd = new OSDArray();
|
||||
/*
|
||||
// this violates all idea of caching and geting things only if needed, so disabled
|
||||
|
||||
int matsCount = 0;
|
||||
lock (m_Materials)
|
||||
lock(CacheGetLock)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, FaceMaterial> kvp in m_Materials)
|
||||
OSDArray allOsd = new OSDArray();
|
||||
double now = Util.GetTimeStamp();
|
||||
if(CacheGet == null || now - CacheGetTime > 30)
|
||||
{
|
||||
OSDMap matMap = new OSDMap();
|
||||
matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes());
|
||||
matMap["Material"] = kvp.Value.toOSD();
|
||||
allOsd.Add(matMap);
|
||||
matsCount++;
|
||||
CacheGetTime = now;
|
||||
|
||||
lock (m_Materials)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, FaceMaterial> kvp in m_Materials)
|
||||
{
|
||||
OSDMap matMap = new OSDMap
|
||||
{
|
||||
["ID"] = OSD.FromBinary(kvp.Key.GetBytes()),
|
||||
["Material"] = kvp.Value.toOSD()
|
||||
};
|
||||
allOsd.Add(matMap);
|
||||
}
|
||||
}
|
||||
|
||||
OSDMap resp = new OSDMap
|
||||
{
|
||||
["Zipped"] = ZCompressOSD(allOsd, false)
|
||||
};
|
||||
|
||||
CacheGet = OSDParser.SerializeLLSDXmlToBytes(resp);
|
||||
}
|
||||
response.RawBuffer = CacheGet ?? GetPutEmptyResponseBytes;
|
||||
}
|
||||
*/
|
||||
//resp["Zipped"] = ZCompressOSD(allOsd, false);
|
||||
//string tmp = OSDParser.SerializeLLSDXmlString(resp);
|
||||
//response.RawBuffer = Encoding.UTF8.GetBytes(tmp);
|
||||
response.RawBuffer = GetPutEmptyResponseBytes;
|
||||
}
|
||||
|
||||
|
||||
private static string ZippedOsdBytesToString(byte[] bytes)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user