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 2010-05-22 22:42:12.000000000 +0900 @@ -0,0 +1,255 @@ + +/* + BitmapStringRenderModule + by Fum.Iseki '10 1/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; + + +namespace OpenSim.Region.CoreModules.Scripting.BitmapStringRender +{ + public class BitmapStringRenderModule : IRegionModule, 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; + + #region IDynamicTextureRender Members + + public string GetContentType() + { + return ("bitmapstring"); + } + + public string GetName() + { + return m_name; + } + + public bool SupportsAsynchronous() + { + return true; + } + + public byte[] ConvertUrl(string url, string extraParams) + { + return null; + } + + public byte[] ConvertStream(Stream data, string extraParams) + { + return null; + } + + public bool AsyncConvertUrl(UUID id, string url, string extraParams) + { + return false; + } + + public bool AsyncConvertData(UUID id, string bodyData, string extraParams) + { + return Trans(bodyData, id, extraParams); + } + + public void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize) + { + xSize = 0; + ySize = 0; + } + + + #endregion + + #region IRegionModule Members + + public void Initialise(Scene scene, IConfigSource config) + { + if (m_scene == null) { + m_scene = scene; + } + } + + public void PostInitialise() + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager != null) { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + + public void Close() + { + } + + public string Name + { + get { return m_name; } + } + + public bool IsSharedModule + { + get { return true; } + } + + #endregion + + + private bool Trans(string data, UUID id, 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 2010-05-22 22:40:57.000000000 +0900 +++ opensim/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs 2010-05-22 22:42:12.000000000 +0900 @@ -335,6 +335,124 @@ 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