Search Results for

    Show / Hide Table of Contents

    Class CameraDrawContext

    Handles how a camera renders a scene.

    Inheritance
    object
    DisposableObject
    DrawContext
    CameraDrawContext
    ForwardDrawContext
    Inherited Members
    DrawContext.ElapsedTime
    DrawContext.TotalTime
    DrawContext.FrameCount
    DrawContext.RenderPipeline
    DrawContext.RenderPath
    DrawContext.CullingResult
    DrawContext.MultiviewStrategy
    DrawContext.AdditionalEffectDirectives
    DrawContext.passCount
    DrawContext.OnFrameBufferProcessed
    DrawContext.OnCollect
    DrawContext.OnPreRender
    DrawContext.OnPostRender
    DrawContext.EffectAutoParamSource
    DrawContext.drawContextGeneration
    DrawContext.RenderManager
    DrawContext.FrameBuffer
    DrawContext.HighResolutionIntermediateFrameBuffer
    DrawContext.LowResolutionIntermediateFrameBuffer
    DrawContext.SuperResolutionEnabled
    DrawContext.SuperResolutionScaleFactor
    DrawContext.IntermediateFrameBuffer
    DrawContext.RenderFramebuffer
    DrawContext.DrawContextGeneration
    DrawContext.ForceBlitAlphaBlending
    DrawContext.ID
    DrawContext.IsMultiview
    DrawContext.IsGammaColorSpace
    DrawContext.DrawContextResources
    DrawContext.GetPassFramebuffer(int)
    DrawContext.CollectMeshSources()
    DrawContext.Collect()
    DrawContext.RenderBatches(int, CommandBuffer)
    DrawContext.RenderBatches(int, CommandBuffer, int, int)
    DrawContext.PrepareBatches(CommandBuffer)
    DrawContext.PrepareBatches(CommandBuffer, int, int)
    DrawContext.ProcessDrawables()
    DrawContext.CullObjects()
    DrawContext.CullLights()
    DrawContext.SortObjects()
    DrawContext.CollectBatches()
    DrawContext.CouldBatch(int, RenderObjectInfo, int, RenderObjectInfo)
    DrawContext.EmitBatch(ref RenderBatch)
    DrawContext.CollectBatch(ref RenderBatch)
    DrawContext.CollectMaterials()
    DrawContext.RefreshAdditionalDirectives()
    DrawContext.FireOnFrameBufferProcessed()
    DisposableObject.Disposed
    DisposableObject.Dispose()
    DisposableObject.Dispose(bool)
    Namespace: Evergine.Framework.Graphics
    Assembly: Evergine.Framework.dll
    Syntax
    public class CameraDrawContext : DrawContext

    Constructors

    CameraDrawContext(RenderPipeline, CameraRenderPath, Camera)

    Initializes a new instance of the CameraDrawContext class.

    Declaration
    public CameraDrawContext(RenderPipeline renderPipeline, CameraRenderPath cameraRenderPath, Camera camera)
    Parameters
    Type Name Description
    RenderPipeline renderPipeline

    The pipeline reference.

    CameraRenderPath cameraRenderPath

    The render path reference.

    Camera camera

    The camera.

    Fields

    AutoExposure

    Calculates auto exposure in real-time (compute shader only).

    Declaration
    protected AutoExposure AutoExposure
    Field Value
    Type Description
    AutoExposure

    Camera

    Reference to the camera.

    Declaration
    public readonly Camera Camera
    Field Value
    Type Description
    Camera

    ComputeDepthBounds

    Computes the minimum and maximum depth bounds of the camera.

    Declaration
    protected ComputeDepthBounds ComputeDepthBounds
    Field Value
    Type Description
    ComputeDepthBounds

    settings

    Application settings.

    Declaration
    protected Settings settings
    Field Value
    Type Description
    Settings

    Properties

    AnyPostProcessingInLastFrame

    Gets or sets a value indicating whether any post-processing graph is enabled.

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

    Aperture

    Gets the aperture of the camera in f-stops (Default f/16).

    Declaration
    public float Aperture { get; }
    Property Value
    Type Description
    float
    Remarks

    This setting controls how open or closed the camera system's aperture is. Since an f-stop indicates the ratio of the lens' focal length to the diameter of the entrance pupil, high values (ƒ/16) indicate a small aperture and small values (ƒ/1.4) indicate a wide aperture. In addition to the exposure, the aperture setting controls the depth of field.

    BackgroundColor

    Gets the color of the background.

    Declaration
    public Color BackgroundColor { get; }
    Property Value
    Type Description
    Color

    The background color of the camera if it is set, or the RenderManager's default background color.

    BoundingFrustum

    Gets the bounding frustum of this camera.

    Declaration
    public override BoundingFrustum BoundingFrustum { get; }
    Property Value
    Type Description
    BoundingFrustum
    Overrides
    DrawContext.BoundingFrustum

    CameraRenderPath

    Gets the specified render path.

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

    ClearFlags

    Gets Clear flags used for clearing the FrameBuffer, stencilBuffer, and ZBuffer.

    Declaration
    public override ClearFlags ClearFlags { get; }
    Property Value
    Type Description
    ClearFlags
    Overrides
    DrawContext.ClearFlags

    ClearValue

    Gets the clear value for the camera.

    Declaration
    public override ClearValue ClearValue { get; }
    Property Value
    Type Description
    ClearValue
    Overrides
    DrawContext.ClearValue

    CullingSystem

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

    Declaration
    public override CullingSystem CullingSystem { get; }
    Property Value
    Type Description
    CullingSystem
    Overrides
    DrawContext.CullingSystem

    Exposure

    Gets the exposure for this camera.

    Declaration
    public float Exposure { get; }
    Property Value
    Type Description
    float

    FarPlane

    Gets the far plane of the frustum.

    Declaration
    public override float FarPlane { get; }
    Property Value
    Type Description
    float
    Overrides
    DrawContext.FarPlane

    FieldOfView

    Gets the field of view of the camera.

    Declaration
    public override float FieldOfView { get; }
    Property Value
    Type Description
    float
    Overrides
    DrawContext.FieldOfView

    FocalDistance

    Gets the focal distance used with Depth of Field effect to determine the focus distance from the camera (m).

    Declaration
    public float FocalDistance { get; }
    Property Value
    Type Description
    float

    FocalLength

    Gets the focal length, which is the simulated distance between the lens and the sensor of the camera. Larger values provide a narrower field of view.

    Declaration
    public float FocalLength { get; }
    Property Value
    Type Description
    float

    Jitter

    Gets the current frame's camera jitter.

    Declaration
    public Vector2 Jitter { get; }
    Property Value
    Type Description
    Vector2

    MultiviewEyeCount

    Gets the number of views of this draw context.

    Declaration
    public override int MultiviewEyeCount { get; }
    Property Value
    Type Description
    int
    Overrides
    DrawContext.MultiviewEyeCount

    MultiviewInstancingCount

    Gets the number of instance count to render all views.

    Declaration
    public override int MultiviewInstancingCount { get; }
    Property Value
    Type Description
    int
    Overrides
    DrawContext.MultiviewInstancingCount
    Remarks

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

    MultiviewPosition

    Gets the multi-view position array.

    Declaration
    public override Vector4[] MultiviewPosition { get; }
    Property Value
    Type Description
    Vector4[]
    Overrides
    DrawContext.MultiviewPosition

    MultiviewProjection

    Gets the Multiview projection transformation array.

    Declaration
    public override Matrix4x4[] MultiviewProjection { get; }
    Property Value
    Type Description
    Matrix4x4[]
    Overrides
    DrawContext.MultiviewProjection

    MultiviewProjectionInverse

    Gets the Multiview view projection inverse transform array.

    Declaration
    public override Matrix4x4[] MultiviewProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4[]
    Overrides
    DrawContext.MultiviewProjectionInverse

    MultiviewView

    Gets the multiview view transform array.

    Declaration
    public override Matrix4x4[] MultiviewView { get; }
    Property Value
    Type Description
    Matrix4x4[]
    Overrides
    DrawContext.MultiviewView

    MultiviewViewProjection

    Gets the multiview view projection transform array.

    Declaration
    public override Matrix4x4[] MultiviewViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4[]
    Overrides
    DrawContext.MultiviewViewProjection

    NearPlane

    Gets the near plane of the frustum.

    Declaration
    public override float NearPlane { get; }
    Property Value
    Type Description
    float
    Overrides
    DrawContext.NearPlane

    Position

    Gets the position.

    Declaration
    public override Vector3 Position { get; }
    Property Value
    Type Description
    Vector3
    Overrides
    DrawContext.Position

    PreviousJitter

    Gets the previous frame's camera jittering.

    Declaration
    public Vector2 PreviousJitter { get; }
    Property Value
    Type Description
    Vector2

    PreviousViewProjection

    Gets the previous viewProjection matrix.

    Declaration
    public Matrix4x4 PreviousViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    Projection

    Gets the projection transform.

    Declaration
    public override Matrix4x4 Projection { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.Projection

    ProjectionInverse

    Gets the inverse projection matrix.

    Declaration
    public override Matrix4x4 ProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.ProjectionInverse

    RenderProjection

    Gets the rendered projection transform.

    Declaration
    public override Matrix4x4 RenderProjection { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.RenderProjection

    RenderViewProjection

    Gets the render view projection transformation.

    Declaration
    public override Matrix4x4 RenderViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.RenderViewProjection

    ScreenViewport

    Gets the screen viewport.

    Declaration
    public Viewport ScreenViewport { get; }
    Property Value
    Type Description
    Viewport

    TemporalAntiAliasingEnabled

    Gets or sets a value indicating whether the DrawContext uses temporal anti-aliasing, so jittering the camera is necessary.

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

    TemporalHistory

    Gets or sets the temporal anti-aliasing history buffer.

    Declaration
    public Texture TemporalHistory { get; protected set; }
    Property Value
    Type Description
    Texture

    Transform

    Gets the view object's transform.

    Declaration
    public override Transform3D Transform { get; }
    Property Value
    Type Description
    Transform3D
    Overrides
    DrawContext.Transform

    UnjitteredProjection

    Gets the unjittered projection matrix.

    Declaration
    public Matrix4x4 UnjitteredProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    UnjitteredViewProjection

    Gets the unjittered view projection matrix.

    Declaration
    public Matrix4x4 UnjitteredViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4

    View

    Gets the view transform.

    Declaration
    public override Matrix4x4 View { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.View

    ViewCount

    Gets the number of views of this draw context.

    Declaration
    public override int ViewCount { get; }
    Property Value
    Type Description
    int
    Overrides
    DrawContext.ViewCount
    Remarks

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

    ViewIndex

    Gets the View index of this draw context.

    Declaration
    public override int ViewIndex { get; }
    Property Value
    Type Description
    int
    Overrides
    DrawContext.ViewIndex
    Remarks

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

    ViewInverse

    Gets the inverse view matrix.

    Declaration
    public override Matrix4x4 ViewInverse { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.ViewInverse

    ViewProjection

    Gets the view-projection transform.

    Declaration
    public override Matrix4x4 ViewProjection { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.ViewProjection

    ViewProjectionInverse

    Gets the inverse of the view-projection transform.

    Declaration
    public override Matrix4x4 ViewProjectionInverse { get; }
    Property Value
    Type Description
    Matrix4x4
    Overrides
    DrawContext.ViewProjectionInverse

    Methods

    BeforeCollect()

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

    Declaration
    protected override void BeforeCollect()
    Overrides
    DrawContext.BeforeCollect()

    BeforeRender()

    Executes actions needed before the camera renders.

    Declaration
    public override bool BeforeRender()
    Returns
    Type Description
    bool

    True if the camera should be rendered.

    Overrides
    DrawContext.BeforeRender()

    CreateIntermediateBuffer()

    Create the full-resolution intermediate framebuffer. Override this method to customize the intermediate framebuffer: consider using the CreateIntermediateBufferHelper(uint?, uint?, PixelFormat?, TextureFlags, PixelFormat, TextureFlags, string) method.

    Declaration
    protected virtual void CreateIntermediateBuffer()

    CreateIntermediateBufferHelper(uint?, uint?, PixelFormat?, TextureFlags, PixelFormat, TextureFlags, string)

    This is a helper function to create a framebuffer from some parameters. Allows reusing code for both the high and low resolution intermediate framebuffers. Also can be used by deriving classes to customize the format of the intermediate framebuffer.

    Declaration
    protected FrameBuffer CreateIntermediateBufferHelper(uint? width = null, uint? height = null, PixelFormat? colorAttachmentFormat = null, TextureFlags colorAttachmentFlags = TextureFlags.ShaderResource | TextureFlags.RenderTarget, PixelFormat depthStencilAttachmentFormat = PixelFormat.D24_UNorm_S8_UInt, TextureFlags depthStencilAttachmentFlags = TextureFlags.DepthStencil, string namePrefix = null)
    Parameters
    Type Name Description
    uint? width

    Width. If not provided, the camera viewport resolution is used.

    uint? height

    Height. If not provided, the camera viewport resolution is used.

    PixelFormat? colorAttachmentFormat

    Format of the color attachment.

    TextureFlags colorAttachmentFlags

    Flags of the color attachment.

    PixelFormat depthStencilAttachmentFormat

    Format of the depth-stencil attachment.

    TextureFlags depthStencilAttachmentFlags

    Flags of the depth-stencil attachment.

    string namePrefix

    Prefix added to the name of the framebuffer.

    Returns
    Type Description
    FrameBuffer

    The created framebuffer.

    CreateLowResolutionIntermediateBuffer()

    Create the low-resolution intermediate framebuffer. This framebuffer will be upscaled to the full resolution. Override this method to customize the intermediate framebuffer: consider using the CreateIntermediateBufferHelper(uint?, uint?, PixelFormat?, TextureFlags, PixelFormat, TextureFlags, string) method.

    Declaration
    protected virtual void CreateLowResolutionIntermediateBuffer()

    Destroy()

    Destroys the resources.

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

    FilterObjects(RenderObjectInfo)

    Indicates whether this object must be filtered.

    Declaration
    public override 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.

    Overrides
    DrawContext.FilterObjects(RenderObjectInfo)

    GenerateTemporalHistoryTexture()

    Creates the temporal history texture (for Temporal Anti-Aliasing purposes).

    Declaration
    protected void GenerateTemporalHistoryTexture()

    GetAdditionalDirectives()

    Refreshes the additional directives.

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

    The additional directives.

    Overrides
    DrawContext.GetAdditionalDirectives()

    GetTexture(TextureSemantic, int)

    Gets the texture.

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

    The texture semantic.

    int textureIndex

    The texture index.

    Returns
    Type Description
    Texture

    The located texture.

    Overrides
    DrawContext.GetTexture(TextureInfo.TextureSemantic, int)

    ProcessAutoDepthBounds()

    Computes the auto depth bounds of this camera using the latest frame.

    Declaration
    protected void ProcessAutoDepthBounds()

    ProcessAutoExposure()

    Processes the auto exposure.

    Declaration
    protected void ProcessAutoExposure()

    ProcessFrameBuffer()

    Creates resources associated with the framebuffer.

    Declaration
    protected bool ProcessFrameBuffer()
    Returns
    Type Description
    bool

    True if the framebuffer is OK.

    Render(CommandBuffer)

    Executes the draw action of the draw context.

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

    The command buffer used for rendering.

    Overrides
    DrawContext.Render(CommandBuffer)

    SetPerViewEngineParameters()

    Collects shader resources per view.

    Declaration
    protected override void SetPerViewEngineParameters()
    Overrides
    DrawContext.SetPerViewEngineParameters()

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In this article
    Back to top
    Generated by DocFX