aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/LegacyMap
diff options
context:
space:
mode:
authorUbitUmarov2015-08-22 11:56:01 +0100
committerUbitUmarov2015-08-22 11:56:01 +0100
commit5b03a04fb0faa4d5db6f1200e7ad52d9bb147116 (patch)
tree8a190b7e04e8f03830faad6e0de64494727959b7 /OpenSim/Region/CoreModules/World/LegacyMap
parentdelay terrain sending if land queue is 2 busy (diff)
downloadopensim-SC_OLD-5b03a04fb0faa4d5db6f1200e7ad52d9bb147116.zip
opensim-SC_OLD-5b03a04fb0faa4d5db6f1200e7ad52d9bb147116.tar.gz
opensim-SC_OLD-5b03a04fb0faa4d5db6f1200e7ad52d9bb147116.tar.bz2
opensim-SC_OLD-5b03a04fb0faa4d5db6f1200e7ad52d9bb147116.tar.xz
fix worldMapModule
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap')
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs35
1 files changed, 22 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index e895178..15533ba 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -34,6 +34,8 @@ using Nini.Config;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenMetaverse.Imaging; 35using OpenMetaverse.Imaging;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
38 40
39namespace OpenSim.Region.CoreModules.World.LegacyMap 41namespace OpenSim.Region.CoreModules.World.LegacyMap
@@ -271,7 +273,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
271 273
272 // the heigthfield might have some jumps in values. Rendered land is smooth, though, 274 // the heigthfield might have some jumps in values. Rendered land is smooth, though,
273 // as a slope is rendered at that place. So average 4 neighbour values to emulate that. 275 // as a slope is rendered at that place. So average 4 neighbour values to emulate that.
274 private float getHeight(double[,] hm, int x, int y) { 276 private float getHeight(ITerrainChannel hm, int x, int y)
277 {
275 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) 278 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
276 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 279 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
277 else 280 else
@@ -284,6 +287,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
284 int tc = Environment.TickCount; 287 int tc = Environment.TickCount;
285 m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain"); 288 m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain");
286 289
290 ITerrainChannel hm = m_scene.Heightmap;
291
292 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
293 {
294 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
295 "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
296 }
297
287 // These textures should be in the AssetCache anyway, as every client conneting to this 298 // These textures should be in the AssetCache anyway, as every client conneting to this
288 // region needs them. Except on start, when the map is recreated (before anyone connected), 299 // region needs them. Except on start, when the map is recreated (before anyone connected),
289 // and on change of the estate settings (textures and terrain values), when the map should 300 // and on change of the estate settings (textures and terrain values), when the map should
@@ -310,19 +321,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
310 321
311 float waterHeight = (float)settings.WaterHeight; 322 float waterHeight = (float)settings.WaterHeight;
312 323
313 double[,] hm = m_scene.Heightmap.GetDoubles(); 324 for (int x = 0; x < hm.Width; x++)
314
315 for (int x = 0; x < (int)Constants.RegionSize; x++)
316 { 325 {
317 float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation 326 float columnRatio = x / (hm.Width - 1); // 0 - 1, for interpolation
318 for (int y = 0; y < (int)Constants.RegionSize; y++) 327 for (int y = 0; y < hm.Height; y++)
319 { 328 {
320 float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation 329 float rowRatio = y / (hm.Height - 1); // 0 - 1, for interpolation
321 330
322 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left 331 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left
323 int yr = ((int)Constants.RegionSize - 1) - y; 332 int yr = (hm.Height - 1) - y;
324 333
325 float heightvalue = getHeight(hm, x, y); 334 float heightvalue = getHeight(m_scene.Heightmap, x, y);
326 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) 335 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
327 heightvalue = 0; 336 heightvalue = 0;
328 337
@@ -366,15 +375,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
366 // first, rescale h to 0.0 - 1.0 375 // first, rescale h to 0.0 - 1.0
367 hmod = (hmod - low) / (high - low); 376 hmod = (hmod - low) / (high - low);
368 // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 377 // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4
369 if (hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); 378 if (hmod < 1f / 3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f);
370 else if (hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); 379 else if (hmod < 2f / 3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f);
371 else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); 380 else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f);
372 } 381 }
373 382
374 // Shade the terrain for shadows 383 // Shade the terrain for shadows
375 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) 384 if (x < (hm.Width - 1) && y < (hm.Height - 1))
376 { 385 {
377 float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there 386 float hfvaluecompare = getHeight(m_scene.Heightmap, x + 1, y + 1); // light from north-east => look at land height there
378 if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) 387 if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare))
379 hfvaluecompare = 0f; 388 hfvaluecompare = 0f;
380 389