diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 850ffc340e..ce017aac10 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -166,8 +166,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap } Vector3 camPos = new Vector3( - (m_scene.RegionInfo.RegionSizeX - 1) * 0.5f, - (m_scene.RegionInfo.RegionSizeY - 1) * 0.5f, + (m_scene.RegionInfo.RegionSizeX) * 0.5f, + (m_scene.RegionInfo.RegionSizeY) * 0.5f, 221.7025033688163f); // Viewport viewing down onto the region Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap m_colors.Clear(); GC.Collect(); - m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); +// m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); return bitmap; } @@ -271,10 +271,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap { float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); - renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f - 0.5f, + renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f + 1.0f); + renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f, waterHeight, - m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f); + m_scene.RegionInfo.RegionSizeY * 0.5f); warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif @@ -299,8 +299,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap int npointsx = (int)(regionsx / diff) + 1; int npointsy = (int)(regionsy / diff) + 1; - float invsx = 1.0f / regionsx; - float invsy = 1.0f / regionsy; + float invsx = 1.0f / (npointsx * diff); + float invsy = 1.0f / (npointsy * diff); // Create all the vertices for the terrain warp_Object obj = new warp_Object(); @@ -321,10 +321,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap for (x = 0; x < regionsx; x += diff) { pos = ConvertVector(x , y , (float)terrain[(int)x, lastY]); - obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f - y * invsy)); + obj.addVertex(new warp_Vertex(pos, x * invsx, 0f)); } pos = ConvertVector(x , y , (float)terrain[(int)(x - diff), lastY]); - obj.addVertex(new warp_Vertex(pos, 1.0f, 1.0f)); + obj.addVertex(new warp_Vertex(pos, 1.0f, 0f)); // Now that we have all the vertices, make another pass and // create the list of triangle indices. diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 12ac436e2f..476d90a2ef 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1399,12 +1399,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_log.InfoFormat( "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); - const int TEXTURESIZE = 2048; - Bitmap mapTexture = new Bitmap(TEXTURESIZE, TEXTURESIZE); - Graphics g = Graphics.FromImage(mapTexture); - SolidBrush sea = new SolidBrush(Color.DarkBlue); - g.FillRectangle(sea, 0, 0, TEXTURESIZE, TEXTURESIZE); - // assumed this is 1m less than next grid line int regionsView = (int)m_scene.MaxRegionViewDistance; @@ -1420,6 +1414,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap int endX = regionX + regionSizeX + regionsView; int endY = regionY + regionSizeY + regionsView; + int spanX = endX - startX + 2; + int spanY = endY - startY + 2; + + Bitmap mapTexture = new Bitmap(spanX, spanY); + Graphics g = Graphics.FromImage(mapTexture); + g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; + g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; + g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; + + SolidBrush sea = new SolidBrush(Color.DarkBlue); + g.FillRectangle(sea, 0, 0, spanX - 1, spanY - 1); + sea.Dispose(); + List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, startX, startY, endX, endY); @@ -1434,11 +1442,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap startX--; startY--; - int spanX = endX - startX + 1; - float scaleX = (float)TEXTURESIZE / (float)spanX; - int spanY = endY - startY + 1; - float scaleY = (float)TEXTURESIZE / (float)spanY; - foreach(GridRegion r in regions) { if(r.TerrainImage == UUID.Zero) @@ -1450,15 +1453,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if(OpenJPEG.DecodeToImage(texAsset.Data, out managedImage, out image)) { - int x = (int)((r.RegionLocX - startX) * scaleX); - int y = (int)((r.RegionLocY - startY ) * scaleY); - int sx = (int)(r.RegionSizeX * scaleX); - int sy = (int)(r.RegionSizeY * scaleY); - g.DrawImage(image, x, TEXTURESIZE - y - sy, sx, sy); // y origin is top + int x = r.RegionLocX - startX; + int y = r.RegionLocY - startY; + int sx = r.RegionSizeX; + int sy = r.RegionSizeY; + g.DrawImage(image, x, spanY - y - sy, sx, sy); // y origin is top if(r.RegionHandle == m_scene.RegionInfo.RegionHandle) { SizeF stringSize = g.MeasureString(r.RegionName, drawFont); - g.DrawString(r.RegionName, drawFont, drawBrush, x + 30, TEXTURESIZE - y - 30 - stringSize.Height); + g.DrawString(r.RegionName, drawFont, drawBrush, x + 30, spanY - y - 30 - stringSize.Height); } } } @@ -1473,11 +1476,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap drawFont.Dispose(); } - mapTexture.Save(exportPath, ImageFormat.Jpeg); - g.Dispose(); + + mapTexture.Save(exportPath, ImageFormat.Jpeg); mapTexture.Dispose(); - sea.Dispose(); m_log.InfoFormat( "[WORLD MAP]: Successfully exported world map for {0} to {1}",