diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain')
3 files changed, 44 insertions, 504 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs index 236584a..d634e8b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs | |||
@@ -46,10 +46,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
46 | if (fillArea[x, y]) | 46 | if (fillArea[x, y]) |
47 | { | 47 | { |
48 | double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); | 48 | double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); |
49 | <<<<<<< HEAD | ||
50 | |||
51 | ======= | ||
52 | >>>>>>> avn/ubitvar | ||
53 | map[x, y] += noise * strength; | 49 | map[x, y] += noise * strength; |
54 | } | 50 | } |
55 | } | 51 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 925de2a..22723fc 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -75,15 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
78 | <<<<<<< HEAD | ||
79 | ======= | ||
80 | |||
81 | #pragma warning disable 414 | ||
82 | private static readonly string LogHeader = "[TERRAIN MODULE]"; | ||
83 | #pragma warning restore 414 | ||
84 | |||
85 | private readonly Commander m_commander = new Commander("terrain"); | ||
86 | >>>>>>> avn/ubitvar | ||
87 | 78 | ||
88 | #pragma warning disable 414 | 79 | #pragma warning disable 414 |
89 | private static readonly string LogHeader = "[TERRAIN MODULE]"; | 80 | private static readonly string LogHeader = "[TERRAIN MODULE]"; |
@@ -95,16 +86,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
95 | private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); | 86 | private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); |
96 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = | 87 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = |
97 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); | 88 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); |
98 | <<<<<<< HEAD | ||
99 | private Dictionary<string, ITerrainEffect> m_plugineffects; | ||
100 | private Dictionary<string, ITerrainModifier> m_modifyOperations = | ||
101 | new Dictionary<string, ITerrainModifier>(); | ||
102 | private ITerrainChannel m_channel; | ||
103 | private ITerrainChannel m_revert; | ||
104 | private Scene m_scene; | ||
105 | private volatile bool m_tainted; | ||
106 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); | ||
107 | ======= | ||
108 | 89 | ||
109 | private Dictionary<string, ITerrainEffect> m_plugineffects; | 90 | private Dictionary<string, ITerrainEffect> m_plugineffects; |
110 | private ITerrainChannel m_channel; | 91 | private ITerrainChannel m_channel; |
@@ -112,7 +93,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
112 | private Scene m_scene; | 93 | private Scene m_scene; |
113 | private volatile bool m_tainted; | 94 | private volatile bool m_tainted; |
114 | 95 | ||
115 | >>>>>>> avn/ubitvar | ||
116 | private String m_InitialTerrain = "pinhead-island"; | 96 | private String m_InitialTerrain = "pinhead-island"; |
117 | 97 | ||
118 | // If true, send terrain patch updates to clients based on their view distance | 98 | // If true, send terrain patch updates to clients based on their view distance |
@@ -126,19 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
126 | private bool[,] updated; // for each patch, whether it needs to be sent to this client | 106 | private bool[,] updated; // for each patch, whether it needs to be sent to this client |
127 | private int updateCount; // number of patches that need to be sent | 107 | private int updateCount; // number of patches that need to be sent |
128 | public ScenePresence Presence; // a reference to the client to send to | 108 | public ScenePresence Presence; // a reference to the client to send to |
129 | <<<<<<< HEAD | 109 | |
130 | public TerrainData Terrain; // reference to the underlying terrain | ||
131 | ======= | ||
132 | >>>>>>> avn/ubitvar | ||
133 | public PatchUpdates(TerrainData terrData, ScenePresence pPresence) | 110 | public PatchUpdates(TerrainData terrData, ScenePresence pPresence) |
134 | { | 111 | { |
135 | updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; | 112 | updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; |
136 | updateCount = 0; | 113 | updateCount = 0; |
137 | Presence = pPresence; | 114 | Presence = pPresence; |
138 | <<<<<<< HEAD | ||
139 | Terrain = terrData; | ||
140 | ======= | ||
141 | >>>>>>> avn/ubitvar | ||
142 | // Initially, send all patches to the client | 115 | // Initially, send all patches to the client |
143 | SetAll(true); | 116 | SetAll(true); |
144 | } | 117 | } |
@@ -147,26 +120,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
147 | { | 120 | { |
148 | return (updateCount > 0); | 121 | return (updateCount > 0); |
149 | } | 122 | } |
150 | <<<<<<< HEAD | ||
151 | 123 | ||
152 | ======= | ||
153 | >>>>>>> avn/ubitvar | ||
154 | public void SetByXY(int x, int y, bool state) | 124 | public void SetByXY(int x, int y, bool state) |
155 | { | 125 | { |
156 | this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); | 126 | this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); |
157 | } | 127 | } |
158 | <<<<<<< HEAD | ||
159 | 128 | ||
160 | ======= | ||
161 | >>>>>>> avn/ubitvar | ||
162 | public bool GetByPatch(int patchX, int patchY) | 129 | public bool GetByPatch(int patchX, int patchY) |
163 | { | 130 | { |
164 | return updated[patchX, patchY]; | 131 | return updated[patchX, patchY]; |
165 | } | 132 | } |
166 | <<<<<<< HEAD | ||
167 | 133 | ||
168 | ======= | ||
169 | >>>>>>> avn/ubitvar | ||
170 | public void SetByPatch(int patchX, int patchY, bool state) | 134 | public void SetByPatch(int patchX, int patchY, bool state) |
171 | { | 135 | { |
172 | bool prevState = updated[patchX, patchY]; | 136 | bool prevState = updated[patchX, patchY]; |
@@ -176,24 +140,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
176 | updateCount--; | 140 | updateCount--; |
177 | updated[patchX, patchY] = state; | 141 | updated[patchX, patchY] = state; |
178 | } | 142 | } |
179 | <<<<<<< HEAD | ||
180 | 143 | ||
181 | public void SetAll(bool state) | 144 | public void SetAll(bool state) |
182 | { | 145 | { |
183 | updateCount = 0; | 146 | updateCount = 0; |
184 | for(int xx = 0; xx < updated.GetLength(0); xx++) | ||
185 | for(int yy = 0; yy < updated.GetLength(1); yy++) | ||
186 | ======= | ||
187 | public void SetAll(bool state) | ||
188 | { | ||
189 | updateCount = 0; | ||
190 | for (int xx = 0; xx < updated.GetLength(0); xx++) | 147 | for (int xx = 0; xx < updated.GetLength(0); xx++) |
191 | for (int yy = 0; yy < updated.GetLength(1); yy++) | 148 | for (int yy = 0; yy < updated.GetLength(1); yy++) |
192 | >>>>>>> avn/ubitvar | ||
193 | updated[xx, yy] = state; | 149 | updated[xx, yy] = state; |
194 | if (state) | 150 | if (state) |
195 | updateCount = updated.GetLength(0) * updated.GetLength(1); | 151 | updateCount = updated.GetLength(0) * updated.GetLength(1); |
196 | } | 152 | } |
153 | |||
197 | // Logically OR's the terrain data's patch taint map into this client's update map. | 154 | // Logically OR's the terrain data's patch taint map into this client's update map. |
198 | public void SetAll(TerrainData terrData) | 155 | public void SetAll(TerrainData terrData) |
199 | { | 156 | { |
@@ -206,15 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
206 | terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) | 163 | terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) |
207 | ); | 164 | ); |
208 | } | 165 | } |
209 | <<<<<<< HEAD | 166 | |
210 | for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) | ||
211 | { | ||
212 | for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) | ||
213 | ======= | ||
214 | for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) | 167 | for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) |
215 | { | 168 | { |
216 | for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) | 169 | for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) |
217 | >>>>>>> avn/ubitvar | ||
218 | { | 170 | { |
219 | // Only set tainted. The patch bit may be set if the patch was to be sent later. | 171 | // Only set tainted. The patch bit may be set if the patch was to be sent later. |
220 | if (terrData.IsTaintedAt(xx, yy, false)) | 172 | if (terrData.IsTaintedAt(xx, yy, false)) |
@@ -275,20 +227,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
275 | (int)m_scene.RegionInfo.RegionSizeY, | 227 | (int)m_scene.RegionInfo.RegionSizeY, |
276 | (int)m_scene.RegionInfo.RegionSizeZ); | 228 | (int)m_scene.RegionInfo.RegionSizeZ); |
277 | m_scene.Heightmap = m_channel; | 229 | m_scene.Heightmap = m_channel; |
278 | <<<<<<< HEAD | 230 | |
279 | UpdateRevertMap(); | ||
280 | ======= | ||
281 | UpdateBakedMap(); | 231 | UpdateBakedMap(); |
282 | >>>>>>> avn/ubitvar | ||
283 | } | 232 | } |
284 | else | 233 | else |
285 | { | 234 | { |
286 | m_channel = m_scene.Heightmap; | 235 | m_channel = m_scene.Heightmap; |
287 | <<<<<<< HEAD | ||
288 | UpdateRevertMap(); | ||
289 | ======= | ||
290 | UpdateBakedMap(); | 236 | UpdateBakedMap(); |
291 | >>>>>>> avn/ubitvar | ||
292 | } | 237 | } |
293 | 238 | ||
294 | m_scene.RegisterModuleInterface<ITerrainModule>(this); | 239 | m_scene.RegisterModuleInterface<ITerrainModule>(this); |
@@ -296,11 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
296 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; | 241 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; |
297 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 242 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
298 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; | 243 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; |
299 | <<<<<<< HEAD | ||
300 | m_scene.EventManager.OnFrame += EventManager_OnFrame; | ||
301 | ======= | ||
302 | m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; | 244 | m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; |
303 | >>>>>>> avn/ubitvar | ||
304 | } | 245 | } |
305 | 246 | ||
306 | InstallDefaultEffects(); | 247 | InstallDefaultEffects(); |
@@ -339,11 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
339 | // remove the commands | 280 | // remove the commands |
340 | m_scene.UnregisterModuleCommander(m_commander.Name); | 281 | m_scene.UnregisterModuleCommander(m_commander.Name); |
341 | // remove the event-handlers | 282 | // remove the event-handlers |
342 | <<<<<<< HEAD | 283 | |
343 | m_scene.EventManager.OnFrame -= EventManager_OnFrame; | ||
344 | ======= | ||
345 | m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; | 284 | m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; |
346 | >>>>>>> avn/ubitvar | ||
347 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; | 285 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; |
348 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | 286 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; |
349 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; | 287 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; |
@@ -490,11 +428,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
490 | { | 428 | { |
491 | ITerrainChannel channel = loader.Value.LoadStream(stream); | 429 | ITerrainChannel channel = loader.Value.LoadStream(stream); |
492 | m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); | 430 | m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); |
493 | <<<<<<< HEAD | ||
494 | UpdateRevertMap(); | ||
495 | ======= | ||
496 | UpdateBakedMap(); | 431 | UpdateBakedMap(); |
497 | >>>>>>> avn/ubitvar | ||
498 | } | 432 | } |
499 | catch(NotImplementedException) | 433 | catch(NotImplementedException) |
500 | { | 434 | { |
@@ -574,27 +508,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
574 | 508 | ||
575 | // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. | 509 | // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. |
576 | // ITerrainModule.TaintTerrain() | 510 | // ITerrainModule.TaintTerrain() |
577 | <<<<<<< HEAD | ||
578 | public void TaintTerrain() | ||
579 | { | ||
580 | lock(m_perClientPatchUpdates) | ||
581 | { | ||
582 | // Set the flags for all clients so the tainted patches will be sent out | ||
583 | foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) | ||
584 | ======= | ||
585 | public void TaintTerrain () | 511 | public void TaintTerrain () |
586 | { | 512 | { |
587 | lock (m_perClientPatchUpdates) | 513 | lock (m_perClientPatchUpdates) |
588 | { | 514 | { |
589 | // Set the flags for all clients so the tainted patches will be sent out | 515 | // Set the flags for all clients so the tainted patches will be sent out |
590 | foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) | 516 | foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) |
591 | >>>>>>> avn/ubitvar | ||
592 | { | 517 | { |
593 | pups.SetAll(m_scene.Heightmap.GetTerrainData()); | 518 | pups.SetAll(m_scene.Heightmap.GetTerrainData()); |
594 | } | 519 | } |
595 | } | 520 | } |
596 | <<<<<<< HEAD | ||
597 | ======= | ||
598 | } | 521 | } |
599 | 522 | ||
600 | // ITerrainModule.PushTerrain() | 523 | // ITerrainModule.PushTerrain() |
@@ -615,38 +538,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
615 | pups.SetAll(true); | 538 | pups.SetAll(true); |
616 | } | 539 | } |
617 | } | 540 | } |
618 | >>>>>>> avn/ubitvar | ||
619 | } | 541 | } |
620 | 542 | ||
621 | // ITerrainModule.PushTerrain() | ||
622 | public void PushTerrain(IClientAPI pClient) | ||
623 | { | ||
624 | // If view distance based, set the modified patch bits and the frame event will send the updates | ||
625 | if (m_sendTerrainUpdatesByViewDistance) | ||
626 | { | ||
627 | ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId); | ||
628 | if (presence != null) | ||
629 | { | ||
630 | lock(m_perClientPatchUpdates) | ||
631 | { | ||
632 | PatchUpdates pups; | ||
633 | if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups)) | ||
634 | { | ||
635 | // There is a ScenePresence without a send patch map. Create one. | ||
636 | pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence); | ||
637 | m_perClientPatchUpdates.Add(presence.UUID, pups); | ||
638 | } | ||
639 | // By setting all to modified, the next update tick will send the patches | ||
640 | pups.SetAll(true); | ||
641 | } | ||
642 | } | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | // The traditional way is to call into the protocol stack to send them all. | ||
647 | pClient.SendLayerData(new float[10]); | ||
648 | } | ||
649 | } | ||
650 | #region Plugin Loading Methods | 543 | #region Plugin Loading Methods |
651 | 544 | ||
652 | private void LoadPlugins() | 545 | private void LoadPlugins() |
@@ -750,6 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
750 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); | 643 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); |
751 | 644 | ||
752 | // Terrain Modifier operations | 645 | // Terrain Modifier operations |
646 | /* | ||
753 | m_modifyOperations["min"] = new MinModifier(this); | 647 | m_modifyOperations["min"] = new MinModifier(this); |
754 | m_modifyOperations["max"] = new MaxModifier(this); | 648 | m_modifyOperations["max"] = new MaxModifier(this); |
755 | m_modifyOperations["raise"] = new RaiseModifier(this); | 649 | m_modifyOperations["raise"] = new RaiseModifier(this); |
@@ -757,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
757 | m_modifyOperations["fill"] = new FillModifier(this); | 651 | m_modifyOperations["fill"] = new FillModifier(this); |
758 | m_modifyOperations["smooth"] = new SmoothModifier(this); | 652 | m_modifyOperations["smooth"] = new SmoothModifier(this); |
759 | m_modifyOperations["noise"] = new NoiseModifier(this); | 653 | m_modifyOperations["noise"] = new NoiseModifier(this); |
760 | 654 | */ | |
761 | // Filesystem load/save loaders | 655 | // Filesystem load/save loaders |
762 | m_loaders[".r32"] = new RAW32(); | 656 | m_loaders[".r32"] = new RAW32(); |
763 | m_loaders[".f32"] = m_loaders[".r32"]; | 657 | m_loaders[".f32"] = m_loaders[".r32"]; |
@@ -778,24 +672,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
778 | /// </summary> | 672 | /// </summary> |
779 | public void UpdateBakedMap() | 673 | public void UpdateBakedMap() |
780 | { | 674 | { |
781 | <<<<<<< HEAD | ||
782 | /* | ||
783 | int x; | ||
784 | for (x = 0; x < m_channel.Width; x++) | ||
785 | { | ||
786 | int y; | ||
787 | for (y = 0; y < m_channel.Height; y++) | ||
788 | { | ||
789 | m_revert[x, y] = m_channel[x, y]; | ||
790 | } | ||
791 | } | ||
792 | */ | ||
793 | m_revert = m_channel.MakeCopy(); | ||
794 | ======= | ||
795 | m_baked = m_channel.MakeCopy(); | 675 | m_baked = m_channel.MakeCopy(); |
796 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); | 676 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); |
797 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); | 677 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); |
798 | >>>>>>> avn/ubitvar | ||
799 | } | 678 | } |
800 | 679 | ||
801 | /// <summary> | 680 | /// <summary> |
@@ -822,13 +701,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
822 | { | 701 | { |
823 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, | 702 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, |
824 | fileWidth, fileHeight, | 703 | fileWidth, fileHeight, |
825 | <<<<<<< HEAD | ||
826 | (int)m_scene.RegionInfo.RegionSizeX, | ||
827 | (int)m_scene.RegionInfo.RegionSizeY); | ||
828 | ======= | ||
829 | (int) m_scene.RegionInfo.RegionSizeX, | 704 | (int) m_scene.RegionInfo.RegionSizeX, |
830 | (int) m_scene.RegionInfo.RegionSizeY); | 705 | (int) m_scene.RegionInfo.RegionSizeY); |
831 | >>>>>>> avn/ubitvar | ||
832 | m_scene.Heightmap = channel; | 706 | m_scene.Heightmap = channel; |
833 | m_channel = channel; | 707 | m_channel = channel; |
834 | UpdateBakedMap(); | 708 | UpdateBakedMap(); |
@@ -894,27 +768,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
894 | } | 768 | } |
895 | 769 | ||
896 | /// <summary> | 770 | /// <summary> |
897 | <<<<<<< HEAD | ||
898 | /// Called before processing of every simulation frame. | ||
899 | ======= | ||
900 | >>>>>>> avn/ubitvar | ||
901 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule | 771 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule |
902 | /// updates for all the presences. | 772 | /// updates for all the presences. |
903 | /// This also checks to see if there are updates that need to be sent for each presence. | 773 | /// This also checks to see if there are updates that need to be sent for each presence. |
904 | /// This is where the logic is to send terrain updates to clients. | 774 | /// This is where the logic is to send terrain updates to clients. |
905 | /// </summary> | 775 | /// </summary> |
906 | <<<<<<< HEAD | ||
907 | private void EventManager_OnFrame() | ||
908 | { | ||
909 | TerrainData terrData = m_channel.GetTerrainData(); | ||
910 | |||
911 | bool shouldTaint = false; | ||
912 | for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | ||
913 | { | ||
914 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | ||
915 | { | ||
916 | if (terrData.IsTaintedAt(x, y)) | ||
917 | ======= | ||
918 | private void EventManager_TerrainCheckUpdates() | 776 | private void EventManager_TerrainCheckUpdates() |
919 | { | 777 | { |
920 | // this needs fixing | 778 | // this needs fixing |
@@ -926,7 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
926 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | 784 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) |
927 | { | 785 | { |
928 | if (terrData.IsTaintedAt(x, y,true)) | 786 | if (terrData.IsTaintedAt(x, y,true)) |
929 | >>>>>>> avn/ubitvar | ||
930 | { | 787 | { |
931 | // Found a patch that was modified. Push this flag into the clients. | 788 | // Found a patch that was modified. Push this flag into the clients. |
932 | SendToClients(terrData, x, y); | 789 | SendToClients(terrData, x, y); |
@@ -944,10 +801,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
944 | m_scene.EventManager.TriggerTerrainTainted(); | 801 | m_scene.EventManager.TriggerTerrainTainted(); |
945 | m_tainted = true; | 802 | m_tainted = true; |
946 | } | 803 | } |
947 | <<<<<<< HEAD | ||
948 | ======= | ||
949 | |||
950 | >>>>>>> avn/ubitvar | ||
951 | } | 804 | } |
952 | 805 | ||
953 | /// <summary> | 806 | /// <summary> |
@@ -1016,14 +869,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1016 | presence.ControllingClient.OnLandUndo -= client_OnLandUndo; | 869 | presence.ControllingClient.OnLandUndo -= client_OnLandUndo; |
1017 | presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; | 870 | presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; |
1018 | } | 871 | } |
1019 | <<<<<<< HEAD | ||
1020 | |||
1021 | lock(m_perClientPatchUpdates) | ||
1022 | m_perClientPatchUpdates.Remove(client); | ||
1023 | } | ||
1024 | ======= | ||
1025 | >>>>>>> avn/ubitvar | ||
1026 | |||
1027 | lock (m_perClientPatchUpdates) | 872 | lock (m_perClientPatchUpdates) |
1028 | m_perClientPatchUpdates.Remove(client); | 873 | m_perClientPatchUpdates.Remove(client); |
1029 | } | 874 | } |
@@ -1038,21 +883,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1038 | TerrainData terrData = m_channel.GetTerrainData(); | 883 | TerrainData terrData = m_channel.GetTerrainData(); |
1039 | 884 | ||
1040 | bool wasLimited = false; | 885 | bool wasLimited = false; |
1041 | <<<<<<< HEAD | ||
1042 | for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | ||
1043 | { | ||
1044 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | ||
1045 | { | ||
1046 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) | ||
1047 | { | ||
1048 | ======= | ||
1049 | for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | 886 | for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) |
1050 | { | 887 | { |
1051 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | 888 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) |
1052 | { | 889 | { |
1053 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) | 890 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) |
1054 | { | 891 | { |
1055 | >>>>>>> avn/ubitvar | ||
1056 | // If we should respect the estate settings then | 892 | // If we should respect the estate settings then |
1057 | // fixup and height deltas that don't respect them. | 893 | // fixup and height deltas that don't respect them. |
1058 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. | 894 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. |
@@ -1075,22 +911,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1075 | float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; | 911 | float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; |
1076 | 912 | ||
1077 | // loop through the height map for this patch and compare it against | 913 | // loop through the height map for this patch and compare it against |
1078 | <<<<<<< HEAD | ||
1079 | // the revert map | ||
1080 | for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) | ||
1081 | ======= | ||
1082 | // the baked map | 914 | // the baked map |
1083 | for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) | 915 | for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) |
1084 | >>>>>>> avn/ubitvar | ||
1085 | { | 916 | { |
1086 | for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) | 917 | for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) |
1087 | { | 918 | { |
1088 | float requestedHeight = terrData[x, y]; | 919 | float requestedHeight = terrData[x, y]; |
1089 | <<<<<<< HEAD | ||
1090 | float bakedHeight = (float)m_revert[x, y]; | ||
1091 | ======= | ||
1092 | float bakedHeight = (float)m_baked[x, y]; | 920 | float bakedHeight = (float)m_baked[x, y]; |
1093 | >>>>>>> avn/ubitvar | ||
1094 | float requestedDelta = requestedHeight - bakedHeight; | 921 | float requestedDelta = requestedHeight - bakedHeight; |
1095 | 922 | ||
1096 | if (requestedDelta > maxDelta) | 923 | if (requestedDelta > maxDelta) |
@@ -1111,19 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1111 | 938 | ||
1112 | private void client_OnLandUndo(IClientAPI client) | 939 | private void client_OnLandUndo(IClientAPI client) |
1113 | { | 940 | { |
1114 | <<<<<<< HEAD | ||
1115 | lock(m_undo) | ||
1116 | { | ||
1117 | if (m_undo.Count > 0) | ||
1118 | { | ||
1119 | LandUndoState goback = m_undo.Pop(); | ||
1120 | if (goback != null) | ||
1121 | goback.PlaybackState(); | ||
1122 | } | ||
1123 | } | ||
1124 | ======= | ||
1125 | |||
1126 | >>>>>>> avn/ubitvar | ||
1127 | } | 941 | } |
1128 | 942 | ||
1129 | /// <summary> | 943 | /// <summary> |
@@ -1133,175 +947,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1133 | /// <param name="x">The patch corner to send</param> | 947 | /// <param name="x">The patch corner to send</param> |
1134 | /// <param name="y">The patch corner to send</param> | 948 | /// <param name="y">The patch corner to send</param> |
1135 | private void SendToClients(TerrainData terrData, int x, int y) | 949 | private void SendToClients(TerrainData terrData, int x, int y) |
1136 | <<<<<<< HEAD | ||
1137 | { | ||
1138 | if (m_sendTerrainUpdatesByViewDistance) | ||
1139 | { | ||
1140 | // Add that this patch needs to be sent to the accounting for each client. | ||
1141 | lock(m_perClientPatchUpdates) | ||
1142 | { | ||
1143 | m_scene.ForEachScenePresence(presence => | ||
1144 | { | ||
1145 | PatchUpdates thisClientUpdates; | ||
1146 | if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates)) | ||
1147 | { | ||
1148 | // There is a ScenePresence without a send patch map. Create one. | ||
1149 | thisClientUpdates = new PatchUpdates(terrData, presence); | ||
1150 | m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates); | ||
1151 | } | ||
1152 | thisClientUpdates.SetByXY(x, y, true); | ||
1153 | } | ||
1154 | ); | ||
1155 | } | ||
1156 | } | ||
1157 | else | ||
1158 | { | ||
1159 | // Legacy update sending where the update is sent out as soon as noticed | ||
1160 | // We know the actual terrain data that is passed is ignored so this passes a dummy heightmap. | ||
1161 | //float[] heightMap = terrData.GetFloatsSerialized(); | ||
1162 | float[] heightMap = new float[10]; | ||
1163 | m_scene.ForEachClient( | ||
1164 | delegate(IClientAPI controller) | ||
1165 | { | ||
1166 | controller.SendLayerData(x / Constants.TerrainPatchSize, | ||
1167 | y / Constants.TerrainPatchSize, | ||
1168 | heightMap); | ||
1169 | } | ||
1170 | ); | ||
1171 | } | ||
1172 | } | ||
1173 | |||
1174 | private class PatchesToSend : IComparable<PatchesToSend> | ||
1175 | { | ||
1176 | public int PatchX; | ||
1177 | public int PatchY; | ||
1178 | public float Dist; | ||
1179 | |||
1180 | public PatchesToSend(int pX, int pY, float pDist) | ||
1181 | { | ||
1182 | PatchX = pX; | ||
1183 | PatchY = pY; | ||
1184 | Dist = pDist; | ||
1185 | } | ||
1186 | |||
1187 | public int CompareTo(PatchesToSend other) | ||
1188 | { | ||
1189 | return Dist.CompareTo(other.Dist); | ||
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | // Called each frame time to see if there are any patches to send to any of the | ||
1194 | // ScenePresences. | ||
1195 | // We know this is only called if we are doing view distance patch sending so some | ||
1196 | // tests are not made. | ||
1197 | // Loop through all the per-client info and send any patches necessary. | ||
1198 | private void CheckSendingPatchesToClients() | ||
1199 | { | ||
1200 | lock(m_perClientPatchUpdates) | ||
1201 | { | ||
1202 | foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) | ||
1203 | { | ||
1204 | if (pups.HasUpdates()) | ||
1205 | { | ||
1206 | // There is something that could be sent to this client. | ||
1207 | List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups); | ||
1208 | if (toSend.Count > 0) | ||
1209 | { | ||
1210 | // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}", | ||
1211 | // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName); | ||
1212 | // Sort the patches to send by the distance from the presence | ||
1213 | toSend.Sort(); | ||
1214 | /* old way that sent individual patches | ||
1215 | foreach (PatchesToSend pts in toSend) | ||
1216 | { | ||
1217 | pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null); | ||
1218 | // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land); | ||
1219 | } | ||
1220 | */ | ||
1221 | |||
1222 | // new way that sends all patches to the protocol so they can be sent in one block | ||
1223 | int[] xPieces = new int[toSend.Count]; | ||
1224 | int[] yPieces = new int[toSend.Count]; | ||
1225 | float[] patchPieces = new float[toSend.Count * 2]; | ||
1226 | int pieceIndex = 0; | ||
1227 | foreach(PatchesToSend pts in toSend) | ||
1228 | { | ||
1229 | patchPieces[pieceIndex++] = pts.PatchX; | ||
1230 | patchPieces[pieceIndex++] = pts.PatchY; | ||
1231 | } | ||
1232 | pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces); | ||
1233 | } | ||
1234 | } | ||
1235 | } | ||
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | // Compute a list of modified patches that are within our view distance. | ||
1240 | private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups) | ||
1241 | { | ||
1242 | List<PatchesToSend> ret = new List<PatchesToSend>(); | ||
1243 | |||
1244 | ScenePresence presence = pups.Presence; | ||
1245 | if (presence == null) | ||
1246 | return ret; | ||
1247 | |||
1248 | Vector3 presencePos = presence.AbsolutePosition; | ||
1249 | |||
1250 | // Before this distance check, the whole region just showed up. Adding the distance | ||
1251 | // check causes different things to happen for the current and adjacent regions. | ||
1252 | // So, to keep legacy views, if the region is legacy sized, don't do distance check. | ||
1253 | bool isLegacySizedRegion = pups.Terrain.SizeX == Constants.RegionSize && pups.Terrain.SizeY == Constants.RegionSize; | ||
1254 | bool shouldCheckViewDistance = m_sendTerrainUpdatesByViewDistance && !isLegacySizedRegion; | ||
1255 | |||
1256 | int startX = 0; | ||
1257 | int endX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize; | ||
1258 | int startY = 0; | ||
1259 | int endY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize; | ||
1260 | |||
1261 | // The following only reduces the size of area scanned for updates. Only significant for very large varregions. | ||
1262 | if (shouldCheckViewDistance) | ||
1263 | { | ||
1264 | // Compute the area of patches within our draw distance | ||
1265 | startX = (((int)(presencePos.X - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2; | ||
1266 | startX = Math.Max(startX, 0); | ||
1267 | startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize); | ||
1268 | startY = (((int)(presencePos.Y - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2; | ||
1269 | startY = Math.Max(startY, 0); | ||
1270 | startY = Math.Min(startY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize); | ||
1271 | endX = (((int)(presencePos.X + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2; | ||
1272 | endX = Math.Max(endX, 0); | ||
1273 | endX = Math.Min(endX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize); | ||
1274 | endY = (((int)(presencePos.Y + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2; | ||
1275 | endY = Math.Max(endY, 0); | ||
1276 | endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize); | ||
1277 | } | ||
1278 | |||
1279 | // m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. rName={1}, ddist={2}, apos={3}, cpos={4}, isChild={5}, start=<{6},{7}>, end=<{8},{9}>", | ||
1280 | // LogHeader, m_scene.RegionInfo.RegionName, | ||
1281 | // presence.DrawDistance, presencePos, presence.CameraPosition, | ||
1282 | // isLegacySizeChildRegion, | ||
1283 | // startX, startY, endX, endY); | ||
1284 | for(int x = startX; x < endX; x++) | ||
1285 | { | ||
1286 | for(int y = startY; y < endY; y++) | ||
1287 | { | ||
1288 | //Need to make sure we don't send the same ones over and over | ||
1289 | Vector3 patchPos = new Vector3(x * Constants.TerrainPatchSize, y * Constants.TerrainPatchSize, presencePos.Z); | ||
1290 | if (pups.GetByPatch(x, y)) | ||
1291 | { | ||
1292 | //Check which has less distance, camera or avatar position, both have to be done. | ||
1293 | //Its not a radius, its a diameter and we add 50 so that it doesn't look like it cuts off | ||
1294 | if (!shouldCheckViewDistance | ||
1295 | || Util.DistanceLessThan(presencePos, patchPos, presence.DrawDistance + 50) | ||
1296 | || Util.DistanceLessThan(presence.CameraPosition, patchPos, presence.DrawDistance + 50)) | ||
1297 | { | ||
1298 | //They can see it, send it to them | ||
1299 | pups.SetByPatch(x, y, false); | ||
1300 | float dist = Vector3.DistanceSquared(presencePos, patchPos); | ||
1301 | ret.Add(new PatchesToSend(x, y, dist)); | ||
1302 | } | ||
1303 | } | ||
1304 | ======= | ||
1305 | { | 950 | { |
1306 | // Add that this patch needs to be sent to the accounting for each client. | 951 | // Add that this patch needs to be sent to the accounting for each client. |
1307 | lock (m_perClientPatchUpdates) | 952 | lock (m_perClientPatchUpdates) |
@@ -1475,7 +1120,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1475 | } | 1120 | } |
1476 | } | 1121 | } |
1477 | } | 1122 | } |
1478 | >>>>>>> avn/ubitvar | ||
1479 | } | 1123 | } |
1480 | } | 1124 | } |
1481 | return ret; | 1125 | return ret; |
@@ -1499,24 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1499 | int zx = (int)(west + 0.5); | 1143 | int zx = (int)(west + 0.5); |
1500 | int zy = (int)(north + 0.5); | 1144 | int zy = (int)(north + 0.5); |
1501 | 1145 | ||
1502 | <<<<<<< HEAD | ||
1503 | int dx; | ||
1504 | for(dx=-n; dx<=n; dx++) | ||
1505 | { | ||
1506 | int dy; | ||
1507 | for(dy=-n; dy<=n; dy++) | ||
1508 | { | ||
1509 | int x = zx + dx; | ||
1510 | int y = zy + dy; | ||
1511 | if (x >= 0 && y >= 0 && x < m_channel.Width && y < m_channel.Height) | ||
1512 | { | ||
1513 | if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) | ||
1514 | { | ||
1515 | allowMask[x, y] = true; | ||
1516 | allowed = true; | ||
1517 | } | ||
1518 | ======= | ||
1519 | |||
1520 | int startX = zx - n; | 1146 | int startX = zx - n; |
1521 | if (startX < 0) | 1147 | if (startX < 0) |
1522 | startX = 0; | 1148 | startX = 0; |
@@ -1542,25 +1168,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1542 | { | 1168 | { |
1543 | allowMask[x, y] = true; | 1169 | allowMask[x, y] = true; |
1544 | allowed = true; | 1170 | allowed = true; |
1545 | >>>>>>> avn/ubitvar | ||
1546 | } | 1171 | } |
1547 | } | 1172 | } |
1548 | } | 1173 | } |
1549 | if (allowed) | 1174 | if (allowed) |
1550 | { | 1175 | { |
1551 | StoreUndoState(); | 1176 | StoreUndoState(); |
1552 | <<<<<<< HEAD | ||
1553 | m_painteffects[(StandardTerrainEffects)action].PaintEffect( | ||
1554 | m_channel, allowMask, west, south, height, size, seconds); | ||
1555 | |||
1556 | //revert changes outside estate limits | ||
1557 | ======= | ||
1558 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( | 1177 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( |
1559 | m_channel, allowMask, west, south, height, size, seconds, | 1178 | m_channel, allowMask, west, south, height, size, seconds, |
1560 | startX, endX, startY, endY); | 1179 | startX, endX, startY, endY); |
1561 | 1180 | ||
1562 | //block changes outside estate limits | 1181 | //block changes outside estate limits |
1563 | >>>>>>> avn/ubitvar | ||
1564 | if (!god) | 1182 | if (!god) |
1565 | EnforceEstateLimits(); | 1183 | EnforceEstateLimits(); |
1566 | } | 1184 | } |
@@ -1577,22 +1195,42 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1577 | bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; | 1195 | bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; |
1578 | fillArea.Initialize(); | 1196 | fillArea.Initialize(); |
1579 | 1197 | ||
1580 | int x; | 1198 | int startX = (int)west; |
1581 | for(x = 0; x < m_channel.Width; x++) | 1199 | int startY = (int)south; |
1200 | int endX = (int)east; | ||
1201 | int endY = (int)north; | ||
1202 | |||
1203 | if (startX < 0) | ||
1204 | startX = 0; | ||
1205 | else if (startX >= m_channel.Width) | ||
1206 | startX = m_channel.Width - 1; | ||
1207 | |||
1208 | if (endX < 0) | ||
1209 | endX = 0; | ||
1210 | else if (endX >= m_channel.Width) | ||
1211 | endX = m_channel.Width - 1; | ||
1212 | |||
1213 | if (startY < 0) | ||
1214 | startY = 0; | ||
1215 | else if (startY >= m_channel.Height) | ||
1216 | startY = m_channel.Height - 1; | ||
1217 | |||
1218 | if (endY < 0) | ||
1219 | endY = 0; | ||
1220 | else if (endY >= m_channel.Height) | ||
1221 | endY = m_channel.Height - 1; | ||
1222 | |||
1223 | |||
1224 | int x, y; | ||
1225 | |||
1226 | for (x = startX; x <= endX; x++) | ||
1582 | { | 1227 | { |
1583 | int y; | 1228 | for (y = startY; y <= endY; y++) |
1584 | for(y = 0; y < m_channel.Height; y++) | ||
1585 | { | 1229 | { |
1586 | if (x < east && x > west) | 1230 | if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) |
1587 | { | 1231 | { |
1588 | if (y < north && y > south) | 1232 | fillArea[x, y] = true; |
1589 | { | 1233 | allowed = true; |
1590 | if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) | ||
1591 | { | ||
1592 | fillArea[x, y] = true; | ||
1593 | allowed = true; | ||
1594 | } | ||
1595 | } | ||
1596 | } | 1234 | } |
1597 | } | 1235 | } |
1598 | } | 1236 | } |
@@ -1600,15 +1238,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1600 | if (allowed) | 1238 | if (allowed) |
1601 | { | 1239 | { |
1602 | StoreUndoState(); | 1240 | StoreUndoState(); |
1603 | <<<<<<< HEAD | 1241 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size, |
1604 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); | 1242 | startX, endX, startY, endY); |
1605 | |||
1606 | //revert changes outside estate limits | ||
1607 | ======= | ||
1608 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size); | ||
1609 | 1243 | ||
1610 | //block changes outside estate limits | 1244 | //block changes outside estate limits |
1611 | >>>>>>> avn/ubitvar | ||
1612 | if (!god) | 1245 | if (!god) |
1613 | EnforceEstateLimits(); | 1246 | EnforceEstateLimits(); |
1614 | } | 1247 | } |
@@ -1641,52 +1274,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1641 | 1274 | ||
1642 | private void StoreUndoState() | 1275 | private void StoreUndoState() |
1643 | { | 1276 | { |
1644 | <<<<<<< HEAD | ||
1645 | lock(m_undo) | ||
1646 | { | ||
1647 | if (m_undo.Count > 0) | ||
1648 | { | ||
1649 | LandUndoState last = m_undo.Peek(); | ||
1650 | if (last != null) | ||
1651 | { | ||
1652 | if (last.Compare(m_channel)) | ||
1653 | return; | ||
1654 | } | ||
1655 | } | ||
1656 | |||
1657 | LandUndoState nUndo = new LandUndoState(this, m_channel); | ||
1658 | m_undo.Push(nUndo); | ||
1659 | } | ||
1660 | ======= | ||
1661 | >>>>>>> avn/ubitvar | ||
1662 | } | 1277 | } |
1663 | 1278 | ||
1664 | #region Console Commands | 1279 | #region Console Commands |
1665 | 1280 | ||
1666 | private void InterfaceLoadFile(Object[] args) | 1281 | private void InterfaceLoadFile(Object[] args) |
1667 | { | 1282 | { |
1668 | <<<<<<< HEAD | ||
1669 | LoadFromFile((string)args[0]); | ||
1670 | ======= | ||
1671 | LoadFromFile((string) args[0]); | 1283 | LoadFromFile((string) args[0]); |
1672 | >>>>>>> avn/ubitvar | ||
1673 | } | 1284 | } |
1674 | 1285 | ||
1675 | private void InterfaceLoadTileFile(Object[] args) | 1286 | private void InterfaceLoadTileFile(Object[] args) |
1676 | { | 1287 | { |
1677 | <<<<<<< HEAD | ||
1678 | LoadFromFile((string)args[0], | ||
1679 | (int)args[1], | ||
1680 | (int)args[2], | ||
1681 | (int)args[3], | ||
1682 | (int)args[4]); | ||
1683 | ======= | ||
1684 | LoadFromFile((string) args[0], | 1288 | LoadFromFile((string) args[0], |
1685 | (int) args[1], | 1289 | (int) args[1], |
1686 | (int) args[2], | 1290 | (int) args[2], |
1687 | (int) args[3], | 1291 | (int) args[3], |
1688 | (int) args[4]); | 1292 | (int) args[4]); |
1689 | >>>>>>> avn/ubitvar | ||
1690 | } | 1293 | } |
1691 | 1294 | ||
1692 | private void InterfaceSaveFile(Object[] args) | 1295 | private void InterfaceSaveFile(Object[] args) |
@@ -1711,15 +1314,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1711 | private void InterfaceRevertTerrain(Object[] args) | 1314 | private void InterfaceRevertTerrain(Object[] args) |
1712 | { | 1315 | { |
1713 | int x, y; | 1316 | int x, y; |
1714 | <<<<<<< HEAD | ||
1715 | for(x = 0; x < m_channel.Width; x++) | ||
1716 | for(y = 0; y < m_channel.Height; y++) | ||
1717 | m_channel[x, y] = m_revert[x, y]; | ||
1718 | ======= | ||
1719 | for (x = 0; x < m_channel.Width; x++) | 1317 | for (x = 0; x < m_channel.Width; x++) |
1720 | for (y = 0; y < m_channel.Height; y++) | 1318 | for (y = 0; y < m_channel.Height; y++) |
1721 | m_channel[x, y] = m_baked[x, y]; | 1319 | m_channel[x, y] = m_baked[x, y]; |
1722 | >>>>>>> avn/ubitvar | ||
1723 | 1320 | ||
1724 | } | 1321 | } |
1725 | 1322 | ||
@@ -1729,15 +1326,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1729 | 1326 | ||
1730 | if (direction.ToLower().StartsWith("y")) | 1327 | if (direction.ToLower().StartsWith("y")) |
1731 | { | 1328 | { |
1732 | <<<<<<< HEAD | ||
1733 | for(int x = 0; x < m_channel.Width; x++) | ||
1734 | { | ||
1735 | for(int y = 0; y < m_channel.Height / 2; y++) | ||
1736 | ======= | ||
1737 | for (int x = 0; x < m_channel.Width; x++) | 1329 | for (int x = 0; x < m_channel.Width; x++) |
1738 | { | 1330 | { |
1739 | for (int y = 0; y < m_channel.Height / 2; y++) | 1331 | for (int y = 0; y < m_channel.Height / 2; y++) |
1740 | >>>>>>> avn/ubitvar | ||
1741 | { | 1332 | { |
1742 | double height = m_channel[x, y]; | 1333 | double height = m_channel[x, y]; |
1743 | double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; | 1334 | double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; |
@@ -1749,15 +1340,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1749 | } | 1340 | } |
1750 | else if (direction.ToLower().StartsWith("x")) | 1341 | else if (direction.ToLower().StartsWith("x")) |
1751 | { | 1342 | { |
1752 | <<<<<<< HEAD | ||
1753 | for(int y = 0; y < m_channel.Height; y++) | ||
1754 | { | ||
1755 | for(int x = 0; x < m_channel.Width / 2; x++) | ||
1756 | ======= | ||
1757 | for (int y = 0; y < m_channel.Height; y++) | 1343 | for (int y = 0; y < m_channel.Height; y++) |
1758 | { | 1344 | { |
1759 | for (int x = 0; x < m_channel.Width / 2; x++) | 1345 | for (int x = 0; x < m_channel.Width / 2; x++) |
1760 | >>>>>>> avn/ubitvar | ||
1761 | { | 1346 | { |
1762 | double height = m_channel[x, y]; | 1347 | double height = m_channel[x, y]; |
1763 | double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; | 1348 | double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; |
@@ -1837,47 +1422,29 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1837 | double val = (double)args[0]; | 1422 | double val = (double)args[0]; |
1838 | 1423 | ||
1839 | int x, y; | 1424 | int x, y; |
1840 | <<<<<<< HEAD | ||
1841 | for(x = 0; x < m_channel.Width; x++) | ||
1842 | for(y = 0; y < m_channel.Height; y++) | ||
1843 | m_channel[x, y] += (double)args[0]; | ||
1844 | ======= | ||
1845 | for (x = 0; x < m_channel.Width; x++) | 1425 | for (x = 0; x < m_channel.Width; x++) |
1846 | for (y = 0; y < m_channel.Height; y++) | 1426 | for (y = 0; y < m_channel.Height; y++) |
1847 | m_channel[x, y] += val; | 1427 | m_channel[x, y] += val; |
1848 | >>>>>>> avn/ubitvar | ||
1849 | } | 1428 | } |
1850 | 1429 | ||
1851 | private void InterfaceMultiplyTerrain(Object[] args) | 1430 | private void InterfaceMultiplyTerrain(Object[] args) |
1852 | { | 1431 | { |
1853 | int x, y; | 1432 | int x, y; |
1854 | <<<<<<< HEAD | ||
1855 | for(x = 0; x < m_channel.Width; x++) | ||
1856 | for(y = 0; y < m_channel.Height; y++) | ||
1857 | m_channel[x, y] *= (double)args[0]; | ||
1858 | ======= | ||
1859 | double val = (double)args[0]; | 1433 | double val = (double)args[0]; |
1860 | 1434 | ||
1861 | for (x = 0; x < m_channel.Width; x++) | 1435 | for (x = 0; x < m_channel.Width; x++) |
1862 | for (y = 0; y < m_channel.Height; y++) | 1436 | for (y = 0; y < m_channel.Height; y++) |
1863 | m_channel[x, y] *= val; | 1437 | m_channel[x, y] *= val; |
1864 | >>>>>>> avn/ubitvar | ||
1865 | } | 1438 | } |
1866 | 1439 | ||
1867 | private void InterfaceLowerTerrain(Object[] args) | 1440 | private void InterfaceLowerTerrain(Object[] args) |
1868 | { | 1441 | { |
1869 | int x, y; | 1442 | int x, y; |
1870 | <<<<<<< HEAD | ||
1871 | for(x = 0; x < m_channel.Width; x++) | ||
1872 | for(y = 0; y < m_channel.Height; y++) | ||
1873 | m_channel[x, y] -= (double)args[0]; | ||
1874 | ======= | ||
1875 | double val = (double)args[0]; | 1443 | double val = (double)args[0]; |
1876 | 1444 | ||
1877 | for (x = 0; x < m_channel.Width; x++) | 1445 | for (x = 0; x < m_channel.Width; x++) |
1878 | for (y = 0; y < m_channel.Height; y++) | 1446 | for (y = 0; y < m_channel.Height; y++) |
1879 | m_channel[x, y] -= val; | 1447 | m_channel[x, y] -= val; |
1880 | >>>>>>> avn/ubitvar | ||
1881 | } | 1448 | } |
1882 | 1449 | ||
1883 | public void InterfaceFillTerrain(Object[] args) | 1450 | public void InterfaceFillTerrain(Object[] args) |
@@ -1885,26 +1452,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1885 | int x, y; | 1452 | int x, y; |
1886 | double val = (double)args[0]; | 1453 | double val = (double)args[0]; |
1887 | 1454 | ||
1888 | <<<<<<< HEAD | ||
1889 | for(x = 0; x < m_channel.Width; x++) | ||
1890 | for(y = 0; y < m_channel.Height; y++) | ||
1891 | m_channel[x, y] = (double)args[0]; | ||
1892 | ======= | ||
1893 | for (x = 0; x < m_channel.Width; x++) | 1455 | for (x = 0; x < m_channel.Width; x++) |
1894 | for (y = 0; y < m_channel.Height; y++) | 1456 | for (y = 0; y < m_channel.Height; y++) |
1895 | m_channel[x, y] = val; | 1457 | m_channel[x, y] = val; |
1896 | >>>>>>> avn/ubitvar | ||
1897 | } | 1458 | } |
1898 | 1459 | ||
1899 | private void InterfaceMinTerrain(Object[] args) | 1460 | private void InterfaceMinTerrain(Object[] args) |
1900 | { | 1461 | { |
1901 | int x, y; | 1462 | int x, y; |
1902 | <<<<<<< HEAD | ||
1903 | for(x = 0; x < m_channel.Width; x++) | ||
1904 | ======= | ||
1905 | double val = (double)args[0]; | 1463 | double val = (double)args[0]; |
1906 | for (x = 0; x < m_channel.Width; x++) | 1464 | for (x = 0; x < m_channel.Width; x++) |
1907 | >>>>>>> avn/ubitvar | ||
1908 | { | 1465 | { |
1909 | for(y = 0; y < m_channel.Height; y++) | 1466 | for(y = 0; y < m_channel.Height; y++) |
1910 | { | 1467 | { |
@@ -1916,19 +1473,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1916 | private void InterfaceMaxTerrain(Object[] args) | 1473 | private void InterfaceMaxTerrain(Object[] args) |
1917 | { | 1474 | { |
1918 | int x, y; | 1475 | int x, y; |
1919 | <<<<<<< HEAD | ||
1920 | for(x = 0; x < m_channel.Width; x++) | ||
1921 | ======= | ||
1922 | double val = (double)args[0]; | 1476 | double val = (double)args[0]; |
1923 | for (x = 0; x < m_channel.Width; x++) | 1477 | for (x = 0; x < m_channel.Width; x++) |
1924 | >>>>>>> avn/ubitvar | ||
1925 | { | 1478 | { |
1926 | for(y = 0; y < m_channel.Height; y++) | 1479 | for(y = 0; y < m_channel.Height; y++) |
1927 | { | 1480 | { |
1928 | m_channel[x, y] = Math.Min(val, m_channel[x, y]); | 1481 | m_channel[x, y] = Math.Min(val, m_channel[x, y]); |
1929 | } | 1482 | } |
1930 | } | 1483 | } |
1931 | <<<<<<< HEAD | ||
1932 | } | 1484 | } |
1933 | 1485 | ||
1934 | private void InterfaceShow(Object[] args) | 1486 | private void InterfaceShow(Object[] args) |
@@ -1944,8 +1496,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1944 | double height = m_channel[(int)point.X, (int)point.Y]; | 1496 | double height = m_channel[(int)point.X, (int)point.Y]; |
1945 | 1497 | ||
1946 | Console.WriteLine("Terrain height at {0} is {1}", point, height); | 1498 | Console.WriteLine("Terrain height at {0} is {1}", point, height); |
1947 | ======= | ||
1948 | >>>>>>> avn/ubitvar | ||
1949 | } | 1499 | } |
1950 | 1500 | ||
1951 | private void InterfaceShowDebugStats(Object[] args) | 1501 | private void InterfaceShowDebugStats(Object[] args) |
@@ -2157,6 +1707,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
2157 | 1707 | ||
2158 | public void ModifyCommand(string module, string[] cmd) | 1708 | public void ModifyCommand(string module, string[] cmd) |
2159 | { | 1709 | { |
1710 | /* | ||
2160 | string result; | 1711 | string result; |
2161 | Scene scene = SceneManager.Instance.CurrentScene; | 1712 | Scene scene = SceneManager.Instance.CurrentScene; |
2162 | if ((scene != null) && (scene != m_scene)) | 1713 | if ((scene != null) && (scene != m_scene)) |
@@ -2196,6 +1747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
2196 | { | 1747 | { |
2197 | MainConsole.Instance.Output(result); | 1748 | MainConsole.Instance.Output(result); |
2198 | } | 1749 | } |
1750 | */ | ||
2199 | } | 1751 | } |
2200 | 1752 | ||
2201 | #endregion | 1753 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 40db370..b209b33 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -60,12 +60,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
60 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); | 60 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
61 | ITerrainPaintableEffect effect = new RaiseSphere(); | 61 | ITerrainPaintableEffect effect = new RaiseSphere(); |
62 | 62 | ||
63 | <<<<<<< HEAD | ||
64 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); | ||
65 | ======= | ||
66 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, | 63 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, |
67 | 0, midRegion - 1,0, (int)Constants.RegionSize -1); | 64 | 0, midRegion - 1,0, (int)Constants.RegionSize -1); |
68 | >>>>>>> avn/ubitvar | ||
69 | Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); | 65 | Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); |
70 | Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); | 66 | Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); |
71 | Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); | 67 | Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); |
@@ -84,12 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
84 | } | 80 | } |
85 | effect = new LowerSphere(); | 81 | effect = new LowerSphere(); |
86 | 82 | ||
87 | <<<<<<< HEAD | ||
88 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); | ||
89 | ======= | ||
90 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, | 83 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, |
91 | 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); | 84 | 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); |
92 | >>>>>>> avn/ubitvar | ||
93 | Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); | 85 | Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); |
94 | Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); | 86 | Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); |
95 | Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); | 87 | Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); |