17.09.2020

+ Generic Scene
+ Generic Camera
+ Generic Window
+ Contexts for drawing and updateing

+ very basic 2D-implermention
This commit is contained in:
Michel Fedde 2020-09-17 21:28:16 +02:00
parent 9889366317
commit 589d131246
25 changed files with 383 additions and 78 deletions

View file

@ -0,0 +1,32 @@
using System;
using OpenTK;
using OpenTK.Graphics.OpenGL4;
using SM.Base.Contexts;
using SM.Base.StaticObjects;
using SM.OGL.Shaders;
namespace SM.Base.Shader
{
public class InstanceShader : GenericShader
{
protected override bool AutoCompile { get; } = true;
public Action<UniformCollection, DrawContext> SetUniform;
public InstanceShader(string vertex, string fragment, Action<UniformCollection, DrawContext> setUniform) : base(
new ShaderFileCollection(vertex, fragment))
{
SetUniform = setUniform;
}
public void Draw(DrawContext context)
{
GL.UseProgram(this);
SetUniform.Invoke(Uniforms, context);
DrawObject(context.Mesh, true);
GL.UseProgram(0);
}
}
}