aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/VectorRender
diff options
context:
space:
mode:
authorMelanie2012-09-07 19:49:46 +0100
committerMelanie2012-09-07 19:49:46 +0100
commit924df14c5e15185e14c144164dd80d9859d5c583 (patch)
tree110f0e402b879f49943ff2e76598e2241e20057c /OpenSim/Region/CoreModules/Scripting/VectorRender
parentRevert "made setting rotation match Second Life" (diff)
parentMove addin attributes to RegionCombinerModule.addin.xml (diff)
downloadopensim-SC-924df14c5e15185e14c144164dd80d9859d5c583.zip
opensim-SC-924df14c5e15185e14c144164dd80d9859d5c583.tar.gz
opensim-SC-924df14c5e15185e14c144164dd80d9859d5c583.tar.bz2
opensim-SC-924df14c5e15185e14c144164dd80d9859d5c583.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Framework/Servers/VersionInfo.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs42
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs44
2 files changed, 71 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
index b50c0bd..41baccc 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
57 57
58 m_dtm = new DynamicTextureModule(); 58 m_dtm = new DynamicTextureModule();
59 m_dtm.ReuseTextures = reuseTextures; 59 m_dtm.ReuseTextures = reuseTextures;
60// m_dtm.ReuseLowDataTextures = reuseTextures;
60 61
61 m_vrm = new VectorRenderModule(); 62 m_vrm = new VectorRenderModule();
62 63
@@ -201,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
201 public void TestRepeatSameDrawReusingTexture() 202 public void TestRepeatSameDrawReusingTexture()
202 { 203 {
203 TestHelpers.InMethod(); 204 TestHelpers.InMethod();
205// TestHelpers.EnableLogging();
204 206
205 string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; 207 string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
206 208
@@ -228,6 +230,46 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
228 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 230 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
229 } 231 }
230 232
233 /// <summary>
234 /// Test a low data dynamically generated texture such that it is treated as a low data texture that causes
235 /// problems for current viewers.
236 /// </summary>
237 /// <remarks>
238 /// As we do not set DynamicTextureModule.ReuseLowDataTextures = true in this test, it should not reuse the
239 /// texture
240 /// </remarks>
241 [Test]
242 public void TestRepeatSameDrawLowDataTexture()
243 {
244 TestHelpers.InMethod();
245// TestHelpers.EnableLogging();
246
247 string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
248
249 SetupScene(true);
250 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
251
252 m_dtm.AddDynamicTextureData(
253 m_scene.RegionInfo.RegionID,
254 so.UUID,
255 m_vrm.GetContentType(),
256 dtText,
257 "1024",
258 0);
259
260 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
261
262 m_dtm.AddDynamicTextureData(
263 m_scene.RegionInfo.RegionID,
264 so.UUID,
265 m_vrm.GetContentType(),
266 dtText,
267 "1024",
268 0);
269
270 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
271 }
272
231 [Test] 273 [Test]
232 public void TestRepeatSameDrawDifferentExtraParamsReusingTexture() 274 public void TestRepeatSameDrawDifferentExtraParamsReusingTexture()
233 { 275 {
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index f687646..1e17b02 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -35,6 +35,7 @@ using System.Net;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Imaging; 37using OpenMetaverse.Imaging;
38using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using log4net; 41using log4net;
@@ -46,6 +47,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
46{ 47{
47 public class VectorRenderModule : IRegionModule, IDynamicTextureRender 48 public class VectorRenderModule : IRegionModule, IDynamicTextureRender
48 { 49 {
50 // These fields exist for testing purposes, please do not remove.
51// private static bool s_flipper;
52// private static byte[] s_asset1Data;
53// private static byte[] s_asset2Data;
54
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 56
51 private Scene m_scene; 57 private Scene m_scene;
@@ -80,20 +86,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
80// return lines.Any((str, r) => str.StartsWith("Image")); 86// return lines.Any((str, r) => str.StartsWith("Image"));
81// } 87// }
82 88
83 public byte[] ConvertUrl(string url, string extraParams) 89 public IDynamicTexture ConvertUrl(string url, string extraParams)
84 { 90 {
85 return null; 91 return null;
86 } 92 }
87 93
88 public byte[] ConvertData(string bodyData, string extraParams) 94 public IDynamicTexture ConvertData(string bodyData, string extraParams)
89 {
90 bool reuseable;
91 return Draw(bodyData, extraParams, out reuseable);
92 }
93
94 private byte[] ConvertData(string bodyData, string extraParams, out bool reuseable)
95 { 95 {
96 return Draw(bodyData, extraParams, out reuseable); 96 return Draw(bodyData, extraParams);
97 } 97 }
98 98
99 public bool AsyncConvertUrl(UUID id, string url, string extraParams) 99 public bool AsyncConvertUrl(UUID id, string url, string extraParams)
@@ -104,10 +104,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
104 public bool AsyncConvertData(UUID id, string bodyData, string extraParams) 104 public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
105 { 105 {
106 // XXX: This isn't actually being done asynchronously! 106 // XXX: This isn't actually being done asynchronously!
107 bool reuseable; 107 m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
108 byte[] data = ConvertData(bodyData, extraParams, out reuseable);
109
110 m_textureManager.ReturnData(id, data, reuseable);
111 108
112 return true; 109 return true;
113 } 110 }
@@ -161,6 +158,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
161 { 158 {
162 m_textureManager.RegisterRender(GetContentType(), this); 159 m_textureManager.RegisterRender(GetContentType(), this);
163 } 160 }
161
162 // This code exists for testing purposes, please do not remove.
163// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data;
164// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data;
165
166 // Terrain dirt - smallest bin/assets file (6004 bytes)
167// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data;
164 } 168 }
165 169
166 public void Close() 170 public void Close()
@@ -179,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
179 183
180 #endregion 184 #endregion
181 185
182 private byte[] Draw(string data, string extraParams, out bool reuseable) 186 private IDynamicTexture Draw(string data, string extraParams)
183 { 187 {
184 // We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha 188 // We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha
185 // we will now support multiple comma seperated params in the form width:256,height:512,alpha:255 189 // we will now support multiple comma seperated params in the form width:256,height:512,alpha:255
@@ -322,6 +326,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
322 326
323 Bitmap bitmap = null; 327 Bitmap bitmap = null;
324 Graphics graph = null; 328 Graphics graph = null;
329 bool reuseable = false;
325 330
326 try 331 try
327 { 332 {
@@ -364,6 +369,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
364 } 369 }
365 370
366 byte[] imageJ2000 = new byte[0]; 371 byte[] imageJ2000 = new byte[0];
372
373 // This code exists for testing purposes, please do not remove.
374// if (s_flipper)
375// imageJ2000 = s_asset1Data;
376// else
377// imageJ2000 = s_asset2Data;
378//
379// s_flipper = !s_flipper;
367 380
368 try 381 try
369 { 382 {
@@ -376,7 +389,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
376 e.Message, e.StackTrace); 389 e.Message, e.StackTrace);
377 } 390 }
378 391
379 return imageJ2000; 392 return new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
393 data, extraParams, imageJ2000, new Size(width, height), reuseable);
380 } 394 }
381 finally 395 finally
382 { 396 {