20.09.2020
+ Instance Drawing + Text and Font ~ Made "DrawBackground" forced Background for 2D - DrawEmpty
This commit is contained in:
parent
acccf5f0e7
commit
c4a0847567
29 changed files with 365 additions and 85 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.OGL.Shaders;
|
||||
|
||||
namespace SM.Base.Shader
|
||||
|
|
@ -7,13 +8,20 @@ namespace SM.Base.Shader
|
|||
public class Shaders
|
||||
{
|
||||
public static InstanceShader Default = new InstanceShader(new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("SM.Base.Shader.Files.default.vert")).ReadToEnd(),
|
||||
new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("SM.Base.Shader.Files.default.frag")).ReadToEnd(),
|
||||
((u, context) =>
|
||||
new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("SM.Base.Shader.Files.default.frag")).ReadToEnd())
|
||||
{
|
||||
|
||||
SetUniformFragment = (u, context) =>
|
||||
{
|
||||
u["MVP"].SetMatrix4(context.View * context.World);
|
||||
u["ModelMatrix"].SetMatrix4(context.ModelMatrix);
|
||||
u["Tint"].SetUniform4(context.Material.Tint);
|
||||
u["Texture"].SetTexture(context.Material.Texture, 0, u["UseTexture"]);
|
||||
}));
|
||||
},
|
||||
SetUniformVertex = (u, context, i) =>
|
||||
{
|
||||
GL.UniformMatrix4(u["ModelMatrix"] + i, false, ref context.Instances[i].ModelMatrix);
|
||||
GL.Uniform2(u["TextureOffset"] + i, context.Instances[i].TexturePosition);
|
||||
GL.Uniform2(u["TextureScale"] + i, context.Instances[i].TextureScale);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue