mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-14 02:54:16 -04:00
update TextureFormat
This commit is contained in:
@ -1232,6 +1232,8 @@ namespace Unity_Studio
|
||||
BitmapData bmd = imageTexture.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
Ponvert(m_Texture2D.image_data, bmd.Scan0, m_Texture2D.m_Width, m_Texture2D.m_Height, m_Texture2D.image_data_size, m_Texture2D.q_format);
|
||||
imageTexture.UnlockBits(bmd);
|
||||
if (m_Texture2D.glBaseInternalFormat == KTXHeader.GL_RED || m_Texture2D.glBaseInternalFormat == KTXHeader.GL_RG)
|
||||
FixAlpha(imageTexture);
|
||||
imageTexture.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
}
|
||||
else
|
||||
@ -1383,6 +1385,19 @@ namespace Unity_Studio
|
||||
}
|
||||
}
|
||||
|
||||
private void FixAlpha(Bitmap imageTexture)
|
||||
{
|
||||
for (int y = 0; y < imageTexture.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < imageTexture.Width; x++)
|
||||
{
|
||||
var color = imageTexture.GetPixel(x, y);
|
||||
color = Color.FromArgb(255, color.R, color.G, color.B);
|
||||
imageTexture.SetPixel(x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] Texture2DToDDS(Texture2D m_Texture2D)
|
||||
{
|
||||
byte[] imageBuffer = new byte[128 + m_Texture2D.image_data_size];
|
||||
@ -3311,6 +3326,8 @@ namespace Unity_Studio
|
||||
var bmd = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
Ponvert(m_Texture2D.image_data, bmd.Scan0, m_Texture2D.m_Width, m_Texture2D.m_Height, m_Texture2D.image_data_size, m_Texture2D.q_format);
|
||||
bitmap.UnlockBits(bmd);
|
||||
if (m_Texture2D.glBaseInternalFormat == KTXHeader.GL_RED || m_Texture2D.glBaseInternalFormat == KTXHeader.GL_RG)
|
||||
FixAlpha(bitmap);
|
||||
if (flip)
|
||||
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
bitmap.Save(exportFullname, format);
|
||||
|
Reference in New Issue
Block a user