aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Primitive.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Primitive.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs447
1 files changed, 244 insertions, 203 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index b413758..5b6b13d 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -15,19 +15,15 @@ namespace OpenSim.Region.Environment.Scenes
15 { 15 {
16 private const uint FULL_MASK_PERMISSIONS = 2147483647; 16 private const uint FULL_MASK_PERMISSIONS = 2147483647;
17 17
18 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 18 private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0);
19 private ulong m_regionHandle; 19 private ulong m_regionHandle;
20 private byte updateFlag = 0; 20 private byte m_updateFlag;
21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; 21 private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
22 22
23 private Dictionary<LLUUID, InventoryItem> inventoryItems; 23 private Dictionary<LLUUID, InventoryItem> m_inventoryItems;
24 24
25 private string m_description = ""; 25 private string m_description = "";
26 26
27 public string SitName = "";
28 public string TouchName = "";
29 public string Text = "";
30
31 public LLUUID CreatorID; 27 public LLUUID CreatorID;
32 public LLUUID OwnerID; 28 public LLUUID OwnerID;
33 public LLUUID LastOwnerID; 29 public LLUUID LastOwnerID;
@@ -52,22 +48,23 @@ namespace OpenSim.Region.Environment.Scenes
52 public event PrimCountTaintedDelegate OnPrimCountTainted; 48 public event PrimCountTaintedDelegate OnPrimCountTainted;
53 49
54 #region Properties 50 #region Properties
51
55 /// <summary> 52 /// <summary>
56 /// If rootprim, will return world position 53 /// If rootprim, will return world position
57 /// otherwise will return local offset from rootprim 54 /// otherwise will return local offset from rootprim
58 /// </summary> 55 /// </summary>
59 public override LLVector3 Pos 56 public override LLVector3 Pos
60 { 57 {
61 get 58 get
62 { 59 {
63 if (m_isRootPrim) 60 if (m_isRootPrim)
64 { 61 {
65 //if we are rootprim then our offset should be zero 62 //if we are rootprim then our offset should be zero
66 return this.m_pos + m_Parent.Pos; 63 return m_pos + m_Parent.Pos;
67 } 64 }
68 else 65 else
69 { 66 {
70 return this.m_pos; 67 return m_pos;
71 } 68 }
72 } 69 }
73 set 70 set
@@ -76,63 +73,72 @@ namespace OpenSim.Region.Environment.Scenes
76 { 73 {
77 m_Parent.Pos = value; 74 m_Parent.Pos = value;
78 } 75 }
79 this.m_pos = value - m_Parent.Pos; 76 m_pos = value - m_Parent.Pos;
80 } 77 }
81
82 } 78 }
83 79
84 public PrimitiveBaseShape Shape 80 public PrimitiveBaseShape Shape
85 { 81 {
86 get 82 get { return m_Shape; }
87 {
88 return this.m_Shape;
89 }
90 } 83 }
91 84
92 public LLVector3 WorldPos 85 public LLVector3 WorldPos
93 { 86 {
94 get 87 get
95 { 88 {
96 if (!this.m_isRootPrim) 89 if (!m_isRootPrim)
97 { 90 {
98 Primitive parentPrim = (Primitive)this.m_Parent; 91 Primitive parentPrim = (Primitive)m_Parent;
99 Axiom.Math.Vector3 offsetPos = new Vector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 92 Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
100 offsetPos = parentPrim.Rotation * offsetPos; 93 offsetPos = parentPrim.Rotation * offsetPos;
101 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z); 94 return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
102 } 95 }
103 else 96 else
104 { 97 {
105 return this.Pos; 98 return Pos;
106 } 99 }
107 } 100 }
108 } 101 }
109 102
110 public string Description 103 public string Description
111 { 104 {
112 get 105 get { return m_description; }
113 { 106 set { m_description = value; }
114 return this.m_description;
115 }
116 set
117 {
118 this.m_description = value;
119 }
120 } 107 }
121 108
122 public LLVector3 Scale 109 public LLVector3 Scale
123 { 110 {
111 set { m_Shape.Scale = value; }
112 get { return m_Shape.Scale; }
113 }
114
115 private string m_sitName = "";
116 public string SitName
117 {
118 get { return m_sitName; }
119 }
120
121 private string m_touchName = "";
122 public string TouchName
123 {
124 get { return m_touchName; }
125 }
126
127 private string m_text = "";
128 public string Text
129 {
130 get { return m_text; }
124 set 131 set
125 { 132 {
126 this.m_Shape.Scale = value; 133 m_text = value;
127 } 134 ScheduleFullUpdate();
128 get
129 {
130 return this.m_Shape.Scale;
131 } 135 }
132 } 136 }
137
133 #endregion 138 #endregion
134 139
135 #region Constructors 140 #region Constructors
141
136 /// <summary> 142 /// <summary>
137 /// 143 ///
138 /// </summary> 144 /// </summary>
@@ -144,21 +150,23 @@ namespace OpenSim.Region.Environment.Scenes
144 /// <param name="isRoot"></param> 150 /// <param name="isRoot"></param>
145 /// <param name="parent"></param> 151 /// <param name="parent"></param>
146 /// <param name="rootObject"></param> 152 /// <param name="rootObject"></param>
147 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 153 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
154 SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
148 { 155 {
149
150 m_regionHandle = regionHandle; 156 m_regionHandle = regionHandle;
151 m_world = world; 157 m_world = world;
152 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 158 m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
153 this.m_Parent = parent; 159 m_Parent = parent;
154 this.m_isRootPrim = isRoot; 160 m_isRootPrim = isRoot;
155 this.m_RootParent = rootObject; 161 m_RootParent = rootObject;
156 this.CreateFromShape(ownerID, localID, pos, shape); 162 ClearUpdateSchedule();
157 this.Rotation = Axiom.Math.Quaternion.Identity; 163 CreateFromShape(ownerID, localID, pos, shape);
164
165 Rotation = Quaternion.Identity;
158 166
159 m_world.AcknowledgeNewPrim(this); 167 m_world.AcknowledgeNewPrim(this);
160 168
161 this.OnPrimCountTainted(); 169 OnPrimCountTainted();
162 } 170 }
163 171
164 /// <summary> 172 /// <summary>
@@ -167,7 +175,6 @@ namespace OpenSim.Region.Environment.Scenes
167 /// <remarks>Empty constructor for duplication</remarks> 175 /// <remarks>Empty constructor for duplication</remarks>
168 public Primitive() 176 public Primitive()
169 { 177 {
170
171 } 178 }
172 179
173 #endregion 180 #endregion
@@ -176,33 +183,34 @@ namespace OpenSim.Region.Environment.Scenes
176 183
177 ~Primitive() 184 ~Primitive()
178 { 185 {
179 this.OnPrimCountTainted(); 186 OnPrimCountTainted();
180 } 187 }
188
181 #endregion 189 #endregion
182 190
183 #region Duplication 191 #region Duplication
184 192
185 public Primitive Copy(EntityBase parent, SceneObject rootParent) 193 public Primitive Copy(EntityBase parent, SceneObject rootParent)
186 { 194 {
187 Primitive dupe = (Primitive)this.MemberwiseClone(); 195 Primitive dupe = (Primitive)MemberwiseClone();
188 196
189 dupe.m_Parent = parent; 197 dupe.m_Parent = parent;
190 dupe.m_RootParent = rootParent; 198 dupe.m_RootParent = rootParent;
191 199
192 // TODO: Copy this properly. 200 // TODO: Copy this properly.
193 dupe.inventoryItems = this.inventoryItems; 201 dupe.m_inventoryItems = m_inventoryItems;
194 dupe.children = new List<EntityBase>(); 202 dupe.m_children = new List<EntityBase>();
195 dupe.m_Shape = this.m_Shape.Copy(); 203 dupe.m_Shape = m_Shape.Copy();
196 dupe.m_regionHandle = this.m_regionHandle; 204 dupe.m_regionHandle = m_regionHandle;
197 dupe.m_world = this.m_world; 205 dupe.m_world = m_world;
198 206
199 uint newLocalID = this.m_world.PrimIDAllocate(); 207 uint newLocalID = m_world.PrimIDAllocate();
200 dupe.uuid = LLUUID.Random(); 208 dupe.m_uuid = LLUUID.Random();
201 dupe.LocalId = newLocalID; 209 dupe.LocalId = newLocalID;
202 210
203 if (parent is SceneObject) 211 if (parent is SceneObject)
204 { 212 {
205 dupe.m_isRootPrim = true; 213 dupe.m_isRootPrim = true;
206 dupe.ParentID = 0; 214 dupe.ParentID = 0;
207 } 215 }
208 else 216 else
@@ -211,18 +219,18 @@ namespace OpenSim.Region.Environment.Scenes
211 dupe.ParentID = ((Primitive)parent).LocalId; 219 dupe.ParentID = ((Primitive)parent).LocalId;
212 } 220 }
213 221
214 dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); 222 dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z);
215 dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 223 dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
216 dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z); 224 dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
217 225
218 rootParent.AddChildToList(dupe); 226 rootParent.AddChildToList(dupe);
219 this.m_world.AcknowledgeNewPrim(dupe); 227 m_world.AcknowledgeNewPrim(dupe);
220 dupe.TriggerOnPrimCountTainted(); 228 dupe.TriggerOnPrimCountTainted();
221 229
222 foreach (Primitive prim in this.children) 230 foreach (Primitive prim in m_children)
223 { 231 {
224 Primitive primClone = prim.Copy(dupe, rootParent); 232 Primitive primClone = prim.Copy(dupe, rootParent);
225 dupe.children.Add(primClone); 233 dupe.m_children.Add(primClone);
226 } 234 }
227 235
228 return dupe; 236 return dupe;
@@ -231,30 +239,41 @@ namespace OpenSim.Region.Environment.Scenes
231 #endregion 239 #endregion
232 240
233 #region Override from EntityBase 241 #region Override from EntityBase
242
234 /// <summary> 243 /// <summary>
235 /// 244 ///
236 /// </summary> 245 /// </summary>
237 public override void update() 246 public override void Update()
238 { 247 {
239 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes 248 if (m_updateFlag == 1) //some change has been made so update the clients
240 { 249 {
241 this.SendFullUpdateToAllClients(); 250 SendTerseUpdateToALLClients();
242 this.updateFlag = 0; 251 ClearUpdateSchedule();
243 } 252 }
244 if (this.updateFlag == 2) //some change has been made so update the clients 253 else
245 { 254 {
246 this.SendTerseUpdateToALLClients(); 255 if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
247 this.updateFlag = 0; 256 {
257 SendFullUpdateToAllClients();
258 ClearUpdateSchedule();
259 }
248 } 260 }
249 261
250 foreach (EntityBase child in children) 262 foreach (EntityBase child in m_children)
251 { 263 {
252 child.update(); 264 child.Update();
253 } 265 }
254 } 266 }
267
268 private void ClearUpdateSchedule()
269 {
270 m_updateFlag = 0;
271 }
272
255 #endregion 273 #endregion
256 274
257 #region Setup 275 #region Setup
276
258 /// <summary> 277 /// <summary>
259 /// 278 ///
260 /// </summary> 279 /// </summary>
@@ -263,21 +282,36 @@ namespace OpenSim.Region.Environment.Scenes
263 /// <param name="localID"></param> 282 /// <param name="localID"></param>
264 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 283 public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
265 { 284 {
266 this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 285 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
267 this.OwnerID = ownerID; 286 OwnerID = ownerID;
268 this.CreatorID = this.OwnerID; 287 CreatorID = OwnerID;
269 this.LastOwnerID = LLUUID.Zero; 288 LastOwnerID = LLUUID.Zero;
270 this.Pos = pos; 289 Pos = pos;
271 this.uuid = LLUUID.Random(); 290 m_uuid = LLUUID.Random();
272 this.m_localId = (uint)(localID); 291 m_localId = (uint)(localID);
292
293 m_Shape = shape;
294
295 ScheduleFullUpdate();
296 }
297
298 private void ScheduleFullUpdate()
299 {
300 m_updateFlag = 2;
301 }
273 302
274 this.m_Shape = shape; 303 private void ScheduleTerseUpdate()
275 this.updateFlag = 1; 304 {
305 if (m_updateFlag < 1)
306 {
307 m_updateFlag = 1;
308 }
276 } 309 }
277 310
278 #endregion 311 #endregion
279 312
280 #region Linking / unlinking 313 #region Linking / unlinking
314
281 /// <summary> 315 /// <summary>
282 /// 316 ///
283 /// </summary> 317 /// </summary>
@@ -286,13 +320,13 @@ namespace OpenSim.Region.Environment.Scenes
286 { 320 {
287 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); 321 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
288 //TODO check permissions 322 //TODO check permissions
289 this.children.Add(linkObject.rootPrimitive); 323 m_children.Add(linkObject.rootPrimitive);
290 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); 324 linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
291 325
292 this.m_world.DeleteEntity(linkObject.rootUUID); 326 m_world.DeleteEntity(linkObject.rootUUID);
293 linkObject.DeleteAllChildren(); 327 linkObject.DeleteAllChildren();
294 328
295 this.OnPrimCountTainted(); 329 OnPrimCountTainted();
296 } 330 }
297 331
298 /// <summary> 332 /// <summary>
@@ -302,59 +336,58 @@ namespace OpenSim.Region.Environment.Scenes
302 /// <param name="rootParent"></param> 336 /// <param name="rootParent"></param>
303 public void SetNewParent(Primitive newParent, SceneObject rootParent) 337 public void SetNewParent(Primitive newParent, SceneObject rootParent)
304 { 338 {
305 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 339 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
306 this.m_isRootPrim = false; 340 m_isRootPrim = false;
307 this.m_Parent = newParent; 341 m_Parent = newParent;
308 this.ParentID = newParent.LocalId; 342 ParentID = newParent.LocalId;
309 this.m_RootParent = rootParent; 343 m_RootParent = rootParent;
310 this.m_RootParent.AddChildToList(this); 344 m_RootParent.AddChildToList(this);
311 this.Pos = oldPos; 345 Pos = oldPos;
312 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 346 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
313 axPos = this.m_Parent.Rotation.Inverse() * axPos; 347 axPos = m_Parent.Rotation.Inverse() * axPos;
314 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 348 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
315 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 349 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
316 this.Rotation = this.m_Parent.Rotation.Inverse() * this.Rotation; 350 Rotation = m_Parent.Rotation.Inverse() * Rotation;
317 this.updateFlag = 1; 351 ScheduleFullUpdate();
318 352
319 foreach (Primitive child in children) 353 foreach (Primitive child in m_children)
320 { 354 {
321 child.SetRootParent(rootParent, newParent, oldPos, oldRot); 355 child.SetRootParent(rootParent, newParent, oldPos, oldRot);
322 } 356 }
323 children.Clear(); 357 m_children.Clear();
324
325
326 } 358 }
327 359
328 /// <summary> 360 /// <summary>
329 /// 361 ///
330 /// </summary> 362 /// </summary>
331 /// <param name="newRoot"></param> 363 /// <param name="newRoot"></param>
332 public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition, Axiom.Math.Quaternion oldParentRotation) 364 public void SetRootParent(SceneObject newRoot, Primitive newParent, LLVector3 oldParentPosition,
365 Quaternion oldParentRotation)
333 { 366 {
334 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 367 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
335 Axiom.Math.Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); 368 Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
336 axOldPos = oldParentRotation * axOldPos; 369 axOldPos = oldParentRotation * axOldPos;
337 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); 370 oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
338 oldPos += oldParentPosition; 371 oldPos += oldParentPosition;
339 Axiom.Math.Quaternion oldRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 372 Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
340 this.m_isRootPrim = false; 373 m_isRootPrim = false;
341 this.m_Parent = newParent; 374 m_Parent = newParent;
342 this.ParentID = newParent.LocalId; 375 ParentID = newParent.LocalId;
343 newParent.AddToChildrenList(this); 376 newParent.AddToChildrenList(this);
344 this.m_RootParent = newRoot; 377 m_RootParent = newRoot;
345 this.m_RootParent.AddChildToList(this); 378 m_RootParent.AddChildToList(this);
346 this.Pos = oldPos; 379 Pos = oldPos;
347 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 380 Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
348 axPos = this.m_Parent.Rotation.Inverse() * axPos; 381 axPos = m_Parent.Rotation.Inverse() * axPos;
349 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 382 m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
350 this.Rotation = oldParentRotation * this.Rotation; 383 Rotation = oldParentRotation * Rotation;
351 this.Rotation = this.m_Parent.Rotation.Inverse()* this.Rotation ; 384 Rotation = m_Parent.Rotation.Inverse() * Rotation;
352 this.updateFlag = 1; 385 ScheduleFullUpdate();
353 foreach (Primitive child in children) 386 foreach (Primitive child in m_children)
354 { 387 {
355 child.SetRootParent(newRoot, newParent, oldPos, oldRot); 388 child.SetRootParent(newRoot, newParent, oldPos, oldRot);
356 } 389 }
357 children.Clear(); 390 m_children.Clear();
358 } 391 }
359 392
360 /// <summary> 393 /// <summary>
@@ -363,12 +396,12 @@ namespace OpenSim.Region.Environment.Scenes
363 /// <param name="offset"></param> 396 /// <param name="offset"></param>
364 public void AddOffsetToChildren(LLVector3 offset) 397 public void AddOffsetToChildren(LLVector3 offset)
365 { 398 {
366 foreach (Primitive prim in this.children) 399 foreach (Primitive prim in m_children)
367 { 400 {
368 prim.m_pos += offset; 401 prim.m_pos += offset;
369 prim.updateFlag = 2; 402 prim.ScheduleTerseUpdate();
370 } 403 }
371 this.OnPrimCountTainted(); 404 OnPrimCountTainted();
372 } 405 }
373 406
374 /// <summary> 407 /// <summary>
@@ -377,38 +410,42 @@ namespace OpenSim.Region.Environment.Scenes
377 /// <param name="prim"></param> 410 /// <param name="prim"></param>
378 public void AddToChildrenList(Primitive prim) 411 public void AddToChildrenList(Primitive prim)
379 { 412 {
380 this.children.Add(prim); 413 m_children.Add(prim);
381 } 414 }
415
382 #endregion 416 #endregion
383 417
384 #region Resizing/Scale 418 #region Resizing/Scale
419
385 /// <summary> 420 /// <summary>
386 /// 421 ///
387 /// </summary> 422 /// </summary>
388 /// <param name="scale"></param> 423 /// <param name="scale"></param>
389 public void ResizeGoup(LLVector3 scale) 424 public void ResizeGoup(LLVector3 scale)
390 { 425 {
391 LLVector3 offset = (scale - this.m_Shape.Scale); 426 LLVector3 offset = (scale - m_Shape.Scale);
392 offset.X /= 2; 427 offset.X /= 2;
393 offset.Y /= 2; 428 offset.Y /= 2;
394 offset.Z /= 2; 429 offset.Z /= 2;
395 if (this.m_isRootPrim) 430 if (m_isRootPrim)
396 { 431 {
397 this.m_Parent.Pos += offset; 432 m_Parent.Pos += offset;
398 } 433 }
399 else 434 else
400 { 435 {
401 this.m_pos += offset; 436 m_pos += offset;
402 } 437 }
403 438
404 this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z)); 439 AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z));
405 this.m_Shape.Scale = scale; 440 m_Shape.Scale = scale;
406 441
407 this.updateFlag = 1; 442 ScheduleFullUpdate();
408 } 443 }
444
409 #endregion 445 #endregion
410 446
411 #region Position 447 #region Position
448
412 /// <summary> 449 /// <summary>
413 /// 450 ///
414 /// </summary> 451 /// </summary>
@@ -417,10 +454,10 @@ namespace OpenSim.Region.Environment.Scenes
417 { 454 {
418 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 455 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
419 456
420 this.Pos = newPos; 457 Pos = newPos;
421 this.updateFlag = 2; 458 ScheduleTerseUpdate();
422 459
423 this.OnPrimCountTainted(); 460 OnPrimCountTainted();
424 } 461 }
425 462
426 /// <summary> 463 /// <summary>
@@ -429,48 +466,46 @@ namespace OpenSim.Region.Environment.Scenes
429 /// <param name="pos"></param> 466 /// <param name="pos"></param>
430 public void UpdateSinglePosition(LLVector3 pos) 467 public void UpdateSinglePosition(LLVector3 pos)
431 { 468 {
432 // Console.WriteLine("updating single prim position"); 469 // Console.WriteLine("updating single prim position");
433 if (this.m_isRootPrim) 470 if (m_isRootPrim)
434 { 471 {
435 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 472 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
436 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); 473 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
437 LLVector3 diff = oldPos - newPos; 474 LLVector3 diff = oldPos - newPos;
438 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); 475 Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
439 axDiff = this.Rotation.Inverse() * axDiff; 476 axDiff = Rotation.Inverse() * axDiff;
440 diff.X = axDiff.x; 477 diff.X = axDiff.x;
441 diff.Y = axDiff.y; 478 diff.Y = axDiff.y;
442 diff.Z = axDiff.z; 479 diff.Z = axDiff.z;
443 this.Pos = newPos; 480 Pos = newPos;
444 481
445 foreach (Primitive prim in this.children) 482 foreach (Primitive prim in m_children)
446 { 483 {
447 prim.m_pos += diff; 484 prim.m_pos += diff;
448 prim.updateFlag = 2; 485 prim.ScheduleTerseUpdate();
449 } 486 }
450 this.updateFlag = 2; 487 ScheduleTerseUpdate();
451 } 488 }
452 else 489 else
453 { 490 {
454 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 491 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
455 this.m_pos = newPos; 492 m_pos = newPos;
456 this.updateFlag = 2; 493 ScheduleTerseUpdate();
457 } 494 }
458
459
460 } 495 }
461 496
462 #endregion 497 #endregion
463 498
464 #region Rotation 499 #region Rotation
500
465 /// <summary> 501 /// <summary>
466 /// 502 ///
467 /// </summary> 503 /// </summary>
468 /// <param name="rot"></param> 504 /// <param name="rot"></param>
469 public void UpdateGroupRotation(LLQuaternion rot) 505 public void UpdateGroupRotation(LLQuaternion rot)
470 { 506 {
471 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 507 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
472 this.updateFlag = 2; 508 ScheduleTerseUpdate();
473
474 } 509 }
475 510
476 /// <summary> 511 /// <summary>
@@ -480,9 +515,9 @@ namespace OpenSim.Region.Environment.Scenes
480 /// <param name="rot"></param> 515 /// <param name="rot"></param>
481 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) 516 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
482 { 517 {
483 this.Rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 518 Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
484 this.Pos = pos; 519 Pos = pos;
485 this.updateFlag = 2; 520 ScheduleTerseUpdate();
486 } 521 }
487 522
488 /// <summary> 523 /// <summary>
@@ -492,62 +527,67 @@ namespace OpenSim.Region.Environment.Scenes
492 public void UpdateSingleRotation(LLQuaternion rot) 527 public void UpdateSingleRotation(LLQuaternion rot)
493 { 528 {
494 //Console.WriteLine("updating single prim rotation"); 529 //Console.WriteLine("updating single prim rotation");
495 Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 530 Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
496 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); 531 Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
497 this.Rotation = axRot; 532 Rotation = axRot;
498 foreach (Primitive prim in this.children) 533 foreach (Primitive prim in m_children)
499 { 534 {
500 Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z); 535 Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
501 axPos = oldParentRot * axPos; 536 axPos = oldParentRot * axPos;
502 axPos = axRot.Inverse() * axPos; 537 axPos = axRot.Inverse() * axPos;
503 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 538 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
504 prim.Rotation = oldParentRot * prim.Rotation ; 539 prim.Rotation = oldParentRot * prim.Rotation;
505 prim.Rotation = axRot.Inverse()* prim.Rotation; 540 prim.Rotation = axRot.Inverse() * prim.Rotation;
506 prim.updateFlag = 2; 541 prim.ScheduleTerseUpdate();
507 } 542 }
508 this.updateFlag = 2; 543 ScheduleTerseUpdate();
509 } 544 }
545
510 #endregion 546 #endregion
511 547
512 #region Shape 548 #region Shape
549
513 /// <summary> 550 /// <summary>
514 /// 551 ///
515 /// </summary> 552 /// </summary>
516 /// <param name="shapeBlock"></param> 553 /// <param name="shapeBlock"></param>
517 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 554 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
518 { 555 {
519 this.m_Shape.PathBegin = shapeBlock.PathBegin; 556 m_Shape.PathBegin = shapeBlock.PathBegin;
520 this.m_Shape.PathEnd = shapeBlock.PathEnd; 557 m_Shape.PathEnd = shapeBlock.PathEnd;
521 this.m_Shape.PathScaleX = shapeBlock.PathScaleX; 558 m_Shape.PathScaleX = shapeBlock.PathScaleX;
522 this.m_Shape.PathScaleY = shapeBlock.PathScaleY; 559 m_Shape.PathScaleY = shapeBlock.PathScaleY;
523 this.m_Shape.PathShearX = shapeBlock.PathShearX; 560 m_Shape.PathShearX = shapeBlock.PathShearX;
524 this.m_Shape.PathShearY = shapeBlock.PathShearY; 561 m_Shape.PathShearY = shapeBlock.PathShearY;
525 this.m_Shape.PathSkew = shapeBlock.PathSkew; 562 m_Shape.PathSkew = shapeBlock.PathSkew;
526 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin; 563 m_Shape.ProfileBegin = shapeBlock.ProfileBegin;
527 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd; 564 m_Shape.ProfileEnd = shapeBlock.ProfileEnd;
528 this.m_Shape.PathCurve = shapeBlock.PathCurve; 565 m_Shape.PathCurve = shapeBlock.PathCurve;
529 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve; 566 m_Shape.ProfileCurve = shapeBlock.ProfileCurve;
530 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow; 567 m_Shape.ProfileHollow = shapeBlock.ProfileHollow;
531 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset; 568 m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
532 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions; 569 m_Shape.PathRevolutions = shapeBlock.PathRevolutions;
533 this.m_Shape.PathTaperX = shapeBlock.PathTaperX; 570 m_Shape.PathTaperX = shapeBlock.PathTaperX;
534 this.m_Shape.PathTaperY = shapeBlock.PathTaperY; 571 m_Shape.PathTaperY = shapeBlock.PathTaperY;
535 this.m_Shape.PathTwist = shapeBlock.PathTwist; 572 m_Shape.PathTwist = shapeBlock.PathTwist;
536 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; 573 m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
537 this.updateFlag = 1; 574 ScheduleFullUpdate();
538 } 575 }
576
539 #endregion 577 #endregion
540 578
541 #region Texture 579 #region Texture
580
542 /// <summary> 581 /// <summary>
543 /// 582 ///
544 /// </summary> 583 /// </summary>
545 /// <param name="textureEntry"></param> 584 /// <param name="textureEntry"></param>
546 public void UpdateTextureEntry(byte[] textureEntry) 585 public void UpdateTextureEntry(byte[] textureEntry)
547 { 586 {
548 this.m_Shape.TextureEntry = textureEntry; 587 m_Shape.TextureEntry = textureEntry;
549 this.updateFlag = 1; 588 ScheduleFullUpdate();
550 } 589 }
590
551 #endregion 591 #endregion
552 592
553 #region Client Update Methods 593 #region Client Update Methods
@@ -558,12 +598,12 @@ namespace OpenSim.Region.Environment.Scenes
558 /// <param name="remoteClient"></param> 598 /// <param name="remoteClient"></param>
559 public void SendFullUpdateForAllChildren(IClientAPI remoteClient) 599 public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
560 { 600 {
561 this.SendFullUpdateToClient(remoteClient); 601 SendFullUpdateToClient(remoteClient);
562 for (int i = 0; i < this.children.Count; i++) 602 for (int i = 0; i < m_children.Count; i++)
563 { 603 {
564 if (this.children[i] is Primitive) 604 if (m_children[i] is Primitive)
565 { 605 {
566 ((Primitive)this.children[i]).SendFullUpdateForAllChildren(remoteClient); 606 ((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
567 } 607 }
568 } 608 }
569 } 609 }
@@ -575,11 +615,12 @@ namespace OpenSim.Region.Environment.Scenes
575 public void SendFullUpdateToClient(IClientAPI remoteClient) 615 public void SendFullUpdateToClient(IClientAPI remoteClient)
576 { 616 {
577 LLVector3 lPos; 617 LLVector3 lPos;
578 lPos = this.Pos; 618 lPos = Pos;
579 LLQuaternion lRot; 619 LLQuaternion lRot;
580 lRot = new LLQuaternion(this.Rotation.x, this.Rotation.y, this.Rotation.z, this.Rotation.w); 620 lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w);
581 621
582 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, this.m_flags, this.uuid, this.OwnerID, this.Text, this.ParentID); 622 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_Shape, lPos, lRot, m_flags, m_uuid,
623 OwnerID, m_text, ParentID);
583 } 624 }
584 625
585 /// <summary> 626 /// <summary>
@@ -587,10 +628,10 @@ namespace OpenSim.Region.Environment.Scenes
587 /// </summary> 628 /// </summary>
588 public void SendFullUpdateToAllClients() 629 public void SendFullUpdateToAllClients()
589 { 630 {
590 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 631 List<ScenePresence> avatars = m_world.RequestAvatarList();
591 for (int i = 0; i < avatars.Count; i++) 632 for (int i = 0; i < avatars.Count; i++)
592 { 633 {
593 this.SendFullUpdateToClient(avatars[i].ControllingClient); 634 SendFullUpdateToClient(avatars[i].ControllingClient);
594 } 635 }
595 } 636 }
596 637
@@ -600,12 +641,12 @@ namespace OpenSim.Region.Environment.Scenes
600 /// <param name="remoteClient"></param> 641 /// <param name="remoteClient"></param>
601 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient) 642 public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
602 { 643 {
603 this.SendTerseUpdateToClient(remoteClient); 644 SendTerseUpdateToClient(remoteClient);
604 for (int i = 0; i < this.children.Count; i++) 645 for (int i = 0; i < m_children.Count; i++)
605 { 646 {
606 if (this.children[i] is Primitive) 647 if (m_children[i] is Primitive)
607 { 648 {
608 ((Primitive)this.children[i]).SendTerseUpdateForAllChildren(remoteClient); 649 ((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient);
609 } 650 }
610 } 651 }
611 } 652 }
@@ -619,11 +660,11 @@ namespace OpenSim.Region.Environment.Scenes
619 LLVector3 lPos; 660 LLVector3 lPos;
620 Quaternion lRot; 661 Quaternion lRot;
621 662
622 lPos = this.Pos; 663 lPos = Pos;
623 lRot = this.Rotation; 664 lRot = Rotation;
624 665
625 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); 666 LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
626 RemoteClient.SendPrimTerseUpdate(this.m_regionHandle, 64096, this.LocalId, lPos, mRot); 667 RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot);
627 } 668 }
628 669
629 /// <summary> 670 /// <summary>
@@ -631,10 +672,10 @@ namespace OpenSim.Region.Environment.Scenes
631 /// </summary> 672 /// </summary>
632 public void SendTerseUpdateToALLClients() 673 public void SendTerseUpdateToALLClients()
633 { 674 {
634 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 675 List<ScenePresence> avatars = m_world.RequestAvatarList();
635 for (int i = 0; i < avatars.Count; i++) 676 for (int i = 0; i < avatars.Count; i++)
636 { 677 {
637 this.SendTerseUpdateToClient(avatars[i].ControllingClient); 678 SendTerseUpdateToClient(avatars[i].ControllingClient);
638 } 679 }
639 } 680 }
640 681
@@ -642,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
642 683
643 public void TriggerOnPrimCountTainted() 684 public void TriggerOnPrimCountTainted()
644 { 685 {
645 this.OnPrimCountTainted(); 686 OnPrimCountTainted();
646 } 687 }
647 } 688 }
648} 689} \ No newline at end of file