Added missing summeries #2
This commit is contained in:
parent
31777faa11
commit
c8db1ce8bc
26 changed files with 261 additions and 36 deletions
|
|
@ -12,26 +12,76 @@ using SM.OGL.Mesh;
|
|||
|
||||
namespace SM.Base.Window
|
||||
{
|
||||
/// <summary>
|
||||
/// The draw context contains (more or less) important information for drawing a object.
|
||||
/// </summary>
|
||||
public struct DrawContext
|
||||
{
|
||||
/// <summary>
|
||||
/// The window, the context came origionally.
|
||||
/// </summary>
|
||||
public IGenericWindow Window { get; internal set; }
|
||||
/// <summary>
|
||||
/// The scene, the context was send to.
|
||||
/// </summary>
|
||||
public GenericScene Scene { get; internal set; }
|
||||
/// <summary>
|
||||
/// The render pipeline, the context is using.
|
||||
/// </summary>
|
||||
public RenderPipeline RenderPipeline { get; internal set; }
|
||||
/// <summary>
|
||||
/// The last object it came though.
|
||||
/// <para>Debugging pourpose.</para>
|
||||
/// </summary>
|
||||
public object LastObject { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The camera the context is using.
|
||||
/// </summary>
|
||||
public GenericCamera UseCamera { get; internal set; }
|
||||
/// <summary>
|
||||
/// The world matrix.
|
||||
/// </summary>
|
||||
public Matrix4 World => UseCamera.World;
|
||||
/// <summary>
|
||||
/// The view matrix.
|
||||
/// </summary>
|
||||
public Matrix4 View => UseCamera.View;
|
||||
|
||||
/// <summary>
|
||||
/// The mesh, that is rendered.
|
||||
/// </summary>
|
||||
public GenericMesh Mesh { get; set; }
|
||||
/// <summary>
|
||||
/// If set, it will force the mesh to render with that primitive type.
|
||||
/// </summary>
|
||||
public PrimitiveType? ForcedType { get; set; }
|
||||
/// <summary>
|
||||
/// The material the mesh is going to use.
|
||||
/// </summary>
|
||||
public Material Material { get; set; }
|
||||
/// <summary>
|
||||
/// The shader the mesh is going to use.
|
||||
/// </summary>
|
||||
public MaterialShader Shader => Material.CustomShader ?? RenderPipeline.DefaultShader;
|
||||
|
||||
/// <summary>
|
||||
/// The master model matrix.
|
||||
/// </summary>
|
||||
public Matrix4 ModelMatrix;
|
||||
/// <summary>
|
||||
/// The master texture matrix.
|
||||
/// </summary>
|
||||
public Matrix3 TextureMatrix;
|
||||
/// <summary>
|
||||
/// Instances
|
||||
/// </summary>
|
||||
public IList<Instance> Instances;
|
||||
|
||||
/// <summary>
|
||||
/// This sets the camera of the context.
|
||||
/// </summary>
|
||||
/// <param name="camera"></param>
|
||||
public void SetCamera(GenericCamera camera)
|
||||
{
|
||||
UseCamera = camera;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace SM.Base.Window.Contexts
|
||||
{
|
||||
/// <summary>
|
||||
/// A context for the fixed update.
|
||||
/// </summary>
|
||||
public struct FixedUpdateContext
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ namespace SM.Base.Window
|
|||
public Vector2 WindowSize { get; set; }
|
||||
|
||||
public ISetup AppliedSetup { get; private set; }
|
||||
public event Action<IGenericWindow> Resize;
|
||||
public event Action<IGenericWindow> Load;
|
||||
public new event Action<IGenericWindow> Resize;
|
||||
public new event Action<IGenericWindow> Load;
|
||||
|
||||
public GenericScene CurrentScene { get; private set; }
|
||||
public RenderPipeline CurrentRenderPipeline { get; private set; }
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ namespace SM.Base.Window
|
|||
bool DrawWhileUnfocused { get; set; }
|
||||
bool UpdateWhileUnfocused { get; set; }
|
||||
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
Vector2 WindowSize { get; set; }
|
||||
|
||||
Rectangle ClientRectangle { get; }
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
namespace SM.Base.Window
|
||||
{
|
||||
/// <summary>
|
||||
/// A interface to implerment a window setup.
|
||||
/// </summary>
|
||||
public interface ISetup
|
||||
{
|
||||
/// <summary>
|
||||
/// This fires when the setup is applied the window.
|
||||
/// </summary>
|
||||
void Applied(IGenericWindow window);
|
||||
/// <summary>
|
||||
/// This fires when the window is currently loading.
|
||||
/// </summary>
|
||||
void Load(IGenericWindow window);
|
||||
/// <summary>
|
||||
/// This fires when the window is done loading.
|
||||
/// </summary>
|
||||
void Loaded(IGenericWindow window);
|
||||
/// <summary>
|
||||
/// This fires when the window was resized.
|
||||
/// </summary>
|
||||
void Resize(IGenericWindow window);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,23 +12,45 @@ using SM.OGL.Texture;
|
|||
|
||||
namespace SM.Base.Window
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents a render pipeline.
|
||||
/// </summary>
|
||||
public abstract class RenderPipeline : IInitializable
|
||||
{
|
||||
/// <summary>
|
||||
/// This contains the windows its connected to.
|
||||
/// </summary>
|
||||
public IGenericWindow ConnectedWindow { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// This should contains the framebuffer, when any back buffer effects are used.
|
||||
/// </summary>
|
||||
public Framebuffer MainFramebuffer { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// This list contains all framebuffers that are required to update.
|
||||
/// </summary>
|
||||
public List<Framebuffer> Framebuffers { get; } = new List<Framebuffer>();
|
||||
|
||||
/// <summary>
|
||||
/// This contains the default shader.
|
||||
/// <para>Default: <see cref="SMRenderer.DefaultMaterialShader"/></para>
|
||||
/// </summary>
|
||||
public virtual MaterialShader DefaultShader { get; protected set; } = SMRenderer.DefaultMaterialShader;
|
||||
/// <summary>
|
||||
/// Here you can set a default material.
|
||||
/// </summary>
|
||||
public virtual Material DefaultMaterial { get; protected set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsInitialized { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual void Activate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual void Initialization()
|
||||
{
|
||||
if (MainFramebuffer != null) Framebuffers.Add(MainFramebuffer);
|
||||
|
|
@ -40,8 +62,14 @@ namespace SM.Base.Window
|
|||
RenderProcess(ref context);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The process of rendering.
|
||||
/// </summary>
|
||||
protected abstract void RenderProcess(ref DrawContext context);
|
||||
|
||||
/// <summary>
|
||||
/// The event when resizing.
|
||||
/// </summary>
|
||||
public virtual void Resize()
|
||||
{
|
||||
if (Framebuffers == null) return;
|
||||
|
|
@ -54,6 +82,11 @@ namespace SM.Base.Window
|
|||
framebuffer.Compile();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This creates a finished setup for a framebuffer.
|
||||
/// </summary>
|
||||
/// <param name="multisamples"></param>
|
||||
/// <returns></returns>
|
||||
public Framebuffer CreateWindowFramebuffer(int multisamples = 0)
|
||||
{
|
||||
Framebuffer framebuffer = new Framebuffer(ConnectedWindow);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,24 @@
|
|||
namespace SM.Base.Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Flags how the window is shown.
|
||||
/// </summary>
|
||||
public enum WindowFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// As default window.
|
||||
/// </summary>
|
||||
Window = 0,
|
||||
/// <summary>
|
||||
/// As a borderless window.
|
||||
/// <para>
|
||||
/// WARNING! This automaticly fits the window to the screen and is not movable.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
BorderlessWindow = 2,
|
||||
/// <summary>
|
||||
/// Contents are shown in fullscreen.
|
||||
/// </summary>
|
||||
ExclusiveFullscreen = 1
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue