aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
5 files changed, 155 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 57fcf51..0883913 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -103,8 +103,26 @@ namespace OpenSim.Region.Framework.Scenes
103 /// </summary> 103 /// </summary>
104 public bool CollidablePrims { get; private set; } 104 public bool CollidablePrims { get; private set; }
105 105
106 /// <summary>
107 /// Minimum value of the size of a non-physical prim in each axis
108 /// </summary>
109 public float m_minNonphys = 0.01f;
110
111 /// <summary>
112 /// Maximum value of the size of a non-physical prim in each axis
113 /// </summary>
106 public float m_maxNonphys = 256; 114 public float m_maxNonphys = 256;
115
116 /// <summary>
117 /// Minimum value of the size of a physical prim in each axis
118 /// </summary>
119 public float m_minPhys = 0.01f;
120
121 /// <summary>
122 /// Maximum value of the size of a physical prim in each axis
123 /// </summary>
107 public float m_maxPhys = 10; 124 public float m_maxPhys = 10;
125
108 public bool m_clampPrimSize; 126 public bool m_clampPrimSize;
109 public bool m_trustBinaries; 127 public bool m_trustBinaries;
110 public bool m_allowScriptCrossings; 128 public bool m_allowScriptCrossings;
@@ -746,12 +764,24 @@ namespace OpenSim.Region.Framework.Scenes
746 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 764 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
747 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 765 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
748 766
767 m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys);
768 if (RegionInfo.NonphysPrimMin > 0)
769 {
770 m_minNonphys = RegionInfo.NonphysPrimMin;
771 }
772
749 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 773 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
750 if (RegionInfo.NonphysPrimMax > 0) 774 if (RegionInfo.NonphysPrimMax > 0)
751 { 775 {
752 m_maxNonphys = RegionInfo.NonphysPrimMax; 776 m_maxNonphys = RegionInfo.NonphysPrimMax;
753 } 777 }
754 778
779 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
780 if (RegionInfo.PhysPrimMin > 0)
781 {
782 m_minPhys = RegionInfo.PhysPrimMin;
783 }
784
755 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 785 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
756 786
757 if (RegionInfo.PhysPrimMax > 0) 787 if (RegionInfo.PhysPrimMax > 0)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e29b2c1..fa66858 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -421,12 +421,9 @@ namespace OpenSim.Region.Framework.Scenes
421 { 421 {
422 Vector3 scale = part.Shape.Scale; 422 Vector3 scale = part.Shape.Scale;
423 423
424 if (scale.X > m_parentScene.m_maxNonphys) 424 scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X));
425 scale.X = m_parentScene.m_maxNonphys; 425 scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y));
426 if (scale.Y > m_parentScene.m_maxNonphys) 426 scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z));
427 scale.Y = m_parentScene.m_maxNonphys;
428 if (scale.Z > m_parentScene.m_maxNonphys)
429 scale.Z = m_parentScene.m_maxNonphys;
430 427
431 part.Shape.Scale = scale; 428 part.Shape.Scale = scale;
432 } 429 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index cb4aa2d..6e48735 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3438,17 +3438,17 @@ namespace OpenSim.Region.Framework.Scenes
3438 /// <param name="scale"></param> 3438 /// <param name="scale"></param>
3439 public void GroupResize(Vector3 scale) 3439 public void GroupResize(Vector3 scale)
3440 { 3440 {
3441 scale.X = Math.Min(scale.X, Scene.m_maxNonphys); 3441 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
3442 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); 3442 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
3443 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); 3443 scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
3444 3444
3445 PhysicsActor pa = m_rootPart.PhysActor; 3445 PhysicsActor pa = m_rootPart.PhysActor;
3446 3446
3447 if (pa != null && pa.IsPhysical) 3447 if (pa != null && pa.IsPhysical)
3448 { 3448 {
3449 scale.X = Math.Min(scale.X, Scene.m_maxPhys); 3449 scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
3450 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); 3450 scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
3451 scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); 3451 scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
3452 } 3452 }
3453 3453
3454 float x = (scale.X / RootPart.Scale.X); 3454 float x = (scale.X / RootPart.Scale.X);
@@ -3479,6 +3479,14 @@ namespace OpenSim.Region.Framework.Scenes
3479 y *= a; 3479 y *= a;
3480 z *= a; 3480 z *= a;
3481 } 3481 }
3482 else if (oldSize.X * x < m_scene.m_minPhys)
3483 {
3484 f = m_scene.m_minPhys / oldSize.X;
3485 a = f / x;
3486 x *= a;
3487 y *= a;
3488 z *= a;
3489 }
3482 3490
3483 if (oldSize.Y * y > m_scene.m_maxPhys) 3491 if (oldSize.Y * y > m_scene.m_maxPhys)
3484 { 3492 {
@@ -3488,6 +3496,14 @@ namespace OpenSim.Region.Framework.Scenes
3488 y *= a; 3496 y *= a;
3489 z *= a; 3497 z *= a;
3490 } 3498 }
3499 else if (oldSize.Y * y < m_scene.m_minPhys)
3500 {
3501 f = m_scene.m_minPhys / oldSize.Y;
3502 a = f / y;
3503 x *= a;
3504 y *= a;
3505 z *= a;
3506 }
3491 3507
3492 if (oldSize.Z * z > m_scene.m_maxPhys) 3508 if (oldSize.Z * z > m_scene.m_maxPhys)
3493 { 3509 {
@@ -3497,6 +3513,14 @@ namespace OpenSim.Region.Framework.Scenes
3497 y *= a; 3513 y *= a;
3498 z *= a; 3514 z *= a;
3499 } 3515 }
3516 else if (oldSize.Z * z < m_scene.m_minPhys)
3517 {
3518 f = m_scene.m_minPhys / oldSize.Z;
3519 a = f / z;
3520 x *= a;
3521 y *= a;
3522 z *= a;
3523 }
3500 } 3524 }
3501 else 3525 else
3502 { 3526 {
@@ -3508,6 +3532,14 @@ namespace OpenSim.Region.Framework.Scenes
3508 y *= a; 3532 y *= a;
3509 z *= a; 3533 z *= a;
3510 } 3534 }
3535 else if (oldSize.X * x < m_scene.m_minNonphys)
3536 {
3537 f = m_scene.m_minNonphys / oldSize.X;
3538 a = f / x;
3539 x *= a;
3540 y *= a;
3541 z *= a;
3542 }
3511 3543
3512 if (oldSize.Y * y > m_scene.m_maxNonphys) 3544 if (oldSize.Y * y > m_scene.m_maxNonphys)
3513 { 3545 {
@@ -3517,6 +3549,14 @@ namespace OpenSim.Region.Framework.Scenes
3517 y *= a; 3549 y *= a;
3518 z *= a; 3550 z *= a;
3519 } 3551 }
3552 else if (oldSize.Y * y < m_scene.m_minNonphys)
3553 {
3554 f = m_scene.m_minNonphys / oldSize.Y;
3555 a = f / y;
3556 x *= a;
3557 y *= a;
3558 z *= a;
3559 }
3520 3560
3521 if (oldSize.Z * z > m_scene.m_maxNonphys) 3561 if (oldSize.Z * z > m_scene.m_maxNonphys)
3522 { 3562 {
@@ -3526,6 +3566,14 @@ namespace OpenSim.Region.Framework.Scenes
3526 y *= a; 3566 y *= a;
3527 z *= a; 3567 z *= a;
3528 } 3568 }
3569 else if (oldSize.Z * z < m_scene.m_minNonphys)
3570 {
3571 f = m_scene.m_minNonphys / oldSize.Z;
3572 a = f / z;
3573 x *= a;
3574 y *= a;
3575 z *= a;
3576 }
3529 } 3577 }
3530 } 3578 }
3531 } 3579 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ce652b4..593e1d3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -790,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes
790 } 790 }
791 catch (Exception e) 791 catch (Exception e)
792 { 792 {
793 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 793 m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
794 } 794 }
795 } 795 }
796 } 796 }
@@ -2969,17 +2969,16 @@ namespace OpenSim.Region.Framework.Scenes
2969 /// <param name="scale"></param> 2969 /// <param name="scale"></param>
2970 public void Resize(Vector3 scale) 2970 public void Resize(Vector3 scale)
2971 { 2971 {
2972 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); 2972 scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X));
2973 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); 2973 scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y));
2974 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); 2974 scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z));
2975 2975
2976 PhysicsActor pa = PhysActor; 2976 PhysicsActor pa = PhysActor;
2977
2978 if (pa != null && pa.IsPhysical) 2977 if (pa != null && pa.IsPhysical)
2979 { 2978 {
2980 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); 2979 scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X));
2981 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); 2980 scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y));
2982 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); 2981 scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z));
2983 } 2982 }
2984 2983
2985// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2984// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
@@ -4864,6 +4863,57 @@ namespace OpenSim.Region.Framework.Scenes
4864 ScheduleFullUpdate(); 4863 ScheduleFullUpdate();
4865 } 4864 }
4866 4865
4866 public void UpdateSlice(float begin, float end)
4867 {
4868 if (end < begin)
4869 {
4870 float temp = begin;
4871 begin = end;
4872 end = temp;
4873 }
4874 end = Math.Min(1f, Math.Max(0f, end));
4875 begin = Math.Min(Math.Min(1f, Math.Max(0f, begin)), end - 0.02f);
4876 if (begin < 0.02f && end < 0.02f)
4877 {
4878 begin = 0f;
4879 end = 0.02f;
4880 }
4881
4882 ushort uBegin = (ushort)(50000.0 * begin);
4883 ushort uEnd = (ushort)(50000.0 * (1f - end));
4884 bool updatePossiblyNeeded = false;
4885 PrimType primType = GetPrimType();
4886 if (primType == PrimType.SPHERE || primType == PrimType.TORUS || primType == PrimType.TUBE || primType == PrimType.RING)
4887 {
4888 if (m_shape.ProfileBegin != uBegin || m_shape.ProfileEnd != uEnd)
4889 {
4890 m_shape.ProfileBegin = uBegin;
4891 m_shape.ProfileEnd = uEnd;
4892 updatePossiblyNeeded = true;
4893 }
4894 }
4895 else if (m_shape.PathBegin != uBegin || m_shape.PathEnd != uEnd)
4896 {
4897 m_shape.PathBegin = uBegin;
4898 m_shape.PathEnd = uEnd;
4899 updatePossiblyNeeded = true;
4900 }
4901
4902 if (updatePossiblyNeeded && ParentGroup != null)
4903 {
4904 ParentGroup.HasGroupChanged = true;
4905 }
4906 if (updatePossiblyNeeded && PhysActor != null)
4907 {
4908 PhysActor.Shape = m_shape;
4909 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
4910 }
4911 if (updatePossiblyNeeded)
4912 {
4913 ScheduleFullUpdate();
4914 }
4915 }
4916
4867 /// <summary> 4917 /// <summary>
4868 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics 4918 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
4869 /// engine can use it. 4919 /// engine can use it.
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 47b2ead..cfd4a51 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1527,17 +1527,22 @@ namespace OpenSim.Region.Framework.Scenes
1527 bool DCFlagKeyPressed = false; 1527 bool DCFlagKeyPressed = false;
1528 Vector3 agent_control_v3 = Vector3.Zero; 1528 Vector3 agent_control_v3 = Vector3.Zero;
1529 1529
1530 bool oldflying = Flying; 1530 bool newFlying = actor.Flying;
1531 1531
1532 if (ForceFly) 1532 if (ForceFly)
1533 actor.Flying = true; 1533 newFlying = true;
1534 else if (FlyDisabled) 1534 else if (FlyDisabled)
1535 actor.Flying = false; 1535 newFlying = false;
1536 else 1536 else
1537 actor.Flying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1537 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1538 1538
1539 if (actor.Flying != oldflying) 1539 if (actor.Flying != newFlying)
1540 {
1541 // Note: ScenePresence.Flying is actually fetched from the physical actor
1542 // so setting PhysActor.Flying here also sets the ScenePresence's value.
1543 actor.Flying = newFlying;
1540 update_movementflag = true; 1544 update_movementflag = true;
1545 }
1541 1546
1542 if (ParentID == 0) 1547 if (ParentID == 0)
1543 { 1548 {