diff options
author | Robert Adams | 2015-03-29 14:25:12 -0700 |
---|---|---|
committer | Robert Adams | 2015-03-29 14:25:12 -0700 |
commit | 07dead7dcb8b0f2a27a50748e4a460d9669903fc (patch) | |
tree | b61c3d892e83d36fece40e7735c5d97e64b9020f /OpenSim/Region/Framework/Scenes | |
parent | varregion: add varregion and TerrainData use in LLClientView. (diff) | |
download | opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.zip opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.gz opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.bz2 opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.xz |
varregion: any conversions of use of Constants.RegionSize converted into
Util.cs routines to convert region coords to and from world coords or handles.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
5 files changed, 48 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index b45cc4d..4ab5a4a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2221,14 +2221,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2221 | itemID = UUID.Zero; | 2221 | itemID = UUID.Zero; |
2222 | if (grp != null) | 2222 | if (grp != null) |
2223 | { | 2223 | { |
2224 | Vector3 inventoryStoredPosition = new Vector3 | 2224 | Vector3 inventoryStoredPosition = new Vector3( |
2225 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | 2225 | Math.Min(grp.AbsolutePosition.X, RegionInfo.RegionSizeX - 6), |
2226 | ? 250 | 2226 | Math.Min(grp.AbsolutePosition.Y, RegionInfo.RegionSizeY - 6), |
2227 | : grp.AbsolutePosition.X) | ||
2228 | , | ||
2229 | (grp.AbsolutePosition.X > (int)Constants.RegionSize) | ||
2230 | ? 250 | ||
2231 | : grp.AbsolutePosition.X, | ||
2232 | grp.AbsolutePosition.Z); | 2227 | grp.AbsolutePosition.Z); |
2233 | 2228 | ||
2234 | Vector3 originalPosition = grp.AbsolutePosition; | 2229 | Vector3 originalPosition = grp.AbsolutePosition; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f5458c1..46c9048 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -6,7 +6,7 @@ | |||
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyrightD | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
@@ -103,7 +103,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// <summary> | 103 | /// <summary> |
104 | /// If false then physical objects are disabled, though collisions will continue as normal. | 104 | /// If false then physical objects are disabled, though collisions will continue as normal. |
105 | /// </summary> | 105 | /// </summary> |
106 | public bool PhysicsEnabled { get; set; } | 106 | public bool PhysicsEnabled |
107 | { | ||
108 | get | ||
109 | { | ||
110 | return m_physicsEnabled; | ||
111 | } | ||
112 | |||
113 | set | ||
114 | { | ||
115 | m_physicsEnabled = value; | ||
116 | |||
117 | if (PhysicsScene != null) | ||
118 | { | ||
119 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; | ||
120 | |||
121 | if (physScene != null) | ||
122 | physScene.SetPhysicsParameter( | ||
123 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | |||
128 | private bool m_physicsEnabled; | ||
107 | 129 | ||
108 | /// <summary> | 130 | /// <summary> |
109 | /// If false then scripts are not enabled on the smiulator | 131 | /// If false then scripts are not enabled on the smiulator |
@@ -199,15 +221,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
199 | /// </summary> | 221 | /// </summary> |
200 | public int m_linksetCapacity = 0; | 222 | public int m_linksetCapacity = 0; |
201 | 223 | ||
224 | public bool m_clampPrimSize; | ||
225 | public bool m_trustBinaries; | ||
226 | public bool m_allowScriptCrossings = true; | ||
227 | |||
202 | /// <summary> | 228 | /// <summary> |
203 | /// Max prims an Physical object will hold | 229 | /// Max prims an Physical object will hold |
204 | /// </summary> | 230 | /// </summary> |
205 | /// | 231 | /// |
206 | public int m_linksetPhysCapacity = 0; | 232 | public int m_linksetPhysCapacity = 0; |
207 | 233 | ||
208 | public bool m_clampPrimSize; | ||
209 | public bool m_trustBinaries; | ||
210 | public bool m_allowScriptCrossings; | ||
211 | public bool m_useFlySlow; | 234 | public bool m_useFlySlow; |
212 | public bool m_useTrashOnDelete = true; | 235 | public bool m_useTrashOnDelete = true; |
213 | 236 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 52f46f2..a2625c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
52 | public class SceneCommunicationService //one instance per region | 52 | public class SceneCommunicationService //one instance per region |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | private static string LogHeader = "[SCENE COMMUNICATION SERVICE]"; | ||
55 | 56 | ||
56 | protected RegionInfo m_regionInfo; | 57 | protected RegionInfo m_regionInfo; |
57 | protected Scene m_scene; | 58 | protected Scene m_scene; |
@@ -100,7 +101,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
100 | { | 101 | { |
101 | m_log.WarnFormat( | 102 | m_log.WarnFormat( |
102 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", | 103 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", |
103 | m_scene.Name, x / Constants.RegionSize, y / Constants.RegionSize); | 104 | m_scene.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
@@ -166,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | // we only want to send one update to each simulator; the simulator will | 167 | // we only want to send one update to each simulator; the simulator will |
167 | // hand it off to the regions where a child agent exists, this does assume | 168 | // hand it off to the regions where a child agent exists, this does assume |
168 | // that the region position is cached or performance will degrade | 169 | // that the region position is cached or performance will degrade |
169 | Utils.LongToUInts(regionHandle, out x, out y); | 170 | Util.RegionHandleToWorldLoc(regionHandle, out x, out y); |
170 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | 171 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
171 | if (dest == null) | 172 | if (dest == null) |
172 | continue; | 173 | continue; |
@@ -206,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | 207 | ||
207 | //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); | 208 | //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); |
208 | uint x = 0, y = 0; | 209 | uint x = 0, y = 0; |
209 | Utils.LongToUInts(regionHandle, out x, out y); | 210 | Util.RegionHandleToWorldLoc(regionHandle, out x, out y); |
210 | 211 | ||
211 | GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); | 212 | GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); |
212 | 213 | ||
@@ -226,6 +227,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | { | 227 | { |
227 | foreach (ulong handle in regionslst) | 228 | foreach (ulong handle in regionslst) |
228 | { | 229 | { |
230 | // We must take a copy here since handle acts like a reference when used in an iterator. | ||
231 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. | ||
229 | ulong handleCopy = handle; | 232 | ulong handleCopy = handle; |
230 | Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); }); | 233 | Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); }); |
231 | } | 234 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a99e469..cb2f377 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
412 | { | 412 | { |
413 | get | 413 | get |
414 | { | 414 | { |
415 | Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | 415 | Vector3 minScale = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, Constants.MaximumRegionSize); |
416 | Vector3 maxScale = Vector3.Zero; | 416 | Vector3 maxScale = Vector3.Zero; |
417 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); | 417 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); |
418 | 418 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2965903..82508ad 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -842,9 +842,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
842 | foreach (ulong handle in seeds.Keys) | 842 | foreach (ulong handle in seeds.Keys) |
843 | { | 843 | { |
844 | uint x, y; | 844 | uint x, y; |
845 | Utils.LongToUInts(handle, out x, out y); | 845 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
846 | x = x / Constants.RegionSize; | 846 | |
847 | y = y / Constants.RegionSize; | ||
848 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | 847 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) |
849 | { | 848 | { |
850 | old.Add(handle); | 849 | old.Add(handle); |
@@ -866,9 +865,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) | 865 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) |
867 | { | 866 | { |
868 | uint x, y; | 867 | uint x, y; |
869 | Utils.LongToUInts(kvp.Key, out x, out y); | 868 | Util.RegionHandleToRegionLoc(kvp.Key, out x, out y); |
870 | x = x / Constants.RegionSize; | ||
871 | y = y / Constants.RegionSize; | ||
872 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); | 869 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); |
873 | } | 870 | } |
874 | } | 871 | } |
@@ -1189,7 +1186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1189 | 1186 | ||
1190 | float posZLimit = 0; | 1187 | float posZLimit = 0; |
1191 | 1188 | ||
1192 | if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) | 1189 | if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY) |
1193 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | 1190 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; |
1194 | 1191 | ||
1195 | float newPosZ = posZLimit + localAVHeight / 2; | 1192 | float newPosZ = posZLimit + localAVHeight / 2; |
@@ -2595,7 +2592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | if (regionCombinerModule != null) | 2592 | if (regionCombinerModule != null) |
2596 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | 2593 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); |
2597 | else | 2594 | else |
2598 | regionSize = new Vector2(Constants.RegionSize); | 2595 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); |
2599 | 2596 | ||
2600 | if (pos.X < 0 || pos.X >= regionSize.X | 2597 | if (pos.X < 0 || pos.X >= regionSize.X |
2601 | || pos.Y < 0 || pos.Y >= regionSize.Y | 2598 | || pos.Y < 0 || pos.Y >= regionSize.Y |
@@ -2613,8 +2610,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | // } | 2610 | // } |
2614 | 2611 | ||
2615 | // Get terrain height for sub-region in a megaregion if necessary | 2612 | // Get terrain height for sub-region in a megaregion if necessary |
2616 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | 2613 | int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); |
2617 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | 2614 | int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); |
2618 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); | 2615 | GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); |
2619 | // If X and Y is NaN, target_region will be null | 2616 | // If X and Y is NaN, target_region will be null |
2620 | if (target_region == null) | 2617 | if (target_region == null) |
@@ -2625,7 +2622,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2625 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 2622 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
2626 | targetScene = m_scene; | 2623 | targetScene = m_scene; |
2627 | 2624 | ||
2628 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; | 2625 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; |
2629 | // dont try to land underground | 2626 | // dont try to land underground |
2630 | terrainHeight += Appearance.AvatarHeight / 2; | 2627 | terrainHeight += Appearance.AvatarHeight / 2; |
2631 | pos.Z = Math.Max(terrainHeight, pos.Z); | 2628 | pos.Z = Math.Max(terrainHeight, pos.Z); |
@@ -3941,7 +3938,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3941 | 3938 | ||
3942 | // Put the child agent back at the center | 3939 | // Put the child agent back at the center |
3943 | AbsolutePosition | 3940 | AbsolutePosition |
3944 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); | 3941 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); |
3945 | 3942 | ||
3946 | Animator.ResetAnimations(); | 3943 | Animator.ResetAnimations(); |
3947 | } | 3944 | } |
@@ -3968,9 +3965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3968 | if (handle != Scene.RegionInfo.RegionHandle) | 3965 | if (handle != Scene.RegionInfo.RegionHandle) |
3969 | { | 3966 | { |
3970 | uint x, y; | 3967 | uint x, y; |
3971 | Utils.LongToUInts(handle, out x, out y); | 3968 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
3972 | x = x / Constants.RegionSize; | ||
3973 | y = y / Constants.RegionSize; | ||
3974 | 3969 | ||
3975 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3970 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3976 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3971 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |