Overload  1.1
Game engine with editor
Classes | Public Member Functions | List of all members
OvRendering::Core::Renderer Class Reference

#include <Renderer.h>

Inheritance diagram for OvRendering::Core::Renderer:
OvCore::ECS::Renderer

Classes

struct  FrameInfo
 

Public Member Functions

 Renderer (Context::Driver &p_driver)
 
 ~Renderer ()=default
 
void SetClearColor (float p_red, float p_green, float p_blue, float p_alpha=1.0f)
 
void Clear (bool p_colorBuffer=true, bool p_depthBuffer=true, bool p_stencilBuffer=true)
 
void Clear (OvRendering::LowRenderer::Camera &p_camera, bool p_colorBuffer=true, bool p_depthBuffer=true, bool p_stencilBuffer=true)
 
void SetRasterizationLinesWidth (float p_width)
 
void SetRasterizationMode (Settings::ERasterizationMode p_rasterizationMode)
 
void SetCapability (Settings::ERenderingCapability p_capability, bool p_value)
 
bool GetCapability (Settings::ERenderingCapability p_capability) const
 
void SetStencilAlgorithm (Settings::EComparaisonAlgorithm p_algorithm, int32_t p_reference, uint32_t p_mask)
 
void SetDepthAlgorithm (Settings::EComparaisonAlgorithm p_algorithm)
 
void SetStencilMask (uint32_t p_mask)
 
void SetStencilOperations (Settings::EOperation p_stencilFail=Settings::EOperation::KEEP, Settings::EOperation p_depthFail=Settings::EOperation::KEEP, Settings::EOperation p_bothPass=Settings::EOperation::KEEP)
 
void SetCullFace (Settings::ECullFace p_cullFace)
 
void SetDepthWriting (bool p_enable)
 
void SetColorWriting (bool p_enableRed, bool p_enableGreen, bool p_enableBlue, bool p_enableAlpha)
 
void SetColorWriting (bool p_enable)
 
bool GetBool (GLenum p_parameter)
 
bool GetBool (GLenum p_parameter, uint32_t p_index)
 
int GetInt (GLenum p_parameter)
 
int GetInt (GLenum p_parameter, uint32_t p_index)
 
float GetFloat (GLenum p_parameter)
 
float GetFloat (GLenum p_parameter, uint32_t p_index)
 
double GetDouble (GLenum p_parameter)
 
double GetDouble (GLenum p_parameter, uint32_t p_index)
 
int64_t GetInt64 (GLenum p_parameter)
 
int64_t GetInt64 (GLenum p_parameter, uint32_t p_index)
 
std::string GetString (GLenum p_parameter)
 
std::string GetString (GLenum p_parameter, uint32_t p_index)
 
void ClearFrameInfo ()
 
void Draw (Resources::IMesh &p_mesh, Settings::EPrimitiveMode p_primitiveMode=Settings::EPrimitiveMode::TRIANGLES, uint32_t p_instances=1)
 
std::vector< std::reference_wrapper< OvRendering::Resources::Mesh > > GetMeshesInFrustum (const OvRendering::Resources::Model &p_model, const OvRendering::Geometry::BoundingSphere &p_modelBoundingSphere, const OvMaths::FTransform &p_modelTransform, const OvRendering::Data::Frustum &p_frustum, OvRendering::Settings::ECullingOptions p_cullingOptions)
 
uint8_t FetchGLState ()
 
void ApplyStateMask (uint8_t p_mask)
 
void SetState (uint8_t p_state)
 
const FrameInfoGetFrameInfo () const
 

Detailed Description

The renderer is one of the main classes of OvRendering. It is necessary to have one to send batches to the GPU

Constructor & Destructor Documentation

◆ Renderer()

OvRendering::Core::Renderer::Renderer ( Context::Driver p_driver)

Constructor of the Renderer

Parameters
p_driver@project: Overload
Author
: Overload Tech. @restrictions: This software may not be resold, redistributed or otherwise conveyed to a third party.

◆ ~Renderer()

OvRendering::Core::Renderer::~Renderer ( )
default

Constructor of the Renderer

Member Function Documentation

◆ ApplyStateMask()

void OvRendering::Core::Renderer::ApplyStateMask ( uint8_t  p_mask)

Apply mask to modify OpenGL state

Parameters
p_mask

◆ Clear() [1/2]

void OvRendering::Core::Renderer::Clear ( bool  p_colorBuffer = true,
bool  p_depthBuffer = true,
bool  p_stencilBuffer = true 
)

Clear the screen using the previously defined clear color (With Renderer::SetClearColor()) or by using the OpenGL default one.

Parameters
p_colorBuffer
p_depthBuffer
p_stencilBuffer

◆ Clear() [2/2]

void OvRendering::Core::Renderer::Clear ( OvRendering::LowRenderer::Camera p_camera,
bool  p_colorBuffer = true,
bool  p_depthBuffer = true,
bool  p_stencilBuffer = true 
)

Clear the screen using the camera clear color

Parameters
p_camera
p_colorBuffer
p_depthBuffer
p_stencilBuffer

◆ ClearFrameInfo()

void OvRendering::Core::Renderer::ClearFrameInfo ( )

Clear frame informations

◆ Draw()

void OvRendering::Core::Renderer::Draw ( Resources::IMesh p_mesh,
Settings::EPrimitiveMode  p_primitiveMode = Settings::EPrimitiveMode::TRIANGLES,
uint32_t  p_instances = 1 
)

Draw the given model the amount of times passed in parameter (Instance rendering if p_instance > 1)

Parameters
p_mesh
p_primitiveMode
p_instances

◆ FetchGLState()

uint8_t OvRendering::Core::Renderer::FetchGLState ( )

Fetch and returns the actual OpenGL state

◆ GetBool() [1/2]

bool OvRendering::Core::Renderer::GetBool ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetBool() [2/2]

bool OvRendering::Core::Renderer::GetBool ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ GetCapability()

bool OvRendering::Core::Renderer::GetCapability ( Settings::ERenderingCapability  p_capability) const

Returns true if the given OpenGL capability is enabled

Parameters
p_capability

◆ GetDouble() [1/2]

double OvRendering::Core::Renderer::GetDouble ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetDouble() [2/2]

double OvRendering::Core::Renderer::GetDouble ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ GetFloat() [1/2]

float OvRendering::Core::Renderer::GetFloat ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetFloat() [2/2]

float OvRendering::Core::Renderer::GetFloat ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ GetFrameInfo()

const OvRendering::Core::Renderer::FrameInfo & OvRendering::Core::Renderer::GetFrameInfo ( ) const

Returns the FrameInfo structure

◆ GetInt() [1/2]

int OvRendering::Core::Renderer::GetInt ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetInt() [2/2]

int OvRendering::Core::Renderer::GetInt ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ GetInt64() [1/2]

int64_t OvRendering::Core::Renderer::GetInt64 ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetInt64() [2/2]

int64_t OvRendering::Core::Renderer::GetInt64 ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ GetMeshesInFrustum()

std::vector< std::reference_wrapper< OvRendering::Resources::Mesh > > OvRendering::Core::Renderer::GetMeshesInFrustum ( const OvRendering::Resources::Model p_model,
const OvRendering::Geometry::BoundingSphere p_modelBoundingSphere,
const OvMaths::FTransform p_modelTransform,
const OvRendering::Data::Frustum p_frustum,
OvRendering::Settings::ECullingOptions  p_cullingOptions 
)

Returns the list of meshes from a model that should be rendered

Parameters
p_model
p_modelBoundingSphere
p_modelTransform
p_frustum
p_cullingOptions

◆ GetString() [1/2]

std::string OvRendering::Core::Renderer::GetString ( GLenum  p_parameter)

Return the value associated to the given GLenum

Parameters
p_parameter

◆ GetString() [2/2]

std::string OvRendering::Core::Renderer::GetString ( GLenum  p_parameter,
uint32_t  p_index 
)

Return the value associated to the given GLenum at the given index.

Parameters
p_parameter
p_index

◆ SetCapability()

void OvRendering::Core::Renderer::SetCapability ( Settings::ERenderingCapability  p_capability,
bool  p_value 
)

Enable or disable an OpenGL capability

Parameters
p_capability
p_value

◆ SetClearColor()

void OvRendering::Core::Renderer::SetClearColor ( float  p_red,
float  p_green,
float  p_blue,
float  p_alpha = 1.0f 
)

Define a clear color. This color will be use for the next Renderer::Clear() call

Parameters
p_red
p_green
p_blue
p_alpha

◆ SetColorWriting() [1/2]

void OvRendering::Core::Renderer::SetColorWriting ( bool  p_enable)

Enable and disable writing color into the frame buffer (Equivalent to Renderer::SetColorWriting(p_enable, p_enable, p_enable, p_enable))

Parameters
p_enable

◆ SetColorWriting() [2/2]

void OvRendering::Core::Renderer::SetColorWriting ( bool  p_enableRed,
bool  p_enableGreen,
bool  p_enableBlue,
bool  p_enableAlpha 
)

Enable and disable writing color individual components into the frame buffer

Parameters
p_enableRed
p_enableGreen
p_enableBlue
p_enableAlpha

◆ SetCullFace()

void OvRendering::Core::Renderer::SetCullFace ( Settings::ECullFace  p_cullFace)

Defines the culling faces

Parameters
p_cullface

◆ SetDepthAlgorithm()

void OvRendering::Core::Renderer::SetDepthAlgorithm ( Settings::EComparaisonAlgorithm  p_algorithm)

Defines the comparaison algorithm to use for the depth buffer test

Parameters
p_algorithm

◆ SetDepthWriting()

void OvRendering::Core::Renderer::SetDepthWriting ( bool  p_enable)

Enable or disable writing into the depth buffer

Parameters
p_enable

◆ SetRasterizationLinesWidth()

void OvRendering::Core::Renderer::SetRasterizationLinesWidth ( float  p_width)

Defines the rasterization lines width

Parameters
p_width

◆ SetRasterizationMode()

void OvRendering::Core::Renderer::SetRasterizationMode ( Settings::ERasterizationMode  p_rasterizationMode)

Defines the rasterization mode to use

Parameters
p_rasterizationMode

◆ SetState()

void OvRendering::Core::Renderer::SetState ( uint8_t  p_state)

Store the given state in the renderer

Parameters
p_state

◆ SetStencilAlgorithm()

void OvRendering::Core::Renderer::SetStencilAlgorithm ( Settings::EComparaisonAlgorithm  p_algorithm,
int32_t  p_reference,
uint32_t  p_mask 
)

Defines the comparaison algorithm to use for the stencil buffer test

Parameters
p_algorithm
p_reference
p_mask

◆ SetStencilMask()

void OvRendering::Core::Renderer::SetStencilMask ( uint32_t  p_mask)

Control the front and back writing of individual bits in the stencil planes @parma p_mask

◆ SetStencilOperations()

void OvRendering::Core::Renderer::SetStencilOperations ( Settings::EOperation  p_stencilFail = Settings::EOperation::KEEP,
Settings::EOperation  p_depthFail = Settings::EOperation::KEEP,
Settings::EOperation  p_bothPass = Settings::EOperation::KEEP 
)

Defines the stencil test operations

Parameters
p_stencilFail: Specifies the action to take when the stencil test fails
p_depthFail: Specifies the stencil action when the stencil test passes, but the depth test fails.
p_bothPass: Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled.

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