mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user