aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
authorUbitUmarov2017-06-24 09:24:56 +0100
committerUbitUmarov2017-06-24 09:24:56 +0100
commit1a8a77c41e4061b75ff97fcf89e39717550bfa25 (patch)
tree325976c8554389b0b566db57eb71a6816ae15291 /OpenSim/Region/CoreModules/Scripting
parentsimplify vectorrender background draw (diff)
downloadopensim-SC-1a8a77c41e4061b75ff97fcf89e39717550bfa25.zip
opensim-SC-1a8a77c41e4061b75ff97fcf89e39717550bfa25.tar.gz
opensim-SC-1a8a77c41e4061b75ff97fcf89e39717550bfa25.tar.bz2
opensim-SC-1a8a77c41e4061b75ff97fcf89e39717550bfa25.tar.xz
revert the thread level change; remove unused dynamic texture timer from internal code; let blend alpha work if < 255; let blend work with the selected face; etc
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs81
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs48
2 files changed, 55 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 82596ca..c0b7ab5 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -138,13 +138,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
138 updater.newTextureID = newTextureID; 138 updater.newTextureID = newTextureID;
139 } 139 }
140 140
141 if (updater.UpdateTimer == 0) 141 lock (Updaters)
142 { 142 {
143 lock (Updaters) 143 if (Updaters.ContainsKey(updater.UpdaterID))
144 { 144 Updaters.Remove(updater.UpdaterID);
145 if (Updaters.ContainsKey(updater.UpdaterID))
146 Updaters.Remove(updater.UpdaterID);
147 }
148 } 145 }
149 } 146 }
150 } 147 }
@@ -171,21 +168,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
171 } 168 }
172 169
173 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 170 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
174 string extraParams, int updateTimer) 171 string extraParams)
175 { 172 {
176 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); 173 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, false, 255);
177 } 174 }
178 175
179 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 176 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
180 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 177 string extraParams, bool SetBlending, byte AlphaValue)
181 { 178 {
182 return AddDynamicTextureURL(simID, primID, contentType, url, 179 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, SetBlending,
183 extraParams, updateTimer, SetBlending, 180 (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
184 (int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
185 } 181 }
186 182
187 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 183 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
188 string extraParams, int updateTimer, bool SetBlending, 184 string extraParams, bool SetBlending,
189 int disp, byte AlphaValue, int face) 185 int disp, byte AlphaValue, int face)
190 { 186 {
191 if (RenderPlugins.ContainsKey(contentType)) 187 if (RenderPlugins.ContainsKey(contentType))
@@ -195,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
195 updater.PrimID = primID; 191 updater.PrimID = primID;
196 updater.ContentType = contentType; 192 updater.ContentType = contentType;
197 updater.Url = url; 193 updater.Url = url;
198 updater.UpdateTimer = updateTimer;
199 updater.UpdaterID = UUID.Random(); 194 updater.UpdaterID = UUID.Random();
200 updater.Params = extraParams; 195 updater.Params = extraParams;
201 updater.BlendWithOldTexture = SetBlending; 196 updater.BlendWithOldTexture = SetBlending;
@@ -218,20 +213,21 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
218 } 213 }
219 214
220 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 215 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
221 string extraParams, int updateTimer) 216 string extraParams)
222 { 217 {
223 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); 218 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, false,
219 (DISP_TEMP|DISP_EXPIRE), 255, ALL_SIDES);
224 } 220 }
225 221
226 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 222 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
227 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 223 string extraParams, bool SetBlending, byte AlphaValue)
228 { 224 {
229 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending, 225 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, SetBlending,
230 (int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); 226 (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
231 } 227 }
232 228
233 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 229 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
234 string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) 230 string extraParams, bool SetBlending, int disp, byte AlphaValue, int face)
235 { 231 {
236 if (!RenderPlugins.ContainsKey(contentType)) 232 if (!RenderPlugins.ContainsKey(contentType))
237 return UUID.Zero; 233 return UUID.Zero;
@@ -257,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
257 updater.PrimID = primID; 253 updater.PrimID = primID;
258 updater.ContentType = contentType; 254 updater.ContentType = contentType;
259 updater.BodyData = data; 255 updater.BodyData = data;
260 updater.UpdateTimer = updateTimer;
261 updater.UpdaterID = UUID.Random(); 256 updater.UpdaterID = UUID.Random();
262 updater.Params = extraParams; 257 updater.Params = extraParams;
263 updater.BlendWithOldTexture = SetBlending; 258 updater.BlendWithOldTexture = SetBlending;
@@ -403,10 +398,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
403 public byte FrontAlpha = 255; 398 public byte FrontAlpha = 255;
404 public string Params; 399 public string Params;
405 public UUID PrimID; 400 public UUID PrimID;
406 public bool SetNewFrontAlpha = false;
407 public UUID SimUUID; 401 public UUID SimUUID;
408 public UUID UpdaterID; 402 public UUID UpdaterID;
409 public int UpdateTimer;
410 public int Face; 403 public int Face;
411 public int Disp; 404 public int Disp;
412 public string Url; 405 public string Url;
@@ -414,7 +407,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
414 407
415 public DynamicTextureUpdater() 408 public DynamicTextureUpdater()
416 { 409 {
417 UpdateTimer = 0;
418 BodyData = null; 410 BodyData = null;
419 } 411 }
420 412
@@ -440,19 +432,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
440 { 432 {
441 oldID = tmptex.DefaultTexture.TextureID; 433 oldID = tmptex.DefaultTexture.TextureID;
442 tmptex.DefaultTexture.TextureID = textureID; 434 tmptex.DefaultTexture.TextureID = textureID;
435 for(int i = 0; i < tmptex.FaceTextures.Length; i++)
436 tmptex.FaceTextures[i] = null;
443 } 437 }
444 else 438 else
445 { 439 {
446 try 440 try
447 { 441 {
448 Primitive.TextureEntryFace texface = tmptex.GetFace((uint)Face); 442 Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
449 if(texface == null) 443 oldID = texface.TextureID;
450 tmptex.GetFace((uint)Face);
451 else
452 {
453 if(texface.TextureID != null && texface.TextureID != UUID.Zero)
454 oldID = texface.TextureID;
455 }
456 texface.TextureID = textureID; 444 texface.TextureID = textureID;
457 tmptex.FaceTextures[Face] = texface; 445 tmptex.FaceTextures[Face] = texface;
458 } 446 }
@@ -462,10 +450,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
462 } 450 }
463 } 451 }
464 452
465 // I'm pretty sure we always want to force this to true
466 // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
467 // tmptex.DefaultTexture.Fullbright = true;
468
469 part.UpdateTextureEntry(tmptex.GetBytes()); 453 part.UpdateTextureEntry(tmptex.GetBytes());
470 } 454 }
471 455
@@ -498,13 +482,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
498 482
499 if (BlendWithOldTexture) 483 if (BlendWithOldTexture)
500 { 484 {
501 Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture; 485 Primitive.TextureEntryFace curFace;
502 if (defaultFace != null) 486 if(Face == ALL_SIDES)
487 curFace = part.Shape.Textures.DefaultTexture;
488 else
489 {
490 try
491 {
492 curFace = part.Shape.Textures.GetFace((uint)Face);
493 }
494 catch
495 {
496 curFace = null;
497 }
498 }
499 if (curFace != null)
503 { 500 {
504 oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString()); 501 oldAsset = scene.AssetService.Get(curFace.TextureID.ToString());
505 502
506 if (oldAsset != null) 503 if (oldAsset != null)
507 assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); 504 assetData = BlendTextures(data, oldAsset.Data, FrontAlpha);
508 } 505 }
509 } 506 }
510 507
@@ -555,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
555 return asset.FullID; 552 return asset.FullID;
556 } 553 }
557 554
558 private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) 555 private byte[] BlendTextures(byte[] frontImage, byte[] backImage, byte newAlpha)
559 { 556 {
560 ManagedImage managedImage; 557 ManagedImage managedImage;
561 Image image; 558 Image image;
@@ -575,7 +572,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
575 Bitmap image2 = new Bitmap(image); 572 Bitmap image2 = new Bitmap(image);
576 image.Dispose(); 573 image.Dispose();
577 574
578 if (setNewAlpha) 575 if (newAlpha < 255)
579 SetAlpha(ref image1, newAlpha); 576 SetAlpha(ref image1, newAlpha);
580 577
581 using(Bitmap joint = MergeBitMaps(image1, image2)) 578 using(Bitmap joint = MergeBitMaps(image1, image2))
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
index ed255bf..325f7f9 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
@@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
77 so.UUID, 77 so.UUID,
78 m_vrm.GetContentType(), 78 m_vrm.GetContentType(),
79 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", 79 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
80 "", 80 "");
81 0);
82 81
83 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 82 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
84 } 83 }
@@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
98 so.UUID, 97 so.UUID,
99 m_vrm.GetContentType(), 98 m_vrm.GetContentType(),
100 dtText, 99 dtText,
101 "", 100 "");
102 0);
103 101
104 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 102 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
105 103
@@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
108 so.UUID, 106 so.UUID,
109 m_vrm.GetContentType(), 107 m_vrm.GetContentType(),
110 dtText, 108 dtText,
111 "", 109 "");
112 0);
113 110
114 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 111 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
115 } 112 }
@@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
129 so.UUID, 126 so.UUID,
130 m_vrm.GetContentType(), 127 m_vrm.GetContentType(),
131 dtText, 128 dtText,
132 "", 129 "");
133 0);
134 130
135 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 131 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
136 132
@@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
139 so.UUID, 135 so.UUID,
140 m_vrm.GetContentType(), 136 m_vrm.GetContentType(),
141 dtText, 137 dtText,
142 "alpha:250", 138 "alpha:250");
143 0);
144 139
145 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 140 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
146 } 141 }
@@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
161 so.UUID, 156 so.UUID,
162 m_vrm.GetContentType(), 157 m_vrm.GetContentType(),
163 dtText, 158 dtText,
164 "", 159 "");
165 0);
166 160
167 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 161 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
168 162
@@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
171 so.UUID, 165 so.UUID,
172 m_vrm.GetContentType(), 166 m_vrm.GetContentType(),
173 dtText, 167 dtText,
174 "", 168 "");
175 0);
176 169
177 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 170 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
178 } 171 }
@@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
191 so.UUID, 184 so.UUID,
192 m_vrm.GetContentType(), 185 m_vrm.GetContentType(),
193 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", 186 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
194 "", 187 "");
195 0);
196 188
197 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 189 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
198 } 190 }
@@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
213 so.UUID, 205 so.UUID,
214 m_vrm.GetContentType(), 206 m_vrm.GetContentType(),
215 dtText, 207 dtText,
216 "", 208 "");
217 0);
218 209
219 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 210 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
220 211
@@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
223 so.UUID, 214 so.UUID,
224 m_vrm.GetContentType(), 215 m_vrm.GetContentType(),
225 dtText, 216 dtText,
226 "", 217 "");
227 0);
228 218
229 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 219 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
230 } 220 }
@@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
253 so.UUID, 243 so.UUID,
254 m_vrm.GetContentType(), 244 m_vrm.GetContentType(),
255 dtText, 245 dtText,
256 "1024", 246 "1024");
257 0);
258 247
259 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 248 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
260 249
@@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
263 so.UUID, 252 so.UUID,
264 m_vrm.GetContentType(), 253 m_vrm.GetContentType(),
265 dtText, 254 dtText,
266 "1024", 255 "1024");
267 0);
268 256
269 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 257 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
270 } 258 }
@@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
284 so.UUID, 272 so.UUID,
285 m_vrm.GetContentType(), 273 m_vrm.GetContentType(),
286 dtText, 274 dtText,
287 "", 275 "");
288 0);
289 276
290 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 277 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
291 278
@@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
294 so.UUID, 281 so.UUID,
295 m_vrm.GetContentType(), 282 m_vrm.GetContentType(),
296 dtText, 283 dtText,
297 "alpha:250", 284 "alpha:250");
298 0);
299 285
300 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 286 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
301 } 287 }
@@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
316 so.UUID, 302 so.UUID,
317 m_vrm.GetContentType(), 303 m_vrm.GetContentType(),
318 dtText, 304 dtText,
319 "", 305 "");
320 0);
321 306
322 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 307 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
323 308
@@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
326 so.UUID, 311 so.UUID,
327 m_vrm.GetContentType(), 312 m_vrm.GetContentType(),
328 dtText, 313 dtText,
329 "", 314 "");
330 0);
331 315
332 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 316 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
333 } 317 }