NUTEXB : Align array levels fixing cubemap importing
This commit is contained in:
parent
7ca392bdfe
commit
336efb45ff
@ -11,6 +11,7 @@ using Toolbox.Library.Forms;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Syroot.NintenTools.NSW.Bntx;
|
using Syroot.NintenTools.NSW.Bntx;
|
||||||
using Syroot.NintenTools.NSW.Bntx.GFX;
|
using Syroot.NintenTools.NSW.Bntx.GFX;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace FirstPlugin
|
namespace FirstPlugin
|
||||||
{
|
{
|
||||||
@ -277,7 +278,7 @@ namespace FirstPlugin
|
|||||||
foreach (var array in tex.Texture.TextureData)
|
foreach (var array in tex.Texture.TextureData)
|
||||||
data.Add(array[0]);
|
data.Add(array[0]);
|
||||||
|
|
||||||
var output = Utils.CombineByteArray(data.ToArray());
|
var output = CreateBuffer(data);
|
||||||
|
|
||||||
Width = tex.Texture.Width;
|
Width = tex.Texture.Width;
|
||||||
Height = tex.Texture.Height;
|
Height = tex.Texture.Height;
|
||||||
@ -329,6 +330,20 @@ namespace FirstPlugin
|
|||||||
UpdateEditor();
|
UpdateEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte[] CreateBuffer(List<byte[]> imageData)
|
||||||
|
{
|
||||||
|
var mem = new MemoryStream();
|
||||||
|
using (var writer = new FileWriter(mem))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < imageData.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0) writer.Align(Alignment);
|
||||||
|
writer.Write(imageData[i]);
|
||||||
|
}
|
||||||
|
return mem.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ApplySettings(GenericTextureImporterSettings settings)
|
private void ApplySettings(GenericTextureImporterSettings settings)
|
||||||
{
|
{
|
||||||
//Combine all arrays
|
//Combine all arrays
|
||||||
@ -565,7 +580,7 @@ namespace FirstPlugin
|
|||||||
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0, int DepthLevel = 0)
|
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0, int DepthLevel = 0)
|
||||||
{
|
{
|
||||||
if (!IsSwizzled)
|
if (!IsSwizzled)
|
||||||
return DDS.GetArrayFaces(this, ImageData,1)[ArrayLevel].mipmaps[0];
|
return DDS.GetArrayFaces(this, ImageData, 1)[ArrayLevel].mipmaps[0];
|
||||||
|
|
||||||
return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, DepthLevel, 1);
|
return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, DepthLevel, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user