diff options
author | Robert Adams | 2013-12-26 22:45:59 -0800 |
---|---|---|
committer | Robert Adams | 2013-12-26 22:45:59 -0800 |
commit | 2d2bea4aa75ff6e82384f0842fe3719bf946b1cc (patch) | |
tree | 9c1429ad59674925944ece4ec366888794e91822 /OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |
parent | varregion: add lots of DEBUG level log messages. Especially for teleport. (diff) | |
download | opensim-SC_OLD-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.zip opensim-SC_OLD-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.gz opensim-SC_OLD-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.bz2 opensim-SC_OLD-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.xz |
varregion: many more updates removing the constant RegionSize and replacing
with a passed region size. This time in the map code and grid services code.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 40638f8..1007e0b 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -102,7 +102,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
102 | 102 | ||
103 | terrainRenderer.Initialise(m_scene, m_config); | 103 | terrainRenderer.Initialise(m_scene, m_config); |
104 | 104 | ||
105 | mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 105 | mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, |
106 | System.Drawing.Imaging.PixelFormat.Format24bppRgb); | ||
106 | //long t = System.Environment.TickCount; | 107 | //long t = System.Environment.TickCount; |
107 | //for (int i = 0; i < 10; ++i) { | 108 | //for (int i = 0; i < 10; ++i) { |
108 | terrainRenderer.TerrainToBitmap(mapbmp); | 109 | terrainRenderer.TerrainToBitmap(mapbmp); |
@@ -273,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
273 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) | 274 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) |
274 | { | 275 | { |
275 | int tc = 0; | 276 | int tc = 0; |
276 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 277 | ITerrainChannel hm = whichScene.Heightmap; |
277 | tc = Environment.TickCount; | 278 | tc = Environment.TickCount; |
278 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); | 279 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); |
279 | EntityBase[] objs = whichScene.GetEntities(); | 280 | EntityBase[] objs = whichScene.GetEntities(); |
@@ -356,7 +357,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
356 | Vector3 pos = part.GetWorldPosition(); | 357 | Vector3 pos = part.GetWorldPosition(); |
357 | 358 | ||
358 | // skip prim outside of retion | 359 | // skip prim outside of retion |
359 | if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) | 360 | if (!m_scene.PositionIsInCurrentRegion(pos)) |
360 | continue; | 361 | continue; |
361 | 362 | ||
362 | // skip prim in non-finite position | 363 | // skip prim in non-finite position |
@@ -399,9 +400,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
399 | int mapdrawendY = (int)(pos.Y + scale.Y); | 400 | int mapdrawendY = (int)(pos.Y + scale.Y); |
400 | 401 | ||
401 | // If object is beyond the edge of the map, don't draw it to avoid errors | 402 | // If object is beyond the edge of the map, don't draw it to avoid errors |
402 | if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1) | 403 | if (mapdrawstartX < 0 |
403 | || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 | 404 | || mapdrawstartX > (hm.Width - 1) |
404 | || mapdrawendY > ((int)Constants.RegionSize - 1)) | 405 | || mapdrawendX < 0 |
406 | || mapdrawendX > (hm.Width - 1) | ||
407 | || mapdrawstartY < 0 | ||
408 | || mapdrawstartY > (hm.Height - 1) | ||
409 | || mapdrawendY < 0 | ||
410 | || mapdrawendY > (hm.Height - 1)) | ||
405 | continue; | 411 | continue; |
406 | 412 | ||
407 | #region obb face reconstruction part duex | 413 | #region obb face reconstruction part duex |
@@ -523,11 +529,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
523 | for (int i = 0; i < FaceA.Length; i++) | 529 | for (int i = 0; i < FaceA.Length; i++) |
524 | { | 530 | { |
525 | Point[] working = new Point[5]; | 531 | Point[] working = new Point[5]; |
526 | working[0] = project(FaceA[i], axPos); | 532 | working[0] = project(hm, FaceA[i], axPos); |
527 | working[1] = project(FaceB[i], axPos); | 533 | working[1] = project(hm, FaceB[i], axPos); |
528 | working[2] = project(FaceD[i], axPos); | 534 | working[2] = project(hm, FaceD[i], axPos); |
529 | working[3] = project(FaceC[i], axPos); | 535 | working[3] = project(hm, FaceC[i], axPos); |
530 | working[4] = project(FaceA[i], axPos); | 536 | working[4] = project(hm, FaceA[i], axPos); |
531 | 537 | ||
532 | face workingface = new face(); | 538 | face workingface = new face(); |
533 | workingface.pts = working; | 539 | workingface.pts = working; |
@@ -595,17 +601,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
595 | return mapbmp; | 601 | return mapbmp; |
596 | } | 602 | } |
597 | 603 | ||
598 | private Point project(Vector3 point3d, Vector3 originpos) | 604 | private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos) |
599 | { | 605 | { |
600 | Point returnpt = new Point(); | 606 | Point returnpt = new Point(); |
601 | //originpos = point3d; | 607 | //originpos = point3d; |
602 | //int d = (int)(256f / 1.5f); | 608 | //int d = (int)(256f / 1.5f); |
603 | 609 | ||
604 | //Vector3 topos = new Vector3(0, 0, 0); | 610 | //Vector3 topos = new Vector3(0, 0, 0); |
605 | // float z = -point3d.z - topos.z; | 611 | // float z = -point3d.z - topos.z; |
606 | 612 | ||
607 | returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); | 613 | returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); |
608 | returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); | 614 | returnpt.Y = (int)((hm.Width - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); |
609 | 615 | ||
610 | return returnpt; | 616 | return returnpt; |
611 | } | 617 | } |