One more module converted: VectorRenderModule.
parent
9f45198516
commit
4de8915ddd
|
@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Mono.Addins;
|
||||||
|
|
||||||
//using Cairo;
|
//using Cairo;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
{
|
{
|
||||||
public class VectorRenderModule : IRegionModule, IDynamicTextureRender
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")]
|
||||||
|
public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender
|
||||||
{
|
{
|
||||||
// These fields exist for testing purposes, please do not remove.
|
// These fields exist for testing purposes, please do not remove.
|
||||||
// private static bool s_flipper;
|
// private static bool s_flipper;
|
||||||
|
@ -56,6 +58,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private IDynamicTextureManager m_textureManager;
|
private IDynamicTextureManager m_textureManager;
|
||||||
|
private IDynamicTextureManager TextureManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_textureManager == null && m_scene != null)
|
||||||
|
{
|
||||||
|
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||||
|
if (m_textureManager != null)
|
||||||
|
{
|
||||||
|
m_textureManager.RegisterRender(GetContentType(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_textureManager;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Graphics m_graph;
|
private Graphics m_graph;
|
||||||
private string m_fontName = "Arial";
|
private string m_fontName = "Arial";
|
||||||
|
|
||||||
|
@ -104,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
||||||
{
|
{
|
||||||
// XXX: This isn't actually being done asynchronously!
|
// XXX: This isn't actually being done asynchronously!
|
||||||
m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
TextureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -131,45 +149,41 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (m_scene == null)
|
|
||||||
{
|
|
||||||
m_scene = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_graph == null)
|
|
||||||
{
|
|
||||||
// We won't dispose of these explicitly since this module is only removed when the entire simulator
|
|
||||||
// is shut down.
|
|
||||||
Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
|
|
||||||
m_graph = Graphics.FromImage(bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
IConfig cfg = config.Configs["VectorRender"];
|
IConfig cfg = config.Configs["VectorRender"];
|
||||||
if (null != cfg)
|
if (null != cfg)
|
||||||
{
|
{
|
||||||
m_fontName = cfg.GetString("font_name", m_fontName);
|
m_fontName = cfg.GetString("font_name", m_fontName);
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
|
m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
|
||||||
|
|
||||||
|
// We won't dispose of these explicitly since this module is only removed when the entire simulator
|
||||||
|
// is shut down.
|
||||||
|
Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
|
||||||
|
m_graph = Graphics.FromImage(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
|
||||||
if (m_textureManager != null)
|
|
||||||
{
|
|
||||||
m_textureManager.RegisterRender(GetContentType(), this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This code exists for testing purposes, please do not remove.
|
public void AddRegion(Scene scene)
|
||||||
// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data;
|
{
|
||||||
// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data;
|
if (m_scene == null)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Terrain dirt - smallest bin/assets file (6004 bytes)
|
public void RegionLoaded(Scene scene)
|
||||||
// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data;
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -181,9 +195,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
get { return "VectorRenderModule"; }
|
get { return "VectorRenderModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue