Skip to content

Commit

Permalink
More types to convert to glsl
Browse files Browse the repository at this point in the history
  • Loading branch information
deccer committed Dec 4, 2022
1 parent 1763cd9 commit 9cca47f
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/EngineKit/Graphics/VirtualFileShaderIncludeHandler.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Text;
using OpenTK.Mathematics;
using Serilog;
using Point = SixLabors.ImageSharp.Point;
using Vector2 = System.Numerics.Vector2;
using Vector3 = OpenTK.Mathematics.Vector3;
using Vector4 = OpenTK.Mathematics.Vector4;

namespace EngineKit.Graphics;

Expand Down Expand Up @@ -54,7 +57,7 @@ public class VirtualFileShaderIncludeHandler : IShaderIncludeHandler
return glsl.ToString();
}

private string ToGlslType(Type type)
private static string ToGlslType(Type type)
{
if (type == typeof(int))
{
Expand Down Expand Up @@ -101,6 +104,46 @@ private string ToGlslType(Type type)
return "vec4";
}

if (type == typeof(Matrix2))
{
return "mat2";
}

if (type == typeof(Matrix3))
{
return "mat3";
}

if (type == typeof(Matrix4) || type == typeof(Matrix4x4))
{
return "mat4";
}

if (type == typeof(Matrix4x3))
{
return "mat4x3";
}

if (type == typeof(Matrix2d))
{
return "dmat2";
}

if (type == typeof(Matrix3d))
{
return "dmat3";
}

if (type == typeof(Matrix4d))
{
return "dmat4";
}

if (type == typeof(Matrix4x3d))
{
return "dmat4x3";
}

return "INVALID";
}
}

0 comments on commit 9cca47f

Please sign in to comment.