diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-07 18:40:56 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-07 18:40:56 -0400 |
commit | c8a68fb3fbac0d99b53a62bb062232c0d5695d3c (patch) | |
tree | bb010e480b095e48cd80fce04305f5e8cd290a3b /OpenSim | |
parent | Silly error, simple fix (diff) | |
download | opensim-SC-c8a68fb3fbac0d99b53a62bb062232c0d5695d3c.zip opensim-SC-c8a68fb3fbac0d99b53a62bb062232c0d5695d3c.tar.gz opensim-SC-c8a68fb3fbac0d99b53a62bb062232c0d5695d3c.tar.bz2 opensim-SC-c8a68fb3fbac0d99b53a62bb062232c0d5695d3c.tar.xz |
* Remove hard coded 256 limitations from various places. There's no more 256m limitation within the OpenSimulator framework, however, the LLClient ClientView does not support regions larger then 256 meters so, if you try and make your region larger by setting Constants.RegionSize = 512; in OpenSim.Framework.Constants.cs, the terrain will not display on clients using the LLUDP protocol
Diffstat (limited to '')
14 files changed, 126 insertions, 74 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 0fe8de7..d79d32b 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs | |||
@@ -485,7 +485,7 @@ ELSE | |||
485 | /// <returns></returns> | 485 | /// <returns></returns> |
486 | public double[,] LoadTerrain(UUID regionID) | 486 | public double[,] LoadTerrain(UUID regionID) |
487 | { | 487 | { |
488 | double[,] terrain = new double[256, 256]; | 488 | double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; |
489 | terrain.Initialize(); | 489 | terrain.Initialize(); |
490 | 490 | ||
491 | string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; | 491 | string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; |
@@ -502,9 +502,9 @@ ELSE | |||
502 | { | 502 | { |
503 | MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]); | 503 | MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]); |
504 | BinaryReader br = new BinaryReader(str); | 504 | BinaryReader br = new BinaryReader(str); |
505 | for (int x = 0; x < 256; x++) | 505 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
506 | { | 506 | { |
507 | for (int y = 0; y < 256; y++) | 507 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
508 | { | 508 | { |
509 | terrain[x, y] = br.ReadDouble(); | 509 | terrain[x, y] = br.ReadDouble(); |
510 | } | 510 | } |
@@ -749,12 +749,12 @@ VALUES | |||
749 | /// <returns></returns> | 749 | /// <returns></returns> |
750 | private static Array serializeTerrain(double[,] val) | 750 | private static Array serializeTerrain(double[,] val) |
751 | { | 751 | { |
752 | MemoryStream str = new MemoryStream(65536 * sizeof(double)); | 752 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double)); |
753 | BinaryWriter bw = new BinaryWriter(str); | 753 | BinaryWriter bw = new BinaryWriter(str); |
754 | 754 | ||
755 | // TODO: COMPATIBILITY - Add byte-order conversions | 755 | // TODO: COMPATIBILITY - Add byte-order conversions |
756 | for (int x = 0; x < 256; x++) | 756 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
757 | for (int y = 0; y < 256; y++) | 757 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
758 | { | 758 | { |
759 | double height = val[x, y]; | 759 | double height = val[x, y]; |
760 | if (height == 0.0) | 760 | if (height == 0.0) |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 09564de..2166845 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -583,16 +583,16 @@ namespace OpenSim.Data.MySQL | |||
583 | { | 583 | { |
584 | while (reader.Read()) | 584 | while (reader.Read()) |
585 | { | 585 | { |
586 | terrain = new double[256,256]; | 586 | terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; |
587 | terrain.Initialize(); | 587 | terrain.Initialize(); |
588 | 588 | ||
589 | MemoryStream mstr = new MemoryStream((byte[]) reader["Heightfield"]); | 589 | MemoryStream mstr = new MemoryStream((byte[]) reader["Heightfield"]); |
590 | int rev = 0; | 590 | int rev = 0; |
591 | 591 | ||
592 | BinaryReader br = new BinaryReader(mstr); | 592 | BinaryReader br = new BinaryReader(mstr); |
593 | for (int x = 0; x < 256; x++) | 593 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
594 | { | 594 | { |
595 | for (int y = 0; y < 256; y++) | 595 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
596 | { | 596 | { |
597 | terrain[x, y] = br.ReadDouble(); | 597 | terrain[x, y] = br.ReadDouble(); |
598 | } | 598 | } |
@@ -1141,12 +1141,12 @@ namespace OpenSim.Data.MySQL | |||
1141 | /// <returns></returns> | 1141 | /// <returns></returns> |
1142 | private static Array SerializeTerrain(double[,] val) | 1142 | private static Array SerializeTerrain(double[,] val) |
1143 | { | 1143 | { |
1144 | MemoryStream str = new MemoryStream(65536*sizeof (double)); | 1144 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1145 | BinaryWriter bw = new BinaryWriter(str); | 1145 | BinaryWriter bw = new BinaryWriter(str); |
1146 | 1146 | ||
1147 | // TODO: COMPATIBILITY - Add byte-order conversions | 1147 | // TODO: COMPATIBILITY - Add byte-order conversions |
1148 | for (int x = 0; x < 256; x++) | 1148 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1149 | for (int y = 0; y < 256; y++) | 1149 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1150 | { | 1150 | { |
1151 | double height = val[x, y]; | 1151 | double height = val[x, y]; |
1152 | if (height == 0.0) | 1152 | if (height == 0.0) |
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index 3f04f68..26ec500 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs | |||
@@ -376,8 +376,8 @@ namespace OpenSim.Data.NHibernate | |||
376 | // BinaryWriter bw = new BinaryWriter(str); | 376 | // BinaryWriter bw = new BinaryWriter(str); |
377 | // | 377 | // |
378 | // // TODO: COMPATIBILITY - Add byte-order conversions | 378 | // // TODO: COMPATIBILITY - Add byte-order conversions |
379 | // for (int x = 0; x < 256; x++) | 379 | // for (int x = 0; x < (int)Constants.RegionSize; x++) |
380 | // for (int y = 0; y < 256; y++) | 380 | // for (int y = 0; y < (int)Constants.RegionSize; y++) |
381 | // bw.Write(val[x, y]); | 381 | // bw.Write(val[x, y]); |
382 | // | 382 | // |
383 | // return str.ToArray(); | 383 | // return str.ToArray(); |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 2f9f59d..3555caf 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -571,7 +571,7 @@ namespace OpenSim.Data.SQLite | |||
571 | { | 571 | { |
572 | lock (ds) | 572 | lock (ds) |
573 | { | 573 | { |
574 | double[,] terret = new double[256,256]; | 574 | double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; |
575 | terret.Initialize(); | 575 | terret.Initialize(); |
576 | 576 | ||
577 | String sql = "select RegionUUID, Revision, Heightfield from terrain" + | 577 | String sql = "select RegionUUID, Revision, Heightfield from terrain" + |
@@ -589,9 +589,9 @@ namespace OpenSim.Data.SQLite | |||
589 | // TODO: put this into a function | 589 | // TODO: put this into a function |
590 | MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); | 590 | MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); |
591 | BinaryReader br = new BinaryReader(str); | 591 | BinaryReader br = new BinaryReader(str); |
592 | for (int x = 0; x < 256; x++) | 592 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
593 | { | 593 | { |
594 | for (int y = 0; y < 256; y++) | 594 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
595 | { | 595 | { |
596 | terret[x, y] = br.ReadDouble(); | 596 | terret[x, y] = br.ReadDouble(); |
597 | } | 597 | } |
@@ -1427,12 +1427,12 @@ namespace OpenSim.Data.SQLite | |||
1427 | /// <returns></returns> | 1427 | /// <returns></returns> |
1428 | private static Array serializeTerrain(double[,] val) | 1428 | private static Array serializeTerrain(double[,] val) |
1429 | { | 1429 | { |
1430 | MemoryStream str = new MemoryStream(65536*sizeof (double)); | 1430 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1431 | BinaryWriter bw = new BinaryWriter(str); | 1431 | BinaryWriter bw = new BinaryWriter(str); |
1432 | 1432 | ||
1433 | // TODO: COMPATIBILITY - Add byte-order conversions | 1433 | // TODO: COMPATIBILITY - Add byte-order conversions |
1434 | for (int x = 0; x < 256; x++) | 1434 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1435 | for (int y = 0; y < 256; y++) | 1435 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1436 | bw.Write(val[x, y]); | 1436 | bw.Write(val[x, y]); |
1437 | 1437 | ||
1438 | return str.ToArray(); | 1438 | return str.ToArray(); |
@@ -1443,12 +1443,12 @@ namespace OpenSim.Data.SQLite | |||
1443 | // row["RegionUUID"] = regionUUID; | 1443 | // row["RegionUUID"] = regionUUID; |
1444 | // row["Revision"] = rev; | 1444 | // row["Revision"] = rev; |
1445 | 1445 | ||
1446 | // MemoryStream str = new MemoryStream(65536*sizeof (double)); | 1446 | // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize )*sizeof (double)); |
1447 | // BinaryWriter bw = new BinaryWriter(str); | 1447 | // BinaryWriter bw = new BinaryWriter(str); |
1448 | 1448 | ||
1449 | // // TODO: COMPATIBILITY - Add byte-order conversions | 1449 | // // TODO: COMPATIBILITY - Add byte-order conversions |
1450 | // for (int x = 0; x < 256; x++) | 1450 | // for (int x = 0; x < (int)Constants.RegionSize; x++) |
1451 | // for (int y = 0; y < 256; y++) | 1451 | // for (int y = 0; y < (int)Constants.RegionSize; y++) |
1452 | // bw.Write(val[x, y]); | 1452 | // bw.Write(val[x, y]); |
1453 | 1453 | ||
1454 | // row["Heightfield"] = str.ToArray(); | 1454 | // row["Heightfield"] = str.ToArray(); |
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)) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b48cf62..e344da3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1192,6 +1192,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1192 | Heightmap = new TerrainChannel(map); | 1192 | Heightmap = new TerrainChannel(map); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | catch (IOException e) | ||
1196 | { | ||
1197 | |||
1198 | m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString() + " Regenerating"); | ||
1199 | |||
1200 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer | ||
1201 | if ((int)Constants.RegionSize != 256) | ||
1202 | { | ||
1203 | Heightmap = new TerrainChannel(); | ||
1204 | |||
1205 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); | ||
1206 | } | ||
1207 | } | ||
1195 | catch (Exception e) | 1208 | catch (Exception e) |
1196 | { | 1209 | { |
1197 | m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString()); | 1210 | m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString()); |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index a7bf2d6..2cc5d41 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | |||
@@ -216,8 +216,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
216 | tempMotionState2 = new btDefaultMotionState(_parent_scene.TransZero); | 216 | tempMotionState2 = new btDefaultMotionState(_parent_scene.TransZero); |
217 | tempMotionState3 = new btDefaultMotionState(_parent_scene.TransZero); | 217 | tempMotionState3 = new btDefaultMotionState(_parent_scene.TransZero); |
218 | 218 | ||
219 | AxisLockLinearLow = new btVector3(-256,-256,-256); | 219 | |
220 | AxisLockLinearHigh = new btVector3(512, 512, 512); | 220 | AxisLockLinearLow = new btVector3(-1 * (int)Constants.RegionSize, -1 * (int)Constants.RegionSize, -1 * (int)Constants.RegionSize); |
221 | int regionsize = (int) Constants.RegionSize; | ||
222 | |||
223 | if (regionsize == 256) | ||
224 | regionsize = 512; | ||
225 | |||
226 | AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize); | ||
221 | 227 | ||
222 | _target_velocity = new PhysicsVector(0, 0, 0); | 228 | _target_velocity = new PhysicsVector(0, 0, 0); |
223 | _velocity = new PhysicsVector(); | 229 | _velocity = new PhysicsVector(); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index b8af77d..b556395 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -1096,8 +1096,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1096 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1096 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1097 | if (vec.X < 0.0f) vec.X = 0.0f; | 1097 | if (vec.X < 0.0f) vec.X = 0.0f; |
1098 | if (vec.Y < 0.0f) vec.Y = 0.0f; | 1098 | if (vec.Y < 0.0f) vec.Y = 0.0f; |
1099 | if (vec.X > 255.95f) vec.X = 255.95f; | 1099 | if (vec.X > (int)Constants.RegionSize - 0.05f) vec.X = (int)Constants.RegionSize - 0.05f; |
1100 | if (vec.Y > 255.95f) vec.Y = 255.95f; | 1100 | if (vec.Y > (int)Constants.RegionSize - 0.05f) vec.Y = (int)Constants.RegionSize - 0.05f; |
1101 | 1101 | ||
1102 | _position.X = vec.X; | 1102 | _position.X = vec.X; |
1103 | _position.Y = vec.Y; | 1103 | _position.Y = vec.Y; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 9805ff5..50dc91d 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -304,6 +304,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
304 | public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); | 304 | public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); |
305 | public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); | 305 | public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); |
306 | 306 | ||
307 | private uint heightmapWidth = m_regionWidth + 1; | ||
308 | private uint heightmapHeight = m_regionHeight + 1; | ||
309 | |||
310 | private uint heightmapWidthSamples; | ||
311 | |||
312 | private uint heightmapHeightSamples; | ||
313 | |||
307 | private volatile int m_global_contactcount = 0; | 314 | private volatile int m_global_contactcount = 0; |
308 | 315 | ||
309 | private ODERayCastRequestManager m_rayCastManager; | 316 | private ODERayCastRequestManager m_rayCastManager; |
@@ -3271,27 +3278,49 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3271 | // this._heightmap[i] = (double)heightMap[i]; | 3278 | // this._heightmap[i] = (double)heightMap[i]; |
3272 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around | 3279 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around |
3273 | _origheightmap = heightMap; // Used for Fly height. Kitto Flora | 3280 | _origheightmap = heightMap; // Used for Fly height. Kitto Flora |
3274 | const uint heightmapWidth = m_regionWidth + 2; | 3281 | uint heightmapWidth = m_regionWidth + 1; |
3275 | const uint heightmapHeight = m_regionHeight + 2; | 3282 | uint heightmapHeight = m_regionHeight + 1; |
3276 | const uint heightmapWidthSamples = 2*m_regionWidth + 2; | 3283 | |
3277 | const uint heightmapHeightSamples = 2*m_regionHeight + 2; | 3284 | uint heightmapWidthSamples; |
3285 | |||
3286 | uint heightmapHeightSamples; | ||
3287 | if (((int)Constants.RegionSize) == 256) | ||
3288 | { | ||
3289 | heightmapWidthSamples = 2*m_regionWidth + 2; | ||
3290 | heightmapHeightSamples = 2*m_regionHeight + 2; | ||
3291 | heightmapWidth++; | ||
3292 | heightmapHeight++; | ||
3293 | } | ||
3294 | else | ||
3295 | { | ||
3296 | heightmapWidthSamples = m_regionWidth + 1; | ||
3297 | heightmapHeightSamples = m_regionHeight + 1; | ||
3298 | } | ||
3299 | |||
3278 | const float scale = 1.0f; | 3300 | const float scale = 1.0f; |
3279 | const float offset = 0.0f; | 3301 | const float offset = 0.0f; |
3280 | const float thickness = 0.2f; | 3302 | const float thickness = 0.2f; |
3281 | const int wrap = 0; | 3303 | const int wrap = 0; |
3304 | |||
3282 | 3305 | ||
3283 | //Double resolution | 3306 | //Double resolution |
3284 | heightMap = ResizeTerrain512Interpolation(heightMap); | 3307 | if (((int)Constants.RegionSize) == 256) |
3308 | heightMap = ResizeTerrain512Interpolation(heightMap); | ||
3309 | |||
3310 | int regionsize = (int)Constants.RegionSize; | ||
3311 | if (regionsize == 256) | ||
3312 | regionsize = 512; | ||
3313 | |||
3285 | float hfmin = 2000; | 3314 | float hfmin = 2000; |
3286 | float hfmax = -2000; | 3315 | float hfmax = -2000; |
3287 | for (int x = 0; x < heightmapWidthSamples; x++) | 3316 | for (int x = 0; x < heightmapWidthSamples; x++) |
3288 | { | 3317 | { |
3289 | for (int y = 0; y < heightmapHeightSamples; y++) | 3318 | for (int y = 0; y < heightmapHeightSamples; y++) |
3290 | { | 3319 | { |
3291 | int xx = Util.Clip(x - 1, 0, 511); | 3320 | int xx = Util.Clip(x - 1, 0, regionsize - 1); |
3292 | int yy = Util.Clip(y - 1, 0, 511); | 3321 | int yy = Util.Clip(y - 1, 0, regionsize - 1); |
3293 | 3322 | ||
3294 | float val = heightMap[yy*512 + xx]; | 3323 | float val = heightMap[yy*regionsize + xx]; |
3295 | _heightmap[x*heightmapHeightSamples + y] = val; | 3324 | _heightmap[x*heightmapHeightSamples + y] = val; |
3296 | hfmin = (val < hfmin) ? val : hfmin; | 3325 | hfmin = (val < hfmin) ? val : hfmin; |
3297 | hfmax = (val > hfmax) ? val : hfmax; | 3326 | hfmax = (val > hfmax) ? val : hfmax; |
@@ -3332,7 +3361,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3332 | 3361 | ||
3333 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3362 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
3334 | d.GeomSetRotation(LandGeom, ref R); | 3363 | d.GeomSetRotation(LandGeom, ref R); |
3335 | d.GeomSetPosition(LandGeom, 128, 128, 0); | 3364 | d.GeomSetPosition(LandGeom, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, 0); |
3336 | } | 3365 | } |
3337 | } | 3366 | } |
3338 | 3367 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index 7d748fd..b186175 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs | |||
@@ -56,8 +56,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
56 | ps = cbt.GetScene("test"); | 56 | ps = cbt.GetScene("test"); |
57 | // Initializing Physics Scene. | 57 | // Initializing Physics Scene. |
58 | ps.Initialise(imp.GetMesher(),null); | 58 | ps.Initialise(imp.GetMesher(),null); |
59 | float[] _heightmap = new float[256 * 256]; | 59 | float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; |
60 | for (int i = 0; i<(256*256);i++) | 60 | for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) |
61 | { | 61 | { |
62 | _heightmap[i] = 21f; | 62 | _heightmap[i] = 21f; |
63 | } | 63 | } |