diff options
Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
5 files changed, 40 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index 905239b..83f004d 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -34,6 +34,7 @@ using DotNetOpenMail.SmtpAuth; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
39 | 40 | ||
@@ -205,8 +206,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
205 | if (part != null) | 206 | if (part != null) |
206 | { | 207 | { |
207 | ObjectRegionName = s.RegionInfo.RegionName; | 208 | ObjectRegionName = s.RegionInfo.RegionName; |
208 | uint localX = (s.RegionInfo.RegionLocX * 256); | 209 | uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize); |
209 | uint localY = (s.RegionInfo.RegionLocY * 256); | 210 | uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize); |
210 | ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")"; | 211 | ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")"; |
211 | return part; | 212 | return part; |
212 | } | 213 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 9660092..3d4f762 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using NUnit.Framework; | 29 | using NUnit.Framework; |
30 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; | 31 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; |
31 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
32 | 33 | ||
@@ -38,12 +39,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
38 | [Test] | 39 | [Test] |
39 | public void BrushTest() | 40 | public void BrushTest() |
40 | { | 41 | { |
41 | bool[,] allowMask = new bool[256, 256]; | 42 | bool[,] allowMask = new bool[(int)Constants.RegionSize, 256]; |
42 | int x; | 43 | int x; |
43 | int y; | 44 | int y; |
44 | for (x=0; x<128; x++) | 45 | for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++) |
45 | { | 46 | { |
46 | for (y=0; y<256; y++) | 47 | for (y = 0; y < (int)Constants.RegionSize; y++) |
47 | { | 48 | { |
48 | allowMask[x,y] = true; | 49 | allowMask[x,y] = true; |
49 | } | 50 | } |
@@ -52,20 +53,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
52 | // | 53 | // |
53 | // Test RaiseSphere | 54 | // Test RaiseSphere |
54 | // | 55 | // |
55 | TerrainChannel map = new TerrainChannel(256, 256); | 56 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
56 | ITerrainPaintableEffect effect = new RaiseSphere(); | 57 | ITerrainPaintableEffect effect = new RaiseSphere(); |
57 | 58 | ||
58 | effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 0.1); | 59 | effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1); |
59 | Assert.That(map[127, 128] > 0.0, "Raise brush should raising value at this point (127,128)."); | 60 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); |
60 | Assert.That(map[124, 128] > 0.0, "Raise brush should raising value at this point (124,128)."); | 61 | Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); |
61 | Assert.That(map[123, 128] == 0.0, "Raise brush should not change value at this point (123,128)."); | 62 | Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128)."); |
62 | Assert.That(map[128, 128] == 0.0, "Raise brush should not change value at this point (128,128)."); | 63 | Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128)."); |
63 | Assert.That(map[0, 128] == 0.0, "Raise brush should not change value at this point (0,128)."); | 64 | Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128)."); |
64 | 65 | ||
65 | // | 66 | // |
66 | // Test LowerSphere | 67 | // Test LowerSphere |
67 | // | 68 | // |
68 | map = new TerrainChannel(256, 256); | 69 | map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
69 | for (x=0; x<map.Width; x++) | 70 | for (x=0; x<map.Width; x++) |
70 | { | 71 | { |
71 | for (y=0; y<map.Height; y++) | 72 | for (y=0; y<map.Height; y++) |
@@ -75,19 +76,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
75 | } | 76 | } |
76 | effect = new LowerSphere(); | 77 | effect = new LowerSphere(); |
77 | 78 | ||
78 | effect.PaintEffect(map, allowMask, 128.0, 128.0, -1.0, 2, 6.0); | 79 | effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0); |
79 | Assert.That(map[127, 128] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); | 80 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); |
80 | Assert.That(map[127, 128] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); | 81 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); |
81 | Assert.That(map[124, 128] < 1.0, "Lower brush should lowering value at this point (124,128)."); | 82 | Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); |
82 | Assert.That(map[123, 128] == 1.0, "Lower brush should not change value at this point (123,128)."); | 83 | Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128)."); |
83 | Assert.That(map[128, 128] == 1.0, "Lower brush should not change value at this point (128,128)."); | 84 | Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); |
84 | Assert.That(map[0, 128] == 1.0, "Lower brush should not change value at this point (0,128)."); | 85 | Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); |
85 | } | 86 | } |
86 | 87 | ||
87 | [Test] | 88 | [Test] |
88 | public void TerrainChannelTest() | 89 | public void TerrainChannelTest() |
89 | { | 90 | { |
90 | TerrainChannel x = new TerrainChannel(256, 256); | 91 | TerrainChannel x = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
91 | Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly."); | 92 | Assert.That(x[0, 0] == 0.0, "Terrain not initialising correctly."); |
92 | 93 | ||
93 | x[0, 0] = 1.0; | 94 | x[0, 0] = 1.0; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 7afada3..d1d3045 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.Imaging; | 35 | using OpenMetaverse.Imaging; |
36 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
38 | 39 | ||
@@ -97,7 +98,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
97 | } | 98 | } |
98 | terrainRenderer.Initialise(m_scene, m_config); | 99 | terrainRenderer.Initialise(m_scene, m_config); |
99 | 100 | ||
100 | Bitmap mapbmp = new Bitmap(256, 256); | 101 | Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize); |
101 | //long t = System.Environment.TickCount; | 102 | //long t = System.Environment.TickCount; |
102 | //for (int i = 0; i < 10; ++i) { | 103 | //for (int i = 0; i < 10; ++i) { |
103 | terrainRenderer.TerrainToBitmap(mapbmp); | 104 | terrainRenderer.TerrainToBitmap(mapbmp); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs index 1836026..f39cf68 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs | |||
@@ -30,6 +30,7 @@ using System.Drawing; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
34 | 35 | ||
35 | namespace OpenSim.Region.CoreModules.World.WorldMap | 36 | namespace OpenSim.Region.CoreModules.World.WorldMap |
@@ -60,9 +61,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
60 | 61 | ||
61 | float low = 255; | 62 | float low = 255; |
62 | float high = 0; | 63 | float high = 0; |
63 | for (int x = 0; x < 256; x++) | 64 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
64 | { | 65 | { |
65 | for (int y = 0; y < 256; y++) | 66 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
66 | { | 67 | { |
67 | float hmval = (float)hm[x, y]; | 68 | float hmval = (float)hm[x, y]; |
68 | if (hmval < low) | 69 | if (hmval < low) |
@@ -74,12 +75,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
74 | 75 | ||
75 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | 76 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; |
76 | 77 | ||
77 | for (int x = 0; x < 256; x++) | 78 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
78 | { | 79 | { |
79 | for (int y = 0; y < 256; y++) | 80 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
80 | { | 81 | { |
81 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left | 82 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left |
82 | int yr = 255 - y; | 83 | int yr = ((int)Constants.RegionSize - 1) - y; |
83 | 84 | ||
84 | float heightvalue = (float)hm[x, y]; | 85 | float heightvalue = (float)hm[x, y]; |
85 | 86 | ||
@@ -111,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
111 | float hfvalue = (float)hm[x, y]; | 112 | float hfvalue = (float)hm[x, y]; |
112 | float hfvaluecompare = 0f; | 113 | float hfvaluecompare = 0f; |
113 | 114 | ||
114 | if ((x + 1 < 256) && (y + 1 < 256)) | 115 | if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize)) |
115 | { | 116 | { |
116 | hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there | 117 | hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there |
117 | } | 118 | } |
@@ -176,7 +177,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
176 | 177 | ||
177 | if (ShadowDebugContinue) | 178 | if (ShadowDebugContinue) |
178 | { | 179 | { |
179 | if ((x - 1 > 0) && (yr + 1 < 256)) | 180 | if ((x - 1 > 0) && (yr + 1 < (int)Constants.RegionSize)) |
180 | { | 181 | { |
181 | color = mapbmp.GetPixel(x - 1, yr + 1); | 182 | color = mapbmp.GetPixel(x - 1, yr + 1); |
182 | int r = color.R; | 183 | int r = color.R; |
@@ -231,7 +232,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
231 | terraincorruptedwarningsaid = true; | 232 | terraincorruptedwarningsaid = true; |
232 | } | 233 | } |
233 | Color black = Color.Black; | 234 | Color black = Color.Black; |
234 | mapbmp.SetPixel(x, (256 - y) - 1, black); | 235 | mapbmp.SetPixel(x, ((int)Constants.RegionSize - y) - 1, black); |
235 | } | 236 | } |
236 | } | 237 | } |
237 | } | 238 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs index 0364e7b..97ee451 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs | |||
@@ -306,15 +306,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
306 | 306 | ||
307 | double[,] hm = m_scene.Heightmap.GetDoubles(); | 307 | double[,] hm = m_scene.Heightmap.GetDoubles(); |
308 | 308 | ||
309 | for (int x = 0; x < 256; x++) | 309 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
310 | { | 310 | { |
311 | float columnRatio = x / 255f; // 0 - 1, for interpolation | 311 | float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation |
312 | for (int y = 0; y < 256; y++) | 312 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
313 | { | 313 | { |
314 | float rowRatio = y / 255f; // 0 - 1, for interpolation | 314 | float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation |
315 | 315 | ||
316 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left | 316 | // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left |
317 | int yr = 255 - y; | 317 | int yr = ((int)Constants.RegionSize - 1) - y; |
318 | 318 | ||
319 | float heightvalue = getHeight(hm, x, y); | 319 | float heightvalue = getHeight(hm, x, y); |
320 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) | 320 | if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) |
@@ -366,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
366 | } | 366 | } |
367 | 367 | ||
368 | // Shade the terrain for shadows | 368 | // Shade the terrain for shadows |
369 | if (x < 255 && y < 255) | 369 | if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) |
370 | { | 370 | { |
371 | float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there | 371 | float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there |
372 | if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) | 372 | if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) |