mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 14:30:26 +00:00
Add support for cull modes
This commit is contained in:
parent
4045581579
commit
656ff9d0d0
6 changed files with 42 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -405,7 +405,7 @@ namespace FirstPlugin
|
|||
//Check render pass first!
|
||||
for (int shp = 0; shp < models[m].shapes.Count; shp++)
|
||||
{
|
||||
SetRenderPass(models[m].shapes[shp].GetMaterial());
|
||||
CheckRenderPass(models[m].shapes[shp].GetMaterial());
|
||||
}
|
||||
|
||||
List<FSHP> opaque = new List<FSHP>();
|
||||
|
@ -708,6 +708,7 @@ namespace FirstPlugin
|
|||
|
||||
if (shader != OpenTKSharedResources.shaders["BFRES_Normals"])
|
||||
{
|
||||
SetRenderPass(mat);
|
||||
SetUniforms(mat, shader, m, m.DisplayId);
|
||||
SetTextureUniforms(mat, m, shader);
|
||||
}
|
||||
|
@ -895,6 +896,45 @@ namespace FirstPlugin
|
|||
}
|
||||
|
||||
private static void SetRenderPass(FMAT mat)
|
||||
{
|
||||
bool NoCull = false;
|
||||
bool CullBack = false;
|
||||
bool CullFront = false;
|
||||
|
||||
for (int i = 0; i < mat.renderinfo.Count; i++)
|
||||
{
|
||||
if (mat.renderinfo[i].Name == "display_face")
|
||||
{
|
||||
NoCull = mat.renderinfo[i].ValueString.Contains("both");
|
||||
CullBack = mat.renderinfo[i].ValueString.Contains("back");
|
||||
CullFront = mat.renderinfo[i].ValueString.Contains("front");
|
||||
}
|
||||
|
||||
|
||||
if (mat.shaderassign.ShaderArchive == "Turbo_UBER")
|
||||
{
|
||||
AglShaderTurbo aglShader = new AglShaderTurbo();
|
||||
aglShader.LoadRenderInfo(mat.renderinfo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (NoCull)
|
||||
{
|
||||
GL.Disable(EnableCap.CullFace);
|
||||
}
|
||||
else if (CullFront)
|
||||
{
|
||||
GL.Enable(EnableCap.CullFace);
|
||||
GL.CullFace(CullFaceMode.Front);
|
||||
}
|
||||
else if (CullBack)
|
||||
{
|
||||
GL.Enable(EnableCap.CullFace);
|
||||
GL.CullFace(CullFaceMode.Back);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckRenderPass(FMAT mat)
|
||||
{
|
||||
if (mat.ImageKey != "material")
|
||||
{
|
||||
|
@ -905,6 +945,7 @@ namespace FirstPlugin
|
|||
bool IsTranslucent = false;
|
||||
bool IsTransparentMask = false;
|
||||
|
||||
|
||||
for (int i = 0; i < mat.renderinfo.Count; i++)
|
||||
{
|
||||
if (mat.renderinfo[i].Name == "gsys_render_state_mode")
|
||||
|
@ -912,12 +953,6 @@ namespace FirstPlugin
|
|||
IsTranslucent = mat.renderinfo[i].ValueString.Contains("translucent");
|
||||
IsTransparentMask = mat.renderinfo[i].ValueString.Contains("mask");
|
||||
}
|
||||
|
||||
if (mat.shaderassign.ShaderArchive == "Turbo_UBER")
|
||||
{
|
||||
AglShaderTurbo aglShader = new AglShaderTurbo();
|
||||
aglShader.LoadRenderInfo(mat.renderinfo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mat.shaderassign.options.ContainsKey("enable_translucent"))
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue