diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 104 |
1 files changed, 22 insertions, 82 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index def1f8e..e9a087b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -12011,120 +12011,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12011 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | 12011 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); |
12012 | 12012 | ||
12013 | if (cachedtex.AgentData.SessionID != SessionId) | 12013 | if (cachedtex.AgentData.SessionID != SessionId) |
12014 | return false; | 12014 | return false; |
12015 | 12015 | ||
12016 | // TODO: don't create new blocks if recycling an old packet | 12016 | // TODO: don't create new blocks if recycling an old packet |
12017 | cachedresp.AgentData.AgentID = AgentId; | 12017 | cachedresp.AgentData.AgentID = AgentId; |
12018 | cachedresp.AgentData.SessionID = m_sessionId; | 12018 | cachedresp.AgentData.SessionID = m_sessionId; |
12019 | // cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | ||
12020 | // m_cachedTextureSerial++; | ||
12021 | cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; | 12019 | cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; |
12022 | cachedresp.WearableData = | 12020 | cachedresp.WearableData = |
12023 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | 12021 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; |
12024 | 12022 | ||
12025 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
12026 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
12027 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
12028 | |||
12029 | IAssetService cache = m_scene.AssetService; | ||
12030 | //bakedTextureModule = null; | ||
12031 | int maxWearablesLoop = cachedtex.WearableData.Length; | 12023 | int maxWearablesLoop = cachedtex.WearableData.Length; |
12032 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | 12024 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) |
12033 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | 12025 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; |
12034 | 12026 | ||
12035 | int cacheHits = 0; | 12027 | int cacheHits = 0; |
12036 | 12028 | ||
12037 | if (cache != null) | 12029 | // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid |
12038 | { | ||
12039 | // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid | ||
12040 | |||
12041 | WearableCacheItem[] cacheItems = null; | ||
12042 | |||
12043 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
12044 | |||
12045 | if (p!= null && p.Appearance != null) | ||
12046 | { | ||
12047 | /* we should only check bakedTextureModule at login or when appearance changes | ||
12048 | if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use | ||
12049 | { | ||
12050 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
12051 | if (bakedTextureModule != null) | ||
12052 | { | ||
12053 | m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); | ||
12054 | try | ||
12055 | { | ||
12056 | cacheItems = bakedTextureModule.Get(AgentId); | ||
12057 | p.Appearance.WearableCacheItems = cacheItems; | ||
12058 | p.Appearance.WearableCacheItemsDirty = false; | ||
12059 | 12030 | ||
12060 | if (cacheItems != null) | 12031 | WearableCacheItem[] cacheItems = null; |
12061 | { | ||
12062 | foreach (WearableCacheItem item in cacheItems) | ||
12063 | { | ||
12064 | if (item.TextureAsset != null) | ||
12065 | { | ||
12066 | item.TextureAsset.Temporary = true; | ||
12067 | item.TextureAsset.Local = true; | ||
12068 | cache.Store(item.TextureAsset); | ||
12069 | } | ||
12070 | } | ||
12071 | } | ||
12072 | } | ||
12073 | 12032 | ||
12074 | catch (Exception) | 12033 | ScenePresence p = m_scene.GetScenePresence(AgentId); |
12075 | { | ||
12076 | cacheItems = null; | ||
12077 | } | ||
12078 | } | ||
12079 | } | ||
12080 | 12034 | ||
12081 | else if (p.Appearance.WearableCacheItems != null) | 12035 | if (p != null && p.Appearance != null) |
12082 | { | 12036 | { |
12083 | cacheItems = p.Appearance.WearableCacheItems; | 12037 | cacheItems = p.Appearance.WearableCacheItems; |
12084 | } | 12038 | } |
12085 | */ | ||
12086 | cacheItems = p.Appearance.WearableCacheItems; | ||
12087 | } | ||
12088 | 12039 | ||
12089 | if (cacheItems != null) | 12040 | if (cacheItems != null) |
12041 | { | ||
12042 | for (int i = 0; i < maxWearablesLoop; i++) | ||
12090 | { | 12043 | { |
12091 | for (int i = 0; i < maxWearablesLoop; i++) | 12044 | int idx = cachedtex.WearableData[i].TextureIndex; |
12092 | { | ||
12093 | int idx = cachedtex.WearableData[i].TextureIndex; | ||
12094 | 12045 | ||
12095 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12046 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
12096 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 12047 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
12097 | cachedresp.WearableData[i].HostName = new byte[0]; | 12048 | cachedresp.WearableData[i].HostName = new byte[0]; |
12098 | if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) | 12049 | if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) |
12099 | { | 12050 | { |
12100 | cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; | 12051 | cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; |
12101 | cacheHits++; | 12052 | cacheHits++; |
12102 | } | ||
12103 | else | ||
12104 | { | ||
12105 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
12106 | } | ||
12107 | } | 12053 | } |
12108 | } | 12054 | else |
12109 | else | ||
12110 | { | ||
12111 | for (int i = 0; i < maxWearablesLoop; i++) | ||
12112 | { | 12055 | { |
12113 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
12114 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
12115 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 12056 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
12116 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12117 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
12118 | } | 12057 | } |
12119 | } | 12058 | } |
12120 | } | 12059 | } |
12121 | else // no cache | 12060 | else |
12122 | { | 12061 | { |
12123 | for (int i = 0; i < maxWearablesLoop; i++) | 12062 | for (int i = 0; i < maxWearablesLoop; i++) |
12124 | { | 12063 | { |
12125 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12064 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
12126 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 12065 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
12127 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 12066 | cachedresp.WearableData[i].TextureID = UUID.Zero; |
12067 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
12128 | cachedresp.WearableData[i].HostName = new byte[0]; | 12068 | cachedresp.WearableData[i].HostName = new byte[0]; |
12129 | } | 12069 | } |
12130 | } | 12070 | } |