aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-21 13:22:49 -0400
committerTeravus Ovares (Dan Olivares)2009-08-21 13:22:49 -0400
commite1b38ff00196c61af4c78cc96bed12afee1dcaf3 (patch)
tree18d2677d387405c2cbebd6361677612cc0d55788 /OpenSim/Region/CoreModules/World
parent* Fixes Terrain issues with combined regions. (diff)
downloadopensim-SC_OLD-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.zip
opensim-SC_OLD-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.gz
opensim-SC_OLD-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.bz2
opensim-SC_OLD-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.xz
* It turns out that Physics heightmap values were being stored in managed memory in _heightmap and using multiple heightmaps caused them all to overwrite each other and the last one was the heightmap for all of the regions. This fixes that. It also reduces the terrain resolution to half.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs110
2 files changed, 69 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index c917840..5c2e136 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -549,6 +549,8 @@ namespace OpenSim.Region.CoreModules.World.Land
549 int x; 549 int x;
550 int y; 550 int y;
551 551
552 if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0)
553 return null;
552 try 554 try
553 { 555 {
554 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); 556 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
diff --git a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
index 450ec21..3a4a17b 100644
--- a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs
@@ -23,6 +23,7 @@ namespace OpenSim.Region.CoreModules.World.Land
23 public Type ReplacableInterface { get { return null; } } 23 public Type ReplacableInterface { get { return null; } }
24 24
25 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>(); 25 private Dictionary<UUID, RegionConnections> m_regions = new Dictionary<UUID, RegionConnections>();
26 private bool enabledYN = true;
26 public void Initialise(IConfigSource source) 27 public void Initialise(IConfigSource source)
27 { 28 {
28 29
@@ -35,12 +36,9 @@ namespace OpenSim.Region.CoreModules.World.Land
35 36
36 public void AddRegion(Scene scene) 37 public void AddRegion(Scene scene)
37 { 38 {
38 /* 39 if (!enabledYN)
39 RegionData regionData = new RegionData(); 40 return;
40 regionData.Offset = Vector3.Zero; 41
41 regionData.RegionId = scene.RegionInfo.originRegionID;
42 regionData.RegionScene = scene;
43 */
44 RegionConnections regionConnections = new RegionConnections(); 42 RegionConnections regionConnections = new RegionConnections();
45 regionConnections.ConnectedRegions = new List<RegionData>(); 43 regionConnections.ConnectedRegions = new List<RegionData>();
46 regionConnections.RegionScene = scene; 44 regionConnections.RegionScene = scene;
@@ -55,12 +53,12 @@ namespace OpenSim.Region.CoreModules.World.Land
55 53
56 foreach (RegionConnections conn in m_regions.Values) 54 foreach (RegionConnections conn in m_regions.Values)
57 { 55 {
58 56 #region commented
59 /* 57 /*
60 // If we're one region over +x +y 58 // If we're one region over +x +y
59 //xxy
61 //xxx 60 //xxx
62 //xxx 61 //xxx
63 //xxy
64 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd 62 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
65 == (regionConnections.X * (int)Constants.RegionSize)) 63 == (regionConnections.X * (int)Constants.RegionSize))
66 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd 64 && (((int)conn.Y * (int)Constants.RegionSize) - conn.YEnd
@@ -181,6 +179,38 @@ namespace OpenSim.Region.CoreModules.World.Land
181 } 179 }
182 */ 180 */
183 181
182 /*
183 // If we're one region over -x -y
184 //yxx
185 //xxx
186 //xxx
187 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
188 == (regionConnections.X * (int)Constants.RegionSize))
189 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
190 == (regionConnections.Y * (int)Constants.RegionSize)))
191 {
192 Vector3 offset = Vector3.Zero;
193 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
194 ((conn.X * (int)Constants.RegionSize)));
195 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
196 ((conn.Y * (int)Constants.RegionSize)));
197
198 Vector3 extents = Vector3.Zero;
199 extents.Y = regionConnections.YEnd + conn.YEnd;
200 extents.X = conn.XEnd + conn.XEnd;
201
202 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
203 conn.RegionScene.RegionInfo.RegionName,
204 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
205
206 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents);
207
208 connectedYN = true;
209 break;
210 }
211 */
212 #endregion
213
184 // If we're one region over +x y 214 // If we're one region over +x y
185 //xxx 215 //xxx
186 //xxy 216 //xxy
@@ -197,49 +227,37 @@ namespace OpenSim.Region.CoreModules.World.Land
197 ((conn.Y * (int)Constants.RegionSize))); 227 ((conn.Y * (int)Constants.RegionSize)));
198 228
199 Vector3 extents = Vector3.Zero; 229 Vector3 extents = Vector3.Zero;
200 extents.Y = regionConnections.YEnd; 230 extents.Y = conn.YEnd;
201 extents.X = conn.XEnd + conn.XEnd; 231 extents.X = conn.XEnd + regionConnections.XEnd;
232
233 conn.UpdateExtents(extents);
234
202 235
203 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", 236 m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}",
204 conn.RegionScene.RegionInfo.RegionName, 237 conn.RegionScene.RegionInfo.RegionName,
205 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 238 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
206 239
207 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); 240 conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
208 241 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
209 connectedYN = true;
210 break;
211 }
212
213 // If we're one region over -x -y
214 //yxx
215 //xxx
216 //xxx
217 if ((((int)conn.X * (int)Constants.RegionSize) - conn.XEnd
218 == (regionConnections.X * (int)Constants.RegionSize))
219 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
220 == (regionConnections.Y * (int)Constants.RegionSize)))
221 {
222 Vector3 offset = Vector3.Zero;
223 offset.X = (((regionConnections.X * (int)Constants.RegionSize)) -
224 ((conn.X * (int)Constants.RegionSize)));
225 offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) -
226 ((conn.Y * (int)Constants.RegionSize)));
227 242
228 Vector3 extents = Vector3.Zero; 243 conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
229 extents.Y = regionConnections.YEnd + conn.YEnd; 244 conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
230 extents.X = conn.XEnd + conn.XEnd; 245 conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
231 246
232 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", 247 scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
233 conn.RegionScene.RegionInfo.RegionName,
234 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
235 248
236 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, extents); 249 // Reset Terrain.. since terrain normally loads first.
250 //
251 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
252 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
237 253
238 connectedYN = true; 254 connectedYN = true;
239 break; 255 break;
240 } 256 }
241 257
242 // If we're one region over x -y 258
259
260 // If we're one region over x +y
243 //xyx 261 //xyx
244 //xxx 262 //xxx
245 //xxx 263 //xxx
@@ -257,12 +275,12 @@ namespace OpenSim.Region.CoreModules.World.Land
257 Vector3 extents = Vector3.Zero; 275 Vector3 extents = Vector3.Zero;
258 extents.Y = regionConnections.YEnd + conn.YEnd; 276 extents.Y = regionConnections.YEnd + conn.YEnd;
259 extents.X = conn.XEnd; 277 extents.X = conn.XEnd;
260 278 conn.UpdateExtents(extents);
261 279
262 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", 280 m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
263 conn.RegionScene.RegionInfo.RegionName, 281 conn.RegionScene.RegionInfo.RegionName,
264 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); 282 regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
265 conn.RegionScene.PhysicsScene.Combine(scene.PhysicsScene,Vector3.Zero,extents); 283 conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents);
266 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); 284 scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
267 285
268 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 286 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
@@ -272,14 +290,15 @@ namespace OpenSim.Region.CoreModules.World.Land
272 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south 290 scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
273 291
274 // Reset Terrain.. since terrain normally loads first. 292 // Reset Terrain.. since terrain normally loads first.
275 conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); 293 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
276 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 294 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
295 //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
277 296
278 connectedYN = true; 297 connectedYN = true;
279 break; 298 break;
280 } 299 }
281 300
282 // If we're one region over +x -y 301 // If we're one region over +x +y
283 //xxy 302 //xxy
284 //xxx 303 //xxx
285 //xxx 304 //xxx
@@ -334,7 +353,7 @@ namespace OpenSim.Region.CoreModules.World.Land
334 } 353 }
335 } 354 }
336 355
337 public struct RegionConnections 356 public class RegionConnections
338 { 357 {
339 public UUID RegionId; 358 public UUID RegionId;
340 public Scene RegionScene; 359 public Scene RegionScene;
@@ -343,6 +362,11 @@ namespace OpenSim.Region.CoreModules.World.Land
343 public int XEnd; 362 public int XEnd;
344 public int YEnd; 363 public int YEnd;
345 public List<RegionData> ConnectedRegions; 364 public List<RegionData> ConnectedRegions;
365 public void UpdateExtents(Vector3 extents)
366 {
367 XEnd = (int)extents.X;
368 YEnd = (int)extents.Y;
369 }
346 370
347 } 371 }
348 372