diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 99f78c9..256b6b5 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -53,8 +53,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
53 | private short m_updateCount = 0; | 53 | private short m_updateCount = 0; |
54 | 54 | ||
55 | private Quaternion bodyRot; | 55 | private Quaternion bodyRot; |
56 | private byte[] visualParams; | 56 | private byte[] m_visualParams; |
57 | private AvatarWearable[] Wearables; | 57 | private AvatarWearable[] m_wearables; |
58 | private LLObject.TextureEntry m_textureEntry; | 58 | private LLObject.TextureEntry m_textureEntry; |
59 | 59 | ||
60 | public bool IsRestrictedToRegion = false; | 60 | public bool IsRestrictedToRegion = false; |
@@ -90,10 +90,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
90 | 90 | ||
91 | //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); | 91 | //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); |
92 | 92 | ||
93 | // private string m_currentQuadNode = " "; | 93 | // private string m_currentQuadNode = " "; |
94 | 94 | ||
95 | // private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); | 95 | // private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); |
96 | //private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); | 96 | //private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); |
97 | 97 | ||
98 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | 98 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); |
99 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); | 99 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); |
@@ -173,8 +173,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
173 | 173 | ||
174 | m_pos = value; | 174 | m_pos = value; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | public override LLVector3 Velocity | 178 | public override LLVector3 Velocity |
179 | { | 179 | { |
180 | get | 180 | get |
@@ -220,14 +220,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
220 | 220 | ||
221 | #region Constructor(s) | 221 | #region Constructor(s) |
222 | 222 | ||
223 | /// <summary> | 223 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables) |
224 | /// | ||
225 | /// </summary> | ||
226 | /// <param name="client"></param> | ||
227 | /// <param name="world"></param> | ||
228 | /// <param name="clientThreads"></param> | ||
229 | /// <param name="regionDat"></param> | ||
230 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) | ||
231 | { | 224 | { |
232 | m_scene = world; | 225 | m_scene = world; |
233 | m_uuid = client.AgentId; | 226 | m_uuid = client.AgentId; |
@@ -240,13 +233,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
240 | m_localId = m_scene.NextLocalId; | 233 | m_localId = m_scene.NextLocalId; |
241 | AbsolutePosition = m_controllingClient.StartPos; | 234 | AbsolutePosition = m_controllingClient.StartPos; |
242 | 235 | ||
243 | visualParams = new byte[218]; | 236 | m_visualParams = visualParams; |
244 | for (int i = 0; i < 218; i++) | 237 | m_wearables = wearables; |
245 | { | ||
246 | visualParams[i] = 100; | ||
247 | } | ||
248 | 238 | ||
249 | Wearables = AvatarWearable.DefaultWearables; | ||
250 | Animations = new AvatarAnimations(); | 239 | Animations = new AvatarAnimations(); |
251 | Animations.LoadAnims(); | 240 | Animations.LoadAnims(); |
252 | 241 | ||
@@ -351,7 +340,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
351 | 340 | ||
352 | AbsolutePosition = pos; | 341 | AbsolutePosition = pos; |
353 | 342 | ||
354 | AddToPhysicalScene( ); | 343 | AddToPhysicalScene(); |
355 | m_physicsActor.Flying = isFlying; | 344 | m_physicsActor.Flying = isFlying; |
356 | 345 | ||
357 | 346 | ||
@@ -410,7 +399,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
410 | 399 | ||
411 | for (int i = 0; i < visualParam.Length; i++) | 400 | for (int i = 0; i < visualParam.Length; i++) |
412 | { | 401 | { |
413 | visualParams[i] = visualParam[i].ParamValue; | 402 | m_visualParams[i] = visualParam[i].ParamValue; |
414 | } | 403 | } |
415 | 404 | ||
416 | SendAppearanceToAllOtherAgents(); | 405 | SendAppearanceToAllOtherAgents(); |
@@ -459,7 +448,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
459 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); | 448 | Vector3 agent_control_v3 = new Vector3(0, 0, 0); |
460 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); | 449 | Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); |
461 | bool oldflying = PhysicsActor.Flying; | 450 | bool oldflying = PhysicsActor.Flying; |
462 | PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); | 451 | PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); |
463 | if (PhysicsActor.Flying != oldflying) | 452 | if (PhysicsActor.Flying != oldflying) |
464 | { | 453 | { |
465 | update_movementflag = true; | 454 | update_movementflag = true; |
@@ -470,23 +459,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
470 | bodyRot = q; | 459 | bodyRot = q; |
471 | update_rotation = true; | 460 | update_rotation = true; |
472 | } | 461 | } |
473 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) | 462 | foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) |
474 | { | 463 | { |
475 | if ((flags & (uint) DCF) != 0) | 464 | if ((flags & (uint)DCF) != 0) |
476 | { | 465 | { |
477 | DCFlagKeyPressed = true; | 466 | DCFlagKeyPressed = true; |
478 | agent_control_v3 += Dir_Vectors[i]; | 467 | agent_control_v3 += Dir_Vectors[i]; |
479 | if ((m_movementflag & (uint) DCF) == 0) | 468 | if ((m_movementflag & (uint)DCF) == 0) |
480 | { | 469 | { |
481 | m_movementflag += (byte) (uint) DCF; | 470 | m_movementflag += (byte)(uint)DCF; |
482 | update_movementflag = true; | 471 | update_movementflag = true; |
483 | } | 472 | } |
484 | } | 473 | } |
485 | else | 474 | else |
486 | { | 475 | { |
487 | if ((m_movementflag & (uint) DCF) != 0) | 476 | if ((m_movementflag & (uint)DCF) != 0) |
488 | { | 477 | { |
489 | m_movementflag -= (byte) (uint) DCF; | 478 | m_movementflag -= (byte)(uint)DCF; |
490 | update_movementflag = true; | 479 | update_movementflag = true; |
491 | } | 480 | } |
492 | } | 481 | } |
@@ -531,10 +520,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
531 | } | 520 | } |
532 | 521 | ||
533 | NewForce newVelocity = new NewForce(); | 522 | NewForce newVelocity = new NewForce(); |
534 | Vector3 direc = rotation*vec; | 523 | Vector3 direc = rotation * vec; |
535 | direc.Normalize(); | 524 | direc.Normalize(); |
536 | 525 | ||
537 | direc = direc*((0.03f)*128f); | 526 | direc = direc * ((0.03f) * 128f); |
538 | if (m_physicsActor.Flying) | 527 | if (m_physicsActor.Flying) |
539 | direc *= 4; | 528 | direc *= 4; |
540 | 529 | ||
@@ -619,7 +608,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
619 | /// </summary> | 608 | /// </summary> |
620 | public void SendTerseUpdateToAllClients() | 609 | public void SendTerseUpdateToAllClients() |
621 | { | 610 | { |
622 | m_scene.Broadcast( SendTerseUpdateToClient ); | 611 | m_scene.Broadcast(SendTerseUpdateToClient); |
623 | } | 612 | } |
624 | 613 | ||
625 | public void SendCoarseLocations() | 614 | public void SendCoarseLocations() |
@@ -628,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
628 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 617 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
629 | for (int i = 0; i < avatars.Count; i++) | 618 | for (int i = 0; i < avatars.Count; i++) |
630 | { | 619 | { |
631 | if (avatars[i] != this ) | 620 | if (avatars[i] != this) |
632 | { | 621 | { |
633 | CoarseLocations.Add(avatars[i].AbsolutePosition); | 622 | CoarseLocations.Add(avatars[i].AbsolutePosition); |
634 | } | 623 | } |
@@ -642,7 +631,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
642 | m_newCoarseLocations = true; | 631 | m_newCoarseLocations = true; |
643 | } | 632 | } |
644 | 633 | ||
645 | 634 | ||
646 | 635 | ||
647 | 636 | ||
648 | /// <summary> | 637 | /// <summary> |
@@ -695,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
695 | /// <param name="OurClient"></param> | 684 | /// <param name="OurClient"></param> |
696 | public void SendOurAppearance(IClientAPI OurClient) | 685 | public void SendOurAppearance(IClientAPI OurClient) |
697 | { | 686 | { |
698 | m_controllingClient.SendWearables(Wearables); | 687 | m_controllingClient.SendWearables(m_wearables); |
699 | 688 | ||
700 | //this.SendFullUpdateToAllClients(); | 689 | //this.SendFullUpdateToAllClients(); |
701 | //this.SendAppearanceToAllOtherAgents(); | 690 | //this.SendAppearanceToAllOtherAgents(); |
@@ -734,7 +723,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
734 | /// <param name="avatarInfo"></param> | 723 | /// <param name="avatarInfo"></param> |
735 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | 724 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) |
736 | { | 725 | { |
737 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, visualParams, | 726 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, |
738 | m_textureEntry.ToBytes()); | 727 | m_textureEntry.ToBytes()); |
739 | } | 728 | } |
740 | 729 | ||
@@ -793,9 +782,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
793 | LLVector3 vel = Velocity; | 782 | LLVector3 vel = Velocity; |
794 | 783 | ||
795 | float timeStep = 0.1f; | 784 | float timeStep = 0.1f; |
796 | pos2.X = pos2.X + (vel.X*timeStep); | 785 | pos2.X = pos2.X + (vel.X * timeStep); |
797 | pos2.Y = pos2.Y + (vel.Y*timeStep); | 786 | pos2.Y = pos2.Y + (vel.Y * timeStep); |
798 | pos2.Z = pos2.Z + (vel.Z*timeStep); | 787 | pos2.Z = pos2.Z + (vel.Z * timeStep); |
799 | 788 | ||
800 | if ((pos2.X < 0) || (pos2.X > 256)) | 789 | if ((pos2.X < 0) || (pos2.X > 256)) |
801 | { | 790 | { |
@@ -840,7 +829,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
840 | } | 829 | } |
841 | 830 | ||
842 | LLVector3 vel = m_velocity; | 831 | LLVector3 vel = m_velocity; |
843 | ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); | 832 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); |
844 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 833 | RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
845 | if (neighbourRegion != null) | 834 | if (neighbourRegion != null) |
846 | { | 835 | { |
@@ -940,7 +929,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
940 | throw new Exception("Can't set Text on avatar."); | 929 | throw new Exception("Can't set Text on avatar."); |
941 | } | 930 | } |
942 | 931 | ||
943 | public void AddToPhysicalScene( ) | 932 | public void AddToPhysicalScene() |
944 | { | 933 | { |
945 | PhysicsScene scene = m_scene.PhysScene; | 934 | PhysicsScene scene = m_scene.PhysScene; |
946 | 935 | ||
@@ -948,7 +937,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
948 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 937 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
949 | AbsolutePosition.Z); | 938 | AbsolutePosition.Z); |
950 | 939 | ||
951 | m_physicsActor = scene.AddAvatar(this.Firstname+"."+this.Lastname, pVec); | 940 | m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec); |
952 | } | 941 | } |
953 | 942 | ||
954 | internal void Close() | 943 | internal void Close() |