smrendererv3/SMCode/SM2D/Drawing/DrawBackground.cs
Michel Fedde 03b3942732 Holidays 12.10. -> 25.10.2020
~ Moved code around in files.

SM.Base:
+ PostProcessing-system
+ OnInitialization() for Scenes.
+ Shader-Extensions
+ Added option to not react while unfocused to the window.
+ Added Screenshots to the window.
+ Connected the log system to the SM.OGL-action system.

~ Replaced IShader with abstract MaterialShader.
~ When a log compression folder doesn't exist, it will create one.

SM.OGL:
+ Added support for UniformArrays
+ Added ShaderPreProcessing
+ Added Shader Extensions.
+ Added Debug actions.
+ SM.OGL settings

~ Framebuffer Size is automaticly changed, when the window and scale is set.

SM2D:
+ Added easy shader drawing.
2020-10-24 15:10:36 +02:00

74 lines
No EOL
1.6 KiB
C#

#region usings
using System.Collections.Generic;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using SM.Base.Contexts;
using SM.Base.Objects.Static;
using SM.Base.Scene;
using SM.Base.Textures;
using SM.OGL.Texture;
#endregion
namespace SM2D.Drawing
{
public class DrawBackground : IBackgroundItem
{
private Material _material = new Material();
public DrawBackground(Color4 color)
{
Color = color;
}
public DrawBackground(Bitmap texture)
{
Texture = (Texture) texture;
}
public DrawBackground(Bitmap texture, Color4 tint)
{
Color = tint;
Texture = (Texture) texture;
}
public Color4 Color
{
get => _material.Tint;
set => _material.Tint = value;
}
public TextureBase Texture
{
get => _material.Texture;
set => _material.Texture = value;
}
public object Parent { get; set; }
public string Name { get; set; } = "Background";
public ICollection<string> Flags { get; set; } = new string[0];
public void Update(UpdateContext context)
{
}
public void Draw(DrawContext context)
{
context.Material = _material;
context.Mesh = Plate.Object;
context.Instances[0].ModelMatrix = Matrix4.CreateScale(context.WorldScale.X, context.WorldScale.Y, 1);
context.Shader.Draw(context);
}
public void OnAdded(object sender)
{
}
public void OnRemoved(object sender)
{
}
}
}