aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-10-20 16:55:18 +0100
committerUbitUmarov2015-10-20 16:55:18 +0100
commit52860a7d154a17c5035702d9a390b219e1aaba03 (patch)
tree4104059a81608e20e6b409301af65e2e01fb3567
parent STATUS_ROTATE are linkset flags and not prim (diff)
downloadopensim-SC_OLD-52860a7d154a17c5035702d9a390b219e1aaba03.zip
opensim-SC_OLD-52860a7d154a17c5035702d9a390b219e1aaba03.tar.gz
opensim-SC_OLD-52860a7d154a17c5035702d9a390b219e1aaba03.tar.bz2
opensim-SC_OLD-52860a7d154a17c5035702d9a390b219e1aaba03.tar.xz
stop using a Vector3 to store 3bits
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs30
2 files changed, 57 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 48fce3d..329ea11 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -110,6 +110,9 @@ namespace OpenSim.Region.Framework.Scenes
110 STATUS_ROTATE_X = 0x002, 110 STATUS_ROTATE_X = 0x002,
111 STATUS_ROTATE_Y = 0x004, 111 STATUS_ROTATE_Y = 0x004,
112 STATUS_ROTATE_Z = 0x008, 112 STATUS_ROTATE_Z = 0x008,
113 NOT_STATUS_ROTATE_X = 0xFD,
114 NOT_STATUS_ROTATE_Y = 0xFB,
115 NOT_STATUS_ROTATE_Z = 0xF7
113 } 116 }
114 117
115 // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm 118 // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
@@ -4367,30 +4370,52 @@ namespace OpenSim.Region.Framework.Scenes
4367 bool setY = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0); 4370 bool setY = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0);
4368 bool setZ = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0); 4371 bool setZ = ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0);
4369 4372
4370 float setval = (rotate10 > 0) ? 1f : 0f; 4373 if (setX || setY || setZ)
4374 {
4375 bool lockaxis = (rotate10 == 0); // zero means axis locked
4376
4377 byte locks = RootPart.RotationAxisLocks;
4371 4378
4372 if (setX) 4379 if (setX)
4373 RootPart.RotationAxis.X = setval; 4380 {
4374 if (setY) 4381 if(lockaxis)
4375 RootPart.RotationAxis.Y = setval; 4382 locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X;
4376 if (setZ) 4383 else
4377 RootPart.RotationAxis.Z = setval; 4384 locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_X;
4385 }
4386
4387 if (setY)
4388 {
4389 if(lockaxis)
4390 locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y;
4391 else
4392 locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Y;
4393 }
4378 4394
4379 if (setX || setY || setZ) 4395 if (setZ)
4396 {
4397 if(lockaxis)
4398 locks |= (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z;
4399 else
4400 locks &= (byte)SceneObjectGroup.axisSelect.NOT_STATUS_ROTATE_Z;
4401 }
4402
4403 RootPart.RotationAxisLocks = locks;
4380 RootPart.SetPhysicsAxisRotation(); 4404 RootPart.SetPhysicsAxisRotation();
4405 }
4381 } 4406 }
4382 4407
4383 public int GetAxisRotation(int axis) 4408 public int GetAxisRotation(int axis)
4384 { 4409 {
4385 Vector3 rotAxis = RootPart.RotationAxis; 4410 byte rotAxislocks = RootPart.RotationAxisLocks;
4386 4411
4387 // if multiple return the one with higher id 4412 // if multiple return the one with higher id
4388 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) 4413 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
4389 return (int)rotAxis.Z; 4414 return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) == 0 ? 1:0;
4390 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) 4415 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
4391 return (int)rotAxis.Y; 4416 return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) == 0 ? 1:0;
4392 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) 4417 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
4393 return (int)rotAxis.X; 4418 return (rotAxislocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) == 0 ? 1:0;
4394 4419
4395 return 0; 4420 return 0;
4396 } 4421 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0ea4ab8..6e7b568 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -254,11 +254,13 @@ namespace OpenSim.Region.Framework.Scenes
254 public Quaternion AttachRotation = Quaternion.Identity; 254 public Quaternion AttachRotation = Quaternion.Identity;
255 255
256 [XmlIgnore] 256 [XmlIgnore]
257 public int STATUS_ROTATE_X; 257 public int STATUS_ROTATE_X; // this should not be used
258 258
259 public int STATUS_ROTATE_Y; 259 [XmlIgnore]
260 public int STATUS_ROTATE_Y; // this should not be used
260 261
261 public int STATUS_ROTATE_Z; 262 [XmlIgnore]
263 public int STATUS_ROTATE_Z; // this should not be used
262 264
263 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); 265 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
264 266
@@ -278,7 +280,10 @@ namespace OpenSim.Region.Framework.Scenes
278 280
279 public Vector3 AttachedPos; 281 public Vector3 AttachedPos;
280 282
281 public Vector3 RotationAxis = Vector3.One; 283 // rotation locks on local X,Y and or Z axis bit flags
284 // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
285 // but reversed logic: bit cleared means free to rotate
286 public byte RotationAxisLocks = 0;
282 287
283 public bool VolumeDetectActive; 288 public bool VolumeDetectActive;
284 289
@@ -778,9 +783,6 @@ namespace OpenSim.Region.Framework.Scenes
778 set { m_damage = value; } 783 set { m_damage = value; }
779 } 784 }
780 785
781
782
783
784 public void setGroupPosition(Vector3 pos) 786 public void setGroupPosition(Vector3 pos)
785 { 787 {
786 m_groupPosition = pos; 788 m_groupPosition = pos;
@@ -791,7 +793,6 @@ namespace OpenSim.Region.Framework.Scenes
791 /// </summary> 793 /// </summary>
792 /// 794 ///
793 795
794
795 public Vector3 GroupPosition 796 public Vector3 GroupPosition
796 { 797 {
797 get 798 get
@@ -3860,7 +3861,16 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
3860 3861
3861 if (pa != null) 3862 if (pa != null)
3862 { 3863 {
3863 pa.LockAngularMotion(RotationAxis); 3864 // physics should also get a byte and not a Vector3 TODO
3865 Vector3 lrRotationAxis = Vector3.One;
3866 if((RotationAxisLocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0 )
3867 lrRotationAxis.X = 0f;
3868 if((RotationAxisLocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0 )
3869 lrRotationAxis.Y = 0f;
3870 if((RotationAxisLocks & (byte)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0 )
3871 lrRotationAxis.Z = 0f;
3872
3873 pa.LockAngularMotion(lrRotationAxis);
3864 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); 3874 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
3865 } 3875 }
3866 } 3876 }