#region usings
using System.Collections.Generic;
using System.Dynamic;
using OpenTK;
using SM.Base.Drawing;
using SM.Base.Scene;
using SM.OGL.Mesh;
#endregion
namespace SM.Base.Contexts
{
///
/// Contains important information for drawing.
///
public struct DrawContext
{
///
/// This says if it was forced to use the viewport camera.
///
public bool ForceViewport;
///
/// Contains the currently used render pipeline.
///
public RenderPipeline ActivePipeline;
public GenericScene ActiveScene;
public IGenericWindow Window;
public GenericCamera UsedCamera =>
ForceViewport || ActiveScene._camera == null ? Window.ViewportCamera : ActiveScene._camera;
///
/// The mesh.
///
public GenericMesh Mesh;
///
/// The material.
///
public Material Material;
///
/// The drawing instances.
/// If there is only one, it's index 0
///
public IList Instances;
///
/// The current world scale.
///
public Vector2 WorldScale;
///
/// The last collection the context was passed though.
///
public object LastPassthough;
///
/// Returns the appropriate shader.
///
/// Returns the material shader, if available, otherwise it will take the default shader from the render
/// pipeline.
///
///
public MaterialShader Shader => Material.CustomShader ?? ActivePipeline._defaultShader;
///
/// Arguments for shaders
///
public IDictionary ShaderArguments;
///
/// The current world matrix.
///
public Matrix4 World;
///
/// The current view matrix.
///
public Matrix4 View;
///
/// The current WorldView matrix.
///
public Matrix4 WorldView;
///
/// The master model matrix.
///
public Matrix4 ModelMaster;
}
}