diff options
author | MW | 2007-06-10 15:49:59 +0000 |
---|---|---|
committer | MW | 2007-06-10 15:49:59 +0000 |
commit | 44e5ff33df48da8ce9c4534d41c3b6c2b8919e13 (patch) | |
tree | a2a9047287d8b2b83223e658c6a84fe6a5fe3124 | |
parent | Prim creation working. (diff) | |
download | opensim-SC-44e5ff33df48da8ce9c4534d41c3b6c2b8919e13.zip opensim-SC-44e5ff33df48da8ce9c4534d41c3b6c2b8919e13.tar.gz opensim-SC-44e5ff33df48da8ce9c4534d41c3b6c2b8919e13.tar.bz2 opensim-SC-44e5ff33df48da8ce9c4534d41c3b6c2b8919e13.tar.xz |
Added a Couple of summary comments
-rw-r--r-- | OpenSim/OpenSim.Region/World/Primitive.cs | 90 | ||||
-rw-r--r-- | OpenSim/OpenSim.RegionServer/ClientView.API.cs | 251 |
2 files changed, 258 insertions, 83 deletions
diff --git a/OpenSim/OpenSim.Region/World/Primitive.cs b/OpenSim/OpenSim.Region/World/Primitive.cs index d540a3b..c800f21 100644 --- a/OpenSim/OpenSim.Region/World/Primitive.cs +++ b/OpenSim/OpenSim.Region/World/Primitive.cs | |||
@@ -45,6 +45,7 @@ namespace OpenSim.Region | |||
45 | this._physActor = value; | 45 | this._physActor = value; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | |||
48 | public override LLVector3 Pos | 49 | public override LLVector3 Pos |
49 | { | 50 | { |
50 | get | 51 | get |
@@ -58,6 +59,12 @@ namespace OpenSim.Region | |||
58 | } | 59 | } |
59 | #endregion | 60 | #endregion |
60 | 61 | ||
62 | /// <summary> | ||
63 | /// | ||
64 | /// </summary> | ||
65 | /// <param name="clientThreads"></param> | ||
66 | /// <param name="regionHandle"></param> | ||
67 | /// <param name="world"></param> | ||
61 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world) | 68 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world) |
62 | { | 69 | { |
63 | m_clientThreads = clientThreads; | 70 | m_clientThreads = clientThreads; |
@@ -66,6 +73,15 @@ namespace OpenSim.Region | |||
66 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); | 73 | inventoryItems = new Dictionary<LLUUID, InventoryItem>(); |
67 | } | 74 | } |
68 | 75 | ||
76 | /// <summary> | ||
77 | /// | ||
78 | /// </summary> | ||
79 | /// <param name="clientThreads"></param> | ||
80 | /// <param name="regionHandle"></param> | ||
81 | /// <param name="world"></param> | ||
82 | /// <param name="owner"></param> | ||
83 | /// <param name="fullID"></param> | ||
84 | /// <param name="localID"></param> | ||
69 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID) | 85 | public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID) |
70 | { | 86 | { |
71 | m_clientThreads = clientThreads; | 87 | m_clientThreads = clientThreads; |
@@ -102,7 +118,10 @@ namespace OpenSim.Region | |||
102 | this.updateFlag = 1; | 118 | this.updateFlag = 1; |
103 | } | 119 | } |
104 | 120 | ||
105 | 121 | /// <summary> | |
122 | /// | ||
123 | /// </summary> | ||
124 | /// <returns></returns> | ||
106 | public byte[] GetByteArray() | 125 | public byte[] GetByteArray() |
107 | { | 126 | { |
108 | byte[] result = null; | 127 | byte[] result = null; |
@@ -139,6 +158,9 @@ namespace OpenSim.Region | |||
139 | 158 | ||
140 | #region Overridden Methods | 159 | #region Overridden Methods |
141 | 160 | ||
161 | /// <summary> | ||
162 | /// | ||
163 | /// </summary> | ||
142 | public override void update() | 164 | public override void update() |
143 | { | 165 | { |
144 | if (this.updateFlag == 1) | 166 | if (this.updateFlag == 1) |
@@ -148,6 +170,9 @@ namespace OpenSim.Region | |||
148 | } | 170 | } |
149 | } | 171 | } |
150 | 172 | ||
173 | /// <summary> | ||
174 | /// | ||
175 | /// </summary> | ||
151 | public override void BackUp() | 176 | public override void BackUp() |
152 | { | 177 | { |
153 | 178 | ||
@@ -157,11 +182,19 @@ namespace OpenSim.Region | |||
157 | 182 | ||
158 | #region Packet handlers | 183 | #region Packet handlers |
159 | 184 | ||
185 | /// <summary> | ||
186 | /// | ||
187 | /// </summary> | ||
188 | /// <param name="pos"></param> | ||
160 | public void UpdatePosition(LLVector3 pos) | 189 | public void UpdatePosition(LLVector3 pos) |
161 | { | 190 | { |
162 | 191 | ||
163 | } | 192 | } |
164 | 193 | ||
194 | /// <summary> | ||
195 | /// | ||
196 | /// </summary> | ||
197 | /// <param name="addPacket"></param> | ||
165 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | 198 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) |
166 | { | 199 | { |
167 | this.primData.PathBegin = addPacket.PathBegin; | 200 | this.primData.PathBegin = addPacket.PathBegin; |
@@ -184,22 +217,38 @@ namespace OpenSim.Region | |||
184 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; | 217 | this.primData.PathTwistBegin = addPacket.PathTwistBegin; |
185 | } | 218 | } |
186 | 219 | ||
220 | /// <summary> | ||
221 | /// | ||
222 | /// </summary> | ||
223 | /// <param name="tex"></param> | ||
187 | public void UpdateTexture(byte[] tex) | 224 | public void UpdateTexture(byte[] tex) |
188 | { | 225 | { |
189 | this.primData.Texture = tex; | 226 | this.primData.Texture = tex; |
190 | //this.dirtyFlag = true; | 227 | //this.dirtyFlag = true; |
191 | } | 228 | } |
192 | 229 | ||
230 | /// <summary> | ||
231 | /// | ||
232 | /// </summary> | ||
233 | /// <param name="pack"></param> | ||
193 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) | 234 | public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) |
194 | { | 235 | { |
195 | 236 | ||
196 | } | 237 | } |
197 | 238 | ||
239 | /// <summary> | ||
240 | /// | ||
241 | /// </summary> | ||
242 | /// <param name="prim"></param> | ||
198 | public void AssignToParent(Primitive prim) | 243 | public void AssignToParent(Primitive prim) |
199 | { | 244 | { |
200 | 245 | ||
201 | } | 246 | } |
202 | 247 | ||
248 | /// <summary> | ||
249 | /// | ||
250 | /// </summary> | ||
251 | /// <param name="client"></param> | ||
203 | public void GetProperites(IClientAPI client) | 252 | public void GetProperites(IClientAPI client) |
204 | { | 253 | { |
205 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | 254 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); |
@@ -286,7 +335,11 @@ namespace OpenSim.Region | |||
286 | 335 | ||
287 | #region Update viewers Methods | 336 | #region Update viewers Methods |
288 | 337 | ||
289 | //should change these mehtods, so that outgoing packets are sent through the avatar class | 338 | //should change these mehtods, so that outgoing packets are sent through the avatar class? |
339 | /// <summary> | ||
340 | /// | ||
341 | /// </summary> | ||
342 | /// <param name="remoteClient"></param> | ||
290 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 343 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
291 | { | 344 | { |
292 | LLVector3 lPos; | 345 | LLVector3 lPos; |
@@ -303,6 +356,9 @@ namespace OpenSim.Region | |||
303 | remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.localid, this.primData, lPos, new LLUUID("00000000-0000-0000-5005-000000000005")); | 356 | remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.localid, this.primData, lPos, new LLUUID("00000000-0000-0000-5005-000000000005")); |
304 | } | 357 | } |
305 | 358 | ||
359 | /// <summary> | ||
360 | /// | ||
361 | /// </summary> | ||
306 | public void SendFullUpdateToAllClients() | 362 | public void SendFullUpdateToAllClients() |
307 | { | 363 | { |
308 | List<Avatar> avatars = this.m_world.RequestAvatarList(); | 364 | List<Avatar> avatars = this.m_world.RequestAvatarList(); |
@@ -312,6 +368,10 @@ namespace OpenSim.Region | |||
312 | } | 368 | } |
313 | } | 369 | } |
314 | 370 | ||
371 | /// <summary> | ||
372 | /// | ||
373 | /// </summary> | ||
374 | /// <param name="RemoteClient"></param> | ||
315 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) | 375 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) |
316 | { | 376 | { |
317 | LLVector3 lPos; | 377 | LLVector3 lPos; |
@@ -331,6 +391,9 @@ namespace OpenSim.Region | |||
331 | 391 | ||
332 | } | 392 | } |
333 | 393 | ||
394 | /// <summary> | ||
395 | /// | ||
396 | /// </summary> | ||
334 | public void SendTerseUpdateToALLClients() | 397 | public void SendTerseUpdateToALLClients() |
335 | { | 398 | { |
336 | List<Avatar> avatars = this.m_world.RequestAvatarList(); | 399 | List<Avatar> avatars = this.m_world.RequestAvatarList(); |
@@ -344,6 +407,12 @@ namespace OpenSim.Region | |||
344 | 407 | ||
345 | #region Create Methods | 408 | #region Create Methods |
346 | 409 | ||
410 | /// <summary> | ||
411 | /// | ||
412 | /// </summary> | ||
413 | /// <param name="addPacket"></param> | ||
414 | /// <param name="ownerID"></param> | ||
415 | /// <param name="localID"></param> | ||
347 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) | 416 | public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) |
348 | { | 417 | { |
349 | PrimData PData = new PrimData(); | 418 | PrimData PData = new PrimData(); |
@@ -380,16 +449,31 @@ namespace OpenSim.Region | |||
380 | this.updateFlag = 1; | 449 | this.updateFlag = 1; |
381 | } | 450 | } |
382 | 451 | ||
452 | /// <summary> | ||
453 | /// | ||
454 | /// </summary> | ||
455 | /// <param name="data"></param> | ||
383 | public void CreateFromBytes(byte[] data) | 456 | public void CreateFromBytes(byte[] data) |
384 | { | 457 | { |
385 | 458 | ||
386 | } | 459 | } |
387 | 460 | ||
461 | /// <summary> | ||
462 | /// | ||
463 | /// </summary> | ||
464 | /// <param name="primData"></param> | ||
388 | public void CreateFromPrimData(PrimData primData) | 465 | public void CreateFromPrimData(PrimData primData) |
389 | { | 466 | { |
390 | this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); | 467 | this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); |
391 | } | 468 | } |
392 | 469 | ||
470 | /// <summary> | ||
471 | /// | ||
472 | /// </summary> | ||
473 | /// <param name="primData"></param> | ||
474 | /// <param name="posi"></param> | ||
475 | /// <param name="localID"></param> | ||
476 | /// <param name="newprim"></param> | ||
393 | public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) | 477 | public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) |
394 | { | 478 | { |
395 | 479 | ||
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index f59e170..fe46fcb 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs | |||
@@ -182,56 +182,7 @@ namespace OpenSim | |||
182 | this.OutPacket(reply); | 182 | this.OutPacket(reply); |
183 | } | 183 | } |
184 | 184 | ||
185 | /// <summary> | 185 | |
186 | /// | ||
187 | /// </summary> | ||
188 | /// <param name="wearables"></param> | ||
189 | public void SendWearables(AvatarWearable[] wearables) | ||
190 | { | ||
191 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
192 | aw.AgentData.AgentID = this.AgentID; | ||
193 | aw.AgentData.SerialNum = 0; | ||
194 | aw.AgentData.SessionID = this.SessionID; | ||
195 | |||
196 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
197 | AgentWearablesUpdatePacket.WearableDataBlock awb; | ||
198 | for (int i = 0; i < wearables.Length; i++) | ||
199 | { | ||
200 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
201 | awb.WearableType = (byte)i; | ||
202 | awb.AssetID = wearables[i].AssetID; | ||
203 | awb.ItemID = wearables[i].ItemID; | ||
204 | aw.WearableData[i] = awb; | ||
205 | } | ||
206 | |||
207 | this.OutPacket(aw); | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// | ||
212 | /// </summary> | ||
213 | /// <param name="agentID"></param> | ||
214 | /// <param name="visualParams"></param> | ||
215 | /// <param name="textureEntry"></param> | ||
216 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) | ||
217 | { | ||
218 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
219 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
220 | avp.ObjectData.TextureEntry = textureEntry; | ||
221 | |||
222 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
223 | for (int i = 0; i < visualParams.Length; i++) | ||
224 | { | ||
225 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
226 | avblock.ParamValue = visualParams[i]; | ||
227 | avp.VisualParam[i] = avblock; | ||
228 | } | ||
229 | |||
230 | avp.Sender.IsTrial = false; | ||
231 | avp.Sender.ID = agentID; | ||
232 | OutPacket(avp); | ||
233 | } | ||
234 | |||
235 | /// <summary> | 186 | /// <summary> |
236 | /// Send the region heightmap to the client | 187 | /// Send the region heightmap to the client |
237 | /// </summary> | 188 | /// </summary> |
@@ -287,7 +238,91 @@ namespace OpenSim | |||
287 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | 238 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); |
288 | } | 239 | } |
289 | } | 240 | } |
241 | |||
242 | public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) | ||
243 | { | ||
244 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
245 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
246 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | ||
247 | |||
248 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
249 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
250 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
251 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
252 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
253 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
254 | OutPacket(enablesimpacket); | ||
255 | } | ||
256 | |||
257 | public AgentCircuitData RequestClientInfo() | ||
258 | { | ||
259 | AgentCircuitData agentData = new AgentCircuitData(); | ||
260 | agentData.AgentID = this.AgentId; | ||
261 | agentData.SessionID = this.SessionID; | ||
262 | agentData.SecureSessionID = this.SecureSessionID; | ||
263 | agentData.circuitcode = this.CircuitCode; | ||
264 | agentData.child = false; | ||
265 | agentData.firstname = this.firstName; | ||
266 | agentData.lastname = this.lastName; | ||
267 | |||
268 | return agentData; | ||
269 | } | ||
270 | |||
271 | #region Appearance/ Wearables Methods | ||
272 | |||
273 | /// <summary> | ||
274 | /// | ||
275 | /// </summary> | ||
276 | /// <param name="wearables"></param> | ||
277 | public void SendWearables(AvatarWearable[] wearables) | ||
278 | { | ||
279 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
280 | aw.AgentData.AgentID = this.AgentID; | ||
281 | aw.AgentData.SerialNum = 0; | ||
282 | aw.AgentData.SessionID = this.SessionID; | ||
283 | |||
284 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
285 | AgentWearablesUpdatePacket.WearableDataBlock awb; | ||
286 | for (int i = 0; i < wearables.Length; i++) | ||
287 | { | ||
288 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
289 | awb.WearableType = (byte)i; | ||
290 | awb.AssetID = wearables[i].AssetID; | ||
291 | awb.ItemID = wearables[i].ItemID; | ||
292 | aw.WearableData[i] = awb; | ||
293 | } | ||
294 | |||
295 | this.OutPacket(aw); | ||
296 | } | ||
297 | |||
298 | /// <summary> | ||
299 | /// | ||
300 | /// </summary> | ||
301 | /// <param name="agentID"></param> | ||
302 | /// <param name="visualParams"></param> | ||
303 | /// <param name="textureEntry"></param> | ||
304 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) | ||
305 | { | ||
306 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | ||
307 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | ||
308 | avp.ObjectData.TextureEntry = textureEntry; | ||
309 | |||
310 | AvatarAppearancePacket.VisualParamBlock avblock = null; | ||
311 | for (int i = 0; i < visualParams.Length; i++) | ||
312 | { | ||
313 | avblock = new AvatarAppearancePacket.VisualParamBlock(); | ||
314 | avblock.ParamValue = visualParams[i]; | ||
315 | avp.VisualParam[i] = avblock; | ||
316 | } | ||
317 | |||
318 | avp.Sender.IsTrial = false; | ||
319 | avp.Sender.ID = agentID; | ||
320 | OutPacket(avp); | ||
321 | } | ||
322 | |||
323 | #endregion | ||
290 | 324 | ||
325 | #region Avatar Packet/data sending Methods | ||
291 | 326 | ||
292 | /// <summary> | 327 | /// <summary> |
293 | /// | 328 | /// |
@@ -316,11 +351,12 @@ namespace OpenSim | |||
316 | libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 351 | libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); |
317 | byte[] pb = pos2.GetBytes(); | 352 | byte[] pb = pos2.GetBytes(); |
318 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 353 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
319 | 354 | ||
320 | OutPacket(objupdate); | 355 | OutPacket(objupdate); |
321 | 356 | ||
322 | } | 357 | } |
323 | 358 | ||
359 | |||
324 | /// <summary> | 360 | /// <summary> |
325 | /// | 361 | /// |
326 | /// </summary> | 362 | /// </summary> |
@@ -384,34 +420,7 @@ namespace OpenSim | |||
384 | return objdata; | 420 | return objdata; |
385 | } | 421 | } |
386 | 422 | ||
387 | public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) | 423 | #endregion |
388 | { | ||
389 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | ||
390 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | ||
391 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | ||
392 | |||
393 | byte[] byteIP = neighbourIP.GetAddressBytes(); | ||
394 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | ||
395 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | ||
396 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | ||
397 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | ||
398 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | ||
399 | OutPacket(enablesimpacket); | ||
400 | } | ||
401 | |||
402 | public AgentCircuitData RequestClientInfo() | ||
403 | { | ||
404 | AgentCircuitData agentData = new AgentCircuitData(); | ||
405 | agentData.AgentID = this.AgentId; | ||
406 | agentData.SessionID = this.SessionID; | ||
407 | agentData.SecureSessionID = this.SecureSessionID; | ||
408 | agentData.circuitcode = this.CircuitCode; | ||
409 | agentData.child = false; | ||
410 | agentData.firstname = this.firstName; | ||
411 | agentData.lastname = this.lastName; | ||
412 | |||
413 | return agentData; | ||
414 | } | ||
415 | 424 | ||
416 | #region Primitive Packet/data Sending Methods | 425 | #region Primitive Packet/data Sending Methods |
417 | 426 | ||
@@ -508,6 +517,88 @@ namespace OpenSim | |||
508 | objectData.PathTwist = primData.PathTwist; | 517 | objectData.PathTwist = primData.PathTwist; |
509 | objectData.PathTwistBegin = primData.PathTwistBegin; | 518 | objectData.PathTwistBegin = primData.PathTwistBegin; |
510 | } | 519 | } |
520 | |||
521 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) | ||
522 | { | ||
523 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
524 | terse.RegionData.RegionHandle = regionHandle; | ||
525 | terse.RegionData.TimeDilation = timeDilation; | ||
526 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
527 | terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); | ||
528 | |||
529 | this.OutPacket(terse); | ||
530 | } | ||
531 | |||
532 | /// <summary> | ||
533 | /// | ||
534 | /// </summary> | ||
535 | /// <param name="localID"></param> | ||
536 | /// <param name="position"></param> | ||
537 | /// <param name="rotation"></param> | ||
538 | /// <returns></returns> | ||
539 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) | ||
540 | { | ||
541 | uint ID = localID; | ||
542 | byte[] bytes = new byte[60]; | ||
543 | |||
544 | int i = 0; | ||
545 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
546 | dat.TextureEntry = new byte[0]; | ||
547 | bytes[i++] = (byte)(ID % 256); | ||
548 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
549 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
550 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
551 | bytes[i++] = 0; | ||
552 | bytes[i++] = 0; | ||
553 | |||
554 | byte[] pb = position.GetBytes(); | ||
555 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
556 | i += 12; | ||
557 | ushort ac = 32767; | ||
558 | |||
559 | //vel | ||
560 | bytes[i++] = (byte)(ac % 256); | ||
561 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
562 | bytes[i++] = (byte)(ac % 256); | ||
563 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
564 | bytes[i++] = (byte)(ac % 256); | ||
565 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
566 | |||
567 | //accel | ||
568 | bytes[i++] = (byte)(ac % 256); | ||
569 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
570 | bytes[i++] = (byte)(ac % 256); | ||
571 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
572 | bytes[i++] = (byte)(ac % 256); | ||
573 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
574 | |||
575 | ushort rw, rx, ry, rz; | ||
576 | rw = (ushort)(32768 * (rotation.W + 1)); | ||
577 | rx = (ushort)(32768 * (rotation.X + 1)); | ||
578 | ry = (ushort)(32768 * (rotation.Y + 1)); | ||
579 | rz = (ushort)(32768 * (rotation.Z + 1)); | ||
580 | |||
581 | //rot | ||
582 | bytes[i++] = (byte)(rx % 256); | ||
583 | bytes[i++] = (byte)((rx >> 8) % 256); | ||
584 | bytes[i++] = (byte)(ry % 256); | ||
585 | bytes[i++] = (byte)((ry >> 8) % 256); | ||
586 | bytes[i++] = (byte)(rz % 256); | ||
587 | bytes[i++] = (byte)((rz >> 8) % 256); | ||
588 | bytes[i++] = (byte)(rw % 256); | ||
589 | bytes[i++] = (byte)((rw >> 8) % 256); | ||
590 | |||
591 | //rotation vel | ||
592 | bytes[i++] = (byte)(ac % 256); | ||
593 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
594 | bytes[i++] = (byte)(ac % 256); | ||
595 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
596 | bytes[i++] = (byte)(ac % 256); | ||
597 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
598 | |||
599 | dat.Data = bytes; | ||
600 | return dat; | ||
601 | } | ||
511 | #endregion | 602 | #endregion |
512 | 603 | ||
513 | #endregion | 604 | #endregion |