vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
ven::Renderer Class Reference

Class for renderer. More...

#include <Renderer.hpp>

+ Collaboration diagram for ven::Renderer:

Public Member Functions

 Renderer (Window &window, Device &device)
 
 ~Renderer ()
 
 Renderer (const Renderer &)=delete
 
Rendereroperator= (const Renderer &)=delete
 
 Renderer (Renderer &&)=delete
 
Rendereroperator= (Renderer &&)=delete
 
VkRenderPass getSwapChainRenderPass () const
 
float getAspectRatio () const
 
bool isFrameInProgress () const
 
VkCommandBuffer getCurrentCommandBuffer () const
 
unsigned long getFrameIndex () const
 
std::array< float, 4 > getClearColor () const
 
WindowgetWindow () const
 
void setClearValue (const VkClearColorValue clearColorValue=DEFAULT_CLEAR_COLOR, const VkClearDepthStencilValue clearDepthValue=DEFAULT_CLEAR_DEPTH)
 
VkCommandBuffer beginFrame ()
 
void endFrame ()
 
void beginSwapChainRenderPass (VkCommandBuffer commandBuffer) const
 
void endSwapChainRenderPass (VkCommandBuffer commandBuffer) const
 

Private Member Functions

void createCommandBuffers ()
 
void freeCommandBuffers ()
 
void recreateSwapChain ()
 

Private Attributes

Windowm_window
 
Devicem_device
 
std::unique_ptr< SwapChainm_swapChain
 
std::vector< VkCommandBuffer > m_commandBuffers
 
std::array< VkClearValue, 2 > m_clearValues {DEFAULT_CLEAR_COLOR, 1.0F, 0.F}
 
uint32_t m_currentImageIndex {0}
 
unsigned long m_currentFrameIndex {0}
 
bool m_isFrameStarted {false}
 

Detailed Description

Class for renderer.

Definition at line 24 of file Renderer.hpp.

Constructor & Destructor Documentation

◆ Renderer() [1/3]

ven::Renderer::Renderer ( Window & window,
Device & device )
inline

Definition at line 28 of file Renderer.hpp.

References createCommandBuffers(), and recreateSwapChain().

+ Here is the call graph for this function:

◆ ~Renderer()

ven::Renderer::~Renderer ( )
inline

Definition at line 29 of file Renderer.hpp.

References freeCommandBuffers().

+ Here is the call graph for this function:

◆ Renderer() [2/3]

ven::Renderer::Renderer ( const Renderer & )
delete

◆ Renderer() [3/3]

ven::Renderer::Renderer ( Renderer && )
delete

Member Function Documentation

◆ beginFrame()

VkCommandBuffer ven::Renderer::beginFrame ( )

Definition at line 43 of file renderer.cpp.

◆ beginSwapChainRenderPass()

void ven::Renderer::beginSwapChainRenderPass ( VkCommandBuffer commandBuffer) const

Definition at line 89 of file renderer.cpp.

◆ createCommandBuffers()

void ven::Renderer::createCommandBuffers ( )
private

Definition at line 3 of file renderer.cpp.

References ven::Device::device(), ven::Device::getCommandPool(), m_commandBuffers, m_device, and ven::MAX_FRAMES_IN_FLIGHT.

Referenced by Renderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ endFrame()

void ven::Renderer::endFrame ( )

Definition at line 69 of file renderer.cpp.

References ven::MAX_FRAMES_IN_FLIGHT.

◆ endSwapChainRenderPass()

void ven::Renderer::endSwapChainRenderPass ( VkCommandBuffer commandBuffer) const

Definition at line 119 of file renderer.cpp.

◆ freeCommandBuffers()

void ven::Renderer::freeCommandBuffers ( )
private

Definition at line 17 of file renderer.cpp.

Referenced by ~Renderer().

+ Here is the caller graph for this function:

◆ getAspectRatio()

float ven::Renderer::getAspectRatio ( ) const
inlinenodiscard

Definition at line 37 of file Renderer.hpp.

References m_swapChain.

Referenced by ven::Gui::rendererSection().

+ Here is the caller graph for this function:

◆ getClearColor()

std::array< float, 4 > ven::Renderer::getClearColor ( ) const
inlinenodiscard

Definition at line 42 of file Renderer.hpp.

References m_clearValues.

Referenced by ven::Gui::rendererSection().

+ Here is the caller graph for this function:

◆ getCurrentCommandBuffer()

VkCommandBuffer ven::Renderer::getCurrentCommandBuffer ( ) const
inlinenodiscard

Definition at line 39 of file Renderer.hpp.

References isFrameInProgress(), m_commandBuffers, and m_currentFrameIndex.

Referenced by ven::Gui::render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFrameIndex()

unsigned long ven::Renderer::getFrameIndex ( ) const
inlinenodiscard

Definition at line 41 of file Renderer.hpp.

References isFrameInProgress(), and m_currentFrameIndex.

+ Here is the call graph for this function:

◆ getSwapChainRenderPass()

VkRenderPass ven::Renderer::getSwapChainRenderPass ( ) const
inlinenodiscard

Definition at line 36 of file Renderer.hpp.

References m_swapChain.

Referenced by ven::Engine::Engine().

+ Here is the caller graph for this function:

◆ getWindow()

Window & ven::Renderer::getWindow ( ) const
inlinenodiscard

Definition at line 49 of file Renderer.hpp.

References m_window.

Referenced by ven::Gui::rendererSection().

+ Here is the caller graph for this function:

◆ isFrameInProgress()

bool ven::Renderer::isFrameInProgress ( ) const
inlinenodiscard

Definition at line 38 of file Renderer.hpp.

References m_isFrameStarted.

Referenced by getCurrentCommandBuffer(), and getFrameIndex().

+ Here is the caller graph for this function:

◆ operator=() [1/2]

Renderer & ven::Renderer::operator= ( const Renderer & )
delete

◆ operator=() [2/2]

Renderer & ven::Renderer::operator= ( Renderer && )
delete

◆ recreateSwapChain()

void ven::Renderer::recreateSwapChain ( )
private

Definition at line 23 of file renderer.cpp.

Referenced by Renderer().

+ Here is the caller graph for this function:

◆ setClearValue()

void ven::Renderer::setClearValue ( const VkClearColorValue clearColorValue = DEFAULT_CLEAR_COLOR,
const VkClearDepthStencilValue clearDepthValue = DEFAULT_CLEAR_DEPTH )
inline

Definition at line 51 of file Renderer.hpp.

References m_clearValues.

Referenced by ven::Gui::rendererSection().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_clearValues

std::array<VkClearValue, 2> ven::Renderer::m_clearValues {DEFAULT_CLEAR_COLOR, 1.0F, 0.F}
private

Definition at line 67 of file Renderer.hpp.

Referenced by getClearColor(), and setClearValue().

◆ m_commandBuffers

std::vector<VkCommandBuffer> ven::Renderer::m_commandBuffers
private

Definition at line 66 of file Renderer.hpp.

Referenced by createCommandBuffers(), and getCurrentCommandBuffer().

◆ m_currentFrameIndex

unsigned long ven::Renderer::m_currentFrameIndex {0}
private

Definition at line 70 of file Renderer.hpp.

Referenced by getCurrentCommandBuffer(), and getFrameIndex().

◆ m_currentImageIndex

uint32_t ven::Renderer::m_currentImageIndex {0}
private

Definition at line 69 of file Renderer.hpp.

◆ m_device

Device& ven::Renderer::m_device
private

Definition at line 64 of file Renderer.hpp.

Referenced by createCommandBuffers().

◆ m_isFrameStarted

bool ven::Renderer::m_isFrameStarted {false}
private

Definition at line 71 of file Renderer.hpp.

Referenced by isFrameInProgress().

◆ m_swapChain

std::unique_ptr<SwapChain> ven::Renderer::m_swapChain
private

Definition at line 65 of file Renderer.hpp.

Referenced by getAspectRatio(), and getSwapChainRenderPass().

◆ m_window

Window& ven::Renderer::m_window
private

Definition at line 63 of file Renderer.hpp.

Referenced by getWindow().


The documentation for this class was generated from the following files: