diff options
author | MW | 2007-07-18 18:12:16 +0000 |
---|---|---|
committer | MW | 2007-07-18 18:12:16 +0000 |
commit | 643a02ec60151e1a501d1b260592695b90be6233 (patch) | |
tree | 55ec1fe8a36c91e8a59a579f62050b6d7b960345 | |
parent | Just trying things out, nothing to see here, please go back to sleep. (diff) | |
download | opensim-SC_OLD-643a02ec60151e1a501d1b260592695b90be6233.zip opensim-SC_OLD-643a02ec60151e1a501d1b260592695b90be6233.tar.gz opensim-SC_OLD-643a02ec60151e1a501d1b260592695b90be6233.tar.bz2 opensim-SC_OLD-643a02ec60151e1a501d1b260592695b90be6233.tar.xz |
More testing some ideas, to find best method for SceneObject Primitive classes.
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/General/NpcClientBase.cs | 129 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 101 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs | 299 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs | 211 |
7 files changed, 513 insertions, 232 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index d58496c..c7e1901 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -180,8 +180,6 @@ namespace OpenSim.Framework.Interfaces | |||
180 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity); | 180 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity); |
181 | 181 | ||
182 | void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); | 182 | void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); |
183 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags); | ||
184 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags); | ||
185 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); | 183 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); |
186 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); | 184 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); |
187 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); | 185 | void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); |
diff --git a/OpenSim/Framework/General/NpcClientBase.cs b/OpenSim/Framework/General/NpcClientBase.cs deleted file mode 100644 index 11160e4..0000000 --- a/OpenSim/Framework/General/NpcClientBase.cs +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Net; | ||
3 | using OpenSim.Framework.Interfaces; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | using libsecondlife.Packets; | ||
8 | |||
9 | |||
10 | namespace OpenSim.Framework | ||
11 | { | ||
12 | public class NpcClientBase : IClientAPI | ||
13 | { | ||
14 | #pragma warning disable 67 | ||
15 | public event ImprovedInstantMessage OnInstantMessage; | ||
16 | public event ChatFromViewer OnChatFromViewer; | ||
17 | public event RezObject OnRezObject; | ||
18 | public event ModifyTerrain OnModifyTerrain; | ||
19 | public event SetAppearance OnSetAppearance; | ||
20 | public event StartAnim OnStartAnim; | ||
21 | public event LinkObjects OnLinkObjects; | ||
22 | public event RequestMapBlocks OnRequestMapBlocks; | ||
23 | public event TeleportLocationRequest OnTeleportLocationRequest; | ||
24 | |||
25 | public event GenericCall4 OnDeRezObject; | ||
26 | public event GenericCall OnRegionHandShakeReply; | ||
27 | public event GenericCall OnRequestWearables; | ||
28 | public event GenericCall2 OnCompleteMovementToRegion; | ||
29 | public event UpdateAgent OnAgentUpdate; | ||
30 | public event GenericCall OnRequestAvatarsData; | ||
31 | public event AddNewPrim OnAddPrim; | ||
32 | public event ObjectDuplicate OnObjectDuplicate; | ||
33 | public event UpdateVector OnGrapObject; | ||
34 | public event ObjectSelect OnDeGrapObject; | ||
35 | public event MoveObject OnGrapUpdate; | ||
36 | |||
37 | public event UpdateShape OnUpdatePrimShape; | ||
38 | public event ObjectSelect OnObjectSelect; | ||
39 | public event GenericCall7 OnObjectDescription; | ||
40 | public event GenericCall7 OnObjectName; | ||
41 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
42 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
43 | public event UpdateVector OnUpdatePrimGroupPosition; | ||
44 | public event UpdateVector OnUpdatePrimSinglePosition; | ||
45 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | ||
46 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | ||
47 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | ||
48 | public event UpdateVector OnUpdatePrimScale; | ||
49 | public event StatusChange OnChildAgentStatus; | ||
50 | public event GenericCall2 OnStopMovement; | ||
51 | public event NewAvatar OnNewAvatar; | ||
52 | public event GenericCall6 OnRemoveAvatar; | ||
53 | |||
54 | public event UUIDNameRequest OnNameFromUUIDRequest; | ||
55 | |||
56 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
57 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
58 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
59 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
60 | public event ParcelSelectObjects OnParcelSelectObjects; | ||
61 | public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; | ||
62 | public event ObjectDeselect OnObjectDeselect; | ||
63 | |||
64 | |||
65 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; | ||
66 | #pragma warning restore 67 | ||
67 | |||
68 | public virtual LLVector3 StartPos | ||
69 | { | ||
70 | get { return new LLVector3(); } | ||
71 | set { } | ||
72 | } | ||
73 | |||
74 | public virtual LLUUID AgentId | ||
75 | { | ||
76 | get { return LLUUID.Random(); } | ||
77 | } | ||
78 | |||
79 | public virtual string FirstName | ||
80 | { | ||
81 | get { return ""; } | ||
82 | } | ||
83 | |||
84 | public virtual string LastName | ||
85 | { | ||
86 | get { return ""; } | ||
87 | } | ||
88 | |||
89 | public NpcClientBase() | ||
90 | { | ||
91 | } | ||
92 | |||
93 | public virtual void OutPacket(Packet newPack){} | ||
94 | public virtual void SendWearables(AvatarWearable[] wearables){} | ||
95 | public virtual void SendStartPingCheck(byte seq){} | ||
96 | public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){} | ||
97 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} | ||
98 | public virtual void SendRegionHandshake(RegionInfo regionInfo){} | ||
99 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} | ||
100 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} | ||
101 | public virtual void SendInstantMessage(string message, LLUUID target, string fromName){} | ||
102 | public virtual void SendLayerData(float[] map){} | ||
103 | public virtual void SendLayerData(int px, int py, float[] map){} | ||
104 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){} | ||
105 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){} | ||
106 | public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } | ||
107 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint){} | ||
108 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks){} | ||
109 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){} | ||
110 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags){} | ||
111 | public virtual void SendTeleportCancel(){} | ||
112 | public virtual void SendTeleportLocationStart(){} | ||
113 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){} | ||
114 | |||
115 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){} | ||
116 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){} | ||
117 | |||
118 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){} | ||
119 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags){} | ||
120 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags){} | ||
121 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} | ||
122 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} | ||
123 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} | ||
124 | |||
125 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} | ||
126 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} | ||
127 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | ||
128 | } | ||
129 | } | ||
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index 9ab6071..a582209 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Framework.Types | |||
65 | } | 65 | } |
66 | 66 | ||
67 | //void returns need to change of course | 67 | //void returns need to change of course |
68 | public void GetMesh() | 68 | public virtual void GetMesh() |
69 | { | 69 | { |
70 | 70 | ||
71 | } | 71 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 044ad68..54ddd97 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -719,56 +719,7 @@ namespace OpenSim.Region.ClientStack | |||
719 | this.OutPacket(attach); | 719 | this.OutPacket(attach); |
720 | } | 720 | } |
721 | 721 | ||
722 | /// <summary> | 722 | |
723 | /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive | ||
724 | /// or big changes to a existing primitive. | ||
725 | /// </summary> | ||
726 | /// <param name="regionHandle"></param> | ||
727 | /// <param name="timeDilation"></param> | ||
728 | /// <param name="localID"></param> | ||
729 | /// <param name="primData"></param> | ||
730 | /// <param name="pos"></param> | ||
731 | /// <param name="rotation"></param> | ||
732 | /// <param name="textureID"></param> | ||
733 | public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) | ||
734 | { | ||
735 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | ||
736 | outPacket.RegionData.RegionHandle = regionHandle; | ||
737 | outPacket.RegionData.TimeDilation = timeDilation; | ||
738 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
739 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); | ||
740 | outPacket.ObjectData[0].ID = localID; | ||
741 | outPacket.ObjectData[0].FullID = primData.FullID; | ||
742 | byte[] pb = pos.GetBytes(); | ||
743 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
744 | byte[] rot = rotation.GetBytes(); | ||
745 | Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); | ||
746 | OutPacket(outPacket); | ||
747 | } | ||
748 | |||
749 | /// <summary> | ||
750 | /// Sends a full ObjectUpdatePacket to a client to inform it of a new primitive | ||
751 | /// or big changes to a existing primitive. | ||
752 | /// Uses default rotation | ||
753 | /// </summary> | ||
754 | /// <param name="primData"></param> | ||
755 | /// <param name="pos"></param> | ||
756 | public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) | ||
757 | { | ||
758 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | ||
759 | outPacket.RegionData.RegionHandle = regionHandle; | ||
760 | outPacket.RegionData.TimeDilation = timeDilation; | ||
761 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
762 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primData, textureID, flags); | ||
763 | outPacket.ObjectData[0].ID = localID; | ||
764 | outPacket.ObjectData[0].FullID = primData.FullID; | ||
765 | byte[] pb = pos.GetBytes(); | ||
766 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
767 | |||
768 | OutPacket(outPacket); | ||
769 | } | ||
770 | |||
771 | |||
772 | public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) | 723 | public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) |
773 | { | 724 | { |
774 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 725 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); |
@@ -978,22 +929,6 @@ namespace OpenSim.Region.ClientStack | |||
978 | return dat; | 929 | return dat; |
979 | } | 930 | } |
980 | 931 | ||
981 | |||
982 | /// <summary> | ||
983 | /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) | ||
984 | /// </summary> | ||
985 | /// <param name="primData"></param> | ||
986 | /// <returns></returns> | ||
987 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimData primData, LLUUID textureID, uint flags) | ||
988 | { | ||
989 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | ||
990 | this.SetDefaultPrimPacketValues(objupdate); | ||
991 | objupdate.UpdateFlags = flags; | ||
992 | this.SetPrimPacketShapeData(objupdate, primData, textureID); | ||
993 | |||
994 | return objupdate; | ||
995 | } | ||
996 | |||
997 | /// <summary> | 932 | /// <summary> |
998 | /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) | 933 | /// Create the ObjectDataBlock for a ObjectUpdatePacket (for a Primitive) |
999 | /// </summary> | 934 | /// </summary> |
@@ -1009,40 +944,6 @@ namespace OpenSim.Region.ClientStack | |||
1009 | return objupdate; | 944 | return objupdate; |
1010 | } | 945 | } |
1011 | 946 | ||
1012 | |||
1013 | /// <summary> | ||
1014 | /// Copy the data from a PrimData object to a ObjectUpdatePacket | ||
1015 | /// </summary> | ||
1016 | /// <param name="objectData"></param> | ||
1017 | /// <param name="primData"></param> | ||
1018 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimData primData, LLUUID textureID) | ||
1019 | { | ||
1020 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID); | ||
1021 | objectData.TextureEntry = ntex.ToBytes(); | ||
1022 | objectData.OwnerID = primData.OwnerID; | ||
1023 | objectData.ParentID = primData.ParentID; | ||
1024 | objectData.PCode = primData.PCode; | ||
1025 | objectData.PathBegin = primData.PathBegin; | ||
1026 | objectData.PathEnd = primData.PathEnd; | ||
1027 | objectData.PathScaleX = primData.PathScaleX; | ||
1028 | objectData.PathScaleY = primData.PathScaleY; | ||
1029 | objectData.PathShearX = primData.PathShearX; | ||
1030 | objectData.PathShearY = primData.PathShearY; | ||
1031 | objectData.PathSkew = primData.PathSkew; | ||
1032 | objectData.ProfileBegin = primData.ProfileBegin; | ||
1033 | objectData.ProfileEnd = primData.ProfileEnd; | ||
1034 | objectData.Scale = primData.Scale; | ||
1035 | objectData.PathCurve = primData.PathCurve; | ||
1036 | objectData.ProfileCurve = primData.ProfileCurve; | ||
1037 | objectData.ProfileHollow = primData.ProfileHollow; | ||
1038 | objectData.PathRadiusOffset = primData.PathRadiusOffset; | ||
1039 | objectData.PathRevolutions = primData.PathRevolutions; | ||
1040 | objectData.PathTaperX = primData.PathTaperX; | ||
1041 | objectData.PathTaperY = primData.PathTaperY; | ||
1042 | objectData.PathTwist = primData.PathTwist; | ||
1043 | objectData.PathTwistBegin = primData.PathTwistBegin; | ||
1044 | } | ||
1045 | |||
1046 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) | 947 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) |
1047 | { | 948 | { |
1048 | 949 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index dd0a6c8..338471e 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -218,6 +218,7 @@ namespace OpenSim.Region.ClientStack | |||
218 | if (OnAddPrim != null) | 218 | if (OnAddPrim != null) |
219 | { | 219 | { |
220 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; | 220 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; |
221 | Console.WriteLine(addPacket.ToString()); | ||
221 | 222 | ||
222 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | 223 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); |
223 | 224 | ||
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs new file mode 100644 index 0000000..5d3a406 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs | |||
@@ -0,0 +1,299 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Text; | ||
3 | using Axiom.Math; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | using OpenSim.Framework.Interfaces; | ||
7 | using OpenSim.Framework.Types; | ||
8 | using OpenSim.Physics.Manager; | ||
9 | |||
10 | namespace OpenSim.Region.Environment.Scenes | ||
11 | { | ||
12 | // public delegate void PrimCountTaintedDelegate(); | ||
13 | |||
14 | public class AllNewSceneObjectGroup2 : EntityBase | ||
15 | { | ||
16 | private Encoding enc = Encoding.ASCII; | ||
17 | |||
18 | protected AllNewSceneObjectPart2 m_rootPart; | ||
19 | protected Dictionary<LLUUID, AllNewSceneObjectPart2> m_parts = new Dictionary<LLUUID, AllNewSceneObjectPart2>(); | ||
20 | |||
21 | public event PrimCountTaintedDelegate OnPrimCountTainted; | ||
22 | |||
23 | /// <summary> | ||
24 | /// | ||
25 | /// </summary> | ||
26 | public int primCount | ||
27 | { | ||
28 | get | ||
29 | { | ||
30 | return 1; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | /// <summary> | ||
35 | /// | ||
36 | /// </summary> | ||
37 | public LLVector3 GroupCentrePoint | ||
38 | { | ||
39 | get | ||
40 | { | ||
41 | return new LLVector3(0, 0, 0); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | /// <summary> | ||
46 | /// | ||
47 | /// </summary> | ||
48 | public AllNewSceneObjectGroup2() | ||
49 | { | ||
50 | |||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// | ||
55 | /// </summary> | ||
56 | public void FlagGroupForFullUpdate() | ||
57 | { | ||
58 | |||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// | ||
63 | /// </summary> | ||
64 | public void FlagGroupForTerseUpdate() | ||
65 | { | ||
66 | |||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// | ||
71 | /// </summary> | ||
72 | /// <param name="objectGroup"></param> | ||
73 | public void LinkToGroup(AllNewSceneObjectGroup2 objectGroup) | ||
74 | { | ||
75 | |||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// | ||
80 | /// </summary> | ||
81 | /// <param name="primID"></param> | ||
82 | /// <returns></returns> | ||
83 | private AllNewSceneObjectPart2 GetChildPrim(LLUUID primID) | ||
84 | { | ||
85 | AllNewSceneObjectPart2 childPart = null; | ||
86 | if (this.m_parts.ContainsKey(primID)) | ||
87 | { | ||
88 | childPart = this.m_parts[primID]; | ||
89 | } | ||
90 | return childPart; | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
94 | /// | ||
95 | /// </summary> | ||
96 | /// <param name="localID"></param> | ||
97 | /// <returns></returns> | ||
98 | private AllNewSceneObjectPart2 GetChildPrim(uint localID) | ||
99 | { | ||
100 | foreach (AllNewSceneObjectPart2 part in this.m_parts.Values) | ||
101 | { | ||
102 | if (part.m_localID == localID) | ||
103 | { | ||
104 | return part; | ||
105 | } | ||
106 | } | ||
107 | return null; | ||
108 | } | ||
109 | |||
110 | public void TriggerTainted() | ||
111 | { | ||
112 | if (OnPrimCountTainted != null) | ||
113 | { | ||
114 | this.OnPrimCountTainted(); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// | ||
120 | /// </summary> | ||
121 | /// <param name="offset"></param> | ||
122 | /// <param name="pos"></param> | ||
123 | /// <param name="remoteClient"></param> | ||
124 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | ||
125 | { | ||
126 | this.Pos = pos; | ||
127 | } | ||
128 | |||
129 | /// <summary> | ||
130 | /// | ||
131 | /// </summary> | ||
132 | /// <param name="client"></param> | ||
133 | public void GetProperites(IClientAPI client) | ||
134 | { | ||
135 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | ||
136 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | ||
137 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | ||
138 | proper.ObjectData[0].ItemID = LLUUID.Zero; | ||
139 | proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate; | ||
140 | proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID; | ||
141 | proper.ObjectData[0].FolderID = LLUUID.Zero; | ||
142 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | ||
143 | proper.ObjectData[0].GroupID = LLUUID.Zero; | ||
144 | proper.ObjectData[0].InventorySerial = 0; | ||
145 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; | ||
146 | proper.ObjectData[0].ObjectID = this.m_uuid; | ||
147 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; | ||
148 | proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); | ||
149 | proper.ObjectData[0].TextureID = new byte[0]; | ||
150 | proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); | ||
151 | proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); | ||
152 | proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); | ||
153 | proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; | ||
154 | proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; | ||
155 | proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask; | ||
156 | proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask; | ||
157 | proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask; | ||
158 | |||
159 | client.OutPacket(proper); | ||
160 | } | ||
161 | |||
162 | #region Shape | ||
163 | /// <summary> | ||
164 | /// | ||
165 | /// </summary> | ||
166 | /// <param name="shapeBlock"></param> | ||
167 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) | ||
168 | { | ||
169 | AllNewSceneObjectPart2 part = this.GetChildPrim(localID); | ||
170 | if (part != null) | ||
171 | { | ||
172 | part.UpdateShape(shapeBlock); | ||
173 | } | ||
174 | } | ||
175 | #endregion | ||
176 | |||
177 | #region Position | ||
178 | public void UpdateGroupPosition(LLVector3 pos) | ||
179 | { | ||
180 | this.m_pos = pos; | ||
181 | } | ||
182 | |||
183 | public void UpdateSinglePosition(LLVector3 pos, uint localID) | ||
184 | { | ||
185 | AllNewSceneObjectPart2 part = this.GetChildPrim(localID); | ||
186 | if (part != null) | ||
187 | { | ||
188 | if (part.uuid == this.m_rootPart.uuid) | ||
189 | { | ||
190 | this.UpdateRootPosition(pos); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | part.UpdateOffSet(pos); | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | |||
199 | private void UpdateRootPosition(LLVector3 pos) | ||
200 | { | ||
201 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
202 | LLVector3 oldPos = new LLVector3(this.Pos.X + this.m_rootPart.OffsetPosition.X, this.Pos.Y + this.m_rootPart.OffsetPosition.Y, this.Pos.Z + this.m_rootPart.OffsetPosition.Z); | ||
203 | LLVector3 diff = oldPos - newPos; | ||
204 | Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | ||
205 | Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | ||
206 | axDiff = partRotation.Inverse() * axDiff; | ||
207 | diff.X = axDiff.x; | ||
208 | diff.Y = axDiff.y; | ||
209 | diff.Z = axDiff.z; | ||
210 | |||
211 | foreach (AllNewSceneObjectPart2 obPart in this.m_parts.Values) | ||
212 | { | ||
213 | if (obPart.uuid != this.m_rootPart.uuid) | ||
214 | { | ||
215 | obPart.OffsetPosition = obPart.OffsetPosition + diff; | ||
216 | } | ||
217 | } | ||
218 | this.Pos = newPos; | ||
219 | pos.X = newPos.X; | ||
220 | pos.Y = newPos.Y; | ||
221 | pos.Z = newPos.Z; | ||
222 | } | ||
223 | #endregion | ||
224 | |||
225 | #region Roation | ||
226 | public void UpdateGroupRotation(LLQuaternion rot) | ||
227 | { | ||
228 | this.m_rootPart.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
229 | } | ||
230 | |||
231 | /// <summary> | ||
232 | /// | ||
233 | /// </summary> | ||
234 | /// <param name="pos"></param> | ||
235 | /// <param name="rot"></param> | ||
236 | public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) | ||
237 | { | ||
238 | this.m_rootPart.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
239 | this.m_pos = pos; | ||
240 | } | ||
241 | |||
242 | public void UpdateSingleRotation(LLQuaternion rot, uint localID) | ||
243 | { | ||
244 | AllNewSceneObjectPart2 part = this.GetChildPrim(localID); | ||
245 | if (part != null) | ||
246 | { | ||
247 | if (part.uuid == this.m_rootPart.uuid) | ||
248 | { | ||
249 | this.UpdateRootRotation(rot); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | part.UpdateRotation(rot); | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | private void UpdateRootRotation(LLQuaternion rot) | ||
258 | { | ||
259 | this.m_rootPart.UpdateRotation(rot); | ||
260 | Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); | ||
261 | Axiom.Math.Quaternion oldParentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | ||
262 | |||
263 | foreach (AllNewSceneObjectPart2 prim in this.m_parts.Values) | ||
264 | { | ||
265 | if (prim.uuid != this.m_rootPart.uuid) | ||
266 | { | ||
267 | Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); | ||
268 | axPos = oldParentRot * axPos; | ||
269 | axPos = axRot.Inverse() * axPos; | ||
270 | prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | ||
271 | Axiom.Math.Quaternion primsRot = new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, prim.RotationOffset.Z); | ||
272 | Axiom.Math.Quaternion newRot = oldParentRot * primsRot; | ||
273 | newRot = axRot.Inverse() * newRot; | ||
274 | prim.RotationOffset = new LLQuaternion(newRot.w, newRot.x, newRot.y, newRot.z); | ||
275 | } | ||
276 | } | ||
277 | } | ||
278 | #endregion | ||
279 | /// <summary> | ||
280 | /// | ||
281 | /// </summary> | ||
282 | /// <param name="part"></param> | ||
283 | private void SetPartAsRoot(AllNewSceneObjectPart2 part) | ||
284 | { | ||
285 | this.m_rootPart = part; | ||
286 | this.m_uuid = part.uuid; | ||
287 | this.m_localId = part.m_localID; | ||
288 | } | ||
289 | |||
290 | /// <summary> | ||
291 | /// | ||
292 | /// </summary> | ||
293 | /// <param name="part"></param> | ||
294 | private void SetPartAsNonRoot(AllNewSceneObjectPart2 part) | ||
295 | { | ||
296 | |||
297 | } | ||
298 | } | ||
299 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs new file mode 100644 index 0000000..b0df4af --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs | |||
@@ -0,0 +1,211 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Text; | ||
3 | using System; | ||
4 | using Axiom.Math; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Types; | ||
9 | |||
10 | namespace OpenSim.Region.Environment.Scenes | ||
11 | { | ||
12 | |||
13 | public class AllNewSceneObjectPart2 | ||
14 | { | ||
15 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
16 | |||
17 | private ulong m_regionHandle; | ||
18 | private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | ||
19 | //private Dictionary<LLUUID, InventoryItem> inventoryItems; | ||
20 | |||
21 | public string SitName = ""; | ||
22 | public string TouchName = ""; | ||
23 | public string Text = ""; | ||
24 | |||
25 | public LLUUID CreatorID; | ||
26 | public LLUUID OwnerID; | ||
27 | public LLUUID LastOwnerID; | ||
28 | public Int32 CreationDate; | ||
29 | |||
30 | public LLUUID uuid; | ||
31 | public uint m_localID; | ||
32 | |||
33 | public uint ParentID = 0; | ||
34 | |||
35 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
36 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
37 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
38 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
39 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
40 | |||
41 | protected PrimitiveBaseShape m_Shape; | ||
42 | |||
43 | protected AllNewSceneObjectGroup2 m_parentGroup; | ||
44 | |||
45 | |||
46 | #region Properties | ||
47 | protected string m_name; | ||
48 | /// <summary> | ||
49 | /// | ||
50 | /// </summary> | ||
51 | public virtual string Name | ||
52 | { | ||
53 | get { return m_name; } | ||
54 | set { m_name = value; } | ||
55 | } | ||
56 | |||
57 | protected LLVector3 m_offset; | ||
58 | public LLVector3 OffsetPosition | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | return m_offset; | ||
63 | } | ||
64 | set | ||
65 | { | ||
66 | m_offset = value; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | protected LLQuaternion m_rotationOffset; | ||
71 | public LLQuaternion RotationOffset | ||
72 | { | ||
73 | get | ||
74 | { | ||
75 | return m_rotationOffset; | ||
76 | } | ||
77 | set | ||
78 | { | ||
79 | m_rotationOffset = value; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | private string m_description = ""; | ||
84 | public string Description | ||
85 | { | ||
86 | get | ||
87 | { | ||
88 | return this.m_description; | ||
89 | } | ||
90 | set | ||
91 | { | ||
92 | this.m_description = value; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public PrimitiveBaseShape Shape | ||
97 | { | ||
98 | get | ||
99 | { | ||
100 | return this.m_Shape; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public LLVector3 Scale | ||
105 | { | ||
106 | set | ||
107 | { | ||
108 | this.m_Shape.Scale = value; | ||
109 | } | ||
110 | get | ||
111 | { | ||
112 | return this.m_Shape.Scale; | ||
113 | } | ||
114 | } | ||
115 | #endregion | ||
116 | |||
117 | #region Constructors | ||
118 | public AllNewSceneObjectPart2(ulong regionHandle, AllNewSceneObjectGroup2 parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 position) | ||
119 | { | ||
120 | this.m_regionHandle = regionHandle; | ||
121 | this.m_parentGroup = parent; | ||
122 | |||
123 | this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
124 | this.OwnerID = ownerID; | ||
125 | this.CreatorID = this.OwnerID; | ||
126 | this.LastOwnerID = LLUUID.Zero; | ||
127 | this.uuid = LLUUID.Random(); | ||
128 | this.m_localID = (uint)(localID); | ||
129 | this.m_Shape = shape; | ||
130 | |||
131 | this.OffsetPosition = position; | ||
132 | } | ||
133 | #endregion | ||
134 | |||
135 | #region Shape | ||
136 | /// <summary> | ||
137 | /// | ||
138 | /// </summary> | ||
139 | /// <param name="shapeBlock"></param> | ||
140 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) | ||
141 | { | ||
142 | this.m_Shape.PathBegin = shapeBlock.PathBegin; | ||
143 | this.m_Shape.PathEnd = shapeBlock.PathEnd; | ||
144 | this.m_Shape.PathScaleX = shapeBlock.PathScaleX; | ||
145 | this.m_Shape.PathScaleY = shapeBlock.PathScaleY; | ||
146 | this.m_Shape.PathShearX = shapeBlock.PathShearX; | ||
147 | this.m_Shape.PathShearY = shapeBlock.PathShearY; | ||
148 | this.m_Shape.PathSkew = shapeBlock.PathSkew; | ||
149 | this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; | ||
150 | this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; | ||
151 | this.m_Shape.PathCurve = shapeBlock.PathCurve; | ||
152 | this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; | ||
153 | this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; | ||
154 | this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; | ||
155 | this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; | ||
156 | this.m_Shape.PathTaperX = shapeBlock.PathTaperX; | ||
157 | this.m_Shape.PathTaperY = shapeBlock.PathTaperY; | ||
158 | this.m_Shape.PathTwist = shapeBlock.PathTwist; | ||
159 | this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; | ||
160 | } | ||
161 | #endregion | ||
162 | |||
163 | #region Texture | ||
164 | /// <summary> | ||
165 | /// | ||
166 | /// </summary> | ||
167 | /// <param name="textureEntry"></param> | ||
168 | public void UpdateTextureEntry(byte[] textureEntry) | ||
169 | { | ||
170 | this.m_Shape.TextureEntry = textureEntry; | ||
171 | } | ||
172 | #endregion | ||
173 | |||
174 | #region Position | ||
175 | /// <summary> | ||
176 | /// | ||
177 | /// </summary> | ||
178 | /// <param name="pos"></param> | ||
179 | public void UpdateOffSet(LLVector3 pos) | ||
180 | { | ||
181 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
182 | this.OffsetPosition = newPos; | ||
183 | } | ||
184 | #endregion | ||
185 | |||
186 | #region rotation | ||
187 | public void UpdateRotation(LLQuaternion rot) | ||
188 | { | ||
189 | this.RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); | ||
190 | } | ||
191 | #endregion | ||
192 | |||
193 | #region Resizing/Scale | ||
194 | /// <summary> | ||
195 | /// | ||
196 | /// </summary> | ||
197 | /// <param name="scale"></param> | ||
198 | public void Resize(LLVector3 scale) | ||
199 | { | ||
200 | LLVector3 offset = (scale - this.m_Shape.Scale); | ||
201 | offset.X /= 2; | ||
202 | offset.Y /= 2; | ||
203 | offset.Z /= 2; | ||
204 | |||
205 | this.OffsetPosition += offset; | ||
206 | this.m_Shape.Scale = scale; | ||
207 | } | ||
208 | #endregion | ||
209 | } | ||
210 | } | ||
211 | |||