aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2018-05-06 23:28:36 +0100
committerUbitUmarov2018-05-06 23:28:36 +0100
commit00cc17c2390c8d558774bc237bdff7141d8209eb (patch)
treef0610109429a0d4632d449b96d6ba79476ef094d
parentremove some debug lines (diff)
downloadopensim-SC-00cc17c2390c8d558774bc237bdff7141d8209eb.zip
opensim-SC-00cc17c2390c8d558774bc237bdff7141d8209eb.tar.gz
opensim-SC-00cc17c2390c8d558774bc237bdff7141d8209eb.tar.bz2
opensim-SC-00cc17c2390c8d558774bc237bdff7141d8209eb.tar.xz
breaking map (warp3d)
-rw-r--r--OpenSim/Framework/Util.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs9
4 files changed, 38 insertions, 39 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c103c5c..c5c4ab3 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -30,6 +30,8 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Diagnostics; 32using System.Diagnostics;
33using System.Drawing;
34using System.Drawing.Imaging;
33using System.Globalization; 35using System.Globalization;
34using System.IO; 36using System.IO;
35using System.IO.Compression; 37using System.IO.Compression;
@@ -3442,6 +3444,34 @@ namespace OpenSim.Framework
3442 m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml); 3444 m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml);
3443 } 3445 }
3444 3446
3447 /// <summary>
3448 /// Performs a high quality image resize
3449 /// </summary>
3450 /// <param name="image">Image to resize</param>
3451 /// <param name="width">New width</param>
3452 /// <param name="height">New height</param>
3453 /// <returns>Resized image</returns>
3454 public static Bitmap ResizeImageSolid(Image image, int width, int height)
3455 {
3456 Bitmap result = new Bitmap(width, height, PixelFormat.Format24bppRgb);
3457
3458 using (ImageAttributes atrib = new ImageAttributes())
3459 using (Graphics graphics = Graphics.FromImage(result))
3460 {
3461 atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
3462 atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
3463 graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
3464 graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
3465 graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
3466 graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
3467
3468 graphics.DrawImage(image,new Rectangle(0,0, result.Width, result.Height),
3469 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib);
3470 }
3471
3472 return result;
3473 }
3474
3445 } 3475 }
3446 3476
3447/* don't like this code 3477/* don't like this code
@@ -3606,5 +3636,6 @@ namespace OpenSim.Framework
3606 { 3636 {
3607 rng.GetBytes(buff); 3637 rng.GetBytes(buff);
3608 } 3638 }
3639
3609 } 3640 }
3610} 3641}
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
161 if(detailTexture[i].PixelFormat != PixelFormat.Format24bppRgb || 161 if(detailTexture[i].PixelFormat != PixelFormat.Format24bppRgb ||
162 detailTexture[i].Width != 16 || detailTexture[i].Height != 16) 162 detailTexture[i].Width != 16 || detailTexture[i].Height != 16)
163 using(Bitmap origBitmap = detailTexture[i]) 163 using(Bitmap origBitmap = detailTexture[i])
164 detailTexture[i] = ImageUtils.ResizeImageSolid(origBitmap, 16, 16); 164 detailTexture[i] = Util.ResizeImageSolid(origBitmap, 16, 16);
165 165
166 // Save the decoded and resized texture to the cache 166 // Save the decoded and resized texture to the cache
167 byte[] data; 167 byte[] data;
@@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
260 if(detailTexture[i].Width != 16 || detailTexture[i].Height != 16) 260 if(detailTexture[i].Width != 16 || detailTexture[i].Height != 16)
261 { 261 {
262 using(Bitmap origBitmap = detailTexture[i]) 262 using(Bitmap origBitmap = detailTexture[i])
263 detailTexture[i] = ImageUtils.ResizeImageSolid(origBitmap, 16, 16); 263 detailTexture[i] = Util.ResizeImageSolid(origBitmap, 16, 16);
264 } 264 }
265 } 265 }
266 } 266 }
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
296 int npointsx = (int)(regionsx / diff); 296 int npointsx = (int)(regionsx / diff);
297 int npointsy = (int)(regionsy / diff); 297 int npointsy = (int)(regionsy / diff);
298 298
299 float invsx = 1.0f / (npointsx); 299 float invsx = 1.0f / (npointsx * diff);
300 float invsy = 1.0f / (npointsy); 300 float invsy = 1.0f / (npointsy * diff);
301 301
302 npointsx++; 302 npointsx++;
303 npointsy++; 303 npointsy++;
@@ -387,9 +387,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
387 texture = new warp_Texture(image); 387 texture = new warp_Texture(image);
388 388
389 warp_Material material = new warp_Material(texture); 389 warp_Material material = new warp_Material(texture);
390// material.setReflectivity(50);
391 renderer.Scene.addMaterial("TerrainColor", material); 390 renderer.Scene.addMaterial("TerrainColor", material);
392// renderer.Scene.material("TerrainColor").setReflectivity(0); // reduces tile seams a bit thanks lkalif
393 renderer.SetObjectMaterial("Terrain", "TerrainColor"); 391 renderer.SetObjectMaterial("Terrain", "TerrainColor");
394 } 392 }
395 393
@@ -775,32 +773,5 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
775 { 773 {
776 return Utils.Lerp(Utils.Lerp(v00, v01, xPercent), Utils.Lerp(v10, v11, xPercent), yPercent); 774 return Utils.Lerp(Utils.Lerp(v00, v01, xPercent), Utils.Lerp(v10, v11, xPercent), yPercent);
777 } 775 }
778
779 /// <summary>
780 /// Performs a high quality image resize
781 /// </summary>
782 /// <param name="image">Image to resize</param>
783 /// <param name="width">New width</param>
784 /// <param name="height">New height</param>
785 /// <returns>Resized image</returns>
786 public static Bitmap ResizeImageSolid(Image image, int width, int height)
787 {
788 Bitmap result = new Bitmap(width, height, PixelFormat.Format24bppRgb);
789
790 using (ImageAttributes atrib = new ImageAttributes())
791 using (Graphics graphics = Graphics.FromImage(result))
792 {
793 atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
794 graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
795 graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
796 graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
797 graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
798
799 graphics.DrawImage(image,new Rectangle(0,0, result.Width, result.Height),
800 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib);
801 }
802
803 return result;
804 }
805 } 776 }
806} 777}
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
1427 1427
1428 Bitmap mapTexture = new Bitmap(spanX, spanY); 1428 Bitmap mapTexture = new Bitmap(spanX, spanY);
1429 ImageAttributes gatrib = new ImageAttributes(); 1429 ImageAttributes gatrib = new ImageAttributes();
1430 Graphics g = Graphics.FromImage(mapTexture);
1431 gatrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY); 1430 gatrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
1431
1432 Graphics g = Graphics.FromImage(mapTexture);
1432 g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; 1433 g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
1433 g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; 1434 g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
1434 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; 1435 g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
@@ -1687,11 +1688,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1687 if(mb > Constants.RegionSize && mb > 0) 1688 if(mb > Constants.RegionSize && mb > 0)
1688 { 1689 {
1689 float scale = (float)Constants.RegionSize/(float)mb; 1690 float scale = (float)Constants.RegionSize/(float)mb;
1690 Size newsize = new Size(); 1691 using(Bitmap scaledbmp = Util.ResizeImageSolid(mapbmp, (int)(bx * scale), (int)(by * scale)))
1691 newsize.Width = (int)(bx * scale);
1692 newsize.Height = (int)(by * scale);
1693
1694 using(Bitmap scaledbmp = new Bitmap(mapbmp,newsize))
1695 data = OpenJPEG.EncodeFromImage(scaledbmp, false); 1692 data = OpenJPEG.EncodeFromImage(scaledbmp, false);
1696 } 1693 }
1697 else 1694 else