From 00cc17c2390c8d558774bc237bdff7141d8209eb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 May 2018 23:28:36 +0100 Subject: breaking map (warp3d) --- .../CoreModules/World/Warp3DMap/TerrainSplat.cs | 4 +-- .../World/Warp3DMap/Warp3DImageModule.cs | 33 ++-------------------- .../CoreModules/World/WorldMap/WorldMapModule.cs | 9 ++---- 3 files changed, 7 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs index 8b9e0d3..622b16c 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap if(detailTexture[i].PixelFormat != PixelFormat.Format24bppRgb || detailTexture[i].Width != 16 || detailTexture[i].Height != 16) using(Bitmap origBitmap = detailTexture[i]) - detailTexture[i] = ImageUtils.ResizeImageSolid(origBitmap, 16, 16); + detailTexture[i] = Util.ResizeImageSolid(origBitmap, 16, 16); // Save the decoded and resized texture to the cache byte[] data; @@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap if(detailTexture[i].Width != 16 || detailTexture[i].Height != 16) { using(Bitmap origBitmap = detailTexture[i]) - detailTexture[i] = ImageUtils.ResizeImageSolid(origBitmap, 16, 16); + detailTexture[i] = Util.ResizeImageSolid(origBitmap, 16, 16); } } } diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index ca95b67..eefd0af 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -296,8 +296,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap int npointsx = (int)(regionsx / diff); int npointsy = (int)(regionsy / diff); - float invsx = 1.0f / (npointsx); - float invsy = 1.0f / (npointsy); + float invsx = 1.0f / (npointsx * diff); + float invsy = 1.0f / (npointsy * diff); npointsx++; npointsy++; @@ -387,9 +387,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap texture = new warp_Texture(image); warp_Material material = new warp_Material(texture); -// material.setReflectivity(50); renderer.Scene.addMaterial("TerrainColor", material); -// renderer.Scene.material("TerrainColor").setReflectivity(0); // reduces tile seams a bit thanks lkalif renderer.SetObjectMaterial("Terrain", "TerrainColor"); } @@ -775,32 +773,5 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap { return Utils.Lerp(Utils.Lerp(v00, v01, xPercent), Utils.Lerp(v10, v11, xPercent), yPercent); } - - /// - /// Performs a high quality image resize - /// - /// Image to resize - /// New width - /// New height - /// Resized image - public static Bitmap ResizeImageSolid(Image image, int width, int height) - { - Bitmap result = new Bitmap(width, height, PixelFormat.Format24bppRgb); - - using (ImageAttributes atrib = new ImageAttributes()) - using (Graphics graphics = Graphics.FromImage(result)) - { - atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); - graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; - graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; - - graphics.DrawImage(image,new Rectangle(0,0, result.Width, result.Height), - 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib); - } - - return result; - } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 4b14c71..e899343 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1427,8 +1427,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Bitmap mapTexture = new Bitmap(spanX, spanY); ImageAttributes gatrib = new ImageAttributes(); - Graphics g = Graphics.FromImage(mapTexture); gatrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); + + 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; @@ -1687,11 +1688,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if(mb > Constants.RegionSize && mb > 0) { float scale = (float)Constants.RegionSize/(float)mb; - Size newsize = new Size(); - newsize.Width = (int)(bx * scale); - newsize.Height = (int)(by * scale); - - using(Bitmap scaledbmp = new Bitmap(mapbmp,newsize)) + using(Bitmap scaledbmp = Util.ResizeImageSolid(mapbmp, (int)(bx * scale), (int)(by * scale))) data = OpenJPEG.EncodeFromImage(scaledbmp, false); } else -- cgit v1.1