diff options
author | UbitUmarov | 2017-06-24 09:24:56 +0100 |
---|---|---|
committer | UbitUmarov | 2017-06-24 09:24:56 +0100 |
commit | 1a8a77c41e4061b75ff97fcf89e39717550bfa25 (patch) | |
tree | 325976c8554389b0b566db57eb71a6816ae15291 /OpenSim/Region/CoreModules/Scripting/DynamicTexture | |
parent | simplify vectorrender background draw (diff) | |
download | opensim-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/DynamicTexture')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | 81 |
1 files changed, 39 insertions, 42 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)) |