aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/MXP/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Client/MXP/ClientStack')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs110
1 files changed, 98 insertions, 12 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index c34c6b0..289b38c 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -38,6 +38,7 @@ using OpenMetaverse.Packets;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Client; 39using OpenSim.Framework.Client;
40using Packet=OpenMetaverse.Packets.Packet; 40using Packet=OpenMetaverse.Packets.Packet;
41using MXP.Extentions.OpenMetaverseFragments.Proto;
41 42
42namespace OpenSim.Client.MXP.ClientStack 43namespace OpenSim.Client.MXP.ClientStack
43{ 44{
@@ -586,43 +587,128 @@ namespace OpenSim.Client.MXP.ClientStack
586 587
587 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius) 588 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
588 { 589 {
589 MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation); 590 MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags,text,color,parentID,particleSystem,clickAction,material,textureanim);
590 } 591 }
591 592
592 private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation) 593 private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
593 { 594 {
594 m_log.Info("[MXP] Transmitting Primitive"); 595 String typeName = PCodeToString(primShape.PCode);
596 m_log.Info("[MXP] Transmitting Primitive" + typeName);
595 597
596 PerceptionEventMessage pe = new PerceptionEventMessage(); 598 PerceptionEventMessage pe = new PerceptionEventMessage();
597 599
600 pe.ObjectFragment.ObjectId = objectID.Guid;
601 // TODO Resolve ParentID
602 pe.ObjectFragment.ParentObjectId = Guid.Empty;
598 pe.ObjectFragment.ObjectIndex = localID; 603 pe.ObjectFragment.ObjectIndex = localID;
599 pe.ObjectFragment.ObjectName = "Object"; 604 pe.ObjectFragment.ObjectName = typeName + " Object";
600 pe.ObjectFragment.OwnerId = ownerID.Guid; 605 pe.ObjectFragment.OwnerId = ownerID.Guid;
601 pe.ObjectFragment.TypeId = Guid.Empty; 606 pe.ObjectFragment.TypeId = Guid.Empty;
602 607 pe.ObjectFragment.TypeName = typeName;
603 pe.ObjectFragment.Acceleration = new float[] { acc.X, acc.Y, acc.Z }; 608 pe.ObjectFragment.Acceleration = new float[] { acc.X, acc.Y, acc.Z };
604 pe.ObjectFragment.AngularAcceleration = new float[4]; 609 pe.ObjectFragment.AngularAcceleration = new float[4];
605 pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f }; 610 pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
606 pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length()/2.0f; 611 pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
607 612
608 pe.ObjectFragment.Location = new float[] { pos.X - 120.0f, pos.Z, pos.Y - 128.0f }; 613 pe.ObjectFragment.Location = new float[] { pos.X - 120.0f, pos.Z, pos.Y - 128.0f };
609 614
610 pe.ObjectFragment.Mass = 1.0f; 615 pe.ObjectFragment.Mass = 1.0f;
611 pe.ObjectFragment.ObjectId = objectID.Guid;
612 pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W }; 616 pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
613 pe.ObjectFragment.ParentObjectId = Guid.Empty;
614 pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z }; 617 pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z };
615 618
616 pe.ObjectFragment.StatePayloadDialect = ""; 619 if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
617 pe.ObjectFragment.StatePayloadLength = 0; 620 {
618 pe.ObjectFragment.SetStatePayloadData(new byte[0]); 621 ObjectExtFragment ext = new ObjectExtFragment();
622 ext.UpdateFlags = flags;
623
624 ext.TextureEntry = primShape.TextureEntry;
625 ext.TextureAnim = textureanim;
626 ext.State = primShape.State;
627 ext.PathBegin = primShape.PathBegin;
628 ext.PathEnd = primShape.PathEnd;
629 ext.PathScaleX = primShape.PathScaleX;
630 ext.PathScaleY = primShape.PathScaleY;
631 ext.PathShearX = primShape.PathShearX;
632 ext.PathShearY = primShape.PathShearY;
633 ext.PathSkew = primShape.PathSkew;
634 ext.ProfileBegin = primShape.ProfileBegin;
635 ext.ProfileEnd = primShape.ProfileEnd;
636 ext.Scale = EncodeVector(primShape.Scale);
637 ext.PathCurve = primShape.PathCurve;
638 ext.ProfileCurve = primShape.ProfileCurve;
639 ext.ProfileHollow = primShape.ProfileHollow;
640 ext.PathRadiusOffset = primShape.PathRadiusOffset;
641 ext.PathRevolutions = primShape.PathRevolutions;
642 ext.PathTaperX = primShape.PathTaperX;
643 ext.PathTaperY = primShape.PathTaperY;
644 ext.PathTwist = primShape.PathTwist;
645 ext.PathTwistBegin = primShape.PathTwistBegin;
646 ext.ExtraParams = primShape.ExtraParams;
647
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
656 }
619 657
620 Session.Send(pe); 658 Session.Send(pe);
621 } 659 }
622 660
661 private vectorf EncodeVector(Vector3 value)
662 {
663 vectorf encodedValue=new vectorf();
664 encodedValue.X=value.X;
665 encodedValue.Y=value.Y;
666 encodedValue.Z=value.Z;
667 return encodedValue;
668 }
669
670 private color EncodeColor(byte[] value)
671 {
672 color encodedValue = new color();
673 encodedValue.R = value[0];
674 encodedValue.G = value[1];
675 encodedValue.B = value[2];
676 encodedValue.A = value[3];
677 return encodedValue;
678 }
679
680 private string PCodeToString(byte value)
681 {
682 if(value==(byte)PCodeEnum.Avatar)
683 {
684 return "Avatar";
685 }
686 if (value == (byte)PCodeEnum.Grass)
687 {
688 return "Grass";
689 }
690 if (value == (byte)PCodeEnum.NewTree)
691 {
692 return "NewTree";
693 }
694 if (value == (byte)PCodeEnum.ParticleSystem)
695 {
696 return "ParticleSystem";
697 }
698 if (value == (byte)PCodeEnum.Primitive)
699 {
700 return "Primitive";
701 }
702 if (value == (byte)PCodeEnum.Tree)
703 {
704 return "Tree";
705 }
706 throw new Exception("Unsupported PCode value: "+value);
707 }
708
623 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material) 709 public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material)
624 { 710 {
625 MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation); 711 MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags, text, color, parentID, particleSystem, clickAction, material, new byte[0]);
626 } 712 }
627 713
628 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint) 714 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint)