diff options
author | lbsa71 | 2007-12-04 13:46:18 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-04 13:46:18 +0000 |
commit | bf8239c7faaf98ef51edfc8d770b3b76c4630852 (patch) | |
tree | 1f24e0b50f1545d6280db2d33532c08926579f10 | |
parent | * took a stab at #54 (diff) | |
download | opensim-SC-bf8239c7faaf98ef51edfc8d770b3b76c4630852.zip opensim-SC-bf8239c7faaf98ef51edfc8d770b3b76c4630852.tar.gz opensim-SC-bf8239c7faaf98ef51edfc8d770b3b76c4630852.tar.bz2 opensim-SC-bf8239c7faaf98ef51edfc8d770b3b76c4630852.tar.xz |
* ApplyPhysics now creates the PhysActor as well.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 185 |
2 files changed, 104 insertions, 83 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index c47a0fa..ce75e3a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1681,7 +1681,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1681 | { | 1681 | { |
1682 | foreach(SceneObjectPart part in m_parts.Values ) | 1682 | foreach(SceneObjectPart part in m_parts.Values ) |
1683 | { | 1683 | { |
1684 | part.ApplyPhysics(); | 1684 | part.ApplyPhysics(); |
1685 | } | 1685 | } |
1686 | } | 1686 | } |
1687 | } | 1687 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 543a468..5c1b9da 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -48,7 +48,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
48 | private string m_inventoryFileName = ""; | 48 | private string m_inventoryFileName = ""; |
49 | private LLUUID m_folderID = LLUUID.Zero; | 49 | private LLUUID m_folderID = LLUUID.Zero; |
50 | 50 | ||
51 | [XmlIgnore] public PhysicsActor PhysActor = null; | 51 | [XmlIgnore] |
52 | public PhysicsActor PhysActor = null; | ||
52 | 53 | ||
53 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); | 54 | protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); |
54 | public LLUUID LastOwnerID; | 55 | public LLUUID LastOwnerID; |
@@ -70,9 +71,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
70 | 71 | ||
71 | protected byte[] m_particleSystem = new byte[0]; | 72 | protected byte[] m_particleSystem = new byte[0]; |
72 | 73 | ||
73 | [XmlIgnore] public uint TimeStampFull = 0; | 74 | [XmlIgnore] |
74 | [XmlIgnore] public uint TimeStampTerse = 0; | 75 | public uint TimeStampFull = 0; |
75 | [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn | 76 | [XmlIgnore] |
77 | public uint TimeStampTerse = 0; | ||
78 | [XmlIgnore] | ||
79 | public uint TimeStampLastActivity = 0; // Will be used for AutoReturn | ||
76 | 80 | ||
77 | 81 | ||
78 | /// <summary> | 82 | /// <summary> |
@@ -128,16 +132,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
128 | 132 | ||
129 | public uint ObjectFlags | 133 | public uint ObjectFlags |
130 | { | 134 | { |
131 | get { return (uint) m_flags;} | 135 | get { return (uint)m_flags; } |
132 | set {m_flags = (LLObject.ObjectFlags) value;} | 136 | set { m_flags = (LLObject.ObjectFlags)value; } |
133 | } | 137 | } |
134 | 138 | ||
135 | protected LLObject.MaterialType m_material = 0; | 139 | protected LLObject.MaterialType m_material = 0; |
136 | 140 | ||
137 | public byte Material | 141 | public byte Material |
138 | { | 142 | { |
139 | get { return (byte) m_material; } | 143 | get { return (byte)m_material; } |
140 | set { m_material = (LLObject.MaterialType) value; } | 144 | set { m_material = (LLObject.MaterialType)value; } |
141 | } | 145 | } |
142 | 146 | ||
143 | protected ulong m_regionHandle; | 147 | protected ulong m_regionHandle; |
@@ -153,7 +157,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
153 | 157 | ||
154 | public LLVector3 GroupPosition | 158 | public LLVector3 GroupPosition |
155 | { | 159 | { |
156 | get | 160 | get |
157 | { | 161 | { |
158 | if (PhysActor != null) | 162 | if (PhysActor != null) |
159 | { | 163 | { |
@@ -161,9 +165,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
161 | m_groupPosition.Y = PhysActor.Position.Y; | 165 | m_groupPosition.Y = PhysActor.Position.Y; |
162 | m_groupPosition.Z = PhysActor.Position.Z; | 166 | m_groupPosition.Z = PhysActor.Position.Z; |
163 | } | 167 | } |
164 | return m_groupPosition; | 168 | return m_groupPosition; |
165 | } | 169 | } |
166 | set | 170 | set |
167 | { | 171 | { |
168 | if (PhysActor != null) | 172 | if (PhysActor != null) |
169 | { | 173 | { |
@@ -180,7 +184,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | Console.WriteLine(e.Message); | 184 | Console.WriteLine(e.Message); |
181 | } | 185 | } |
182 | } | 186 | } |
183 | m_groupPosition = value; | 187 | m_groupPosition = value; |
184 | } | 188 | } |
185 | } | 189 | } |
186 | 190 | ||
@@ -201,11 +205,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
201 | 205 | ||
202 | public LLQuaternion RotationOffset | 206 | public LLQuaternion RotationOffset |
203 | { | 207 | { |
204 | get | 208 | get |
205 | { | 209 | { |
206 | if (PhysActor != null) | 210 | if (PhysActor != null) |
207 | { | 211 | { |
208 | if(PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 | 212 | if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 |
209 | || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) | 213 | || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) |
210 | { | 214 | { |
211 | m_rotationOffset.X = PhysActor.Orientation.x; | 215 | m_rotationOffset.X = PhysActor.Orientation.x; |
@@ -214,9 +218,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
214 | m_rotationOffset.W = PhysActor.Orientation.w; | 218 | m_rotationOffset.W = PhysActor.Orientation.w; |
215 | } | 219 | } |
216 | } | 220 | } |
217 | return m_rotationOffset; | 221 | return m_rotationOffset; |
218 | } | 222 | } |
219 | set | 223 | set |
220 | { | 224 | { |
221 | if (PhysActor != null) | 225 | if (PhysActor != null) |
222 | { | 226 | { |
@@ -233,7 +237,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
233 | Console.WriteLine(ex.Message); | 237 | Console.WriteLine(ex.Message); |
234 | } | 238 | } |
235 | } | 239 | } |
236 | m_rotationOffset = value; | 240 | m_rotationOffset = value; |
237 | } | 241 | } |
238 | } | 242 | } |
239 | 243 | ||
@@ -243,7 +247,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
243 | /// <summary></summary> | 247 | /// <summary></summary> |
244 | public LLVector3 Velocity | 248 | public LLVector3 Velocity |
245 | { | 249 | { |
246 | get { | 250 | get |
251 | { | ||
247 | //if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0 | 252 | //if (PhysActor.Velocity.x != 0 || PhysActor.Velocity.y != 0 |
248 | //|| PhysActor.Velocity.z != 0) | 253 | //|| PhysActor.Velocity.z != 0) |
249 | //{ | 254 | //{ |
@@ -256,8 +261,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
256 | m_velocity.Z = PhysActor.Velocity.Z; | 261 | m_velocity.Z = PhysActor.Velocity.Z; |
257 | } | 262 | } |
258 | } | 263 | } |
259 | 264 | ||
260 | return m_velocity; | 265 | return m_velocity; |
261 | } | 266 | } |
262 | set { m_velocity = value; } | 267 | set { m_velocity = value; } |
263 | } | 268 | } |
@@ -312,10 +317,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
312 | 317 | ||
313 | private Color m_color = Color.Black; | 318 | private Color m_color = Color.Black; |
314 | 319 | ||
315 | public Color Color | 320 | public Color Color |
316 | { | 321 | { |
317 | get { return m_color; } | 322 | get { return m_color; } |
318 | set | 323 | set |
319 | { | 324 | { |
320 | m_color = value; | 325 | m_color = value; |
321 | /* ScheduleFullUpdate() need not be called b/c after | 326 | /* ScheduleFullUpdate() need not be called b/c after |
@@ -430,13 +435,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
430 | m_name = "Primitive"; | 435 | m_name = "Primitive"; |
431 | m_regionHandle = regionHandle; | 436 | m_regionHandle = regionHandle; |
432 | m_parentGroup = parent; | 437 | m_parentGroup = parent; |
433 | 438 | ||
434 | CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 439 | CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; |
435 | OwnerID = ownerID; | 440 | OwnerID = ownerID; |
436 | CreatorID = OwnerID; | 441 | CreatorID = OwnerID; |
437 | LastOwnerID = LLUUID.Zero; | 442 | LastOwnerID = LLUUID.Zero; |
438 | UUID = LLUUID.Random(); | 443 | UUID = LLUUID.Random(); |
439 | LocalID = (uint) (localID); | 444 | LocalID = (uint)(localID); |
440 | Shape = shape; | 445 | Shape = shape; |
441 | // Todo: Add More Object Parameter from above! | 446 | // Todo: Add More Object Parameter from above! |
442 | OwnershipCost = 0; | 447 | OwnershipCost = 0; |
@@ -495,7 +500,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
495 | CreatorID = creatorID; | 500 | CreatorID = creatorID; |
496 | LastOwnerID = lastOwnerID; | 501 | LastOwnerID = lastOwnerID; |
497 | UUID = LLUUID.Random(); | 502 | UUID = LLUUID.Random(); |
498 | LocalID = (uint) (localID); | 503 | LocalID = (uint)(localID); |
499 | Shape = shape; | 504 | Shape = shape; |
500 | OwnershipCost = 0; | 505 | OwnershipCost = 0; |
501 | ObjectSaleType = (byte)0; | 506 | ObjectSaleType = (byte)0; |
@@ -521,15 +526,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
521 | /// <returns></returns> | 526 | /// <returns></returns> |
522 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 527 | public static SceneObjectPart FromXml(XmlReader xmlReader) |
523 | { | 528 | { |
524 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 529 | XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); |
525 | SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); | 530 | SceneObjectPart newobject = (SceneObjectPart)serializer.Deserialize(xmlReader); |
526 | return newobject; | 531 | return newobject; |
527 | } | 532 | } |
528 | 533 | ||
529 | public void ApplyPhysics() | 534 | public void ApplyPhysics() |
530 | { | 535 | { |
531 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 536 | bool isPhysical = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
532 | DoPhysicsPropertyUpdate(UsePhysics, true); | 537 | bool isPhantom = ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0); |
538 | |||
539 | bool usePhysics = isPhysical && !isPhantom; | ||
540 | |||
541 | if (usePhysics) | ||
542 | { | ||
543 | PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( | ||
544 | Name, | ||
545 | Shape, | ||
546 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | ||
547 | AbsolutePosition.Z), | ||
548 | new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | ||
549 | new Quaternion(RotationOffset.W, RotationOffset.X, | ||
550 | RotationOffset.Y, RotationOffset.Z), usePhysics); | ||
551 | } | ||
552 | |||
553 | DoPhysicsPropertyUpdate(usePhysics, true); | ||
533 | } | 554 | } |
534 | 555 | ||
535 | public void ApplyPermissions() | 556 | public void ApplyPermissions() |
@@ -557,7 +578,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
557 | /// <param name="xmlWriter"></param> | 578 | /// <param name="xmlWriter"></param> |
558 | public void ToXml(XmlWriter xmlWriter) | 579 | public void ToXml(XmlWriter xmlWriter) |
559 | { | 580 | { |
560 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 581 | XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); |
561 | serializer.Serialize(xmlWriter, this); | 582 | serializer.Serialize(xmlWriter, this); |
562 | } | 583 | } |
563 | 584 | ||
@@ -566,7 +587,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
566 | 587 | ||
567 | // In this case we're using a sphere with a radius of the largest dimention of the prim | 588 | // In this case we're using a sphere with a radius of the largest dimention of the prim |
568 | // TODO: Change to take shape into account | 589 | // TODO: Change to take shape into account |
569 | 590 | ||
570 | 591 | ||
571 | EntityIntersection returnresult = new EntityIntersection(); | 592 | EntityIntersection returnresult = new EntityIntersection(); |
572 | Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 593 | Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
@@ -578,12 +599,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
578 | Quaternion worldRotation = (qRotation * parentrot); | 599 | Quaternion worldRotation = (qRotation * parentrot); |
579 | Matrix3 worldRotM = worldRotation.ToRotationMatrix(); | 600 | Matrix3 worldRotM = worldRotation.ToRotationMatrix(); |
580 | 601 | ||
581 | 602 | ||
582 | 603 | ||
583 | Vector3 rOrigin = iray.Origin; | 604 | Vector3 rOrigin = iray.Origin; |
584 | Vector3 rDirection = iray.Direction; | 605 | Vector3 rDirection = iray.Direction; |
585 | 606 | ||
586 | 607 | ||
587 | // Buidling the first part of the Quadratic equation | 608 | // Buidling the first part of the Quadratic equation |
588 | Vector3 r2ndDirection = rDirection * rDirection; | 609 | Vector3 r2ndDirection = rDirection * rDirection; |
589 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; | 610 | float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; |
@@ -604,7 +625,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
604 | 625 | ||
605 | // Set Radius to the largest dimention of the prim | 626 | // Set Radius to the largest dimention of the prim |
606 | float radius = 0f; | 627 | float radius = 0f; |
607 | if (vScale.x > radius) | 628 | if (vScale.x > radius) |
608 | radius = vScale.x; | 629 | radius = vScale.x; |
609 | if (vScale.y > radius) | 630 | if (vScale.y > radius) |
610 | radius = vScale.y; | 631 | radius = vScale.y; |
@@ -613,8 +634,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
613 | 634 | ||
614 | //radius = radius; | 635 | //radius = radius; |
615 | 636 | ||
616 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z -(2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); | 637 | float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - (2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); |
617 | 638 | ||
618 | // Yuk Quadradrics.. Solve first | 639 | // Yuk Quadradrics.. Solve first |
619 | float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); | 640 | float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); |
620 | if (rootsqr < 0.0f) | 641 | if (rootsqr < 0.0f) |
@@ -639,19 +660,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
639 | 660 | ||
640 | // We got an intersection. putting together an EntityIntersection object with the | 661 | // We got an intersection. putting together an EntityIntersection object with the |
641 | // intersection information | 662 | // intersection information |
642 | Vector3 ipoint = new Vector3(iray.Origin.x + (iray.Direction.x * root),iray.Origin.y + (iray.Direction.y * root),iray.Origin.z + (iray.Direction.z * root)); | 663 | Vector3 ipoint = new Vector3(iray.Origin.x + (iray.Direction.x * root), iray.Origin.y + (iray.Direction.y * root), iray.Origin.z + (iray.Direction.z * root)); |
643 | 664 | ||
644 | returnresult.HitTF = true; | 665 | returnresult.HitTF = true; |
645 | returnresult.ipoint = ipoint; | 666 | returnresult.ipoint = ipoint; |
646 | 667 | ||
647 | // Normal is calculated by the difference and then normalizing the result | 668 | // Normal is calculated by the difference and then normalizing the result |
648 | Vector3 normalpart = ipoint-vAbsolutePosition; | 669 | Vector3 normalpart = ipoint - vAbsolutePosition; |
649 | returnresult.normal = normalpart.Normalize(); | 670 | returnresult.normal = normalpart.Normalize(); |
650 | 671 | ||
651 | // It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesnt. | 672 | // It's funny how the LLVector3 object has a Distance function, but the Axiom.Math object doesnt. |
652 | // I can write a function to do it.. but I like the fact that this one is Static. | 673 | // I can write a function to do it.. but I like the fact that this one is Static. |
653 | 674 | ||
654 | LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x,iray.Origin.y,iray.Origin.z); | 675 | LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z); |
655 | LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z); | 676 | LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z); |
656 | float distance = (float)distanceConvert1.GetDistanceTo(distanceConvert2); | 677 | float distance = (float)distanceConvert1.GetDistanceTo(distanceConvert2); |
657 | 678 | ||
@@ -687,7 +708,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
687 | /// <returns></returns> | 708 | /// <returns></returns> |
688 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID) | 709 | public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID) |
689 | { | 710 | { |
690 | SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone(); | 711 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); |
691 | dupe.m_shape = m_shape.Copy(); | 712 | dupe.m_shape = m_shape.Copy(); |
692 | dupe.m_regionHandle = m_regionHandle; | 713 | dupe.m_regionHandle = m_regionHandle; |
693 | dupe.UUID = LLUUID.Random(); | 714 | dupe.UUID = LLUUID.Random(); |
@@ -710,7 +731,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
710 | 731 | ||
711 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 732 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
712 | dupe.LastOwnerID = ObjectOwner; | 733 | dupe.LastOwnerID = ObjectOwner; |
713 | 734 | ||
714 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 735 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
715 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 736 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
716 | dupe.Shape.ExtraParams = extraP; | 737 | dupe.Shape.ExtraParams = extraP; |
@@ -741,7 +762,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
741 | { | 762 | { |
742 | m_parentGroup.HasChanged = true; | 763 | m_parentGroup.HasChanged = true; |
743 | } | 764 | } |
744 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); | 765 | TimeStampFull = (uint)Util.UnixTimeSinceEpoch(); |
745 | m_updateFlag = 2; | 766 | m_updateFlag = 2; |
746 | } | 767 | } |
747 | 768 | ||
@@ -749,7 +770,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
749 | { | 770 | { |
750 | LLObject.ObjectFlags prevflag = m_flags; | 771 | LLObject.ObjectFlags prevflag = m_flags; |
751 | //uint objflags = m_flags; | 772 | //uint objflags = m_flags; |
752 | if ((ObjectFlags & (uint) flag) == 0) | 773 | if ((ObjectFlags & (uint)flag) == 0) |
753 | { | 774 | { |
754 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); | 775 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); |
755 | m_flags |= flag; | 776 | m_flags |= flag; |
@@ -757,7 +778,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
757 | GroupMask |= (uint)flag; | 778 | GroupMask |= (uint)flag; |
758 | EveryoneMask |= (uint)flag; | 779 | EveryoneMask |= (uint)flag; |
759 | } | 780 | } |
760 | uint currflag = (uint) m_flags; | 781 | uint currflag = (uint)m_flags; |
761 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); | 782 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); |
762 | //ScheduleFullUpdate(); | 783 | //ScheduleFullUpdate(); |
763 | } | 784 | } |
@@ -765,7 +786,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
765 | public void RemFlag(LLObject.ObjectFlags flag) | 786 | public void RemFlag(LLObject.ObjectFlags flag) |
766 | { | 787 | { |
767 | LLObject.ObjectFlags prevflag = m_flags; | 788 | LLObject.ObjectFlags prevflag = m_flags; |
768 | if ((ObjectFlags & (uint) flag) != 0) | 789 | if ((ObjectFlags & (uint)flag) != 0) |
769 | { | 790 | { |
770 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); | 791 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); |
771 | m_flags &= ~flag; | 792 | m_flags &= ~flag; |
@@ -788,7 +809,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
788 | { | 809 | { |
789 | m_parentGroup.HasChanged = true; | 810 | m_parentGroup.HasChanged = true; |
790 | } | 811 | } |
791 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); | 812 | TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); |
792 | m_updateFlag = 1; | 813 | m_updateFlag = 1; |
793 | } | 814 | } |
794 | } | 815 | } |
@@ -807,8 +828,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
807 | // bad, so it's been replaced by an event driven method. | 828 | // bad, so it's been replaced by an event driven method. |
808 | //if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) | 829 | //if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) |
809 | //{ | 830 | //{ |
810 | // Only send the constant terse updates on physical objects! | 831 | // Only send the constant terse updates on physical objects! |
811 | //ScheduleTerseUpdate(); | 832 | //ScheduleTerseUpdate(); |
812 | //} | 833 | //} |
813 | } | 834 | } |
814 | else | 835 | else |
@@ -898,7 +919,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
898 | { | 919 | { |
899 | if (m_inventorySerial > 0) | 920 | if (m_inventorySerial > 0) |
900 | { | 921 | { |
901 | client.SendTaskInventory(m_uuid, (short) m_inventorySerial, | 922 | client.SendTaskInventory(m_uuid, (short)m_inventorySerial, |
902 | Helpers.StringToField(m_inventoryFileName)); | 923 | Helpers.StringToField(m_inventoryFileName)); |
903 | return true; | 924 | return true; |
904 | } | 925 | } |
@@ -981,12 +1002,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
981 | //Silently ignore it - TODO: FIXME Quick | 1002 | //Silently ignore it - TODO: FIXME Quick |
982 | } | 1003 | } |
983 | 1004 | ||
984 | if (usePhysics ) | 1005 | if (usePhysics) |
985 | { | 1006 | { |
986 | AddFlag(LLObject.ObjectFlags.Physics); | 1007 | AddFlag(LLObject.ObjectFlags.Physics); |
987 | if (!wasUsingPhysics) | 1008 | if (!wasUsingPhysics) |
988 | { | 1009 | { |
989 | DoPhysicsPropertyUpdate(usePhysics,false); | 1010 | DoPhysicsPropertyUpdate(usePhysics, false); |
990 | } | 1011 | } |
991 | 1012 | ||
992 | } | 1013 | } |
@@ -998,10 +1019,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
998 | DoPhysicsPropertyUpdate(usePhysics, false); | 1019 | DoPhysicsPropertyUpdate(usePhysics, false); |
999 | } | 1020 | } |
1000 | } | 1021 | } |
1001 | |||
1002 | 1022 | ||
1003 | 1023 | ||
1004 | 1024 | ||
1025 | |||
1005 | 1026 | ||
1006 | if (IsPhantom) | 1027 | if (IsPhantom) |
1007 | { | 1028 | { |
@@ -1009,7 +1030,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1009 | if (PhysActor != null) | 1030 | if (PhysActor != null) |
1010 | { | 1031 | { |
1011 | m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); | 1032 | m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); |
1012 | /// that's not wholesome. Had to make m_scene public | 1033 | /// that's not wholesome. Had to make m_scene public |
1013 | PhysActor = null; | 1034 | PhysActor = null; |
1014 | } | 1035 | } |
1015 | } | 1036 | } |
@@ -1031,7 +1052,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1031 | else | 1052 | else |
1032 | { | 1053 | { |
1033 | PhysActor.IsPhysical = usePhysics; | 1054 | PhysActor.IsPhysical = usePhysics; |
1034 | DoPhysicsPropertyUpdate(usePhysics,false); | 1055 | DoPhysicsPropertyUpdate(usePhysics, false); |
1035 | } | 1056 | } |
1036 | } | 1057 | } |
1037 | 1058 | ||
@@ -1043,17 +1064,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1043 | { | 1064 | { |
1044 | RemFlag(LLObject.ObjectFlags.TemporaryOnRez); | 1065 | RemFlag(LLObject.ObjectFlags.TemporaryOnRez); |
1045 | } | 1066 | } |
1046 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 1067 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
1047 | ScheduleFullUpdate(); | 1068 | ScheduleFullUpdate(); |
1048 | } | 1069 | } |
1049 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 1070 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
1050 | { | 1071 | { |
1051 | 1072 | ||
1052 | if (PhysActor != null) | 1073 | if (PhysActor != null) |
1053 | { | 1074 | { |
1054 | if (UsePhysics != PhysActor.IsPhysical || isNew) | 1075 | if (UsePhysics != PhysActor.IsPhysical || isNew) |
1055 | { | 1076 | { |
1056 | 1077 | ||
1057 | if (PhysActor.IsPhysical) | 1078 | if (PhysActor.IsPhysical) |
1058 | { | 1079 | { |
1059 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | 1080 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; |
@@ -1065,7 +1086,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1065 | //m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); | 1086 | //m_parentGroup.m_scene.PhysicsScene.RemovePrim(PhysActor); |
1066 | /// that's not wholesome. Had to make m_scene public | 1087 | /// that's not wholesome. Had to make m_scene public |
1067 | //PhysActor = null; | 1088 | //PhysActor = null; |
1068 | 1089 | ||
1069 | 1090 | ||
1070 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 1091 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) |
1071 | { | 1092 | { |
@@ -1073,10 +1094,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1073 | //Name, | 1094 | //Name, |
1074 | //Shape, | 1095 | //Shape, |
1075 | //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 1096 | //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
1076 | //AbsolutePosition.Z), | 1097 | //AbsolutePosition.Z), |
1077 | //new PhysicsVector(Scale.X, Scale.Y, Scale.Z), | 1098 | //new PhysicsVector(Scale.X, Scale.Y, Scale.Z), |
1078 | //new Quaternion(RotationOffset.W, RotationOffset.X, | 1099 | //new Quaternion(RotationOffset.W, RotationOffset.X, |
1079 | //RotationOffset.Y, RotationOffset.Z), UsePhysics); | 1100 | //RotationOffset.Y, RotationOffset.Z), UsePhysics); |
1080 | if (UsePhysics) | 1101 | if (UsePhysics) |
1081 | { | 1102 | { |
1082 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 1103 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; |
@@ -1092,15 +1113,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1092 | { | 1113 | { |
1093 | m_shape.ExtraParams = new byte[data.Length + 7]; | 1114 | m_shape.ExtraParams = new byte[data.Length + 7]; |
1094 | int i = 0; | 1115 | int i = 0; |
1095 | uint length = (uint) data.Length; | 1116 | uint length = (uint)data.Length; |
1096 | m_shape.ExtraParams[i++] = 1; | 1117 | m_shape.ExtraParams[i++] = 1; |
1097 | m_shape.ExtraParams[i++] = (byte) (type%256); | 1118 | m_shape.ExtraParams[i++] = (byte)(type % 256); |
1098 | m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256); | 1119 | m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); |
1099 | 1120 | ||
1100 | m_shape.ExtraParams[i++] = (byte) (length%256); | 1121 | m_shape.ExtraParams[i++] = (byte)(length % 256); |
1101 | m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256); | 1122 | m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); |
1102 | m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256); | 1123 | m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); |
1103 | m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256); | 1124 | m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); |
1104 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); | 1125 | Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); |
1105 | 1126 | ||
1106 | ScheduleFullUpdate(); | 1127 | ScheduleFullUpdate(); |
@@ -1234,7 +1255,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1234 | { | 1255 | { |
1235 | LLQuaternion lRot; | 1256 | LLQuaternion lRot; |
1236 | lRot = RotationOffset; | 1257 | lRot = RotationOffset; |
1237 | uint clientFlags = ObjectFlags & ~(uint) LLObject.ObjectFlags.CreateSelected; | 1258 | uint clientFlags = ObjectFlags & ~(uint)LLObject.ObjectFlags.CreateSelected; |
1238 | 1259 | ||
1239 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | 1260 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
1240 | foreach (ScenePresence s in avatars) | 1261 | foreach (ScenePresence s in avatars) |
@@ -1250,7 +1271,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1250 | } | 1271 | } |
1251 | } | 1272 | } |
1252 | // If you can't edit it, send the base permissions minus the flag to edit | 1273 | // If you can't edit it, send the base permissions minus the flag to edit |
1253 | 1274 | ||
1254 | 1275 | ||
1255 | // We're going to be moving this into ScenePresence and the PermissionsManager itself. | 1276 | // We're going to be moving this into ScenePresence and the PermissionsManager itself. |
1256 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | 1277 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) |
@@ -1267,20 +1288,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1267 | clientFlags = ObjectFlags; | 1288 | clientFlags = ObjectFlags; |
1268 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) | 1289 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1269 | { | 1290 | { |
1270 | clientFlags = (clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectCopy); | 1291 | clientFlags = (clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy); |
1271 | } | 1292 | } |
1272 | 1293 | ||
1273 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) | 1294 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1274 | { | 1295 | { |
1275 | clientFlags = clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectMove; | 1296 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; |
1276 | } | 1297 | } |
1277 | clientFlags = EveryoneMask; | 1298 | clientFlags = EveryoneMask; |
1278 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; | 1299 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; |
1279 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; | 1300 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; |
1280 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | 1301 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; |
1281 | 1302 | ||
1282 | 1303 | ||
1283 | 1304 | ||
1284 | } | 1305 | } |
1285 | } | 1306 | } |
1286 | 1307 | ||
@@ -1374,10 +1395,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1374 | { | 1395 | { |
1375 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); | 1396 | OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); |
1376 | RemFlag(LLObject.ObjectFlags.Physics); | 1397 | RemFlag(LLObject.ObjectFlags.Physics); |
1377 | DoPhysicsPropertyUpdate(false,true); | 1398 | DoPhysicsPropertyUpdate(false, true); |
1378 | m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1399 | m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
1379 | 1400 | ||
1380 | 1401 | ||
1381 | } | 1402 | } |
1382 | 1403 | ||
1383 | 1404 | ||
@@ -1387,7 +1408,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1387 | 1408 | ||
1388 | public void SetText(string text, Vector3 color, double alpha) | 1409 | public void SetText(string text, Vector3 color, double alpha) |
1389 | { | 1410 | { |
1390 | Color = Color.FromArgb (0xff - (int)(alpha * 0xff), | 1411 | Color = Color.FromArgb(0xff - (int)(alpha * 0xff), |
1391 | (int)(color.x * 0xff), | 1412 | (int)(color.x * 0xff), |
1392 | (int)(color.y * 0xff), | 1413 | (int)(color.y * 0xff), |
1393 | (int)(color.z * 0xff)); | 1414 | (int)(color.z * 0xff)); |