SM.Core: + Particle System + scriptable system for scripts ~ Moved Texts- and Particles-namespace to SM.Base.Drawing ~ Changed how you tell the stopwatch to pause. (From method to property) ~ Fixed Randomize.GetFloat(min, max) ~ Now automaticly adds the DrawingBase.Transformation to DrawContext.ModelMatrix. No need to change DrawContext.Instances[0], anymore. SM.OGL: + "one-file-shader"-support SM2D: + DrawParticles (Control for Texture and Color not there yet) ~ Changed coordnate system to upper-right as (1,1) ~ Changed default shader to "one-file-shader"
56 lines
No EOL
1.3 KiB
C#
56 lines
No EOL
1.3 KiB
C#
#region usings
|
|
|
|
using OpenTK.Graphics.OpenGL4;
|
|
using SM.Base.Contexts;
|
|
using SM.OGL.Shaders;
|
|
|
|
#endregion
|
|
|
|
namespace SM.Base.Drawing
|
|
{
|
|
/// <summary>
|
|
/// A general class to work with material shaders properly.
|
|
/// </summary>
|
|
public abstract class MaterialShader : GenericShader
|
|
{
|
|
/// <inheritdoc />
|
|
protected MaterialShader(string combinedData) : base(combinedData)
|
|
{}
|
|
|
|
/// <inheritdoc />
|
|
protected MaterialShader(string vertex, string fragment) : base(vertex, fragment)
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected MaterialShader(ShaderFileCollection shaderFileFiles) : base(shaderFileFiles)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prepares the context for the drawing.
|
|
/// </summary>
|
|
/// <param name="context">The context</param>
|
|
public virtual void Draw(DrawContext context)
|
|
{
|
|
GL.UseProgram(this);
|
|
|
|
GL.BindVertexArray(context.Mesh);
|
|
|
|
DrawProcess(context);
|
|
|
|
CleanUp();
|
|
|
|
GL.UseProgram(0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Draws the context.
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
protected virtual void DrawProcess(DrawContext context)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |