04.10.2020

+ render pipeline system for more control about the renderering.
+ Log system
+ Framebuffer system

~ Default shader was moved to pipelines.
This commit is contained in:
Michel Fedde 2020-10-04 16:31:48 +02:00
parent 97e638d9d9
commit 820d6ce700
34 changed files with 660 additions and 106 deletions

View file

@ -4,13 +4,48 @@ using SM.Base.Contexts;
namespace SM.Base.Scene
{
/// <summary>
/// A generic scene, that imports functions for scene control.
/// </summary>
public abstract class GenericScene
{
/// <summary>
/// This contains the background.
/// </summary>
protected IBackgroundItem _background;
/// <summary>
/// Draws this scene.
/// </summary>
public virtual void Draw(DrawContext context)
{
}
/// <summary>
/// Called, when the user activates the scene.
/// </summary>
internal void Activate()
{
OnActivating();
}
/// <summary>
/// Called, when the user activates the scene.
/// </summary>
protected virtual void OnActivating()
{ }
}
/// <summary>
/// A generic scene that imports different functions.
/// </summary>
/// <typeparam name="TCamera">The type of cameras.</typeparam>
/// <typeparam name="TItem">The type of show items.</typeparam>
public abstract class GenericScene<TCamera, TItem> : GenericItemCollection<TItem>
/// <typeparam name="TCollection">The type for collections</typeparam>
public abstract class GenericScene<TCamera, TCollection, TItem> : GenericScene
where TCamera : GenericCamera, new()
where TCollection : GenericItemCollection<TItem>, new()
where TItem : IShowItem
{
/// <summary>
@ -28,13 +63,13 @@ namespace SM.Base.Scene
public TCamera HUDCamera { get; set; } = new TCamera();
/// <summary>
/// This contains the background.
/// Objects inside the scene.
/// </summary>
protected IBackgroundItem _background;
public TCollection Objects { get; set; } = new TCollection();
/// <summary>
/// This defines the HUD objects.
/// </summary>
public List<TItem> HUD { get; } = new List<TItem>();
public TCollection HUD { get; } = new TCollection();
/// <summary>
/// A collection for cameras to switch easier to different cameras.
/// </summary>
@ -49,25 +84,10 @@ namespace SM.Base.Scene
backgroundDrawContext.View = BackgroundCamera.CalculateViewMatrix();
_background?.Draw(backgroundDrawContext);
base.Draw(context);
Objects.Draw(context);
context.View = HUDCamera.CalculateViewMatrix();
for (int i = 0; i < HUD.Count; i++)
HUD[i].Draw(context);
HUD.Draw(context);
}
/// <summary>
/// Called, when the user activates the scene.
/// </summary>
internal void Activate()
{
OnActivating();
}
/// <summary>
/// Called, when the user activates the scene.
/// </summary>
protected virtual void OnActivating()
{ }
}
}