mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2025-02-16 22:08:26 +00:00
More layout rendering fixes
This commit is contained in:
parent
0f19107dd2
commit
6ec78fa2c5
7 changed files with 45 additions and 41 deletions
|
@ -61,10 +61,10 @@ namespace LayoutBXLYT
|
|||
var pic1Pane = pane as Cafe.BFLYT.PIC1;
|
||||
|
||||
Color[] Colors = new Color[] {
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
pic1Pane.ColorBottomRight.Color,
|
||||
pic1Pane.ColorBottomLeft.Color,
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
};
|
||||
|
||||
var mat = pic1Pane.Material;
|
||||
|
|
|
@ -66,12 +66,9 @@ namespace LayoutBXLYT
|
|||
if (material.TextureTransforms.Length > 0)
|
||||
{
|
||||
var transform = material.TextureTransforms[0];
|
||||
float shiftX = 0;
|
||||
float shiftY = 0;
|
||||
|
||||
SetVec2("uvScale0",new Vector2(transform.Scale.X, transform.Scale.Y));
|
||||
SetFloat("uvRotate0", transform.Rotate);
|
||||
SetVec2("uvTranslate0",new Vector2(shiftX + transform.Translate.X, shiftY + transform.Translate.Y));
|
||||
SetVec2("uvTranslate0",new Vector2(transform.Translate.X, transform.Translate.Y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,26 +21,31 @@ namespace LayoutBXLYT
|
|||
|
||||
public override void OnCompiled()
|
||||
{
|
||||
SetColor("whiteColor", Color.FromArgb(255,255,255,255));
|
||||
SetColor("whiteColor", Color.FromArgb(255, 255, 255, 255));
|
||||
SetColor("blackColor", Color.FromArgb(0, 0, 0, 0));
|
||||
SetInt("debugShading", 0);
|
||||
SetInt("hasTexture0", 0);
|
||||
SetInt("numTextureMaps", 0);
|
||||
SetInt("flipTexture", 0);
|
||||
SetInt("textures0", 0);
|
||||
SetInt("textures1", 0);
|
||||
SetInt("textures2", 0);
|
||||
|
||||
SetVec2("uvScale0", new Vector2(1,1));
|
||||
SetVec2("uvScale0", new Vector2(1, 1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
}
|
||||
|
||||
public void SetMaterials(Dictionary<string, STGenericTexture> textures)
|
||||
{
|
||||
SetColor("whiteColor", Color.FromArgb(255, 255, 255, 255));
|
||||
SetColor("blackColor", Color.FromArgb(0, 0, 0, 0));
|
||||
SetColor("whiteColor", material.TevConstantColors[0].Color);
|
||||
SetColor("blackColor", material.TevColor.Color);
|
||||
SetInt("debugShading", (int)Runtime.LayoutEditor.Shading);
|
||||
SetInt("numTextureMaps", material.TextureMaps.Count);
|
||||
SetVec2("uvScale0", new Vector2(1, 1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
SetInt("flipTexture", 0);
|
||||
|
||||
BindTextureUniforms();
|
||||
|
||||
|
@ -60,16 +65,9 @@ namespace LayoutBXLYT
|
|||
if (material.TextureTransforms.Count > 0)
|
||||
{
|
||||
var transform = material.TextureTransforms[0];
|
||||
float shiftX = 0;
|
||||
float shiftY = 0;
|
||||
if (transform.Scale.X < 0)
|
||||
shiftX = 1;
|
||||
if (transform.Scale.Y < 0)
|
||||
shiftY = 1;
|
||||
|
||||
//SetVec2("uvScale0",new Vector2(transform.Scale.X, transform.Scale.Y));
|
||||
// SetFloat("uvRotate0", transform.Rotate);
|
||||
// SetVec2("uvTranslate0",new Vector2(shiftX + transform.Translate.X, shiftY + transform.Translate.Y));
|
||||
SetVec2("uvScale0", new Vector2(transform.Scale.X, transform.Scale.Y));
|
||||
SetFloat("uvRotate0", transform.Rotate);
|
||||
SetVec2("uvTranslate0", new Vector2(transform.Translate.X, transform.Translate.Y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -897,8 +897,8 @@ namespace LayoutBXLYT
|
|||
|
||||
Name = reader.ReadString(0x14, true);
|
||||
|
||||
WhiteColor = reader.ReadColor16RGBA();
|
||||
BlackColor = reader.ReadColor16RGBA();
|
||||
WhiteColor = reader.ReadColor16RGBA();
|
||||
ColorRegister3 = reader.ReadColor16RGBA();
|
||||
TevColor1 = reader.ReadColor8RGBA();
|
||||
TevColor2 = reader.ReadColor8RGBA();
|
||||
|
|
|
@ -21,13 +21,17 @@ namespace LayoutBXLYT
|
|||
|
||||
public override void OnCompiled()
|
||||
{
|
||||
SetColor("whiteColor", Color.FromArgb(255,255,255,255));
|
||||
SetColor("whiteColor", Color.FromArgb(255, 255, 255, 255));
|
||||
SetColor("blackColor", Color.FromArgb(0, 0, 0, 0));
|
||||
SetInt("debugShading", 0);
|
||||
SetInt("hasTexture0", 0);
|
||||
SetInt("numTextureMaps", 0);
|
||||
SetInt("flipTexture", 0);
|
||||
SetInt("textures0", 0);
|
||||
SetInt("textures1", 0);
|
||||
SetInt("textures2", 0);
|
||||
|
||||
SetVec2("uvScale0", new Vector2(1,1));
|
||||
SetVec2("uvScale0", new Vector2(1, 1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
}
|
||||
|
@ -38,6 +42,10 @@ namespace LayoutBXLYT
|
|||
SetColor("blackColor", material.BlackColor.Color);
|
||||
SetInt("debugShading", (int)Runtime.LayoutEditor.Shading);
|
||||
SetInt("numTextureMaps", material.TextureMaps.Count);
|
||||
SetVec2("uvScale0", new Vector2(1, 1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
SetInt("flipTexture", 0);
|
||||
|
||||
BindTextureUniforms();
|
||||
|
||||
|
@ -57,16 +65,9 @@ namespace LayoutBXLYT
|
|||
if (material.TextureTransforms.Count > 0)
|
||||
{
|
||||
var transform = material.TextureTransforms[0];
|
||||
float shiftX = 0;
|
||||
float shiftY = 0;
|
||||
if (transform.Scale.X < 0)
|
||||
shiftX = 1;
|
||||
if (transform.Scale.Y < 0)
|
||||
shiftY = 1;
|
||||
|
||||
SetVec2("uvScale0",new Vector2(transform.Scale.X, transform.Scale.Y));
|
||||
SetFloat("uvRotate0", transform.Rotate);
|
||||
SetVec2("uvTranslate0",new Vector2(shiftX + transform.Translate.X, shiftY + transform.Translate.Y));
|
||||
SetVec2("uvTranslate0",new Vector2( transform.Translate.X, transform.Translate.Y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ namespace Toolbox.Library
|
|||
//If true, the editors will call "SetImageData" for setting data back to the original data.
|
||||
public abstract bool CanEdit { get; set; }
|
||||
|
||||
public STChannelType RedChannel;
|
||||
public STChannelType GreenChannel;
|
||||
public STChannelType BlueChannel;
|
||||
public STChannelType AlphaChannel;
|
||||
public STChannelType RedChannel = STChannelType.Red;
|
||||
public STChannelType GreenChannel = STChannelType.Green;
|
||||
public STChannelType BlueChannel = STChannelType.Blue;
|
||||
public STChannelType AlphaChannel = STChannelType.Alpha;
|
||||
|
||||
/// <summary>
|
||||
/// The total length of all the bytes given from GetImageData.
|
||||
|
@ -510,7 +510,7 @@ namespace Toolbox.Library
|
|||
|
||||
Console.WriteLine("Decoding " + Format + " " + Runtime.UseDirectXTexDecoder);
|
||||
|
||||
if (PlatformSwizzle == PlatformSwizzle.Platform_3DS && !IsCompressed(Format))
|
||||
if (PlatformSwizzle == PlatformSwizzle.Platform_3DS)
|
||||
{
|
||||
var Image = BitmapExtension.GetBitmap(ConvertBgraToRgba(CTR_3DS.DecodeBlock(data, (int)width, (int)height, Format)),
|
||||
(int)width, (int)height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
@ -637,7 +637,7 @@ namespace Toolbox.Library
|
|||
byte[] imageData = new byte[0];
|
||||
bool DontSwapRG = false;
|
||||
|
||||
if (PlatformSwizzle == PlatformSwizzle.Platform_3DS && !IsCompressed(Format))
|
||||
if (PlatformSwizzle == PlatformSwizzle.Platform_3DS)
|
||||
{
|
||||
imageData = CTR_3DS.DecodeBlock(data, (int)Width, (int)Height, Format);
|
||||
DontSwapRG = true;
|
||||
|
|
|
@ -196,6 +196,14 @@ namespace Toolbox.Library.Rendering
|
|||
pixelInternalFormat = PixelInternalFormat.Rgba;
|
||||
pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Rgba;
|
||||
|
||||
if (GenericTexture.PlatformSwizzle == PlatformSwizzle.Platform_3DS ||
|
||||
GenericTexture.PlatformSwizzle == PlatformSwizzle.Platform_Gamecube)
|
||||
{
|
||||
UseOpenGLDecoder = false;
|
||||
pixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
|
||||
}
|
||||
|
||||
|
||||
if (UseOpenGLDecoder)
|
||||
SetPixelFormats(GenericTexture.Format);
|
||||
|
||||
|
@ -313,9 +321,9 @@ namespace Toolbox.Library.Rendering
|
|||
width,
|
||||
height,
|
||||
GenericTexture.Format,
|
||||
new byte[0],
|
||||
GenericTexture.GetPaletteData(),
|
||||
GenericTexture.Parameters,
|
||||
PALETTE_FORMAT.None,
|
||||
GenericTexture.PaletteFormat,
|
||||
GenericTexture.PlatformSwizzle));
|
||||
}
|
||||
|
||||
|
@ -346,9 +354,9 @@ namespace Toolbox.Library.Rendering
|
|||
width,
|
||||
height,
|
||||
GenericTexture.Format,
|
||||
new byte[0],
|
||||
GenericTexture.GetPaletteData(),
|
||||
GenericTexture.Parameters,
|
||||
PALETTE_FORMAT.None,
|
||||
GenericTexture.PaletteFormat,
|
||||
GenericTexture.PlatformSwizzle));
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue