aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMic Bowman2013-05-08 13:13:51 -0700
committerMic Bowman2013-05-08 13:13:51 -0700
commit33aaa40bee37ca4d8a3afa10fbbea7c1be3a1d58 (patch)
tree36cdb2066ecc0cbf8298225c53da6c996da4b50d /OpenSim/Region/CoreModules
parentDelete "" entry for AvatarPicker cap. (diff)
downloadopensim-SC_OLD-33aaa40bee37ca4d8a3afa10fbbea7c1be3a1d58.zip
opensim-SC_OLD-33aaa40bee37ca4d8a3afa10fbbea7c1be3a1d58.tar.gz
opensim-SC_OLD-33aaa40bee37ca4d8a3afa10fbbea7c1be3a1d58.tar.bz2
opensim-SC_OLD-33aaa40bee37ca4d8a3afa10fbbea7c1be3a1d58.tar.xz
Adds an event and a method so that handling of the CachedTexture
packet can be pulled out of LLClientView and moved to AvatarFactory. The first pass at reusing textures (turned off by default) is included. When reusing textures, if the baked textures from a previous login are still in the asset service (which generally means that they are in the simulator's cache) then the avatar will not need to rebake. This is both a performance improvement (specifically that an avatars baked textures do not need to be sent to other users who have the old textures cached) and a resource improvement (don't have to deal with duplicate bakes in the asset service cache).
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index c7ac7c4..b640b48 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
55 55
56 private int m_savetime = 5; // seconds to wait before saving changed appearance 56 private int m_savetime = 5; // seconds to wait before saving changed appearance
57 private int m_sendtime = 2; // seconds to wait before sending changed appearance 57 private int m_sendtime = 2; // seconds to wait before sending changed appearance
58 private bool m_reusetextures = false;
58 59
59 private int m_checkTime = 500; // milliseconds to wait between checks for appearance updates 60 private int m_checkTime = 500; // milliseconds to wait between checks for appearance updates
60 private System.Timers.Timer m_updateTimer = new System.Timers.Timer(); 61 private System.Timers.Timer m_updateTimer = new System.Timers.Timer();
@@ -73,6 +74,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
73 { 74 {
74 m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); 75 m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime)));
75 m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); 76 m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime)));
77 m_reusetextures = appearanceConfig.GetBoolean("ReuseTextures",m_reusetextures);
78
76 // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); 79 // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime);
77 } 80 }
78 81
@@ -131,6 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
131 client.OnRequestWearables += Client_OnRequestWearables; 134 client.OnRequestWearables += Client_OnRequestWearables;
132 client.OnSetAppearance += Client_OnSetAppearance; 135 client.OnSetAppearance += Client_OnSetAppearance;
133 client.OnAvatarNowWearing += Client_OnAvatarNowWearing; 136 client.OnAvatarNowWearing += Client_OnAvatarNowWearing;
137 client.OnCachedTextureRequest += Client_OnCachedTextureRequest;
134 } 138 }
135 139
136 #endregion 140 #endregion
@@ -671,6 +675,61 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
671 QueueAppearanceSave(client.AgentId); 675 QueueAppearanceSave(client.AgentId);
672 } 676 }
673 } 677 }
678
679 /// <summary>
680 /// Respond to the cached textures request from the client
681 /// </summary>
682 /// <param name="client"></param>
683 /// <param name="serial"></param>
684 /// <param name="cachedTextureRequest"></param>
685 private void Client_OnCachedTextureRequest(IClientAPI client, int serial, List<CachedTextureRequestArg> cachedTextureRequest)
686 {
687 // m_log.WarnFormat("[AVFACTORY]: Client_OnCachedTextureRequest called for {0} ({1})", client.Name, client.AgentId);
688 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
689
690 List<CachedTextureResponseArg> cachedTextureResponse = new List<CachedTextureResponseArg>();
691 foreach (CachedTextureRequestArg request in cachedTextureRequest)
692 {
693 UUID texture = UUID.Zero;
694 int index = request.BakedTextureIndex;
695
696 if (m_reusetextures)
697 {
698 // this is the most insanely dumb way to do this... however it seems to
699 // actually work. if the appearance has been reset because wearables have
700 // changed then the texture entries are zero'd out until the bakes are
701 // uploaded. on login, if the textures exist in the cache (eg if you logged
702 // into the simulator recently, then the appearance will pull those and send
703 // them back in the packet and you won't have to rebake. if the textures aren't
704 // in the cache then the intial makeroot() call in scenepresence will zero
705 // them out.
706 //
707 // a better solution (though how much better is an open question) is to
708 // store the hashes in the appearance and compare them. Thats's coming.
709
710 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[index];
711 if (face != null)
712 texture = face.TextureID;
713
714 // m_log.WarnFormat("[AVFACTORY]: reuse texture {0} for index {1}",texture,index);
715 }
716
717 CachedTextureResponseArg response = new CachedTextureResponseArg();
718 response.BakedTextureIndex = index;
719 response.BakedTextureID = texture;
720 response.HostName = null;
721
722 cachedTextureResponse.Add(response);
723 }
724
725 // m_log.WarnFormat("[AVFACTORY]: serial is {0}",serial);
726 // The serial number appears to be used to match requests and responses
727 // in the texture transaction. We just send back the serial number
728 // that was provided in the request. The viewer bumps this for us.
729 client.SendCachedTextureResponse(sp, serial, cachedTextureResponse);
730 }
731
732
674 #endregion 733 #endregion
675 734
676 public void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction outputAction) 735 public void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction outputAction)