diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 22 |
2 files changed, 17 insertions, 16 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7175d83..64b9abb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
685 | 685 | ||
686 | private void UpdateTerrain() | 686 | private void UpdateTerrain() |
687 | { | 687 | { |
688 | if (Terrain.Tainted() && !Terrain.StillEditing()) | 688 | if (Terrain.IsTainted() && !Terrain.IsUserStillEditing()) |
689 | { | 689 | { |
690 | CreateTerrainTexture(true); | 690 | CreateTerrainTexture(true); |
691 | 691 | ||
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
706 | { | 706 | { |
707 | for (int y = 0; y < 16; y++) | 707 | for (int y = 0; y < 16; y++) |
708 | { | 708 | { |
709 | if (Terrain.Tainted(x*16, y*16)) | 709 | if (Terrain.IsTainted(x*16, y*16)) |
710 | { | 710 | { |
711 | client.SendLayerData(x, y, terData); | 711 | client.SendLayerData(x, y, terData); |
712 | } | 712 | } |
@@ -807,6 +807,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
807 | public void LoadWorldMap(string filename) | 807 | public void LoadWorldMap(string filename) |
808 | { | 808 | { |
809 | Terrain.LoadFromFileF32(filename); | 809 | Terrain.LoadFromFileF32(filename); |
810 | Terrain.SaveRevertMap(); | ||
810 | } | 811 | } |
811 | 812 | ||
812 | /// <summary> | 813 | /// <summary> |
@@ -823,7 +824,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
823 | if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile)) | 824 | if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile)) |
824 | { | 825 | { |
825 | MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); | 826 | MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain."); |
826 | Terrain.HillsGenerator(); | 827 | Terrain.SetDefaultTerrain(); |
827 | 828 | ||
828 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); | 829 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
829 | } | 830 | } |
@@ -838,7 +839,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
838 | { | 839 | { |
839 | MainLog.Instance.Verbose("TERRAIN", | 840 | MainLog.Instance.Verbose("TERRAIN", |
840 | "No terrain found in database or default. Generating a new terrain."); | 841 | "No terrain found in database or default. Generating a new terrain."); |
841 | Terrain.HillsGenerator(); | 842 | Terrain.SetDefaultTerrain(); |
842 | } | 843 | } |
843 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); | 844 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
844 | } | 845 | } |
@@ -885,7 +886,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
885 | public void CreateTerrainTexture(bool temporary) | 886 | public void CreateTerrainTexture(bool temporary) |
886 | { | 887 | { |
887 | //create a texture asset of the terrain | 888 | //create a texture asset of the terrain |
888 | byte[] data = Terrain.ExportJpegImage("defaultstripe.png"); | 889 | byte[] data = Terrain.WriteJpegImage("defaultstripe.png"); |
889 | m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); | 890 | m_regInfo.EstateSettings.terrainImageID = LLUUID.Random(); |
890 | AssetBase asset = new AssetBase(); | 891 | AssetBase asset = new AssetBase(); |
891 | asset.FullID = m_regInfo.EstateSettings.terrainImageID; | 892 | asset.FullID = m_regInfo.EstateSettings.terrainImageID; |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index fdbbb5e..7605122 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -123,12 +123,12 @@ namespace OpenSim.Region.Terrain | |||
123 | tainted++; | 123 | tainted++; |
124 | } | 124 | } |
125 | 125 | ||
126 | public bool Tainted() | 126 | public bool IsTainted() |
127 | { | 127 | { |
128 | return (tainted != 0); | 128 | return (tainted != 0); |
129 | } | 129 | } |
130 | 130 | ||
131 | public bool StillEditing() | 131 | public bool IsUserStillEditing() |
132 | { | 132 | { |
133 | TimeSpan gap = DateTime.Now - lastEdit; | 133 | TimeSpan gap = DateTime.Now - lastEdit; |
134 | 134 | ||
@@ -138,7 +138,7 @@ namespace OpenSim.Region.Terrain | |||
138 | return false; | 138 | return false; |
139 | } | 139 | } |
140 | 140 | ||
141 | public bool Tainted(int x, int y) | 141 | public bool IsTainted(int x, int y) |
142 | { | 142 | { |
143 | return (heightmap.diff[x/16, y/16] != 0); | 143 | return (heightmap.diff[x/16, y/16] != 0); |
144 | } | 144 | } |
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Terrain | |||
284 | { | 284 | { |
285 | for (int y = 0; y < 16; y++) | 285 | for (int y = 0; y < 16; y++) |
286 | { | 286 | { |
287 | if (Tainted(x*16, y*16)) | 287 | if (IsTainted(x*16, y*16)) |
288 | { | 288 | { |
289 | remoteUser.SendLayerData(x, y, GetHeights1D()); | 289 | remoteUser.SendLayerData(x, y, GetHeights1D()); |
290 | } | 290 | } |
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Terrain | |||
300 | /// <summary> | 300 | /// <summary> |
301 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower | 301 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower |
302 | /// </summary> | 302 | /// </summary> |
303 | public void CheckHeightValues() | 303 | private void SetTerrainWithinBounds() |
304 | { | 304 | { |
305 | int x, y; | 305 | int x, y; |
306 | for (x = 0; x < w; x++) | 306 | for (x = 0; x < w; x++) |
@@ -518,7 +518,7 @@ namespace OpenSim.Region.Terrain | |||
518 | return ConsoleHills(args, ref resultText); | 518 | return ConsoleHills(args, ref resultText); |
519 | 519 | ||
520 | case "regenerate": | 520 | case "regenerate": |
521 | HillsGenerator(); | 521 | SetDefaultTerrain(); |
522 | break; | 522 | break; |
523 | 523 | ||
524 | case "rescale": | 524 | case "rescale": |
@@ -618,9 +618,9 @@ namespace OpenSim.Region.Terrain | |||
618 | 618 | ||
619 | case "grdmap": | 619 | case "grdmap": |
620 | if (args.Length >= 4) | 620 | if (args.Length >= 4) |
621 | ExportImage(filename, args[3]); | 621 | WriteImage(filename, args[3]); |
622 | else | 622 | else |
623 | ExportImage(filename, "defaultstripe.png"); | 623 | WriteImage(filename, "defaultstripe.png"); |
624 | break; | 624 | break; |
625 | 625 | ||
626 | case "png": | 626 | case "png": |
@@ -1272,7 +1272,7 @@ namespace OpenSim.Region.Terrain | |||
1272 | /// <summary> | 1272 | /// <summary> |
1273 | /// Generates a simple set of hills in the shape of an island | 1273 | /// Generates a simple set of hills in the shape of an island |
1274 | /// </summary> | 1274 | /// </summary> |
1275 | public void HillsGenerator() | 1275 | public void SetDefaultTerrain() |
1276 | { | 1276 | { |
1277 | lock (heightmap) | 1277 | lock (heightmap) |
1278 | { | 1278 | { |
@@ -1317,7 +1317,7 @@ namespace OpenSim.Region.Terrain | |||
1317 | /// </summary> | 1317 | /// </summary> |
1318 | /// <param name="filename">The destination filename for the image</param> | 1318 | /// <param name="filename">The destination filename for the image</param> |
1319 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> | 1319 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> |
1320 | public void ExportImage(string filename, string gradientmap) | 1320 | public void WriteImage(string filename, string gradientmap) |
1321 | { | 1321 | { |
1322 | try | 1322 | try |
1323 | { | 1323 | { |
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Terrain | |||
1335 | /// Exports the current heightmap in Jpeg2000 format to a byte[] | 1335 | /// Exports the current heightmap in Jpeg2000 format to a byte[] |
1336 | /// </summary> | 1336 | /// </summary> |
1337 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> | 1337 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> |
1338 | public byte[] ExportJpegImage(string gradientmap) | 1338 | public byte[] WriteJpegImage(string gradientmap) |
1339 | { | 1339 | { |
1340 | byte[] imageData = null; | 1340 | byte[] imageData = null; |
1341 | try | 1341 | try |