Search Results for

    Show / Hide Table of Contents

    Class DrawContext

    Allows to control how the scene is rendering.

    Inheritance
    object
    DisposableObject
    DrawContext
    CameraDrawContext
    LightDrawContext
    Implements
    IDisposable
    Inherited Members
    DisposableObject.Disposed
    DisposableObject.Dispose()
    DisposableObject.Dispose(bool)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Evergine.Framework.Graphics
    Assembly: Evergine.Framework.dll
    Syntax
    public abstract class DrawContext : DisposableObject, IDisposable

    Constructors

    DrawContext(RenderPipeline, RenderPath, DrawableType)

    Initializes a new instance of the DrawContext class.

    Declaration
    public DrawContext(RenderPipeline renderPipeline, RenderPath renderPath, DrawableType drawableType)
    Parameters
    Type Name Description
    RenderPipeline renderPipeline

    The render pipeline.

    RenderPath renderPath

    The render path.

    DrawableType drawableType

    The drawable type to render.

    Fields

    CullingResult

    The culling result.

    Declaration
    public readonly CullingResult CullingResult
    Field Value
    Type Description
    CullingResult

    DrawContextResources

    The material collection associated to this draw context.

    Declaration
    public DrawContextResources DrawContextResources
    Field Value
    Type Description
    DrawContextResources

    DrawablesToRender

    Gets the drawable to render collection.

    Declaration
    public readonly DrawableType DrawablesToRender
    Field Value
    Type Description
    DrawableType

    EffectAutoParamSource

    Instance used to automatically pass parameters to effects.

    Declaration
    public EngineShaderParameters EffectAutoParamSource
    Field Value
    Type Description
    EngineShaderParameters

    ElapsedTime

    The elapsed time between the last frame render and the current frame.

    Declaration
    public TimeSpan ElapsedTime
    Field Value
    Type Description
    TimeSpan

    ForceBlitAlphaBlending

    Indicates that when this camera intermediate buffer will be blit into the target framebuffer, it will be forced to use Alpha blending.

    Declaration
    public bool ForceBlitAlphaBlending
    Field Value
    Type Description
    bool

    FrameCount

    The frame count.

    Declaration
    public long FrameCount
    Field Value
    Type Description
    long

    ID

    Gets the identified id.

    Declaration
    public readonly int ID
    Field Value
    Type Description
    int

    MultiviewStrategy

    The cached multiview strategy of this graphic context device.

    Declaration
    protected readonly MultiviewStrategy MultiviewStrategy
    Field Value
    Type Description
    MultiviewStrategy

    RenderPath

    The render path.

    Declaration
    public readonly RenderPath RenderPath
    Field Value
    Type Description
    RenderPath

    RenderPipeline

    The render manager.

    Declaration
    protected readonly RenderPipeline RenderPipeline
    Field Value
    Type Description
    RenderPipeline

    TotalTime

    The total time since this camera is rendering.

    Declaration
    public TimeSpan TotalTime
    Field Value
    Type Description
    TimeSpan

    drawContextGeneration

    The draw context generation number.

    Declaration
    protected int drawContextGeneration
    Field Value
    Type Description
    int

    passCount

    Pass count.

    Declaration
    protected int passCount
    Field Value
    Type Description
    int

    Properties

    AdditionalEffectDirectives

    Gets the additional effect directives that must be included to compile effect techniques.

    Declaration
    public string[] AdditionalEffectDirectives { get; }
    Property Value
    Type Description
    string[]

    BoundingFrustum

    Gets the boundingFrustum of this camera.

    Declaration
    public abstract BoundingFrustum BoundingFrustum { get; }
    Property Value
    Type Description
    BoundingFrustum

    ClearFlags

    Gets Clear flags used for clean FrameBuffer, stencilBuffer and ZBuffer.

    Declaration
    public abstract ClearFlags ClearFlags { get; }
    Property Value
    Type Description
    ClearFlags

    ClearValue

    Gets the Clear value for the camera.

    Declaration
    public abstract ClearValue ClearValue { get; }
    Property Value
    Type Description
    ClearValue

    CullingSystem

    Gets the culling system used by the Render System. A camera could specify the Culling System that it will use.

    Declaration
    public virtual CullingSystem CullingSystem { get; }
    Property Value
    Type Description
    CullingSystem

    DrawContextGeneration

    Gets the additional directives generation Id.

    Declaration
    public int DrawContextGeneration { get; }
    Property Value
    Type Description
    int

    FarPlane

    Gets the frustum far plane.

    Declaration
    public abstract float FarPlane { get; }
    Property Value
    Type Description
    float

    FrameBuffer

    Gets or sets the framebuffer.

    Declaration
    public FrameBuffer FrameBuffer { get; set; }
    Property Value
    Type Description
    FrameBuffer

    HighResolutionIntermediateFrameBuffer

    Gets or sets the intermediate framebuffer. Is used whether the framebuffer came from swapchain, then the renderPath will use this intermediateFramebuffer to render before to transfer the intermediateFrameBuffer to Framebuffer.

    Declaration
    public FrameBuffer HighResolutionIntermediateFrameBuffer { get; protected set; }
    Property Value
    Type Description
    FrameBuffer

    IntermediateFrameBuffer

    Gets the intermediate framebuffer depending of whether super resolution is enable or not.

    Declaration
    public FrameBuffer IntermediateFrameBuffer { get; }
    Property Value
    Type Description
    FrameBuffer

    IsGammaColorSpace

    Gets or sets a value indicating whether this draw context will draw in a gamma color space framebuffer.

    Declaration
    public bool IsGammaColorSpace { get; protected set; }
    Property Value
    Type Description
    bool

    IsMultiview

    Gets or sets a value indicating whether this draw context will draw in a stereo display.

    Declaration
    public bool IsMultiview { get; protected set; }
    Property Value
    Type Description
    bool

    LowResolutionIntermediateFrameBuffer

    Gets or sets the low resolution intermediate framebuffer. This buffer is used by the render after that will be upsampling and copy to the IntermediateFramebuffer before to transfer to FrameBuffer swapchain.

    Declaration
    public FrameBuffer LowResolutionIntermediateFrameBuffer { get; protected set; }
    Property Value
    Type Description
    FrameBuffer

    MultiviewEyeCount

    Gets the number of views of this drawcontext.

    Declaration
    public abstract int MultiviewEyeCount { get; }
    Property Value
    Type Description
    int

    MultiviewInstancingCount

    Gets the number of instance count to render all views.

    Declaration
    public abstract int MultiviewInstancingCount { get; }
    Property Value
    Type Description
    int
    Remarks

    In a Multiview with RenderTargetIndex strategy the number is MultiviewEyeCount, but in ViewIndex strategy the instanceCount is 1.

    MultiviewPosition

    Gets the Multiview position array.

    Declaration
    public abstract Vector4[] MultiviewPosition { get; }
    Property Value
    Type Description
    Vector4[]

    MultiviewProjection

    Gets the Multiview projection transform array.

    Declaration
    public abstract Matrix4x4[] MultiviewProjection { get; }
    Property Value
    Type Description
    Matrix4x4[]

    MultiviewProjectionInverse

    Gets the Multiview view projection inverse transform array.

    Declaration
    public abstract Matrix4x4[] MultiviewProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4[]

    MultiviewView

    Gets the Multiview view transform array.

    Declaration
    public abstract Matrix4x4[] MultiviewView { get; }
    Property Value
    Type Description
    Matrix4x4[]

    MultiviewViewProjection

    Gets the Multiview view projection transform array.

    Declaration
    public abstract Matrix4x4[] MultiviewViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4[]

    NearPlane

    Gets the frustum near plane.

    Declaration
    public abstract float NearPlane { get; }
    Property Value
    Type Description
    float

    Position

    Gets the position.

    Declaration
    public abstract Vector3 Position { get; }
    Property Value
    Type Description
    Vector3

    Projection

    Gets the projection transform.

    Declaration
    public abstract Matrix4x4 Projection { get; }
    Property Value
    Type Description
    Matrix4x4

    ProjectionInverse

    Gets the projection inverse matrix.

    Declaration
    public abstract Matrix4x4 ProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4

    RenderFramebuffer

    Gets the framebuffer used to render the scene.

    Declaration
    public FrameBuffer RenderFramebuffer { get; }
    Property Value
    Type Description
    FrameBuffer
    Remarks

    If the draw context has intermediate buffer, return the intermediate buffer. If the IntermediateBuffer is disabled, return the default Framebuffer.

    RenderManager

    Gets the render manager.

    Declaration
    public RenderManager RenderManager { get; }
    Property Value
    Type Description
    RenderManager

    RenderProjection

    Gets the render projection transform.

    Declaration
    public abstract Matrix4x4 RenderProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    RenderViewProjection

    Gets the render view projection transform.

    Declaration
    public abstract Matrix4x4 RenderViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    SuperResolutionEnabled

    Gets or sets a value indicating whether the super resolution is enabled.

    Declaration
    public bool SuperResolutionEnabled { get; set; }
    Property Value
    Type Description
    bool

    SuperResolutionScaleFactor

    Gets or sets Scale Factor for FidelityFX 1.0 Performance 2.0, Balance 1.7, Quality 1.5, UltraQuality 1.7.

    Declaration
    public float SuperResolutionScaleFactor { get; set; }
    Property Value
    Type Description
    float

    Transform

    Gets the view object transform.

    Declaration
    public abstract Transform3D Transform { get; }
    Property Value
    Type Description
    Transform3D

    View

    Gets the view transform.

    Declaration
    public abstract Matrix4x4 View { get; }
    Property Value
    Type Description
    Matrix4x4

    ViewCount

    Gets the number of views of this draw context.

    Declaration
    public abstract int ViewCount { get; }
    Property Value
    Type Description
    int
    Remarks

    A draw context can contains several views (cascade shadows, point light shadows, reflection probe, etc...).

    ViewIndex

    Gets the View index of this draw context.

    Declaration
    public abstract int ViewIndex { get; }
    Property Value
    Type Description
    int
    Remarks

    A draw context can contains several views (cascade shadows, point light shadows, reflection probe, etc...).

    ViewInverse

    Gets the view inverse matrix.

    Declaration
    public abstract Matrix4x4 ViewInverse { get; }
    Property Value
    Type Description
    Matrix4x4

    ViewProjection

    Gets the view projection transform.

    Declaration
    public abstract Matrix4x4 ViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    ViewProjectionInverse

    Gets the view projection inverse transform.

    Declaration
    public abstract Matrix4x4 ViewProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4

    Methods

    BeforeCollect()

    Before collect method. Used to process drawables and cull objects.

    Declaration
    protected virtual void BeforeCollect()

    BeforeRender()

    Execute actions needed before camera render.

    Declaration
    public abstract bool BeforeRender()
    Returns
    Type Description
    bool

    True if the camera should be rendered.

    Collect()

    Collect resources to perform the render.

    Declaration
    protected virtual void Collect()

    CollectBatch(ref RenderBatch)

    Collect a batch.

    Declaration
    public virtual void CollectBatch(ref RenderBatch batch)
    Parameters
    Type Name Description
    RenderBatch batch

    The batch info to be collected.

    CollectBatches()

    Collect render batches from the visible meshes.

    Declaration
    protected virtual void CollectBatches()

    CollectMaterials()

    Update all per view constant buffers.

    Declaration
    protected virtual void CollectMaterials()

    CollectMeshSources()

    Gets the mesh sources.

    Declaration
    public virtual RenderObjectSource[] CollectMeshSources()
    Returns
    Type Description
    RenderObjectSource[]

    Mesh collection.

    CouldBatch(int, RenderObjectInfo, int, RenderObjectInfo)

    Method that indicates if this drawContext could batch this meshes.

    Declaration
    protected virtual bool CouldBatch(int idxA, RenderObjectInfo meshA, int idxB, RenderObjectInfo meshB)
    Parameters
    Type Name Description
    int idxA

    Mesh Index A.

    RenderObjectInfo meshA

    Mesh A.

    int idxB

    Mesh Index B.

    RenderObjectInfo meshB

    Mesh B.

    Returns
    Type Description
    bool

    True if all is OK.

    CullLights()

    Cull non visible meshes.

    Declaration
    protected virtual void CullLights()

    CullObjects()

    Cull non visible meshes.

    Declaration
    protected virtual void CullObjects()

    Destroy()

    Destroy the resources.

    Declaration
    protected override void Destroy()
    Overrides
    DisposableObject.Destroy()

    EmitBatch(ref RenderBatch)

    Collect a batch.

    Declaration
    protected virtual void EmitBatch(ref RenderBatch batch)
    Parameters
    Type Name Description
    RenderBatch batch

    The batch info to be collected.

    FilterObjects(RenderObjectInfo)

    Indicates if this object must be filtered.

    Declaration
    public abstract bool FilterObjects(RenderObjectInfo renderObjectInfo)
    Parameters
    Type Name Description
    RenderObjectInfo renderObjectInfo

    The object info to filter.

    Returns
    Type Description
    bool

    True if the object must be filtered.

    FireOnFrameBufferProcessed()

    Fire OnFrameBufferProcessed event.

    Declaration
    protected void FireOnFrameBufferProcessed()

    GetAdditionalDirectives()

    Refresh the additional directives.

    Declaration
    protected virtual List<string> GetAdditionalDirectives()
    Returns
    Type Description
    List<string>

    The additional directives.

    GetPassFramebuffer(int)

    Gets the framebuffer associated to the specified pass.

    Declaration
    public virtual FrameBuffer GetPassFramebuffer(int passID)
    Parameters
    Type Name Description
    int passID

    The pass ID.

    Returns
    Type Description
    FrameBuffer

    The framebuffer.

    GetTexture(TextureSemantic, int)

    Gets the texture.

    Declaration
    public virtual Texture GetTexture(TextureInfo.TextureSemantic textureSemantic, int textureIndex)
    Parameters
    Type Name Description
    TextureInfo.TextureSemantic textureSemantic

    Texture semantic.

    int textureIndex

    Texture index.

    Returns
    Type Description
    Texture

    The found texture.

    PrepareBatches(CommandBuffer)

    Prepare batches to be rendered.

    Declaration
    public void PrepareBatches(CommandBuffer commandBuffer)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    The command buffer.

    PrepareBatches(CommandBuffer, int, int)

    Prepare batches to be rendered.

    Declaration
    public virtual void PrepareBatches(CommandBuffer commandBuffer, int count, int offset)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    The command buffer.

    int count

    The number of batches to prepare.

    int offset

    The offset index of the batch to be draw.

    ProcessDrawables()

    Execute the Draw() method to each drawable.

    Declaration
    protected virtual void ProcessDrawables()

    RefreshAdditionalDirectives()

    Refresh the additional directives.

    Declaration
    protected bool RefreshAdditionalDirectives()
    Returns
    Type Description
    bool

    True if the directives has changed.

    Render(CommandBuffer)

    Execute the draw action of draw context.

    Declaration
    public abstract void Render(CommandBuffer commandBuffer)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    The command buffer used to render.

    RenderBatches(int, CommandBuffer)

    Batches the render passes.

    Declaration
    public void RenderBatches(int passId, CommandBuffer commandBuffer)
    Parameters
    Type Name Description
    int passId

    Pass id.

    CommandBuffer commandBuffer

    Command buffer.

    RenderBatches(int, CommandBuffer, int, int)

    Batches the render passes.

    Declaration
    public virtual void RenderBatches(int passId, CommandBuffer commandBuffer, int count, int offset)
    Parameters
    Type Name Description
    int passId

    Pass id.

    CommandBuffer commandBuffer

    Command buffer.

    int count

    Pass count.

    int offset

    Pass offset.

    SetPerViewEngineParameters()

    Collect shader resources per view.

    Declaration
    protected abstract void SetPerViewEngineParameters()

    SortObjects()

    Sort the meshes.

    Declaration
    protected virtual void SortObjects()

    Events

    OnCollect

    OnCollect is called before a camera starts collecting resources.

    Declaration
    public event EventHandler OnCollect
    Event Type
    Type Description
    EventHandler

    OnFrameBufferProcessed

    OnProcessFrameBuffer is called when the framebuffer is refreshed.

    Declaration
    public event EventHandler OnFrameBufferProcessed
    Event Type
    Type Description
    EventHandler

    OnPostRender

    OnPostRender is called after a camera finished rendering the scene.

    Declaration
    public event DrawContext.DrawContextEventHandler OnPostRender
    Event Type
    Type Description
    DrawContext.DrawContextEventHandler

    OnPreRender

    OnPreRender is called before a camera starts rendering the scene.

    Declaration
    public event DrawContext.DrawContextEventHandler OnPreRender
    Event Type
    Type Description
    DrawContext.DrawContextEventHandler

    Implements

    IDisposable

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In This Article
    Back to top
    Generated by DocFX