diff -Nur opensim-/OpenSim/Region/CoreModules/Scripting/BitmapRender/BitmapRenderModule.cs opensim/OpenSim/Region/CoreModules/Scripting/BitmapRender/BitmapRenderModule.cs --- opensim-/OpenSim/Region/CoreModules/Scripting/BitmapRender/BitmapRenderModule.cs 1970-01-01 09:00:00.000000000 +0900 +++ opensim/OpenSim/Region/CoreModules/Scripting/BitmapRender/BitmapRenderModule.cs 2014-07-05 22:35:46.498420203 +0900 @@ -0,0 +1,309 @@ + +/* + BitmapStringRenderModule v1.1 + by Fum.Iseki '14 6/20 + + string data = "1 2 3 4 5 6 7 8 9 10 11 12"; + A R G B A R G B A R G B + */ + +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.Globalization; +using System.IO; +using System.Net; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.Imaging; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using log4net; +using System.Reflection; +using Mono.Addins; + + + +namespace OpenSim.Region.CoreModules.Scripting.BitmapStringRender +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BitmapStringRenderModule")] + public class BitmapStringRenderModule : ISharedRegionModule, IDynamicTextureRender + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_name = "BitmapStringRenderModule"; + private Scene m_scene; + private IDynamicTextureManager m_textureManager; + + public BitmapStringRenderModule() + { + } + + #region IDynamicTextureRender Members + + public string GetContentType() + { + return ("bitmapstring"); + } + + + public string GetName() + { + return Name; + } + + + public bool SupportsAsynchronous() + { + return true; + } + + + public IDynamicTexture ConvertUrl(string url, string extraParams) + { + return null; + } + + + public IDynamicTexture ConvertData(string bodyData, string extraParams) + { + return Trans(bodyData, extraParams); + } + + + public bool AsyncConvertUrl(UUID id, string url, string extraParams) + { + return false; + } + + + public bool AsyncConvertData(UUID id, string bodyData, string extraParams) + { + //m_log.Error("[BITMAP STRING RENDER MODULE]: Start AsyncConvertData"); + + if (m_textureManager==null) + { + m_log.Warn("[BitMapStringRenderModule]: No texture manager. Can't function"); + return false; + } + + IDynamicTexture texture = Trans(bodyData, extraParams); + if (texture==null) { + m_log.Error("[BITMAP STRING RENDER MODULE]: Texture is NULL"); + return false; + } + + m_textureManager.ReturnData(id, texture); + return true; + } + + + public void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize) + { + xSize = 0; + ySize = 0; + } + + + #endregion + + + + #region ISharedRegionModule Members + + public void PostInitialise() + { + } + + + public string Name + { + get { return m_name; } + } + + + public Type ReplaceableInterface + { + get { return null; } + } + + + public void Initialise(IConfigSource config) + { + return; + } + + + public void Close() + { + } + + + public void AddRegion(Scene scene) + { + if (m_scene==null) m_scene = scene; + } + + + public void RemoveRegion(Scene scene) + { + } + + + public void RegionLoaded(Scene scene) + { + if (m_textureManager==null && m_scene==scene) + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager!=null) + { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + } + + + #endregion + + + + private IDynamicTexture Trans(string data, string extraParams) + { + int width = 256; + int height = 256; + + char[] paramDelimiter = { ',' }; + char[] nvpDelimiter = { ':' }; + + extraParams = extraParams.Trim(); + extraParams = extraParams.ToLower(); + string[] nvps = extraParams.Split(paramDelimiter); + + // for Parameter + foreach (string pair in nvps) + { + string[] nvp = pair.Split(nvpDelimiter); + string name = ""; + string value = ""; + + if (nvp[0] != null) name = nvp[0].Trim(); + if (nvp.Length == 2) value = nvp[1].Trim(); + + int temp; + switch (name) { + case "width": + temp = parseIntParam(value); + if (temp!=-1) { + if (temp < 1) { + width = 1; + } + else if (temp > 2048) { + width = 2048; + } + else { + width = temp; + } + } + break; + + case "height": + temp = parseIntParam(value); + if (temp!=-1) { + if (temp < 1) { + height = 1; + } + else if (temp > 2048) { + height = 2048; + } + else { + height = temp; + } + } + break; + + default: + break; + } + } + + + // for Data + int len = width*height; + string[] buf = System.Text.RegularExpressions.Regex.Split(data.Trim(), " {1,}"); + if (buf.Length255) { + parsed = 0xff; + } + else { + parsed = (byte)temp; + } + + return parsed; + } + + } + +} diff -Nur opensim-/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs opensim/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs --- opensim-/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs 2014-07-05 22:38:44.506839465 +0900 +++ opensim/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs 2014-07-05 22:40:17.732011705 +0900 @@ -495,6 +495,123 @@ if (terrainModule != null) terrainModule.TaintTerrain(); } + + // Fumi.Iseki + public void osTerrainSetByString(string str, double rate) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainSetByString"); + + m_host.AddScriptLPS(1); + + int i, j; + + int lnno = (int)(World.Heightmap.Height*rate+1); + double[,] hgt = new double[World.Heightmap.Width, lnno]; + for (i=0; i=lnno) break; + i = 0; + string line = rec.Trim(' '); + foreach(string itm in System.Text.RegularExpressions.Regex.Split(line, " {1,}")) { + if (i>=World.Heightmap.Width) break; + hgt[i, j] = double.Parse(itm); + i++; + } + j++; + } + + for (j=0; j=World.Heightmap.Width) mm = World.Heightmap.Width - 1; + if (hh>=World.Heightmap.Width) hh = World.Heightmap.Width - 1; + if (mm<0) mm = 0; + if (hh<0) hh = 0; + + for (int j=0; j=World.Heightmap.Height) nn = World.Heightmap.Height - 1; + if (ll>=World.Heightmap.Height) ll = World.Heightmap.Height - 1; + if (nn<0) nn = 0; + if (ll<0) ll = 0; + + double aa = World.Heightmap[mm, nn]; + double bb = World.Heightmap[hh, nn]; + double cc = World.Heightmap[mm, ll]; + double dd = World.Heightmap[hh, ll]; + double zz = (1.0-al)*(1.0-bt)*aa + al*(1.0-bt)*bb + (1.0-al)*bt*cc + al*bt*dd - z; + + int kk = (int)(mhsz*(zz/obsz+0.5)*sfc + 0.5); + if (i