Renderer
- Namespace: Turian.Engine.Core
- Source File: Renderer.cs
Represents a renderer for rendering graphics using Vulkan.
Remarks
Initializes a new instance of the Renderer class.
Properties
SwapChain
(SwapChain): Gets the Vulkan swap chain used for rendering.
SwapChainImageFormat
(Format): Gets the image format used by the swap chain.
SwapChainDepthFormat
(Format): Gets the depth format used by the swap chain.
IsFrameStarted
(bool): Gets whether a rendering frame has been started.
SwapChainRenderPass
(RenderPass): Gets the render pass associated with the swap chain.
AspectRatio
(float): Gets the aspect ratio of the swap chain's images.
CurrentCommandBuffer
(CommandBuffer): Gets the current command buffer for rendering.
FrameIndex
(int): Gets the index of the current rendering frame.
UseFifo
(bool) { get; set }: Gets or sets a value indicating whether FIFO presentation mode should be used.
Public Methods
Initialize
public void Initialize()
Initializes the renderer by recreating the swap chain and creating command buffers.
BeginFrame
public CommandBuffer? BeginFrame()
Begins a new rendering frame. Acquires the next image for rendering.
Returns: CommandBuffer?
- A
CommandBufferfor recording rendering commands. Returnsnullif the swap chain needs to be recreated.
EndFrame
public void EndFrame()
Ends the current rendering frame and submits the recorded commands to the swap chain.
BeginSwapChainRenderPass
public unsafe void BeginSwapChainRenderPass(CommandBuffer commandBuffer)
Begins a render pass for the swap chain.
Parameters:
commandBuffer(CommandBuffer): The command buffer for rendering.
EndSwapChainRenderPass
public void EndSwapChainRenderPass(CommandBuffer commandBuffer)
Ends the current render pass for the swap chain.
Parameters:
commandBuffer(CommandBuffer): The command buffer for rendering.
RecreateSwapChain
public void RecreateSwapChain(bool forceCreateSwapChain = false)
Recreates the swap chain, handling changes in window size or format.
Parameters:
forceCreateSwapChain(bool) (Default:false)
Dispose
public void Dispose()
Disposes of the renderer and its resources.