#region usings
using System.Collections.Generic;
using System.Threading;
using SM.Base.Contexts;
using SM.Base.Scene;
using SM.OGL.Framebuffer;
#endregion
namespace SM.Base
{
///
/// Definition of specific render options.
///
public abstract class RenderPipeline
{
///
/// The framebuffers, that are used in this Pipeline.
///
protected virtual List _framebuffers { get; }
///
/// The default shader for the pipeline.
///
protected internal virtual MaterialShader _defaultShader { get; } = SMRenderer.DefaultMaterialShader;
///
/// Occurs, when the window is loading.
///
protected internal virtual void Load()
{
}
///
/// Occurs, when the window is resizing.
///
protected internal virtual void Resize()
{
if (_framebuffers == null) return;
foreach (var framebuffer in _framebuffers)
framebuffer.Dispose();
Thread.Sleep(50);
foreach (Framebuffer framebuffer in _framebuffers)
{
framebuffer.Compile();
}
}
///
/// Occurs, when the pipeline was connected to a window.
///
protected internal virtual void Activate(GenericWindow window)
{
}
///
/// Occurs, when the window is unloading.
///
protected internal virtual void Unload()
{
}
}
///
/// Represents a render pipeline.
///
/// The scene type
public abstract class RenderPipeline : RenderPipeline
where TScene : GenericScene
{
///
/// The system to render stuff.
///
protected internal virtual void Render(ref DrawContext context, TScene scene)
{
context.ActivePipeline = this;
}
}
}