aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
diff options
context:
space:
mode:
authorteravus2012-11-04 22:57:24 -0500
committerteravus2012-11-04 22:57:24 -0500
commit4fa088bafb4c78ad3177b0e944a4312bd6abdea7 (patch)
treed6ff3e82c2e5502fc57eec819dc9e97752030c27 /OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
parentPrevent IMs being sent to prims when avies decline inventory offers from them. (diff)
downloadopensim-SC_OLD-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.zip
opensim-SC_OLD-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.gz
opensim-SC_OLD-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.bz2
opensim-SC_OLD-4fa088bafb4c78ad3177b0e944a4312bd6abdea7.tar.xz
Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index d1a1583..19d4b91 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack.Linden
91 { 91 {
92 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 92 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
93 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 93 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
94 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
94 m_scene = null; 95 m_scene = null;
95 } 96 }
96 97
@@ -101,6 +102,7 @@ namespace OpenSim.Region.ClientStack.Linden
101 102
102 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 103 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
103 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 104 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
105 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
104 106
105 if (m_workerThreads == null) 107 if (m_workerThreads == null)
106 { 108 {
@@ -118,6 +120,46 @@ namespace OpenSim.Region.ClientStack.Linden
118 } 120 }
119 } 121 }
120 } 122 }
123 private int ExtractImageThrottle(byte[] pthrottles)
124 {
125
126 byte[] adjData;
127 int pos = 0;
128
129 if (!BitConverter.IsLittleEndian)
130 {
131 byte[] newData = new byte[7 * 4];
132 Buffer.BlockCopy(pthrottles, 0, newData, 0, 7 * 4);
133
134 for (int i = 0; i < 7; i++)
135 Array.Reverse(newData, i * 4, 4);
136
137 adjData = newData;
138 }
139 else
140 {
141 adjData = pthrottles;
142 }
143
144 // 0.125f converts from bits to bytes
145 //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
146 // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
147 // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
148 // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
149 // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
150 pos = pos + 16;
151 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
152 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
153 return texture;
154 }
155
156 // Now we know when the throttle is changed by the client in the case of a root agent or by a neighbor region in the case of a child agent.
157 public void ThrottleUpdate(ScenePresence p)
158 {
159 byte[] throttles = p.ControllingClient.GetThrottlesPacked(1);
160 UUID user = p.UUID;
161 int imagethrottle = ExtractImageThrottle(throttles);
162 }
121 163
122 public void PostInitialise() 164 public void PostInitialise()
123 { 165 {