aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs68
1 files changed, 41 insertions, 27 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index b4e3d77..efa99e9 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using log4net; 41using log4net;
42using System.Reflection; 42using System.Reflection;
43using Mono.Addins;
43 44
44//using Cairo; 45//using Cairo;
45 46
46namespace OpenSim.Region.CoreModules.Scripting.VectorRender 47namespace OpenSim.Region.CoreModules.Scripting.VectorRender
47{ 48{
48 public class VectorRenderModule : IRegionModule, IDynamicTextureRender 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")]
50 public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender
49 { 51 {
50 // These fields exist for testing purposes, please do not remove. 52 // These fields exist for testing purposes, please do not remove.
51// private static bool s_flipper; 53// private static bool s_flipper;
@@ -56,6 +58,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
56 58
57 private Scene m_scene; 59 private Scene m_scene;
58 private IDynamicTextureManager m_textureManager; 60 private IDynamicTextureManager m_textureManager;
61 private IDynamicTextureManager TextureManager
62 {
63 get
64 {
65 if (m_textureManager == null && m_scene != null)
66 {
67 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
68 if (m_textureManager != null)
69 {
70 m_textureManager.RegisterRender(GetContentType(), this);
71 }
72 }
73 return m_textureManager;
74 }
75 }
76
59 private Graphics m_graph; 77 private Graphics m_graph;
60 private string m_fontName = "Arial"; 78 private string m_fontName = "Arial";
61 79
@@ -104,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
104 public bool AsyncConvertData(UUID id, string bodyData, string extraParams) 122 public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
105 { 123 {
106 // XXX: This isn't actually being done asynchronously! 124 // XXX: This isn't actually being done asynchronously!
107 m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); 125 TextureManager.ReturnData(id, ConvertData(bodyData, extraParams));
108 126
109 return true; 127 return true;
110 } 128 }
@@ -131,45 +149,41 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
131 149
132 #endregion 150 #endregion
133 151
134 #region IRegionModule Members 152 #region ISharedRegionModule Members
135 153
136 public void Initialise(Scene scene, IConfigSource config) 154 public void Initialise(IConfigSource config)
137 { 155 {
138 if (m_scene == null)
139 {
140 m_scene = scene;
141 }
142
143 if (m_graph == null)
144 {
145 // We won't dispose of these explicitly since this module is only removed when the entire simulator
146 // is shut down.
147 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
148 m_graph = Graphics.FromImage(bitmap);
149 }
150
151 IConfig cfg = config.Configs["VectorRender"]; 156 IConfig cfg = config.Configs["VectorRender"];
152 if (null != cfg) 157 if (null != cfg)
153 { 158 {
154 m_fontName = cfg.GetString("font_name", m_fontName); 159 m_fontName = cfg.GetString("font_name", m_fontName);
155 } 160 }
156 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); 161 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
162
163 // We won't dispose of these explicitly since this module is only removed when the entire simulator
164 // is shut down.
165 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
166 m_graph = Graphics.FromImage(bitmap);
157 } 167 }
158 168
159 public void PostInitialise() 169 public void PostInitialise()
160 { 170 {
161 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 171 }
162 if (m_textureManager != null) 172
173 public void AddRegion(Scene scene)
174 {
175 if (m_scene == null)
163 { 176 {
164 m_textureManager.RegisterRender(GetContentType(), this); 177 m_scene = scene;
165 } 178 }
179 }
166 180
167 // This code exists for testing purposes, please do not remove. 181 public void RegionLoaded(Scene scene)
168// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; 182 {
169// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; 183 }
170 184
171 // Terrain dirt - smallest bin/assets file (6004 bytes) 185 public void RemoveRegion(Scene scene)
172// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; 186 {
173 } 187 }
174 188
175 public void Close() 189 public void Close()
@@ -181,9 +195,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
181 get { return "VectorRenderModule"; } 195 get { return "VectorRenderModule"; }
182 } 196 }
183 197
184 public bool IsSharedModule 198 public Type ReplaceableInterface
185 { 199 {
186 get { return true; } 200 get { return null; }
187 } 201 }
188 202
189 #endregion 203 #endregion