diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 |
5 files changed, 155 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a5f0bff..d9cd2f0 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 6104c66..3726a15 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3436,17 +3436,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3436 | /// <param name="scale"></param> | 3436 | /// <param name="scale"></param> |
3437 | public void GroupResize(Vector3 scale) | 3437 | public void GroupResize(Vector3 scale) |
3438 | { | 3438 | { |
3439 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 3439 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); |
3440 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 3440 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); |
3441 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | 3441 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); |
3442 | 3442 | ||
3443 | PhysicsActor pa = m_rootPart.PhysActor; | 3443 | PhysicsActor pa = m_rootPart.PhysActor; |
3444 | 3444 | ||
3445 | if (pa != null && pa.IsPhysical) | 3445 | if (pa != null && pa.IsPhysical) |
3446 | { | 3446 | { |
3447 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); | 3447 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); |
3448 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); | 3448 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); |
3449 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); | 3449 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); |
3450 | } | 3450 | } |
3451 | 3451 | ||
3452 | float x = (scale.X / RootPart.Scale.X); | 3452 | float x = (scale.X / RootPart.Scale.X); |
@@ -3477,6 +3477,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3477 | y *= a; | 3477 | y *= a; |
3478 | z *= a; | 3478 | z *= a; |
3479 | } | 3479 | } |
3480 | else if (oldSize.X * x < m_scene.m_minPhys) | ||
3481 | { | ||
3482 | f = m_scene.m_minPhys / oldSize.X; | ||
3483 | a = f / x; | ||
3484 | x *= a; | ||
3485 | y *= a; | ||
3486 | z *= a; | ||
3487 | } | ||
3480 | 3488 | ||
3481 | if (oldSize.Y * y > m_scene.m_maxPhys) | 3489 | if (oldSize.Y * y > m_scene.m_maxPhys) |
3482 | { | 3490 | { |
@@ -3486,6 +3494,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3486 | y *= a; | 3494 | y *= a; |
3487 | z *= a; | 3495 | z *= a; |
3488 | } | 3496 | } |
3497 | else if (oldSize.Y * y < m_scene.m_minPhys) | ||
3498 | { | ||
3499 | f = m_scene.m_minPhys / oldSize.Y; | ||
3500 | a = f / y; | ||
3501 | x *= a; | ||
3502 | y *= a; | ||
3503 | z *= a; | ||
3504 | } | ||
3489 | 3505 | ||
3490 | if (oldSize.Z * z > m_scene.m_maxPhys) | 3506 | if (oldSize.Z * z > m_scene.m_maxPhys) |
3491 | { | 3507 | { |
@@ -3495,6 +3511,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3495 | y *= a; | 3511 | y *= a; |
3496 | z *= a; | 3512 | z *= a; |
3497 | } | 3513 | } |
3514 | else if (oldSize.Z * z < m_scene.m_minPhys) | ||
3515 | { | ||
3516 | f = m_scene.m_minPhys / oldSize.Z; | ||
3517 | a = f / z; | ||
3518 | x *= a; | ||
3519 | y *= a; | ||
3520 | z *= a; | ||
3521 | } | ||
3498 | } | 3522 | } |
3499 | else | 3523 | else |
3500 | { | 3524 | { |
@@ -3506,6 +3530,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3506 | y *= a; | 3530 | y *= a; |
3507 | z *= a; | 3531 | z *= a; |
3508 | } | 3532 | } |
3533 | else if (oldSize.X * x < m_scene.m_minNonphys) | ||
3534 | { | ||
3535 | f = m_scene.m_minNonphys / oldSize.X; | ||
3536 | a = f / x; | ||
3537 | x *= a; | ||
3538 | y *= a; | ||
3539 | z *= a; | ||
3540 | } | ||
3509 | 3541 | ||
3510 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 3542 | if (oldSize.Y * y > m_scene.m_maxNonphys) |
3511 | { | 3543 | { |
@@ -3515,6 +3547,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3515 | y *= a; | 3547 | y *= a; |
3516 | z *= a; | 3548 | z *= a; |
3517 | } | 3549 | } |
3550 | else if (oldSize.Y * y < m_scene.m_minNonphys) | ||
3551 | { | ||
3552 | f = m_scene.m_minNonphys / oldSize.Y; | ||
3553 | a = f / y; | ||
3554 | x *= a; | ||
3555 | y *= a; | ||
3556 | z *= a; | ||
3557 | } | ||
3518 | 3558 | ||
3519 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 3559 | if (oldSize.Z * z > m_scene.m_maxNonphys) |
3520 | { | 3560 | { |
@@ -3524,6 +3564,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3524 | y *= a; | 3564 | y *= a; |
3525 | z *= a; | 3565 | z *= a; |
3526 | } | 3566 | } |
3567 | else if (oldSize.Z * z < m_scene.m_minNonphys) | ||
3568 | { | ||
3569 | f = m_scene.m_minNonphys / oldSize.Z; | ||
3570 | a = f / z; | ||
3571 | x *= a; | ||
3572 | y *= a; | ||
3573 | z *= a; | ||
3574 | } | ||
3527 | } | 3575 | } |
3528 | } | 3576 | } |
3529 | } | 3577 | } |
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 | { |