Fixed several cases of inverted colors and alpha in DNE and XEngine.

Added clamping to 0.0 - 1.0 for R, G, B, and A.
0.6.0-stable
Homer Horwitz 2008-09-13 22:48:30 +00:00
parent af899e50c2
commit 37e6ce24a2
2 changed files with 70 additions and 70 deletions

View File

@ -1340,7 +1340,7 @@ namespace OpenSim.Region.ScriptEngine.Common
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -1352,12 +1352,12 @@ namespace OpenSim.Region.ScriptEngine.Common
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2866,9 +2866,9 @@ namespace OpenSim.Region.ScriptEngine.Common
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2876,25 +2876,25 @@ namespace OpenSim.Region.ScriptEngine.Common
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2913,34 +2913,34 @@ namespace OpenSim.Region.ScriptEngine.Common
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
}
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
}
@ -6154,7 +6154,7 @@ namespace OpenSim.Region.ScriptEngine.Common
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -6162,19 +6162,19 @@ namespace OpenSim.Region.ScriptEngine.Common
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -6193,26 +6193,26 @@ namespace OpenSim.Region.ScriptEngine.Common
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
}
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
}

View File

@ -1149,7 +1149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -1161,12 +1161,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2710,9 +2710,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2720,25 +2720,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -2757,34 +2757,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
}
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.R = (float)Math.Abs(color.x - 1);
texcolor.G = (float)Math.Abs(color.y - 1);
texcolor.B = (float)Math.Abs(color.z - 1);
texcolor.R = (float)Math.Min(Math.Max(color.x, 0.0), 1.0);
texcolor.G = (float)Math.Min(Math.Max(color.y, 0.0), 1.0);
texcolor.B = (float)Math.Min(Math.Max(color.z, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
}
@ -5959,7 +5959,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -5967,19 +5967,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
return;
@ -5998,26 +5998,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face > -1)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[face].RGBA = texcolor;
part.UpdateTexture(tex);
}
else if (face == -1)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
for (uint i = 0; i < 32; i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = (float)Math.Abs(alpha - 1);
texcolor.A = (float)Math.Min(Math.Max(alpha, 0.0), 1.0);
tex.DefaultTexture.RGBA = texcolor;
part.UpdateTexture(tex);
}