mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 22:40:27 +00:00
Add proper render pass check and sort transparent shapes properly
This commit is contained in:
parent
056a13d03a
commit
3b7e02f399
5 changed files with 18 additions and 4 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -36,6 +36,7 @@ namespace FirstPlugin
|
|||
TEX_FORMAT.R8G8B8A8_UNORM,
|
||||
TEX_FORMAT.A8_UNORM,
|
||||
TEX_FORMAT.R8G8_UNORM,
|
||||
TEX_FORMAT.R8G8_SNORM,
|
||||
TEX_FORMAT.B5G6R5_UNORM,
|
||||
TEX_FORMAT.R10G10B10A2_UNORM,
|
||||
TEX_FORMAT.B4G4R4A4_UNORM,
|
||||
|
@ -49,6 +50,7 @@ namespace FirstPlugin
|
|||
{
|
||||
case TEX_FORMAT.A8_UNORM: return BFLIMFormat.L8_UNORM;
|
||||
case TEX_FORMAT.R8G8_UNORM: return BFLIMFormat.LA8;
|
||||
case TEX_FORMAT.R8G8_SNORM: return BFLIMFormat.LA8;
|
||||
case TEX_FORMAT.B5G6R5_UNORM: return BFLIMFormat.RGB565;
|
||||
case TEX_FORMAT.B5G5R5A1_UNORM: return BFLIMFormat.RGB5A1;
|
||||
case TEX_FORMAT.R8G8B8A8_UNORM: return BFLIMFormat.RGBA8;
|
||||
|
|
|
@ -402,6 +402,12 @@ namespace FirstPlugin
|
|||
{
|
||||
if (models[m].Checked)
|
||||
{
|
||||
//Check render pass first!
|
||||
for (int shp = 0; shp < models[m].shapes.Count; shp++)
|
||||
{
|
||||
SetRenderPass(models[m].shapes[shp].GetMaterial());
|
||||
}
|
||||
|
||||
List<FSHP> opaque = new List<FSHP>();
|
||||
List<FSHP> transparent = new List<FSHP>();
|
||||
|
||||
|
@ -413,9 +419,14 @@ namespace FirstPlugin
|
|||
opaque.Add(models[m].shapes[shp]);
|
||||
}
|
||||
|
||||
for (int shp = 0; shp < models[m].shapes.Count; shp++)
|
||||
for (int shp = 0; shp < transparent.Count; shp++)
|
||||
{
|
||||
DrawModel(models[m].shapes[shp], models[m], shader, models[m].IsSelected);
|
||||
DrawModel(transparent[shp], models[m], shader, models[m].IsSelected);
|
||||
}
|
||||
|
||||
for (int shp = 0; shp < opaque.Count; shp++)
|
||||
{
|
||||
DrawModel(opaque[shp], models[m], shader, models[m].IsSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,7 +694,6 @@ namespace FirstPlugin
|
|||
|
||||
if (shader != OpenTKSharedResources.shaders["BFRES_Normals"])
|
||||
{
|
||||
SetRenderPass(mat, shader, m, m.DisplayId);
|
||||
SetUniforms(mat, shader, m, m.DisplayId);
|
||||
SetTextureUniforms(mat, m, shader);
|
||||
}
|
||||
|
@ -870,7 +880,7 @@ namespace FirstPlugin
|
|||
LibraryGUI.Instance.UpdateViewport();
|
||||
}
|
||||
|
||||
private static void SetRenderPass(FMAT mat, SF.Shader shader, FSHP m, int id)
|
||||
private static void SetRenderPass(FMAT mat)
|
||||
{
|
||||
if (mat.ImageKey != "material")
|
||||
{
|
||||
|
@ -907,6 +917,8 @@ namespace FirstPlugin
|
|||
IsTransparentMask = mat.MaterialU.RenderState.FlagsMode == ResU.RenderStateFlagsMode.AlphaMask;
|
||||
}
|
||||
|
||||
mat.isTransparent = IsTransparentMask || IsTranslucent;
|
||||
|
||||
SetMaterialIcon(mat, IsTranslucent, "MaterialTranslucent");
|
||||
SetMaterialIcon(mat, IsTransparentMask, "MaterialTransparent");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue