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