diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
6 files changed, 468 insertions, 134 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 0447bc4..b162bb9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -59,6 +59,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
59 | public class EventQueueGetModule : IEventQueue, INonSharedRegionModule | 59 | public class EventQueueGetModule : IEventQueue, INonSharedRegionModule |
60 | { | 60 | { |
61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
62 | private static string LogHeader = "[EVENT QUEUE GET MODULE]"; | ||
62 | 63 | ||
63 | /// <value> | 64 | /// <value> |
64 | /// Debug level. | 65 | /// Debug level. |
@@ -717,34 +718,46 @@ namespace OpenSim.Region.ClientStack.Linden | |||
717 | Enqueue(item, avatarID); | 718 | Enqueue(item, avatarID); |
718 | } | 719 | } |
719 | 720 | ||
720 | public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID) | 721 | public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) |
721 | { | 722 | { |
722 | OSD item = EventQueueHelper.EnableSimulator(handle, endPoint); | 723 | m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>", |
724 | LogHeader, handle, avatarID, regionSizeX, regionSizeY); | ||
725 | |||
726 | OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); | ||
723 | Enqueue(item, avatarID); | 727 | Enqueue(item, avatarID); |
724 | } | 728 | } |
725 | 729 | ||
726 | public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath) | 730 | public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath, |
731 | ulong regionHandle, int regionSizeX, int regionSizeY) | ||
727 | { | 732 | { |
728 | OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath); | 733 | m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>", |
734 | LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); | ||
735 | OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); | ||
729 | Enqueue(item, avatarID); | 736 | Enqueue(item, avatarID); |
730 | } | 737 | } |
731 | 738 | ||
732 | public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess, | 739 | public virtual void TeleportFinishEvent(ulong regionHandle, byte simAccess, |
733 | IPEndPoint regionExternalEndPoint, | 740 | IPEndPoint regionExternalEndPoint, |
734 | uint locationID, uint flags, string capsURL, | 741 | uint locationID, uint flags, string capsURL, |
735 | UUID avatarID) | 742 | UUID avatarID, int regionSizeX, int regionSizeY) |
736 | { | 743 | { |
744 | m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize=<{3},{4}>", | ||
745 | LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); | ||
746 | |||
737 | OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, | 747 | OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, |
738 | locationID, flags, capsURL, avatarID); | 748 | locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); |
739 | Enqueue(item, avatarID); | 749 | Enqueue(item, avatarID); |
740 | } | 750 | } |
741 | 751 | ||
742 | public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | 752 | public virtual void CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, |
743 | IPEndPoint newRegionExternalEndPoint, | 753 | IPEndPoint newRegionExternalEndPoint, |
744 | string capsURL, UUID avatarID, UUID sessionID) | 754 | string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) |
745 | { | 755 | { |
756 | m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", | ||
757 | LogHeader, handle, avatarID, regionSizeX, regionSizeY); | ||
758 | |||
746 | OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, | 759 | OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, |
747 | capsURL, avatarID, sessionID); | 760 | capsURL, avatarID, sessionID, regionSizeX, regionSizeY); |
748 | Enqueue(item, avatarID); | 761 | Enqueue(item, avatarID); |
749 | } | 762 | } |
750 | 763 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index dab727f..384af74 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -70,13 +70,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
70 | return llsdEvent; | 70 | return llsdEvent; |
71 | } | 71 | } |
72 | 72 | ||
73 | public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint) | 73 | public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint, int regionSizeX, int regionSizeY) |
74 | { | 74 | { |
75 | OSDMap llsdSimInfo = new OSDMap(3); | 75 | OSDMap llsdSimInfo = new OSDMap(5); |
76 | 76 | ||
77 | llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); | 77 | llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); |
78 | llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); | 78 | llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); |
79 | llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); | 79 | llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); |
80 | llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint) regionSizeX)); | ||
81 | llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint) regionSizeY)); | ||
80 | 82 | ||
81 | OSDArray arr = new OSDArray(1); | 83 | OSDArray arr = new OSDArray(1); |
82 | arr.Add(llsdSimInfo); | 84 | arr.Add(llsdSimInfo); |
@@ -104,7 +106,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
104 | 106 | ||
105 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | 107 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, |
106 | IPEndPoint newRegionExternalEndPoint, | 108 | IPEndPoint newRegionExternalEndPoint, |
107 | string capsURL, UUID agentID, UUID sessionID) | 109 | string capsURL, UUID agentID, UUID sessionID, |
110 | int regionSizeX, int regionSizeY) | ||
108 | { | 111 | { |
109 | OSDArray lookAtArr = new OSDArray(3); | 112 | OSDArray lookAtArr = new OSDArray(3); |
110 | lookAtArr.Add(OSD.FromReal(lookAt.X)); | 113 | lookAtArr.Add(OSD.FromReal(lookAt.X)); |
@@ -130,11 +133,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
130 | OSDArray agentDataArr = new OSDArray(1); | 133 | OSDArray agentDataArr = new OSDArray(1); |
131 | agentDataArr.Add(agentDataMap); | 134 | agentDataArr.Add(agentDataMap); |
132 | 135 | ||
133 | OSDMap regionDataMap = new OSDMap(4); | 136 | OSDMap regionDataMap = new OSDMap(6); |
134 | regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle))); | 137 | regionDataMap.Add("RegionHandle", OSD.FromBinary(ulongToByteArray(handle))); |
135 | regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); | 138 | regionDataMap.Add("SeedCapability", OSD.FromString(capsURL)); |
136 | regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); | 139 | regionDataMap.Add("SimIP", OSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); |
137 | regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); | 140 | regionDataMap.Add("SimPort", OSD.FromInteger(newRegionExternalEndPoint.Port)); |
141 | regionDataMap.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); | ||
142 | regionDataMap.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); | ||
138 | 143 | ||
139 | OSDArray regionDataArr = new OSDArray(1); | 144 | OSDArray regionDataArr = new OSDArray(1); |
140 | regionDataArr.Add(regionDataMap); | 145 | regionDataArr.Add(regionDataMap); |
@@ -148,8 +153,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
148 | } | 153 | } |
149 | 154 | ||
150 | public static OSD TeleportFinishEvent( | 155 | public static OSD TeleportFinishEvent( |
151 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 156 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
152 | uint locationID, uint flags, string capsURL, UUID agentID) | 157 | uint locationID, uint flags, string capsURL, UUID agentID, |
158 | int regionSizeX, int regionSizeY) | ||
153 | { | 159 | { |
154 | OSDMap info = new OSDMap(); | 160 | OSDMap info = new OSDMap(); |
155 | info.Add("AgentID", OSD.FromUUID(agentID)); | 161 | info.Add("AgentID", OSD.FromUUID(agentID)); |
@@ -160,6 +166,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
160 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); | 166 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); |
161 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); | 167 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); |
162 | info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation | 168 | info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation |
169 | info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); | ||
170 | info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); | ||
163 | 171 | ||
164 | OSDArray infoArr = new OSDArray(); | 172 | OSDArray infoArr = new OSDArray(); |
165 | infoArr.Add(info); | 173 | infoArr.Add(info); |
@@ -187,12 +195,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
187 | return BuildEvent("ScriptRunningReply", body); | 195 | return BuildEvent("ScriptRunningReply", body); |
188 | } | 196 | } |
189 | 197 | ||
190 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap) | 198 | public static OSD EstablishAgentCommunication(UUID agentID, string simIpAndPort, string seedcap, |
199 | ulong regionHandle, int regionSizeX, int regionSizeY) | ||
191 | { | 200 | { |
192 | OSDMap body = new OSDMap(3); | 201 | OSDMap body = new OSDMap(6) |
193 | body.Add("agent-id", new OSDUUID(agentID)); | 202 | { |
194 | body.Add("sim-ip-and-port", new OSDString(simIpAndPort)); | 203 | {"agent-id", new OSDUUID(agentID)}, |
195 | body.Add("seed-capability", new OSDString(seedcap)); | 204 | {"sim-ip-and-port", new OSDString(simIpAndPort)}, |
205 | {"seed-capability", new OSDString(seedcap)}, | ||
206 | {"region-handle", OSD.FromULong(regionHandle)}, | ||
207 | {"region-size-x", OSD.FromInteger(regionSizeX)}, | ||
208 | {"region-size-y", OSD.FromInteger(regionSizeY)} | ||
209 | }; | ||
196 | 210 | ||
197 | return BuildEvent("EstablishAgentCommunication", body); | 211 | return BuildEvent("EstablishAgentCommunication", body); |
198 | } | 212 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 4501dd9..3b39153 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Collections.Specialized; | 31 | using System.Collections.Specialized; |
31 | using System.Drawing; | 32 | using System.Drawing; |
32 | using System.Drawing.Imaging; | 33 | using System.Drawing.Imaging; |
@@ -53,8 +54,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UploadBakedTextureModule")] | 54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UploadBakedTextureModule")] |
54 | public class UploadBakedTextureModule : INonSharedRegionModule | 55 | public class UploadBakedTextureModule : INonSharedRegionModule |
55 | { | 56 | { |
56 | // private static readonly ILog m_log = | 57 | private static readonly ILog m_log = |
57 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 59 | ||
59 | /// <summary> | 60 | /// <summary> |
60 | /// For historical reasons this is fixed, but there | 61 | /// For historical reasons this is fixed, but there |
@@ -63,39 +64,211 @@ namespace OpenSim.Region.ClientStack.Linden | |||
63 | 64 | ||
64 | private Scene m_scene; | 65 | private Scene m_scene; |
65 | private bool m_persistBakedTextures; | 66 | private bool m_persistBakedTextures; |
66 | private string m_URL; | 67 | |
68 | private IBakedTextureModule m_BakedTextureModule; | ||
67 | 69 | ||
68 | public void Initialise(IConfigSource source) | 70 | public void Initialise(IConfigSource source) |
69 | { | 71 | { |
70 | IConfig config = source.Configs["ClientStack.LindenCaps"]; | ||
71 | if (config == null) | ||
72 | return; | ||
73 | |||
74 | m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); | ||
75 | |||
76 | IConfig appearanceConfig = source.Configs["Appearance"]; | 72 | IConfig appearanceConfig = source.Configs["Appearance"]; |
77 | if (appearanceConfig != null) | 73 | if (appearanceConfig != null) |
78 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 74 | m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
75 | |||
76 | |||
79 | } | 77 | } |
80 | 78 | ||
81 | public void AddRegion(Scene s) | 79 | public void AddRegion(Scene s) |
82 | { | 80 | { |
83 | m_scene = s; | 81 | m_scene = s; |
82 | |||
84 | } | 83 | } |
85 | 84 | ||
86 | public void RemoveRegion(Scene s) | 85 | public void RemoveRegion(Scene s) |
87 | { | 86 | { |
87 | s.EventManager.OnRegisterCaps -= RegisterCaps; | ||
88 | s.EventManager.OnNewPresence -= RegisterNewPresence; | ||
89 | s.EventManager.OnRemovePresence -= DeRegisterPresence; | ||
90 | m_BakedTextureModule = null; | ||
91 | m_scene = null; | ||
88 | } | 92 | } |
89 | 93 | ||
94 | |||
95 | |||
90 | public void RegionLoaded(Scene s) | 96 | public void RegionLoaded(Scene s) |
91 | { | 97 | { |
92 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 98 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
99 | m_scene.EventManager.OnNewPresence += RegisterNewPresence; | ||
100 | m_scene.EventManager.OnRemovePresence += DeRegisterPresence; | ||
101 | |||
102 | } | ||
103 | |||
104 | private void DeRegisterPresence(UUID agentId) | ||
105 | { | ||
106 | ScenePresence presence = null; | ||
107 | if (m_scene.TryGetScenePresence(agentId, out presence)) | ||
108 | { | ||
109 | presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; | ||
110 | } | ||
111 | |||
112 | } | ||
113 | |||
114 | private void RegisterNewPresence(ScenePresence presence) | ||
115 | { | ||
116 | presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; | ||
117 | |||
118 | } | ||
119 | |||
120 | private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) | ||
121 | { | ||
122 | int maxCacheitemsLoop = cacheItems.Length; | ||
123 | if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES) | ||
124 | { | ||
125 | maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; | ||
126 | m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); | ||
127 | } | ||
128 | |||
129 | m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
130 | if (cacheItems.Length > 0) | ||
131 | { | ||
132 | m_log.Debug("[Cacheitems]: " + cacheItems.Length); | ||
133 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | ||
134 | { | ||
135 | m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | ||
136 | cacheItems[iter].TextureID); | ||
137 | } | ||
138 | |||
139 | ScenePresence p = null; | ||
140 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) | ||
141 | { | ||
142 | |||
143 | WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; | ||
144 | if (existingitems == null) | ||
145 | { | ||
146 | if (m_BakedTextureModule != null) | ||
147 | { | ||
148 | WearableCacheItem[] savedcache = null; | ||
149 | try | ||
150 | { | ||
151 | if (p.Appearance.WearableCacheItemsDirty) | ||
152 | { | ||
153 | savedcache = m_BakedTextureModule.Get(p.UUID); | ||
154 | p.Appearance.WearableCacheItems = savedcache; | ||
155 | p.Appearance.WearableCacheItemsDirty = false; | ||
156 | } | ||
157 | |||
158 | } | ||
159 | /* | ||
160 | * The following Catch types DO NOT WORK with m_BakedTextureModule.Get | ||
161 | * it jumps to the General Packet Exception Handler if you don't catch Exception! | ||
162 | * | ||
163 | catch (System.Net.Sockets.SocketException) | ||
164 | { | ||
165 | cacheItems = null; | ||
166 | } | ||
167 | catch (WebException) | ||
168 | { | ||
169 | cacheItems = null; | ||
170 | } | ||
171 | catch (InvalidOperationException) | ||
172 | { | ||
173 | cacheItems = null; | ||
174 | } */ | ||
175 | catch (Exception) | ||
176 | { | ||
177 | // The service logs a sufficient error message. | ||
178 | } | ||
179 | |||
180 | |||
181 | if (savedcache != null) | ||
182 | existingitems = savedcache; | ||
183 | } | ||
184 | } | ||
185 | // Existing items null means it's a fully new appearance | ||
186 | if (existingitems == null) | ||
187 | { | ||
188 | |||
189 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
190 | { | ||
191 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
192 | { | ||
193 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
194 | if (face == null) | ||
195 | { | ||
196 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
197 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
198 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
199 | continue; | ||
200 | } | ||
201 | cacheItems[i].TextureID =face.TextureID; | ||
202 | if (m_scene.AssetService != null) | ||
203 | cacheItems[i].TextureAsset = | ||
204 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
205 | } | ||
206 | else | ||
207 | { | ||
208 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
209 | } | ||
210 | |||
211 | |||
212 | } | ||
213 | } | ||
214 | else | ||
215 | |||
216 | |||
217 | { | ||
218 | // for each uploaded baked texture | ||
219 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
220 | { | ||
221 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
222 | { | ||
223 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
224 | if (face == null) | ||
225 | { | ||
226 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
227 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
228 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
229 | continue; | ||
230 | } | ||
231 | cacheItems[i].TextureID = | ||
232 | face.TextureID; | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
241 | { | ||
242 | if (cacheItems[i].TextureAsset == null) | ||
243 | { | ||
244 | cacheItems[i].TextureAsset = | ||
245 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
250 | |||
251 | |||
252 | p.Appearance.WearableCacheItems = cacheItems; | ||
253 | |||
254 | |||
255 | |||
256 | if (m_BakedTextureModule != null) | ||
257 | { | ||
258 | m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); | ||
259 | p.Appearance.WearableCacheItemsDirty = true; | ||
260 | |||
261 | } | ||
262 | } | ||
263 | } | ||
93 | } | 264 | } |
94 | 265 | ||
95 | public void PostInitialise() | 266 | public void PostInitialise() |
96 | { | 267 | { |
97 | } | 268 | } |
98 | 269 | ||
270 | |||
271 | |||
99 | public void Close() { } | 272 | public void Close() { } |
100 | 273 | ||
101 | public string Name { get { return "UploadBakedTextureModule"; } } | 274 | public string Name { get { return "UploadBakedTextureModule"; } } |
@@ -107,26 +280,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
107 | 280 | ||
108 | public void RegisterCaps(UUID agentID, Caps caps) | 281 | public void RegisterCaps(UUID agentID, Caps caps) |
109 | { | 282 | { |
110 | // UUID capID = UUID.Random(); | 283 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( |
284 | caps, m_scene.AssetService, m_persistBakedTextures); | ||
111 | 285 | ||
112 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | 286 | |
113 | if (m_URL == "localhost") | 287 | |
114 | { | 288 | caps.RegisterHandler( |
115 | caps.RegisterHandler( | 289 | "UploadBakedTexture", |
290 | new RestStreamHandler( | ||
291 | "POST", | ||
292 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
293 | avatarhandler.UploadBakedTexture, | ||
116 | "UploadBakedTexture", | 294 | "UploadBakedTexture", |
117 | new RestStreamHandler( | 295 | agentID.ToString())); |
118 | "POST", | 296 | |
119 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | 297 | |
120 | new UploadBakedTextureHandler( | 298 | |
121 | caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture, | 299 | |
122 | "UploadBakedTexture", | ||
123 | agentID.ToString())); | ||
124 | |||
125 | } | ||
126 | else | ||
127 | { | ||
128 | caps.RegisterHandler("UploadBakedTexture", m_URL); | ||
129 | } | ||
130 | } | 300 | } |
131 | } | 301 | } |
132 | } \ No newline at end of file | 302 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0ebccbe..9d39daa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -34,11 +34,13 @@ using System.Text; | |||
34 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Timers; | 35 | using System.Timers; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | |||
37 | using log4net; | 38 | using log4net; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenMetaverse.Packets; | 40 | using OpenMetaverse.Packets; |
40 | using OpenMetaverse.Messages.Linden; | 41 | using OpenMetaverse.Messages.Linden; |
41 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | |||
42 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Client; | 45 | using OpenSim.Framework.Client; |
44 | using OpenSim.Framework.Monitoring; | 46 | using OpenSim.Framework.Monitoring; |
@@ -48,7 +50,6 @@ using OpenSim.Services.Interfaces; | |||
48 | using Timer = System.Timers.Timer; | 50 | using Timer = System.Timers.Timer; |
49 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 51 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
50 | using RegionFlags = OpenMetaverse.RegionFlags; | 52 | using RegionFlags = OpenMetaverse.RegionFlags; |
51 | using Nini.Config; | ||
52 | 53 | ||
53 | using System.IO; | 54 | using System.IO; |
54 | using PermissionMask = OpenSim.Framework.PermissionMask; | 55 | using PermissionMask = OpenSim.Framework.PermissionMask; |
@@ -307,6 +308,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
307 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; | 308 | private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; |
308 | 309 | ||
309 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 310 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
311 | private static string LogHeader = "[LLCLIENTVIEW]"; | ||
310 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 312 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
311 | 313 | ||
312 | /// <summary> | 314 | /// <summary> |
@@ -323,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
323 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; | 325 | private readonly byte[] m_channelVersion = Utils.EmptyBytes; |
324 | private readonly IGroupsModule m_GroupsModule; | 326 | private readonly IGroupsModule m_GroupsModule; |
325 | 327 | ||
328 | private int m_cachedTextureSerial; | ||
326 | private PriorityQueue m_entityUpdates; | 329 | private PriorityQueue m_entityUpdates; |
327 | private PriorityQueue m_entityProps; | 330 | private PriorityQueue m_entityProps; |
328 | private Prioritizer m_prioritizer; | 331 | private Prioritizer m_prioritizer; |
@@ -447,7 +450,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
447 | 450 | ||
448 | // ~LLClientView() | 451 | // ~LLClientView() |
449 | // { | 452 | // { |
450 | // m_log.DebugFormat("[LLCLIENTVIEW]: Destructor called for {0}, circuit code {1}", Name, CircuitCode); | 453 | // m_log.DebugFormat("{0} Destructor called for {1}, circuit code {2}", LogHeader, Name, CircuitCode); |
451 | // } | 454 | // } |
452 | 455 | ||
453 | /// <summary> | 456 | /// <summary> |
@@ -513,9 +516,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | // there is some unidentified connection problem, not where we have issues due to deadlock | 516 | // there is some unidentified connection problem, not where we have issues due to deadlock |
514 | if (!IsActive && !force) | 517 | if (!IsActive && !force) |
515 | { | 518 | { |
516 | m_log.DebugFormat( | 519 | m_log.DebugFormat( "{0} Not attempting to close inactive client {1} in {2} since force flag is not set", |
517 | "[CLIENT]: Not attempting to close inactive client {0} in {1} since force flag is not set", | 520 | LogHeader, Name, m_scene.Name); |
518 | Name, m_scene.Name); | ||
519 | 521 | ||
520 | return; | 522 | return; |
521 | } | 523 | } |
@@ -1153,7 +1155,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1153 | /// <param name="map">heightmap</param> | 1155 | /// <param name="map">heightmap</param> |
1154 | public virtual void SendLayerData(float[] map) | 1156 | public virtual void SendLayerData(float[] map) |
1155 | { | 1157 | { |
1156 | Util.FireAndForget(DoSendLayerData, map); | 1158 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); |
1157 | } | 1159 | } |
1158 | 1160 | ||
1159 | /// <summary> | 1161 | /// <summary> |
@@ -1162,10 +1164,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1162 | /// <param name="o"></param> | 1164 | /// <param name="o"></param> |
1163 | private void DoSendLayerData(object o) | 1165 | private void DoSendLayerData(object o) |
1164 | { | 1166 | { |
1165 | float[] map = LLHeightFieldMoronize((float[])o); | 1167 | TerrainData map = (TerrainData)o; |
1166 | 1168 | ||
1167 | try | 1169 | try |
1168 | { | 1170 | { |
1171 | // Send LayerData in typerwriter pattern | ||
1169 | //for (int y = 0; y < 16; y++) | 1172 | //for (int y = 0; y < 16; y++) |
1170 | //{ | 1173 | //{ |
1171 | // for (int x = 0; x < 16; x++) | 1174 | // for (int x = 0; x < 16; x++) |
@@ -1175,7 +1178,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1175 | //} | 1178 | //} |
1176 | 1179 | ||
1177 | // Send LayerData in a spiral pattern. Fun! | 1180 | // Send LayerData in a spiral pattern. Fun! |
1178 | SendLayerTopRight(map, 0, 0, 15, 15); | 1181 | SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); |
1179 | } | 1182 | } |
1180 | catch (Exception e) | 1183 | catch (Exception e) |
1181 | { | 1184 | { |
@@ -1183,7 +1186,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1183 | } | 1186 | } |
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | 1189 | private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2) |
1187 | { | 1190 | { |
1188 | // Row | 1191 | // Row |
1189 | for (int i = x1; i <= x2; i++) | 1192 | for (int i = x1; i <= x2; i++) |
@@ -1193,11 +1196,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1193 | for (int j = y1 + 1; j <= y2; j++) | 1196 | for (int j = y1 + 1; j <= y2; j++) |
1194 | SendLayerData(x2, j, map); | 1197 | SendLayerData(x2, j, map); |
1195 | 1198 | ||
1196 | if (x2 - x1 > 0) | 1199 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1197 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | 1200 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); |
1198 | } | 1201 | } |
1199 | 1202 | ||
1200 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | 1203 | void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2) |
1201 | { | 1204 | { |
1202 | // Row in reverse | 1205 | // Row in reverse |
1203 | for (int i = x2; i >= x1; i--) | 1206 | for (int i = x2; i >= x1; i--) |
@@ -1207,7 +1210,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1207 | for (int j = y2 - 1; j >= y1; j--) | 1210 | for (int j = y2 - 1; j >= y1; j--) |
1208 | SendLayerData(x1, j, map); | 1211 | SendLayerData(x1, j, map); |
1209 | 1212 | ||
1210 | if (x2 - x1 > 0) | 1213 | if (x2 - x1 > 0 && y2 - y1 > 0) |
1211 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | 1214 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); |
1212 | } | 1215 | } |
1213 | 1216 | ||
@@ -1229,22 +1232,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1229 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1232 | // OutPacket(layerpack, ThrottleOutPacketType.Land); |
1230 | // } | 1233 | // } |
1231 | 1234 | ||
1235 | // Legacy form of invocation that passes around a bare data array. | ||
1236 | // Just ignore what was passed and use the real terrain info that is part of the scene. | ||
1237 | public void SendLayerData(int px, int py, float[] map) | ||
1238 | { | ||
1239 | SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); | ||
1240 | } | ||
1241 | |||
1232 | /// <summary> | 1242 | /// <summary> |
1233 | /// Sends a specified patch to a client | 1243 | /// Sends a terrain packet for the point specified. |
1244 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. | ||
1245 | /// We just use the terrain from the region we know about. | ||
1234 | /// </summary> | 1246 | /// </summary> |
1235 | /// <param name="px">Patch coordinate (x) 0..15</param> | 1247 | /// <param name="px">Patch coordinate (x) 0..15</param> |
1236 | /// <param name="py">Patch coordinate (y) 0..15</param> | 1248 | /// <param name="py">Patch coordinate (y) 0..15</param> |
1237 | /// <param name="map">heightmap</param> | 1249 | /// <param name="map">heightmap</param> |
1238 | public void SendLayerData(int px, int py, float[] map) | 1250 | public void SendLayerData(int px, int py, TerrainData terrData) |
1239 | { | 1251 | { |
1240 | try | 1252 | try |
1241 | { | 1253 | { |
1242 | int[] patches = new int[] { py * 16 + px }; | 1254 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py); |
1243 | float[] heightmap = (map.Length == 65536) ? | ||
1244 | map : | ||
1245 | LLHeightFieldMoronize(map); | ||
1246 | |||
1247 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1248 | 1255 | ||
1249 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. | 1256 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. |
1250 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. | 1257 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. |
@@ -1262,14 +1269,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1262 | if (m_justEditedTerrain) | 1269 | if (m_justEditedTerrain) |
1263 | { | 1270 | { |
1264 | layerpack.Header.Reliable = false; | 1271 | layerpack.Header.Reliable = false; |
1265 | OutPacket(layerpack, | 1272 | OutPacket(layerpack, ThrottleOutPacketType.Unknown ); |
1266 | ThrottleOutPacketType.Unknown ); | ||
1267 | } | 1273 | } |
1268 | else | 1274 | else |
1269 | { | 1275 | { |
1270 | layerpack.Header.Reliable = true; | 1276 | layerpack.Header.Reliable = true; |
1271 | OutPacket(layerpack, | 1277 | OutPacket(layerpack, ThrottleOutPacketType.Land); |
1272 | ThrottleOutPacketType.Land); | ||
1273 | } | 1278 | } |
1274 | } | 1279 | } |
1275 | catch (Exception e) | 1280 | catch (Exception e) |
@@ -1279,38 +1284,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1279 | } | 1284 | } |
1280 | 1285 | ||
1281 | /// <summary> | 1286 | /// <summary> |
1282 | /// Munges heightfield into the LLUDP backed in restricted heightfield. | ||
1283 | /// </summary> | ||
1284 | /// <param name="map">float array in the base; Constants.RegionSize</param> | ||
1285 | /// <returns>float array in the base 256</returns> | ||
1286 | internal float[] LLHeightFieldMoronize(float[] map) | ||
1287 | { | ||
1288 | if (map.Length == 65536) | ||
1289 | return map; | ||
1290 | else | ||
1291 | { | ||
1292 | float[] returnmap = new float[65536]; | ||
1293 | |||
1294 | if (map.Length < 65535) | ||
1295 | { | ||
1296 | // rebase the vector stride to 256 | ||
1297 | for (int i = 0; i < Constants.RegionSize; i++) | ||
1298 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize); | ||
1299 | } | ||
1300 | else | ||
1301 | { | ||
1302 | for (int i = 0; i < 256; i++) | ||
1303 | Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256); | ||
1304 | } | ||
1305 | |||
1306 | //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536); | ||
1307 | |||
1308 | return returnmap; | ||
1309 | } | ||
1310 | |||
1311 | } | ||
1312 | |||
1313 | /// <summary> | ||
1314 | /// Send the wind matrix to the client | 1287 | /// Send the wind matrix to the client |
1315 | /// </summary> | 1288 | /// </summary> |
1316 | /// <param name="windSpeeds">16x16 array of wind speeds</param> | 1289 | /// <param name="windSpeeds">16x16 array of wind speeds</param> |
@@ -1350,7 +1323,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1350 | } | 1323 | } |
1351 | } | 1324 | } |
1352 | 1325 | ||
1353 | LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Wind); | 1326 | byte layerType = (byte)TerrainPatch.LayerType.Wind; |
1327 | if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) | ||
1328 | layerType = (byte)TerrainPatch.LayerType.WindExtended; | ||
1329 | |||
1330 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, | ||
1331 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); | ||
1354 | layerpack.Header.Zerocoded = true; | 1332 | layerpack.Header.Zerocoded = true; |
1355 | OutPacket(layerpack, ThrottleOutPacketType.Wind); | 1333 | OutPacket(layerpack, ThrottleOutPacketType.Wind); |
1356 | } | 1334 | } |
@@ -1374,7 +1352,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1374 | } | 1352 | } |
1375 | } | 1353 | } |
1376 | 1354 | ||
1377 | LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Cloud); | 1355 | byte layerType = (byte)TerrainPatch.LayerType.Cloud; |
1356 | if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) | ||
1357 | layerType = (byte)TerrainPatch.LayerType.CloudExtended; | ||
1358 | |||
1359 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, | ||
1360 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); | ||
1378 | layerpack.Header.Zerocoded = true; | 1361 | layerpack.Header.Zerocoded = true; |
1379 | OutPacket(layerpack, ThrottleOutPacketType.Cloud); | 1362 | OutPacket(layerpack, ThrottleOutPacketType.Cloud); |
1380 | } | 1363 | } |
@@ -2785,8 +2768,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2785 | { | 2768 | { |
2786 | if (req.AssetInf.Data == null) | 2769 | if (req.AssetInf.Data == null) |
2787 | { | 2770 | { |
2788 | m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null", | 2771 | m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null", |
2789 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2772 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2790 | return; | 2773 | return; |
2791 | } | 2774 | } |
2792 | 2775 | ||
@@ -6446,26 +6429,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6446 | // Temporarily protect ourselves from the mantis #951 failure. | 6429 | // Temporarily protect ourselves from the mantis #951 failure. |
6447 | // However, we could do this for several other handlers where a failure isn't terminal | 6430 | // However, we could do this for several other handlers where a failure isn't terminal |
6448 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 6431 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
6432 | Vector3 avSize = appear.AgentData.Size; | ||
6449 | try | 6433 | try |
6450 | { | 6434 | { |
6451 | byte[] visualparams = new byte[appear.VisualParam.Length]; | 6435 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
6452 | for (int i = 0; i < appear.VisualParam.Length; i++) | 6436 | for (int i = 0; i < appear.VisualParam.Length; i++) |
6453 | visualparams[i] = appear.VisualParam[i].ParamValue; | 6437 | visualparams[i] = appear.VisualParam[i].ParamValue; |
6438 | //var b = appear.WearableData[0]; | ||
6454 | 6439 | ||
6455 | Primitive.TextureEntry te = null; | 6440 | Primitive.TextureEntry te = null; |
6456 | if (appear.ObjectData.TextureEntry.Length > 1) | 6441 | if (appear.ObjectData.TextureEntry.Length > 1) |
6457 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 6442 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
6458 | 6443 | ||
6459 | List<CachedTextureRequestArg> hashes = new List<CachedTextureRequestArg>(); | 6444 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; |
6460 | for (int i = 0; i < appear.WearableData.Length; i++) | 6445 | for (int i=0; i<appear.WearableData.Length;i++) |
6461 | { | 6446 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; |
6462 | CachedTextureRequestArg arg = new CachedTextureRequestArg(); | ||
6463 | arg.BakedTextureIndex = appear.WearableData[i].TextureIndex; | ||
6464 | arg.WearableHashID = appear.WearableData[i].CacheID; | ||
6465 | hashes.Add(arg); | ||
6466 | } | ||
6467 | 6447 | ||
6468 | handlerSetAppearance(sender, te, visualparams, hashes); | 6448 | |
6449 | |||
6450 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); | ||
6469 | } | 6451 | } |
6470 | catch (Exception e) | 6452 | catch (Exception e) |
6471 | { | 6453 | { |
@@ -8971,6 +8953,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8971 | TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; | 8953 | TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; |
8972 | if (handlerTeleportLocationRequest != null) | 8954 | if (handlerTeleportLocationRequest != null) |
8973 | { | 8955 | { |
8956 | // Adjust teleport location to base of a larger region if requested to teleport to a sub-region | ||
8957 | uint locX, locY; | ||
8958 | Util.RegionHandleToWorldLoc(tpLocReq.Info.RegionHandle, out locX, out locY); | ||
8959 | if ((locX >= m_scene.RegionInfo.WorldLocX) | ||
8960 | && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) | ||
8961 | && (locY >= m_scene.RegionInfo.WorldLocY) | ||
8962 | && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) | ||
8963 | { | ||
8964 | tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
8965 | tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; | ||
8966 | tpLocReq.Info.Position.Y += locY - m_scene.RegionInfo.WorldLocY; | ||
8967 | } | ||
8968 | |||
8974 | handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, | 8969 | handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, |
8975 | tpLocReq.Info.LookAt, 16); | 8970 | tpLocReq.Info.LookAt, 16); |
8976 | } | 8971 | } |
@@ -11758,36 +11753,158 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11758 | /// <returns></returns> | 11753 | /// <returns></returns> |
11759 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | 11754 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) |
11760 | { | 11755 | { |
11756 | //m_log.Debug("texture cached: " + packet.ToString()); | ||
11761 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | 11757 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
11758 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | ||
11762 | 11759 | ||
11763 | if (cachedtex.AgentData.SessionID != SessionId) | 11760 | if (cachedtex.AgentData.SessionID != SessionId) |
11764 | return false; | 11761 | return false; |
11765 | 11762 | ||
11766 | List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); | ||
11767 | 11763 | ||
11768 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | 11764 | // TODO: don't create new blocks if recycling an old packet |
11769 | { | 11765 | cachedresp.AgentData.AgentID = AgentId; |
11770 | CachedTextureRequestArg arg = new CachedTextureRequestArg(); | 11766 | cachedresp.AgentData.SessionID = m_sessionId; |
11771 | arg.BakedTextureIndex = cachedtex.WearableData[i].TextureIndex; | 11767 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; |
11772 | arg.WearableHashID = cachedtex.WearableData[i].ID; | 11768 | m_cachedTextureSerial++; |
11773 | 11769 | cachedresp.WearableData = | |
11774 | requestArgs.Add(arg); | 11770 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; |
11775 | } | 11771 | |
11772 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); | ||
11773 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
11774 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
11775 | |||
11776 | IAssetService cache = m_scene.AssetService; | ||
11777 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
11778 | //bakedTextureModule = null; | ||
11779 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
11780 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | ||
11781 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | ||
11782 | |||
11783 | if (bakedTextureModule != null && cache != null) | ||
11784 | { | ||
11785 | // 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 | ||
11786 | |||
11787 | WearableCacheItem[] cacheItems = null; | ||
11788 | ScenePresence p = m_scene.GetScenePresence(AgentId); | ||
11789 | if (p.Appearance != null) | ||
11790 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
11791 | { | ||
11792 | try | ||
11793 | { | ||
11794 | cacheItems = bakedTextureModule.Get(AgentId); | ||
11795 | p.Appearance.WearableCacheItems = cacheItems; | ||
11796 | p.Appearance.WearableCacheItemsDirty = false; | ||
11797 | } | ||
11776 | 11798 | ||
11777 | try | 11799 | /* |
11778 | { | 11800 | * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! |
11779 | CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; | 11801 | * |
11780 | if (handlerCachedTextureRequest != null) | 11802 | catch (System.Net.Sockets.SocketException) |
11803 | { | ||
11804 | cacheItems = null; | ||
11805 | } | ||
11806 | catch (WebException) | ||
11807 | { | ||
11808 | cacheItems = null; | ||
11809 | } | ||
11810 | catch (InvalidOperationException) | ||
11811 | { | ||
11812 | cacheItems = null; | ||
11813 | } */ | ||
11814 | catch (Exception) | ||
11815 | { | ||
11816 | cacheItems = null; | ||
11817 | } | ||
11818 | |||
11819 | } | ||
11820 | else if (p.Appearance.WearableCacheItems != null) | ||
11821 | { | ||
11822 | cacheItems = p.Appearance.WearableCacheItems; | ||
11823 | } | ||
11824 | |||
11825 | if (cache != null && cacheItems != null) | ||
11826 | { | ||
11827 | foreach (WearableCacheItem item in cacheItems) | ||
11828 | { | ||
11829 | |||
11830 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
11831 | { | ||
11832 | item.TextureAsset.Temporary = true; | ||
11833 | cache.Store(item.TextureAsset); | ||
11834 | } | ||
11835 | |||
11836 | |||
11837 | } | ||
11838 | } | ||
11839 | if (cacheItems != null) | ||
11781 | { | 11840 | { |
11782 | handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); | 11841 | |
11842 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11843 | { | ||
11844 | WearableCacheItem item = | ||
11845 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
11846 | |||
11847 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11848 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | ||
11849 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11850 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | ||
11851 | { | ||
11852 | |||
11853 | cachedresp.WearableData[i].TextureID = item.TextureID; | ||
11854 | } | ||
11855 | else | ||
11856 | { | ||
11857 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11858 | } | ||
11859 | } | ||
11860 | } | ||
11861 | else | ||
11862 | { | ||
11863 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11864 | { | ||
11865 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11866 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11867 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11868 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11869 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11870 | } | ||
11783 | } | 11871 | } |
11784 | } | 11872 | } |
11785 | catch (Exception e) | 11873 | else |
11786 | { | 11874 | { |
11787 | m_log.ErrorFormat("[CLIENT VIEW]: AgentTextureCached packet handler threw an exception, {0}", e); | 11875 | if (cache == null) |
11788 | return false; | 11876 | { |
11877 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11878 | { | ||
11879 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11880 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11881 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11882 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11883 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11884 | } | ||
11885 | } | ||
11886 | else | ||
11887 | { | ||
11888 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11889 | { | ||
11890 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11891 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11892 | |||
11893 | |||
11894 | |||
11895 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) | ||
11896 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11897 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11898 | else | ||
11899 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11900 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11901 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11902 | } | ||
11903 | } | ||
11789 | } | 11904 | } |
11790 | 11905 | cachedresp.Header.Zerocoded = true; | |
11906 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | ||
11907 | |||
11791 | return true; | 11908 | return true; |
11792 | } | 11909 | } |
11793 | 11910 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 202cc62..51433cb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -162,6 +162,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
162 | private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC | 162 | private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC |
163 | private int m_maxRTO = 60000; | 163 | private int m_maxRTO = 60000; |
164 | 164 | ||
165 | /// <summary> | ||
166 | /// This is the percentage of the udp texture queue to add to the task queue since | ||
167 | /// textures are now generally handled through http. | ||
168 | /// </summary> | ||
169 | private double m_cannibalrate = 0.0; | ||
170 | |||
165 | private ClientInfo m_info = new ClientInfo(); | 171 | private ClientInfo m_info = new ClientInfo(); |
166 | 172 | ||
167 | /// <summary> | 173 | /// <summary> |
@@ -201,6 +207,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
201 | // Create an array of token buckets for this clients different throttle categories | 207 | // Create an array of token buckets for this clients different throttle categories |
202 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 208 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
203 | 209 | ||
210 | m_cannibalrate = rates.CannibalizeTextureRate; | ||
211 | |||
204 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) | 212 | for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) |
205 | { | 213 | { |
206 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; | 214 | ThrottleOutPacketType type = (ThrottleOutPacketType)i; |
@@ -349,6 +357,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
349 | texture = Math.Max(texture, LLUDPServer.MTU); | 357 | texture = Math.Max(texture, LLUDPServer.MTU); |
350 | asset = Math.Max(asset, LLUDPServer.MTU); | 358 | asset = Math.Max(asset, LLUDPServer.MTU); |
351 | 359 | ||
360 | // Since most textures are now delivered through http, make it possible | ||
361 | // to cannibalize some of the bw from the texture throttle to use for | ||
362 | // the task queue (e.g. object updates) | ||
363 | task = task + (int)(m_cannibalrate * texture); | ||
364 | texture = (int)((1 - m_cannibalrate) * texture); | ||
365 | |||
352 | //int total = resend + land + wind + cloud + task + texture + asset; | 366 | //int total = resend + land + wind + cloud + task + texture + asset; |
353 | //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", | 367 | //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", |
354 | // AgentID, resend, land, wind, cloud, task, texture, asset, total); | 368 | // AgentID, resend, land, wind, cloud, task, texture, asset, total); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index c9aac0b..e5bae6e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
@@ -59,6 +59,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
59 | /// <summary>Flag used to enable adaptive throttles</summary> | 59 | /// <summary>Flag used to enable adaptive throttles</summary> |
60 | public bool AdaptiveThrottlesEnabled; | 60 | public bool AdaptiveThrottlesEnabled; |
61 | 61 | ||
62 | /// <summary>Amount of the texture throttle to steal for the task throttle</summary> | ||
63 | public double CannibalizeTextureRate; | ||
64 | |||
62 | /// <summary> | 65 | /// <summary> |
63 | /// Default constructor | 66 | /// Default constructor |
64 | /// </summary> | 67 | /// </summary> |
@@ -80,6 +83,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
80 | Total = throttleConfig.GetInt("client_throttle_max_bps", 0); | 83 | Total = throttleConfig.GetInt("client_throttle_max_bps", 0); |
81 | 84 | ||
82 | AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); | 85 | AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); |
86 | |||
87 | CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); | ||
88 | CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); | ||
83 | } | 89 | } |
84 | catch (Exception) { } | 90 | catch (Exception) { } |
85 | } | 91 | } |