protected void SetAlpha(ISceneChildEntity part, double alpha, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
Color4 texcolor;
bool changed = false;
if (face >= 0 && face < GetNumberOfSides(part))
{
texcolor = tex.CreateFace((uint)face).RGBA;
if (texcolor.A != alpha)
changed = true;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.FaceTextures[face].RGBA = texcolor;
if (changed)
part.UpdateTexture(tex, false);
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
for (int i = 0; i < GetNumberOfSides(part); i++)
{
if (tex.FaceTextures[i] != null)
{
texcolor = tex.FaceTextures[i].RGBA;
if (texcolor.A != alpha)
changed = true;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.FaceTextures[i].RGBA = texcolor;
}
}
texcolor = tex.DefaultTexture.RGBA;
if (texcolor.A != alpha)
changed = true;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor;
if (changed)
part.UpdateTexture(tex, false);
}
part.ScheduleUpdate(PrimUpdateFlags.FullUpdate);
}