aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2011-12-05 18:54:31 +0000
committerMelanie2011-12-05 18:54:31 +0000
commitcc482ee865efb06c05f5bd25943fdab30c0170a7 (patch)
treecc1bee262b25bf10c0ccbb50512d09ec8efec432 /OpenSim/Region/Framework
parentMerge branch 'master' into bigmerge (diff)
parentFix CHANGED_TEXTURE and CHANGED_COLOR. (diff)
downloadopensim-SC_OLD-cc482ee865efb06c05f5bd25943fdab30c0170a7.zip
opensim-SC_OLD-cc482ee865efb06c05f5bd25943fdab30c0170a7.tar.gz
opensim-SC_OLD-cc482ee865efb06c05f5bd25943fdab30c0170a7.tar.bz2
opensim-SC_OLD-cc482ee865efb06c05f5bd25943fdab30c0170a7.tar.xz
Merge branch 'bigmerge' of ssh://melanie@3dhosting.de/var/git/careminster into bigmerge
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs79
1 files changed, 40 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3cc72fe..dbf29d0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3231,7 +3231,10 @@ namespace OpenSim.Region.Framework.Scenes
3231 /// <param name="face"></param> 3231 /// <param name="face"></param>
3232 public void SetFaceColor(Vector3 color, int face) 3232 public void SetFaceColor(Vector3 color, int face)
3233 { 3233 {
3234 Primitive.TextureEntry tex = Shape.Textures; 3234 // The only way to get a deep copy/ If we don't do this, we can
3235 // mever detect color changes further down.
3236 Byte[] buf = Shape.Textures.GetBytes();
3237 Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length);
3235 Color4 texcolor; 3238 Color4 texcolor;
3236 if (face >= 0 && face < GetNumberOfSides()) 3239 if (face >= 0 && face < GetNumberOfSides())
3237 { 3240 {
@@ -3240,8 +3243,7 @@ namespace OpenSim.Region.Framework.Scenes
3240 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); 3243 texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
3241 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3244 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
3242 tex.FaceTextures[face].RGBA = texcolor; 3245 tex.FaceTextures[face].RGBA = texcolor;
3243 UpdateTexture(tex); 3246 UpdateTextureEntry(tex.GetBytes());
3244 TriggerScriptChangedEvent(Changed.COLOR);
3245 return; 3247 return;
3246 } 3248 }
3247 else if (face == ALL_SIDES) 3249 else if (face == ALL_SIDES)
@@ -3262,8 +3264,7 @@ namespace OpenSim.Region.Framework.Scenes
3262 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); 3264 texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
3263 tex.DefaultTexture.RGBA = texcolor; 3265 tex.DefaultTexture.RGBA = texcolor;
3264 } 3266 }
3265 UpdateTexture(tex); 3267 UpdateTextureEntry(tex.GetBytes());
3266 TriggerScriptChangedEvent(Changed.COLOR);
3267 return; 3268 return;
3268 } 3269 }
3269 } 3270 }
@@ -4591,46 +4592,46 @@ namespace OpenSim.Region.Framework.Scenes
4591 } 4592 }
4592 4593
4593 /// <summary> 4594 /// <summary>
4594 /// Update the textures on the part.
4595 /// </summary>
4596 /// <remarks>
4597 /// Added to handle bug in libsecondlife's TextureEntry.ToBytes()
4598 /// not handling RGBA properly. Cycles through, and "fixes" the color
4599 /// info
4600 /// </remarks>
4601 /// <param name="tex"></param>
4602 public void UpdateTexture(Primitive.TextureEntry tex)
4603 {
4604 //Color4 tmpcolor;
4605 //for (uint i = 0; i < 32; i++)
4606 //{
4607 // if (tex.FaceTextures[i] != null)
4608 // {
4609 // tmpcolor = tex.GetFace((uint) i).RGBA;
4610 // tmpcolor.A = tmpcolor.A*255;
4611 // tmpcolor.R = tmpcolor.R*255;
4612 // tmpcolor.G = tmpcolor.G*255;
4613 // tmpcolor.B = tmpcolor.B*255;
4614 // tex.FaceTextures[i].RGBA = tmpcolor;
4615 // }
4616 //}
4617 //tmpcolor = tex.DefaultTexture.RGBA;
4618 //tmpcolor.A = tmpcolor.A*255;
4619 //tmpcolor.R = tmpcolor.R*255;
4620 //tmpcolor.G = tmpcolor.G*255;
4621 //tmpcolor.B = tmpcolor.B*255;
4622 //tex.DefaultTexture.RGBA = tmpcolor;
4623 UpdateTextureEntry(tex.GetBytes());
4624 }
4625
4626 /// <summary>
4627 /// Update the texture entry for this part. 4595 /// Update the texture entry for this part.
4628 /// </summary> 4596 /// </summary>
4629 /// <param name="textureEntry"></param> 4597 /// <param name="textureEntry"></param>
4630 public void UpdateTextureEntry(byte[] textureEntry) 4598 public void UpdateTextureEntry(byte[] textureEntry)
4631 { 4599 {
4600 Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length);
4601 Primitive.TextureEntry oldTex = Shape.Textures;
4602
4603 Changed changeFlags = 0;
4604
4605 for (int i = 0 ; i < GetNumberOfSides(); i++)
4606 {
4607 Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
4608 Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;
4609
4610 if (oldTex.FaceTextures[i] != null)
4611 oldFace = oldTex.FaceTextures[i];
4612 if (newTex.FaceTextures[i] != null)
4613 newFace = newTex.FaceTextures[i];
4614
4615 Color4 oldRGBA = oldFace.RGBA;
4616 Color4 newRGBA = newFace.RGBA;
4617
4618 if (oldRGBA.R != newRGBA.R ||
4619 oldRGBA.G != newRGBA.G ||
4620 oldRGBA.B != newRGBA.B ||
4621 oldRGBA.A != newRGBA.A)
4622 changeFlags |= Changed.COLOR;
4623
4624 if (oldFace.TextureID != newFace.TextureID)
4625 changeFlags |= Changed.TEXTURE;
4626
4627 // Max change, skip the rest of testing
4628 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
4629 break;
4630 }
4631
4632 m_shape.TextureEntry = textureEntry; 4632 m_shape.TextureEntry = textureEntry;
4633 TriggerScriptChangedEvent(Changed.TEXTURE); 4633 if (changeFlags != 0)
4634 TriggerScriptChangedEvent(changeFlags);
4634 UpdateFlag = UpdateRequired.FULL; 4635 UpdateFlag = UpdateRequired.FULL;
4635 ParentGroup.HasGroupChanged = true; 4636 ParentGroup.HasGroupChanged = true;
4636 4637