Update BakeLayer.cs

This commit is contained in:
Madpeterz 2021-02-16 07:52:27 +00:00
parent 3f54072665
commit 0d6e7cba4d

View file

@ -30,7 +30,6 @@ using System.Collections.Generic;
using System.IO;
using System.Drawing;
using OpenMetaverse.Assets;
using log4net;
namespace OpenMetaverse.Imaging
{
@ -329,9 +328,9 @@ namespace OpenMetaverse.Imaging
DrawLayer(texture, false);
}
}
}
// Apply any alpha wearable textures to make parts of the avatar disappear
}
// Apply any alpha wearable textures to make parts of the avatar disappear
Logger.Log("[XBakes]: Number of alpha wearable textures: " + alphaWearableTextures.Count.ToString(), Helpers.LogLevel.Debug);
foreach (ManagedImage img in alphaWearableTextures)
AddAlpha(bakedTexture.Image, img);
@ -462,6 +461,8 @@ namespace OpenMetaverse.Imaging
{
for (int x = 0; x < bakeWidth; x++)
{
alpha = 0;
alphaInv = 0;
if (sourceHasAlpha)
{
if (sourceAlpha.Length > i)
@ -486,14 +487,22 @@ namespace OpenMetaverse.Imaging
if (addSourceAlpha)
{
if (sourceAlpha[i] < bakedAlpha[i])
{
bakedAlpha[i] = sourceAlpha[i];
if ((sourceAlpha.Length > i) && (bakedAlpha.Length > i))
{
if (sourceAlpha[i] < bakedAlpha[i])
{
bakedAlpha[i] = sourceAlpha[i];
}
}
}
if (sourceHasBump)
bakedBump[i] = sourceBump[i];
if (sourceHasBump)
{
if (sourceBump.Length > i)
{
bakedBump[i] = sourceBump[i];
}
}
++i;
}