aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation.cs94
-rw-r--r--OpenSim/Region/Framework/Scenes/AnimationSet.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs513
3 files changed, 1 insertions, 607 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation.cs b/OpenSim/Region/Framework/Scenes/Animation.cs
deleted file mode 100644
index 1e697bd..0000000
--- a/OpenSim/Region/Framework/Scenes/Animation.cs
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using OpenMetaverse.StructuredData;
31
32namespace OpenSim.Region.Framework.Scenes
33{
34 [Serializable]
35 public class Animation
36 {
37 private UUID animID;
38 public UUID AnimID
39 {
40 get { return animID; }
41 set { animID = value; }
42 }
43
44 private int sequenceNum;
45 public int SequenceNum
46 {
47 get { return sequenceNum; }
48 set { sequenceNum = value; }
49 }
50
51 private UUID objectID;
52 public UUID ObjectID
53 {
54 get { return objectID; }
55 set { objectID = value; }
56 }
57
58 public Animation()
59 {
60 }
61
62 public Animation(UUID animID, int sequenceNum, UUID objectID)
63 {
64 this.animID = animID;
65 this.sequenceNum = sequenceNum;
66 this.objectID = objectID;
67 }
68
69 public Animation(OSDMap args)
70 {
71 UnpackUpdateMessage(args);
72 }
73
74 public OSDMap PackUpdateMessage()
75 {
76 OSDMap anim = new OSDMap();
77 anim["animation"] = OSD.FromUUID(animID);
78 anim["object_id"] = OSD.FromUUID(objectID);
79 anim["seq_num"] = OSD.FromInteger(sequenceNum);
80 return anim;
81 }
82
83 public void UnpackUpdateMessage(OSDMap args)
84 {
85 if (args["animation"] != null)
86 animID = args["animation"].AsUUID();
87 if (args["object_id"] != null)
88 objectID = args["object_id"].AsUUID();
89 if (args["seq_num"] != null)
90 sequenceNum = args["seq_num"].AsInteger();
91 }
92
93 }
94}
diff --git a/OpenSim/Region/Framework/Scenes/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/AnimationSet.cs
index 8e25954..b9521d6 100644
--- a/OpenSim/Region/Framework/Scenes/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/AnimationSet.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Region.Framework.Scenes 33namespace OpenSim.Region.Framework.Scenes
diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
deleted file mode 100644
index 7e6e52a..0000000
--- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
+++ /dev/null
@@ -1,513 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using OpenSim.Framework;
32using OpenMetaverse;
33using OpenMetaverse.StructuredData;
34using log4net;
35using System.Reflection;
36
37namespace OpenSim.Region.Framework.Scenes
38{
39 public interface IAgentData
40 {
41 UUID AgentID { get; set; }
42
43 OSDMap Pack();
44 void Unpack(OSDMap map);
45 }
46
47 /// <summary>
48 /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
49 /// </summary>
50 public class AgentPosition : IAgentData
51 {
52 private UUID m_id;
53 public UUID AgentID
54 {
55 get { return m_id; }
56 set { m_id = value; }
57 }
58
59 public ulong RegionHandle;
60 public uint CircuitCode;
61 public UUID SessionID;
62
63 public float Far;
64 public Vector3 Position;
65 public Vector3 Velocity;
66 public Vector3 Center;
67 public Vector3 Size;
68 public Vector3 AtAxis;
69 public Vector3 LeftAxis;
70 public Vector3 UpAxis;
71 public bool ChangedGrid;
72
73 // This probably shouldn't be here
74 public byte[] Throttles;
75
76
77 public OSDMap Pack()
78 {
79 OSDMap args = new OSDMap();
80 args["message_type"] = OSD.FromString("AgentPosition");
81
82 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
83 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
84 args["agent_uuid"] = OSD.FromUUID(AgentID);
85 args["session_uuid"] = OSD.FromUUID(SessionID);
86
87 args["position"] = OSD.FromString(Position.ToString());
88 args["velocity"] = OSD.FromString(Velocity.ToString());
89 args["center"] = OSD.FromString(Center.ToString());
90 args["size"] = OSD.FromString(Size.ToString());
91 args["at_axis"] = OSD.FromString(AtAxis.ToString());
92 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
93 args["up_axis"] = OSD.FromString(UpAxis.ToString());
94
95 args["far"] = OSD.FromReal(Far);
96 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
97
98 if ((Throttles != null) && (Throttles.Length > 0))
99 args["throttles"] = OSD.FromBinary(Throttles);
100
101 return args;
102 }
103
104 public void Unpack(OSDMap args)
105 {
106 if (args.ContainsKey("region_handle"))
107 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
108
109 if (args["circuit_code"] != null)
110 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
111
112 if (args["agent_uuid"] != null)
113 AgentID = args["agent_uuid"].AsUUID();
114
115 if (args["session_uuid"] != null)
116 SessionID = args["session_uuid"].AsUUID();
117
118 if (args["position"] != null)
119 Vector3.TryParse(args["position"].AsString(), out Position);
120
121 if (args["velocity"] != null)
122 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
123
124 if (args["center"] != null)
125 Vector3.TryParse(args["center"].AsString(), out Center);
126
127 if (args["size"] != null)
128 Vector3.TryParse(args["size"].AsString(), out Size);
129
130 if (args["at_axis"] != null)
131 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
132
133 if (args["left_axis"] != null)
134 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
135
136 if (args["up_axis"] != null)
137 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
138
139 if (args["changed_grid"] != null)
140 ChangedGrid = args["changed_grid"].AsBoolean();
141
142 if (args["far"] != null)
143 Far = (float)(args["far"].AsReal());
144
145 if (args["throttles"] != null)
146 Throttles = args["throttles"].AsBinary();
147 }
148
149 /// <summary>
150 /// Soon to be decommissioned
151 /// </summary>
152 /// <param name="cAgent"></param>
153 public void CopyFrom(ChildAgentDataUpdate cAgent)
154 {
155 AgentID = new UUID(cAgent.AgentID);
156
157 // next: ???
158 Size = new Vector3();
159 Size.Z = cAgent.AVHeight;
160
161 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
162 Far = cAgent.drawdistance;
163 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
164 RegionHandle = cAgent.regionHandle;
165 Throttles = cAgent.throttles;
166 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
167 }
168
169 }
170
171 public class AgentGroupData
172 {
173 public UUID GroupID;
174 public ulong GroupPowers;
175 public bool AcceptNotices;
176
177 public AgentGroupData(UUID id, ulong powers, bool notices)
178 {
179 GroupID = id;
180 GroupPowers = powers;
181 AcceptNotices = notices;
182 }
183
184 public AgentGroupData(OSDMap args)
185 {
186 UnpackUpdateMessage(args);
187 }
188
189 public OSDMap PackUpdateMessage()
190 {
191 OSDMap groupdata = new OSDMap();
192 groupdata["group_id"] = OSD.FromUUID(GroupID);
193 groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString());
194 groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices);
195
196 return groupdata;
197 }
198
199 public void UnpackUpdateMessage(OSDMap args)
200 {
201 if (args["group_id"] != null)
202 GroupID = args["group_id"].AsUUID();
203 if (args["group_powers"] != null)
204 UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers);
205 if (args["accept_notices"] != null)
206 AcceptNotices = args["accept_notices"].AsBoolean();
207 }
208 }
209
210 public class AgentData : IAgentData
211 {
212 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
213 private UUID m_id;
214 public UUID AgentID
215 {
216 get { return m_id; }
217 set { m_id = value; }
218 }
219 public ulong RegionHandle;
220 public uint CircuitCode;
221 public UUID SessionID;
222
223 public Vector3 Position;
224 public Vector3 Velocity;
225 public Vector3 Center;
226 public Vector3 Size;
227 public Vector3 AtAxis;
228 public Vector3 LeftAxis;
229 public Vector3 UpAxis;
230 public bool ChangedGrid;
231
232 public float Far;
233 public float Aspect;
234 //public int[] Throttles;
235 public byte[] Throttles;
236
237 public uint LocomotionState;
238 public Quaternion HeadRotation;
239 public Quaternion BodyRotation;
240 public uint ControlFlags;
241 public float EnergyLevel;
242 public Byte GodLevel;
243 public bool AlwaysRun;
244 public UUID PreyAgent;
245 public Byte AgentAccess;
246 public UUID ActiveGroupID;
247
248 public AgentGroupData[] Groups;
249 public Animation[] Anims;
250
251 public UUID GranterID;
252
253 // Appearance
254 public byte[] AgentTextures;
255 public byte[] VisualParams;
256 public UUID[] Wearables;
257
258 public string CallbackURI;
259
260 public virtual OSDMap Pack()
261 {
262 OSDMap args = new OSDMap();
263 args["message_type"] = OSD.FromString("AgentData");
264
265 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
266 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
267 args["agent_uuid"] = OSD.FromUUID(AgentID);
268 args["session_uuid"] = OSD.FromUUID(SessionID);
269
270 args["position"] = OSD.FromString(Position.ToString());
271 args["velocity"] = OSD.FromString(Velocity.ToString());
272 args["center"] = OSD.FromString(Center.ToString());
273 args["size"] = OSD.FromString(Size.ToString());
274 args["at_axis"] = OSD.FromString(AtAxis.ToString());
275 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
276 args["up_axis"] = OSD.FromString(UpAxis.ToString());
277
278 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
279 args["far"] = OSD.FromReal(Far);
280 args["aspect"] = OSD.FromReal(Aspect);
281
282 if ((Throttles != null) && (Throttles.Length > 0))
283 args["throttles"] = OSD.FromBinary(Throttles);
284
285 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
286 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
287 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
288 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
289
290 args["energy_level"] = OSD.FromReal(EnergyLevel);
291 args["god_level"] = OSD.FromString(GodLevel.ToString());
292 args["always_run"] = OSD.FromBoolean(AlwaysRun);
293 args["prey_agent"] = OSD.FromUUID(PreyAgent);
294 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
295
296 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
297
298 if ((Groups != null) && (Groups.Length > 0))
299 {
300 OSDArray groups = new OSDArray(Groups.Length);
301 foreach (AgentGroupData agd in Groups)
302 groups.Add(agd.PackUpdateMessage());
303 args["groups"] = groups;
304 }
305
306 if ((Anims != null) && (Anims.Length > 0))
307 {
308 OSDArray anims = new OSDArray(Anims.Length);
309 foreach (Animation aanim in Anims)
310 anims.Add(aanim.PackUpdateMessage());
311 args["animations"] = anims;
312 }
313
314 //if ((AgentTextures != null) && (AgentTextures.Length > 0))
315 //{
316 // OSDArray textures = new OSDArray(AgentTextures.Length);
317 // foreach (UUID uuid in AgentTextures)
318 // textures.Add(OSD.FromUUID(uuid));
319 // args["agent_textures"] = textures;
320 //}
321
322 if ((AgentTextures != null) && (AgentTextures.Length > 0))
323 args["texture_entry"] = OSD.FromBinary(AgentTextures);
324
325 if ((VisualParams != null) && (VisualParams.Length > 0))
326 args["visual_params"] = OSD.FromBinary(VisualParams);
327
328 // We might not pass this in all cases...
329 if ((Wearables != null) && (Wearables.Length > 0))
330 {
331 OSDArray wears = new OSDArray(Wearables.Length);
332 foreach (UUID uuid in Wearables)
333 wears.Add(OSD.FromUUID(uuid));
334 args["wearables"] = wears;
335 }
336
337
338 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
339 args["callback_uri"] = OSD.FromString(CallbackURI);
340
341 return args;
342 }
343
344 /// <summary>
345 /// Deserialization of agent data.
346 /// Avoiding reflection makes it painful to write, but that's the price!
347 /// </summary>
348 /// <param name="hash"></param>
349 public virtual void Unpack(OSDMap args)
350 {
351 if (args.ContainsKey("region_handle"))
352 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
353
354 if (args["circuit_code"] != null)
355 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
356
357 if (args["agent_uuid"] != null)
358 AgentID = args["agent_uuid"].AsUUID();
359
360 if (args["session_uuid"] != null)
361 SessionID = args["session_uuid"].AsUUID();
362
363 if (args["position"] != null)
364 Vector3.TryParse(args["position"].AsString(), out Position);
365
366 if (args["velocity"] != null)
367 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
368
369 if (args["center"] != null)
370 Vector3.TryParse(args["center"].AsString(), out Center);
371
372 if (args["size"] != null)
373 Vector3.TryParse(args["size"].AsString(), out Size);
374
375 if (args["at_axis"] != null)
376 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
377
378 if (args["left_axis"] != null)
379 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
380
381 if (args["up_axis"] != null)
382 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
383
384 if (args["changed_grid"] != null)
385 ChangedGrid = args["changed_grid"].AsBoolean();
386
387 if (args["far"] != null)
388 Far = (float)(args["far"].AsReal());
389
390 if (args["aspect"] != null)
391 Aspect = (float)args["aspect"].AsReal();
392
393 if (args["throttles"] != null)
394 Throttles = args["throttles"].AsBinary();
395
396 if (args["locomotion_state"] != null)
397 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
398
399 if (args["head_rotation"] != null)
400 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
401
402 if (args["body_rotation"] != null)
403 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
404
405 if (args["control_flags"] != null)
406 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
407
408 if (args["energy_level"] != null)
409 EnergyLevel = (float)(args["energy_level"].AsReal());
410
411 if (args["god_level"] != null)
412 Byte.TryParse(args["god_level"].AsString(), out GodLevel);
413
414 if (args["always_run"] != null)
415 AlwaysRun = args["always_run"].AsBoolean();
416
417 if (args["prey_agent"] != null)
418 PreyAgent = args["prey_agent"].AsUUID();
419
420 if (args["agent_access"] != null)
421 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
422
423 if (args["active_group_id"] != null)
424 ActiveGroupID = args["active_group_id"].AsUUID();
425
426 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
427 {
428 OSDArray groups = (OSDArray)(args["groups"]);
429 Groups = new AgentGroupData[groups.Count];
430 int i = 0;
431 foreach (OSD o in groups)
432 {
433 if (o.Type == OSDType.Map)
434 {
435 Groups[i++] = new AgentGroupData((OSDMap)o);
436 }
437 }
438 }
439
440 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
441 {
442 OSDArray anims = (OSDArray)(args["animations"]);
443 Anims = new Animation[anims.Count];
444 int i = 0;
445 foreach (OSD o in anims)
446 {
447 if (o.Type == OSDType.Map)
448 {
449 Anims[i++] = new Animation((OSDMap)o);
450 }
451 }
452 }
453
454 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
455 //{
456 // OSDArray textures = (OSDArray)(args["agent_textures"]);
457 // AgentTextures = new UUID[textures.Count];
458 // int i = 0;
459 // foreach (OSD o in textures)
460 // AgentTextures[i++] = o.AsUUID();
461 //}
462
463 if (args["texture_entry"] != null)
464 AgentTextures = args["texture_entry"].AsBinary();
465
466 if (args["visual_params"] != null)
467 VisualParams = args["visual_params"].AsBinary();
468
469 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
470 {
471 OSDArray wears = (OSDArray)(args["wearables"]);
472 Wearables = new UUID[wears.Count];
473 int i = 0;
474 foreach (OSD o in wears)
475 Wearables[i++] = o.AsUUID();
476 }
477
478 if (args["callback_uri"] != null)
479 CallbackURI = args["callback_uri"].AsString();
480 }
481
482 public AgentData()
483 {
484 }
485
486 public AgentData(Hashtable hash)
487 {
488 //UnpackUpdateMessage(hash);
489 }
490
491 public void Dump()
492 {
493 m_log.Info("------------ AgentData ------------");
494 m_log.Info("UUID: " + AgentID);
495 m_log.Info("Region: " + RegionHandle);
496 m_log.Info("Position: " + Position);
497 }
498 }
499
500 public class CompleteAgentData : AgentData
501 {
502 public override OSDMap Pack()
503 {
504 return base.Pack();
505 }
506
507 public override void Unpack(OSDMap map)
508 {
509 base.Unpack(map);
510 }
511 }
512
513}