diff options
Diffstat (limited to 'OpenSim/Client/MXP/ClientStack/MXPClientView.cs')
-rw-r--r-- | OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 120 |
1 files changed, 79 insertions, 41 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 3d734ad..db60622 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -46,30 +46,38 @@ namespace OpenSim.Client.MXP.ClientStack | |||
46 | { | 46 | { |
47 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private readonly Session mxpSession; | 49 | private readonly Session m_session; |
50 | private readonly UUID mxpSessionID; | 50 | private readonly UUID m_sessionID; |
51 | private readonly IScene mxpHostBubble; | 51 | private readonly UUID m_userID; |
52 | private readonly string mxpUsername; | 52 | private readonly IScene m_hostBubble; |
53 | private readonly string m_firstName; | ||
54 | private readonly string m_lastName; | ||
53 | 55 | ||
54 | private int debugLevel; | 56 | private Vector3 m_startPosition=new Vector3(128f, 128f, 128f); |
57 | private int m_debugLevel; | ||
58 | |||
55 | 59 | ||
56 | public MXPClientView(Session mxpSession, UUID mxpSessionID, IScene mxpHostBubble, string mxpUsername) | 60 | public MXPClientView(Session mxpSession, UUID mxpSessionID, UUID userID, IScene mxpHostBubble, string mxpFirstName, string mxpLastName) |
57 | { | 61 | { |
58 | this.mxpSession = mxpSession; | 62 | this.m_session = mxpSession; |
59 | this.mxpUsername = mxpUsername; | 63 | this.m_userID = userID; |
60 | this.mxpHostBubble = mxpHostBubble; | 64 | this.m_firstName = mxpFirstName; |
61 | this.mxpSessionID = mxpSessionID; | 65 | this.m_lastName = mxpLastName; |
66 | this.m_hostBubble = mxpHostBubble; | ||
67 | this.m_sessionID = mxpSessionID; | ||
62 | } | 68 | } |
63 | 69 | ||
64 | public Session Session | 70 | public Session Session |
65 | { | 71 | { |
66 | get { return mxpSession; } | 72 | get { return m_session; } |
67 | } | 73 | } |
68 | 74 | ||
69 | public bool ProcessMXPPacket(Message msg) | 75 | public bool ProcessMXPPacket(Message msg) |
70 | { | 76 | { |
71 | if (debugLevel > 0) | 77 | if (m_debugLevel > 0) |
72 | m_log.Warn("[MXP] Got Action/Command Packet: " + msg); | 78 | { |
79 | m_log.Warn("[MXP] Received messaged unhandled: " + msg); | ||
80 | } | ||
73 | 81 | ||
74 | return false; | 82 | return false; |
75 | } | 83 | } |
@@ -78,23 +86,23 @@ namespace OpenSim.Client.MXP.ClientStack | |||
78 | 86 | ||
79 | public Vector3 StartPos | 87 | public Vector3 StartPos |
80 | { | 88 | { |
81 | get { return new Vector3(128f, 128f, 128f); } | 89 | get { return m_startPosition; } |
82 | set { } // TODO: Implement Me | 90 | set { m_startPosition = value; } |
83 | } | 91 | } |
84 | 92 | ||
85 | public UUID AgentId | 93 | public UUID AgentId |
86 | { | 94 | { |
87 | get { return mxpSessionID; } | 95 | get { return m_userID; } |
88 | } | 96 | } |
89 | 97 | ||
90 | public UUID SessionId | 98 | public UUID SessionId |
91 | { | 99 | { |
92 | get { return mxpSessionID; } | 100 | get { return m_sessionID; } |
93 | } | 101 | } |
94 | 102 | ||
95 | public UUID SecureSessionId | 103 | public UUID SecureSessionId |
96 | { | 104 | { |
97 | get { return mxpSessionID; } | 105 | get { return m_sessionID; } |
98 | } | 106 | } |
99 | 107 | ||
100 | public UUID ActiveGroupId | 108 | public UUID ActiveGroupId |
@@ -124,17 +132,17 @@ namespace OpenSim.Client.MXP.ClientStack | |||
124 | 132 | ||
125 | public string FirstName | 133 | public string FirstName |
126 | { | 134 | { |
127 | get { return mxpUsername; } | 135 | get { return m_firstName; } |
128 | } | 136 | } |
129 | 137 | ||
130 | public string LastName | 138 | public string LastName |
131 | { | 139 | { |
132 | get { return "@mxp://" + Session.RemoteEndPoint.Address; } | 140 | get { return m_lastName; } |
133 | } | 141 | } |
134 | 142 | ||
135 | public IScene Scene | 143 | public IScene Scene |
136 | { | 144 | { |
137 | get { return mxpHostBubble; } | 145 | get { return m_hostBubble; } |
138 | } | 146 | } |
139 | 147 | ||
140 | public int NextAnimationSequenceNumber | 148 | public int NextAnimationSequenceNumber |
@@ -165,7 +173,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
165 | 173 | ||
166 | public uint CircuitCode | 174 | public uint CircuitCode |
167 | { | 175 | { |
168 | get { return mxpSessionID.CRC(); } | 176 | get { return m_sessionID.CRC(); } |
169 | } | 177 | } |
170 | 178 | ||
171 | public event GenericMessage OnGenericMessage; | 179 | public event GenericMessage OnGenericMessage; |
@@ -348,7 +356,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
348 | 356 | ||
349 | public void SetDebugPacketLevel(int newDebug) | 357 | public void SetDebugPacketLevel(int newDebug) |
350 | { | 358 | { |
351 | debugLevel = newDebug; | 359 | m_debugLevel = newDebug; |
352 | } | 360 | } |
353 | 361 | ||
354 | public void InPacket(object NewPack) | 362 | public void InPacket(object NewPack) |
@@ -560,14 +568,42 @@ namespace OpenSim.Client.MXP.ClientStack | |||
560 | // Need to translate to MXP somehow | 568 | // Need to translate to MXP somehow |
561 | } | 569 | } |
562 | 570 | ||
563 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation) | 571 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 pos, byte[] textureEntry, uint parentID, Quaternion rotation) |
564 | { | 572 | { |
565 | // TODO: This needs handling - to display other avatars | 573 | m_log.Info("[MXP] Transmitting Avatar Data " + firstName + " " + lastName); |
574 | |||
575 | PerceptionEventMessage pe = new PerceptionEventMessage(); | ||
576 | |||
577 | pe.ObjectFragment.ObjectId = avatarID.Guid; | ||
578 | // TODO Resolve ParentID | ||
579 | pe.ObjectFragment.ParentObjectId = Guid.Empty; | ||
580 | pe.ObjectFragment.ObjectIndex = avatarLocalID; | ||
581 | pe.ObjectFragment.ObjectName = firstName+" "+lastName; | ||
582 | pe.ObjectFragment.OwnerId = Guid.Empty; | ||
583 | pe.ObjectFragment.TypeId = Guid.Empty; | ||
584 | pe.ObjectFragment.TypeName = "Avatar"; | ||
585 | pe.ObjectFragment.Acceleration = new float[3]; | ||
586 | pe.ObjectFragment.AngularAcceleration = new float[4]; | ||
587 | pe.ObjectFragment.AngularVelocity = new float[4]; | ||
588 | pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value | ||
589 | |||
590 | pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z }; | ||
591 | |||
592 | pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value | ||
593 | pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | ||
594 | pe.ObjectFragment.Velocity = new float[3]; | ||
595 | |||
596 | Session.Send(pe); | ||
566 | } | 597 | } |
567 | 598 | ||
568 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation) | 599 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation) |
569 | { | 600 | { |
570 | // TODO: This probably needs handling - update other avatar positions | 601 | MovementEventMessage me = new MovementEventMessage(); |
602 | me.ObjectIndex = localID; | ||
603 | me.Location = new float[] { position.X, position.Y, position.Z }; | ||
604 | me.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | ||
605 | |||
606 | Session.Send(me); | ||
571 | } | 607 | } |
572 | 608 | ||
573 | public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations) | 609 | public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations) |
@@ -610,20 +646,17 @@ namespace OpenSim.Client.MXP.ClientStack | |||
610 | pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f }; | 646 | pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f }; |
611 | pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); | 647 | pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); |
612 | 648 | ||
613 | pe.ObjectFragment.Location = new float[] { pos.X - 120.0f, pos.Z, pos.Y - 128.0f }; | 649 | pe.ObjectFragment.Location = new float[] { pos.X , pos.Y, pos.Z }; |
614 | 650 | ||
615 | pe.ObjectFragment.Mass = 1.0f; | 651 | pe.ObjectFragment.Mass = 1.0f; |
616 | pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; | 652 | pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; |
617 | pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z }; | 653 | pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z }; |
618 | 654 | ||
655 | ObjectExtFragment ext = new ObjectExtFragment(); | ||
656 | |||
619 | if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) | 657 | if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) |
620 | { | 658 | { |
621 | ObjectExtFragment ext = new ObjectExtFragment(); | ||
622 | ext.UpdateFlags = flags; | ||
623 | 659 | ||
624 | ext.TextureEntry = primShape.TextureEntry; | ||
625 | ext.TextureAnim = textureanim; | ||
626 | ext.State = primShape.State; | ||
627 | ext.PathBegin = primShape.PathBegin; | 660 | ext.PathBegin = primShape.PathBegin; |
628 | ext.PathEnd = primShape.PathEnd; | 661 | ext.PathEnd = primShape.PathEnd; |
629 | ext.PathScaleX = primShape.PathScaleX; | 662 | ext.PathScaleX = primShape.PathScaleX; |
@@ -633,7 +666,6 @@ namespace OpenSim.Client.MXP.ClientStack | |||
633 | ext.PathSkew = primShape.PathSkew; | 666 | ext.PathSkew = primShape.PathSkew; |
634 | ext.ProfileBegin = primShape.ProfileBegin; | 667 | ext.ProfileBegin = primShape.ProfileBegin; |
635 | ext.ProfileEnd = primShape.ProfileEnd; | 668 | ext.ProfileEnd = primShape.ProfileEnd; |
636 | ext.Scale = EncodeVector(primShape.Scale); | ||
637 | ext.PathCurve = primShape.PathCurve; | 669 | ext.PathCurve = primShape.PathCurve; |
638 | ext.ProfileCurve = primShape.ProfileCurve; | 670 | ext.ProfileCurve = primShape.ProfileCurve; |
639 | ext.ProfileHollow = primShape.ProfileHollow; | 671 | ext.ProfileHollow = primShape.ProfileHollow; |
@@ -643,18 +675,24 @@ namespace OpenSim.Client.MXP.ClientStack | |||
643 | ext.PathTaperY = primShape.PathTaperY; | 675 | ext.PathTaperY = primShape.PathTaperY; |
644 | ext.PathTwist = primShape.PathTwist; | 676 | ext.PathTwist = primShape.PathTwist; |
645 | ext.PathTwistBegin = primShape.PathTwistBegin; | 677 | ext.PathTwistBegin = primShape.PathTwistBegin; |
646 | ext.ExtraParams = primShape.ExtraParams; | ||
647 | 678 | ||
648 | ext.Text = text; | ||
649 | ext.TextColor = EncodeColor(textColor); | ||
650 | ext.PSBlock = particleSystem; | ||
651 | ext.ClickAction = clickAction; | ||
652 | ext.Material = material; | ||
653 | |||
654 | pe.SetExtension<ObjectExtFragment>(ext); | ||
655 | 679 | ||
656 | } | 680 | } |
657 | 681 | ||
682 | ext.UpdateFlags = flags; | ||
683 | ext.ExtraParams = primShape.ExtraParams; | ||
684 | ext.State = primShape.State; | ||
685 | ext.TextureEntry = primShape.TextureEntry; | ||
686 | ext.TextureAnim = textureanim; | ||
687 | ext.Scale = EncodeVector(primShape.Scale); | ||
688 | ext.Text = text; | ||
689 | ext.TextColor = EncodeColor(textColor); | ||
690 | ext.PSBlock = particleSystem; | ||
691 | ext.ClickAction = clickAction; | ||
692 | ext.Material = material; | ||
693 | |||
694 | pe.SetExtension<ObjectExtFragment>(ext); | ||
695 | |||
658 | Session.Send(pe); | 696 | Session.Send(pe); |
659 | } | 697 | } |
660 | 698 | ||