From 76206543e83661bbf04ee046b10b27736c589c81 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 25 Jan 2009 04:34:00 +0000 Subject: * Adds console command, 'predecode-j2k ' to load all of the texture assets from the scene and decode the j2k layer data to cache. The work is split between the number of threads you specify. A good number of threads value is the number of cores on your machine minus 1. * Increases the number of ImageDataPackets we send per PriorityQueue pop and tweak it so that the number of packets is ( (2 * decode level) + 1 ) * 2, and (((2 * (5-decode level)) + 1) * 2). The first one sends more data for low quality textures, the second one sends more data for high quality textures. --- OpenSim/Region/Environment/Scenes/SceneManager.cs | 127 ++++++++++++++++++++++ 1 file changed, 127 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 040a0d4..b2b79b4 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -547,5 +547,132 @@ namespace OpenSim.Region.Environment.Scenes { m_localScenes.ForEach(action); } + + public void CacheJ2kDecode(int threads) + { + if (threads < 1) threads = 1; + + IJ2KDecoder m_decoder = m_localScenes[0].RequestModuleInterface(); + + List assetRequestList = new List(); + + #region AssetGathering! + foreach (Scene scene in m_localScenes) + { + List entitles = scene.GetEntities(); + foreach (EntityBase entity in entitles) + { + if (entity is SceneObjectGroup) + { + SceneObjectGroup sog = (SceneObjectGroup) entity; + foreach (SceneObjectPart part in sog.Children.Values) + { + if (part.Shape != null) + { + if (part.Shape.TextureEntry.Length > 0) + { + OpenMetaverse.Primitive.TextureEntry te = + new Primitive.TextureEntry(part.Shape.TextureEntry, 0, + part.Shape.TextureEntry.Length); + if (te.DefaultTexture != null) // this has been null for some reason... + { + if (te.DefaultTexture.TextureID != UUID.Zero) + assetRequestList.Add(te.DefaultTexture.TextureID); + } + for (int i=0; i arrvalus = new List(); + + //split into separate arrays + for (int j=0;j val = new List(); + + for (int k=j*entries_per_thread; k < ((j+1)* entries_per_thread);k++) + { + if (k < arrAssetRequestList.Length) + { + val.Add(arrAssetRequestList[k]); + } + + } + arrvalus.Add(val.ToArray()); + } + + for (int l=0;l