1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Use bmd cull modes

This commit is contained in:
KillzXGaming 2019-07-12 20:13:27 -04:00
parent d74988583f
commit 530c86e672
6 changed files with 29 additions and 1 deletions

Binary file not shown.

View File

@ -12,7 +12,7 @@ namespace FirstPlugin
{
public class BMDMaterialWrapper : STGenericMaterial
{
Material Material;
public Material Material;
SuperBMDLib.Model ParentModel;
public BMDMaterialWrapper(Material mat, SuperBMDLib.Model model)

View File

@ -9,6 +9,7 @@ using GL_EditorFramework.GL_Core;
using GL_EditorFramework.Interfaces;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using SuperBMDLib.Materials.Enums;
namespace FirstPlugin
{
@ -21,6 +22,27 @@ namespace FirstPlugin
}
public override void SetRenderData(STGenericMaterial mat, ShaderProgram shader, STGenericObject m)
{
var bmdMaterial = (BMDMaterialWrapper)mat;
switch (bmdMaterial.Material.CullMode)
{
case CullMode.None:
GL.Disable(EnableCap.CullFace);
break;
case CullMode.Back:
GL.CullFace(CullFaceMode.Back);
break;
case CullMode.Front:
GL.CullFace(CullFaceMode.Front);
break;
case CullMode.All:
GL.CullFace(CullFaceMode.FrontAndBack);
break;
}
}
public override int BindTexture(STGenericMatTexture tex, ShaderProgram shader)
{
GL.ActiveTexture(TextureUnit.Texture0 + tex.textureUnit + 1);

View File

@ -233,6 +233,11 @@ namespace Switch_Toolbox.Library.Rendering
}
public virtual void SetRenderData(STGenericMaterial mat, ShaderProgram shader, STGenericObject m)
{
}
private static void SetUniforms(STGenericMaterial mat, ShaderProgram shader, STGenericObject m)
{
//UV Scale
@ -409,6 +414,7 @@ namespace Switch_Toolbox.Library.Rendering
if (group.faces.Count <= 3)
return;
SetRenderData(Material, shader, m);
SetUniforms(Material, shader, m);
SetUniformBlocks(Material, shader, m);
SetBoneUniforms(control, shader, Skeleton, m);