aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs598
1 files changed, 299 insertions, 299 deletions
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
index 4f48217..a4b3852 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
@@ -1,299 +1,299 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System.Text; 2using System.Text;
3using Axiom.Math; 3using Axiom.Math;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
8using OpenSim.Physics.Manager; 8using OpenSim.Physics.Manager;
9 9
10namespace OpenSim.Region.Environment.Scenes 10namespace OpenSim.Region.Environment.Scenes
11{ 11{
12 // public delegate void PrimCountTaintedDelegate(); 12 // public delegate void PrimCountTaintedDelegate();
13 13
14 public class AllNewSceneObjectGroup2 : EntityBase 14 public class AllNewSceneObjectGroup2 : EntityBase
15 { 15 {
16 private Encoding enc = Encoding.ASCII; 16 private Encoding enc = Encoding.ASCII;
17 17
18 protected AllNewSceneObjectPart2 m_rootPart; 18 protected AllNewSceneObjectPart2 m_rootPart;
19 protected Dictionary<LLUUID, AllNewSceneObjectPart2> m_parts = new Dictionary<LLUUID, AllNewSceneObjectPart2>(); 19 protected Dictionary<LLUUID, AllNewSceneObjectPart2> m_parts = new Dictionary<LLUUID, AllNewSceneObjectPart2>();
20 20
21 public event PrimCountTaintedDelegate OnPrimCountTainted; 21 public event PrimCountTaintedDelegate OnPrimCountTainted;
22 22
23 /// <summary> 23 /// <summary>
24 /// 24 ///
25 /// </summary> 25 /// </summary>
26 public int primCount 26 public int primCount
27 { 27 {
28 get 28 get
29 { 29 {
30 return 1; 30 return 1;
31 } 31 }
32 } 32 }
33 33
34 /// <summary> 34 /// <summary>
35 /// 35 ///
36 /// </summary> 36 /// </summary>
37 public LLVector3 GroupCentrePoint 37 public LLVector3 GroupCentrePoint
38 { 38 {
39 get 39 get
40 { 40 {
41 return new LLVector3(0, 0, 0); 41 return new LLVector3(0, 0, 0);
42 } 42 }
43 } 43 }
44 44
45 /// <summary> 45 /// <summary>
46 /// 46 ///
47 /// </summary> 47 /// </summary>
48 public AllNewSceneObjectGroup2() 48 public AllNewSceneObjectGroup2()
49 { 49 {
50 50
51 } 51 }
52 52
53 /// <summary> 53 /// <summary>
54 /// 54 ///
55 /// </summary> 55 /// </summary>
56 public void FlagGroupForFullUpdate() 56 public void FlagGroupForFullUpdate()
57 { 57 {
58 58
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// 62 ///
63 /// </summary> 63 /// </summary>
64 public void FlagGroupForTerseUpdate() 64 public void FlagGroupForTerseUpdate()
65 { 65 {
66 66
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// 70 ///
71 /// </summary> 71 /// </summary>
72 /// <param name="objectGroup"></param> 72 /// <param name="objectGroup"></param>
73 public void LinkToGroup(AllNewSceneObjectGroup2 objectGroup) 73 public void LinkToGroup(AllNewSceneObjectGroup2 objectGroup)
74 { 74 {
75 75
76 } 76 }
77 77
78 /// <summary> 78 /// <summary>
79 /// 79 ///
80 /// </summary> 80 /// </summary>
81 /// <param name="primID"></param> 81 /// <param name="primID"></param>
82 /// <returns></returns> 82 /// <returns></returns>
83 private AllNewSceneObjectPart2 GetChildPrim(LLUUID primID) 83 private AllNewSceneObjectPart2 GetChildPrim(LLUUID primID)
84 { 84 {
85 AllNewSceneObjectPart2 childPart = null; 85 AllNewSceneObjectPart2 childPart = null;
86 if (this.m_parts.ContainsKey(primID)) 86 if (this.m_parts.ContainsKey(primID))
87 { 87 {
88 childPart = this.m_parts[primID]; 88 childPart = this.m_parts[primID];
89 } 89 }
90 return childPart; 90 return childPart;
91 } 91 }
92 92
93 /// <summary> 93 /// <summary>
94 /// 94 ///
95 /// </summary> 95 /// </summary>
96 /// <param name="localID"></param> 96 /// <param name="localID"></param>
97 /// <returns></returns> 97 /// <returns></returns>
98 private AllNewSceneObjectPart2 GetChildPrim(uint localID) 98 private AllNewSceneObjectPart2 GetChildPrim(uint localID)
99 { 99 {
100 foreach (AllNewSceneObjectPart2 part in this.m_parts.Values) 100 foreach (AllNewSceneObjectPart2 part in this.m_parts.Values)
101 { 101 {
102 if (part.m_localID == localID) 102 if (part.m_localID == localID)
103 { 103 {
104 return part; 104 return part;
105 } 105 }
106 } 106 }
107 return null; 107 return null;
108 } 108 }
109 109
110 public void TriggerTainted() 110 public void TriggerTainted()
111 { 111 {
112 if (OnPrimCountTainted != null) 112 if (OnPrimCountTainted != null)
113 { 113 {
114 this.OnPrimCountTainted(); 114 this.OnPrimCountTainted();
115 } 115 }
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// 119 ///
120 /// </summary> 120 /// </summary>
121 /// <param name="offset"></param> 121 /// <param name="offset"></param>
122 /// <param name="pos"></param> 122 /// <param name="pos"></param>
123 /// <param name="remoteClient"></param> 123 /// <param name="remoteClient"></param>
124 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 124 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
125 { 125 {
126 this.Pos = pos; 126 this.Pos = pos;
127 } 127 }
128 128
129 /// <summary> 129 /// <summary>
130 /// 130 ///
131 /// </summary> 131 /// </summary>
132 /// <param name="client"></param> 132 /// <param name="client"></param>
133 public void GetProperites(IClientAPI client) 133 public void GetProperites(IClientAPI client)
134 { 134 {
135 ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); 135 ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
136 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 136 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
137 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 137 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
138 proper.ObjectData[0].ItemID = LLUUID.Zero; 138 proper.ObjectData[0].ItemID = LLUUID.Zero;
139 proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate; 139 proper.ObjectData[0].CreationDate = (ulong)this.m_rootPart.CreationDate;
140 proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID; 140 proper.ObjectData[0].CreatorID = this.m_rootPart.CreatorID;
141 proper.ObjectData[0].FolderID = LLUUID.Zero; 141 proper.ObjectData[0].FolderID = LLUUID.Zero;
142 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 142 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
143 proper.ObjectData[0].GroupID = LLUUID.Zero; 143 proper.ObjectData[0].GroupID = LLUUID.Zero;
144 proper.ObjectData[0].InventorySerial = 0; 144 proper.ObjectData[0].InventorySerial = 0;
145 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; 145 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
146 proper.ObjectData[0].ObjectID = this.m_uuid; 146 proper.ObjectData[0].ObjectID = this.m_uuid;
147 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; 147 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
148 proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); 148 proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0");
149 proper.ObjectData[0].TextureID = new byte[0]; 149 proper.ObjectData[0].TextureID = new byte[0];
150 proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\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"); 151 proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0");
152 proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); 152 proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0");
153 proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; 153 proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask;
154 proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; 154 proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask;
155 proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask; 155 proper.ObjectData[0].GroupMask = this.m_rootPart.GroupMask;
156 proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask; 156 proper.ObjectData[0].EveryoneMask = this.m_rootPart.EveryoneMask;
157 proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask; 157 proper.ObjectData[0].BaseMask = this.m_rootPart.BaseMask;
158 158
159 client.OutPacket(proper); 159 client.OutPacket(proper);
160 } 160 }
161 161
162 #region Shape 162 #region Shape
163 /// <summary> 163 /// <summary>
164 /// 164 ///
165 /// </summary> 165 /// </summary>
166 /// <param name="shapeBlock"></param> 166 /// <param name="shapeBlock"></param>
167 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) 167 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
168 { 168 {
169 AllNewSceneObjectPart2 part = this.GetChildPrim(localID); 169 AllNewSceneObjectPart2 part = this.GetChildPrim(localID);
170 if (part != null) 170 if (part != null)
171 { 171 {
172 part.UpdateShape(shapeBlock); 172 part.UpdateShape(shapeBlock);
173 } 173 }
174 } 174 }
175 #endregion 175 #endregion
176 176
177 #region Position 177 #region Position
178 public void UpdateGroupPosition(LLVector3 pos) 178 public void UpdateGroupPosition(LLVector3 pos)
179 { 179 {
180 this.m_pos = pos; 180 this.m_pos = pos;
181 } 181 }
182 182
183 public void UpdateSinglePosition(LLVector3 pos, uint localID) 183 public void UpdateSinglePosition(LLVector3 pos, uint localID)
184 { 184 {
185 AllNewSceneObjectPart2 part = this.GetChildPrim(localID); 185 AllNewSceneObjectPart2 part = this.GetChildPrim(localID);
186 if (part != null) 186 if (part != null)
187 { 187 {
188 if (part.uuid == this.m_rootPart.uuid) 188 if (part.uuid == this.m_rootPart.uuid)
189 { 189 {
190 this.UpdateRootPosition(pos); 190 this.UpdateRootPosition(pos);
191 } 191 }
192 else 192 else
193 { 193 {
194 part.UpdateOffSet(pos); 194 part.UpdateOffSet(pos);
195 } 195 }
196 } 196 }
197 } 197 }
198 198
199 private void UpdateRootPosition(LLVector3 pos) 199 private void UpdateRootPosition(LLVector3 pos)
200 { 200 {
201 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 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); 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; 203 LLVector3 diff = oldPos - newPos;
204 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 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); 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; 206 axDiff = partRotation.Inverse() * axDiff;
207 diff.X = axDiff.x; 207 diff.X = axDiff.x;
208 diff.Y = axDiff.y; 208 diff.Y = axDiff.y;
209 diff.Z = axDiff.z; 209 diff.Z = axDiff.z;
210 210
211 foreach (AllNewSceneObjectPart2 obPart in this.m_parts.Values) 211 foreach (AllNewSceneObjectPart2 obPart in this.m_parts.Values)
212 { 212 {
213 if (obPart.uuid != this.m_rootPart.uuid) 213 if (obPart.uuid != this.m_rootPart.uuid)
214 { 214 {
215 obPart.OffsetPosition = obPart.OffsetPosition + diff; 215 obPart.OffsetPosition = obPart.OffsetPosition + diff;
216 } 216 }
217 } 217 }
218 this.Pos = newPos; 218 this.Pos = newPos;
219 pos.X = newPos.X; 219 pos.X = newPos.X;
220 pos.Y = newPos.Y; 220 pos.Y = newPos.Y;
221 pos.Z = newPos.Z; 221 pos.Z = newPos.Z;
222 } 222 }
223 #endregion 223 #endregion
224 224
225 #region Roation 225 #region Roation
226 public void UpdateGroupRotation(LLQuaternion rot) 226 public void UpdateGroupRotation(LLQuaternion rot)
227 { 227 {
228 this.m_rootPart.UpdateRotation(rot); 228 this.m_rootPart.UpdateRotation(rot);
229 } 229 }
230 230
231 /// <summary> 231 /// <summary>
232 /// 232 ///
233 /// </summary> 233 /// </summary>
234 /// <param name="pos"></param> 234 /// <param name="pos"></param>
235 /// <param name="rot"></param> 235 /// <param name="rot"></param>
236 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) 236 public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot)
237 { 237 {
238 this.m_rootPart.UpdateRotation(rot); 238 this.m_rootPart.UpdateRotation(rot);
239 this.m_pos = pos; 239 this.m_pos = pos;
240 } 240 }
241 241
242 public void UpdateSingleRotation(LLQuaternion rot, uint localID) 242 public void UpdateSingleRotation(LLQuaternion rot, uint localID)
243 { 243 {
244 AllNewSceneObjectPart2 part = this.GetChildPrim(localID); 244 AllNewSceneObjectPart2 part = this.GetChildPrim(localID);
245 if (part != null) 245 if (part != null)
246 { 246 {
247 if (part.uuid == this.m_rootPart.uuid) 247 if (part.uuid == this.m_rootPart.uuid)
248 { 248 {
249 this.UpdateRootRotation(rot); 249 this.UpdateRootRotation(rot);
250 } 250 }
251 else 251 else
252 { 252 {
253 part.UpdateRotation(rot); 253 part.UpdateRotation(rot);
254 } 254 }
255 } 255 }
256 } 256 }
257 private void UpdateRootRotation(LLQuaternion rot) 257 private void UpdateRootRotation(LLQuaternion rot)
258 { 258 {
259 this.m_rootPart.UpdateRotation(rot); 259 this.m_rootPart.UpdateRotation(rot);
260 Axiom.Math.Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); 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); 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 262
263 foreach (AllNewSceneObjectPart2 prim in this.m_parts.Values) 263 foreach (AllNewSceneObjectPart2 prim in this.m_parts.Values)
264 { 264 {
265 if (prim.uuid != this.m_rootPart.uuid) 265 if (prim.uuid != this.m_rootPart.uuid)
266 { 266 {
267 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 267 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
268 axPos = oldParentRot * axPos; 268 axPos = oldParentRot * axPos;
269 axPos = axRot.Inverse() * axPos; 269 axPos = axRot.Inverse() * axPos;
270 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 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); 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; 272 Axiom.Math.Quaternion newRot = oldParentRot * primsRot;
273 newRot = axRot.Inverse() * newRot; 273 newRot = axRot.Inverse() * newRot;
274 prim.RotationOffset = new LLQuaternion(newRot.w, newRot.x, newRot.y, newRot.z); 274 prim.RotationOffset = new LLQuaternion(newRot.w, newRot.x, newRot.y, newRot.z);
275 } 275 }
276 } 276 }
277 } 277 }
278 #endregion 278 #endregion
279 /// <summary> 279 /// <summary>
280 /// 280 ///
281 /// </summary> 281 /// </summary>
282 /// <param name="part"></param> 282 /// <param name="part"></param>
283 private void SetPartAsRoot(AllNewSceneObjectPart2 part) 283 private void SetPartAsRoot(AllNewSceneObjectPart2 part)
284 { 284 {
285 this.m_rootPart = part; 285 this.m_rootPart = part;
286 this.m_uuid = part.uuid; 286 this.m_uuid = part.uuid;
287 this.m_localId = part.m_localID; 287 this.m_localId = part.m_localID;
288 } 288 }
289 289
290 /// <summary> 290 /// <summary>
291 /// 291 ///
292 /// </summary> 292 /// </summary>
293 /// <param name="part"></param> 293 /// <param name="part"></param>
294 private void SetPartAsNonRoot(AllNewSceneObjectPart2 part) 294 private void SetPartAsNonRoot(AllNewSceneObjectPart2 part)
295 { 295 {
296 296
297 } 297 }
298 } 298 }
299} 299}