Overload  1.1
Game engine with editor
Public Types | Public Member Functions | List of all members
OvCore::ECS::Renderer Class Reference

#include <Renderer.h>

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

Public Types

using Drawable = std::tuple< OvMaths::FMatrix4, OvRendering::Resources::Mesh *, OvCore::Resources::Material *, OvMaths::FMatrix4 >
 
using OpaqueDrawables = std::multimap< float, Drawable, std::less< float > >
 
using TransparentDrawables = std::multimap< float, Drawable, std::greater< float > >
 

Public Member Functions

 Renderer (OvRendering::Context::Driver &p_driver)
 
 ~Renderer ()
 
OvCore::ECS::Components::CCameraFindMainCamera (const OvCore::SceneSystem::Scene &p_scene)
 
std::vector< OvMaths::FMatrix4FindLightMatrices (const OvCore::SceneSystem::Scene &p_scene)
 
std::vector< OvMaths::FMatrix4FindLightMatricesInFrustum (const OvCore::SceneSystem::Scene &p_scene, const OvRendering::Data::Frustum &p_frustum)
 
void RenderScene (OvCore::SceneSystem::Scene &p_scene, const OvMaths::FVector3 &p_cameraPosition, const OvRendering::LowRenderer::Camera &p_camera, const OvRendering::Data::Frustum *p_customFrustum=nullptr, OvCore::Resources::Material *p_defaultMaterial=nullptr)
 
std::pair< OpaqueDrawables, TransparentDrawablesFindAndSortFrustumCulledDrawables (const OvCore::SceneSystem::Scene &p_scene, const OvMaths::FVector3 &p_cameraPosition, const OvRendering::Data::Frustum &p_frustum, OvCore::Resources::Material *p_defaultMaterial)
 
std::pair< OpaqueDrawables, TransparentDrawablesFindAndSortDrawables (const OvCore::SceneSystem::Scene &p_scene, const OvMaths::FVector3 &p_cameraPosition, OvCore::Resources::Material *p_defaultMaterial)
 
void DrawDrawable (const Drawable &p_toDraw)
 
void DrawModelWithSingleMaterial (OvRendering::Resources::Model &p_model, OvCore::Resources::Material &p_material, OvMaths::FMatrix4 const *p_modelMatrix, OvCore::Resources::Material *p_defaultMaterial=nullptr)
 
void DrawModelWithMaterials (OvRendering::Resources::Model &p_model, std::vector< OvCore::Resources::Material * > p_materials, OvMaths::FMatrix4 const *p_modelMatrix, OvCore::Resources::Material *p_defaultMaterial=nullptr)
 
void DrawMesh (OvRendering::Resources::Mesh &p_mesh, OvCore::Resources::Material &p_material, OvMaths::FMatrix4 const *p_modelMatrix)
 
void RegisterModelMatrixSender (std::function< void(OvMaths::FMatrix4)> p_modelMatrixSender)
 
void RegisterUserMatrixSender (std::function< void(OvMaths::FMatrix4)> p_userMatrixSender)
 
- Public Member Functions inherited from OvRendering::Core::Renderer
 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

A Renderer capable of rendering stuffs linked with the ECS. It is a convenient class that should be used instead of OvRendering::Core::Renderer when you plan to use the OvCore ECS architecture.

Member Typedef Documentation

◆ Drawable

◆ OpaqueDrawables

using OvCore::ECS::Renderer::OpaqueDrawables = std::multimap<float, Drawable, std::less<float> >

◆ TransparentDrawables

using OvCore::ECS::Renderer::TransparentDrawables = std::multimap<float, Drawable, std::greater<float> >

Constructor & Destructor Documentation

◆ Renderer()

OvCore::ECS::Renderer::Renderer ( OvRendering::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()

OvCore::ECS::Renderer::~Renderer ( )

Destructor of the Renderer

Parameters
p_driver

Member Function Documentation

◆ DrawDrawable()

void OvCore::ECS::Renderer::DrawDrawable ( const Drawable p_toDraw)

Draw a Drawable instance

Parameters
p_toDraw

◆ DrawMesh()

void OvCore::ECS::Renderer::DrawMesh ( OvRendering::Resources::Mesh p_mesh,
OvCore::Resources::Material p_material,
OvMaths::FMatrix4 const *  p_modelMatrix 
)

Try drawing a mesh using the given material (Fails if the material has no shader attached)

Parameters
p_mesh
p_material
p_modelMatrix(If set to nullptr, no data will be sent to the GPU)

◆ DrawModelWithMaterials()

void OvCore::ECS::Renderer::DrawModelWithMaterials ( OvRendering::Resources::Model p_model,
std::vector< OvCore::Resources::Material * >  p_materials,
OvMaths::FMatrix4 const *  p_modelMatrix,
OvCore::Resources::Material p_defaultMaterial = nullptr 
)

Draw the model using the given materials

Parameters
p_model
p_modelMatrix
p_defaultMaterial(Used when a submesh material has no shader attached)

◆ DrawModelWithSingleMaterial()

void OvCore::ECS::Renderer::DrawModelWithSingleMaterial ( OvRendering::Resources::Model p_model,
OvCore::Resources::Material p_material,
OvMaths::FMatrix4 const *  p_modelMatrix,
OvCore::Resources::Material p_defaultMaterial = nullptr 
)

Draw the model using the given material (The material will be applied to every submeshes of the the model)

Parameters
p_model
p_material
p_modelMatrix
p_defaultMaterial(Used if the given material has no shader attached)

◆ FindAndSortDrawables()

std::pair< OvCore::ECS::Renderer::OpaqueDrawables, OvCore::ECS::Renderer::TransparentDrawables > OvCore::ECS::Renderer::FindAndSortDrawables ( const OvCore::SceneSystem::Scene p_scene,
const OvMaths::FVector3 p_cameraPosition,
OvCore::Resources::Material p_defaultMaterial 
)

Returns opaque and transparents drawables from the scene

Parameters
p_scene
p_cameraPosition
p_defaultMaterial

◆ FindAndSortFrustumCulledDrawables()

std::pair< OvCore::ECS::Renderer::OpaqueDrawables, OvCore::ECS::Renderer::TransparentDrawables > OvCore::ECS::Renderer::FindAndSortFrustumCulledDrawables ( const OvCore::SceneSystem::Scene p_scene,
const OvMaths::FVector3 p_cameraPosition,
const OvRendering::Data::Frustum p_frustum,
OvCore::Resources::Material p_defaultMaterial 
)

Returns opaque and transparents drawables from the scene with frustum culling

Parameters
p_scene
p_cameraPosition
p_frustum
p_defaultMaterial

◆ FindLightMatrices()

std::vector< OvMaths::FMatrix4 > OvCore::ECS::Renderer::FindLightMatrices ( const OvCore::SceneSystem::Scene p_scene)

Fill the given FMatrix4 vector with lights information

Parameters
p_scene

◆ FindLightMatricesInFrustum()

std::vector< OvMaths::FMatrix4 > OvCore::ECS::Renderer::FindLightMatricesInFrustum ( const OvCore::SceneSystem::Scene p_scene,
const OvRendering::Data::Frustum p_frustum 
)

Fill the given FMatrix4 vector with lights information that are inside the frustum

Parameters
p_scene
p_frustum

◆ FindMainCamera()

OvCore::ECS::Components::CCamera * OvCore::ECS::Renderer::FindMainCamera ( const OvCore::SceneSystem::Scene p_scene)

Parse a scene to find the main camera

Parameters
p_scene

◆ RegisterModelMatrixSender()

void OvCore::ECS::Renderer::RegisterModelMatrixSender ( std::function< void(OvMaths::FMatrix4)>  p_modelMatrixSender)

Register the given function as the model matrix sender. The given function will be called before every draw calls. You should use this function to send the model matrix to the GPU in the way you want

Parameters
p_modelMatrixSender

◆ RegisterUserMatrixSender()

void OvCore::ECS::Renderer::RegisterUserMatrixSender ( std::function< void(OvMaths::FMatrix4)>  p_userMatrixSender)

Register the given function as the user matrix sender. The given function will be called before every draw calls. You should use this function to send the user matrix to the GPU in the way you want

Parameters
p_userMatrixSender

◆ RenderScene()

void OvCore::ECS::Renderer::RenderScene ( OvCore::SceneSystem::Scene p_scene,
const OvMaths::FVector3 p_cameraPosition,
const OvRendering::LowRenderer::Camera p_camera,
const OvRendering::Data::Frustum p_customFrustum = nullptr,
OvCore::Resources::Material p_defaultMaterial = nullptr 
)

Draw the given scene using the given default material (optional) if no material found on an actor

Parameters
p_scene
p_cameraPosition
p_camera
p_customFrustum
p_defaultMaterial

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