Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::RenderSet Struct Reference

A collection of shaders, render configurations, cameras, and related framebuffers used by a viewport within an ECSWorld. More...

#include <render_system.hpp>

Public Types

enum class  RenderType : uint8_t { BASIC_3D , ADDITION }
 Enum listing the different rendering pipelines available. More...
 

Public Member Functions

void renderNextTexture ()
 Renders the next debug texture to the render system's final render target.
 
void setRenderProperties (glm::u16vec2 renderDimensions, glm::u16vec2 targetDimensions, const SDL_Rect &viewportDimensions, RenderType renderType)
 Sets the render properties for this render set.
 
std::shared_ptr< TexturegetCurrentScreenTexture ()
 Returns the currently active debug render texture.
 
void copyAndResize ()
 Uses the resize-stage to scale the rendered image up or down.
 
void addOrAssignRenderSource (const std::string &name, std::shared_ptr< Texture > renderSource)
 Adds a named render source, presumably intended for use by a render stage in this pipeline.
 
void removeRenderSource (const std::string &name)
 Removes a named render source.
 
void setSkybox (std::shared_ptr< Texture > skyboxTexture)
 Sets the texture of the skybox painted to the background of the current scene in the 3D pipeline.
 
void setCamera (EntityID cameraEntity)
 Sets the entity to be treated as this render set's active camera.
 
void setGamma (float gamma)
 Sets the gamma value used for gamma correction in the tonemapping stage of the pipeline.
 
float getGamma ()
 Gets the gamma value used in this set's tonemapping-stage.
 
void setExposure (float exposure)
 Sets the exposure value responsible for determining the behaviour of tonemapping in the tonemapping-stage.
 
float getExposure ()
 Returns the value of exposure set on this render set.
 

Public Attributes

std::size_t mCurrentScreenTexture {7}
 The index of the current texture being treated as this object's texture target.
 
std::vector< std::shared_ptr< Texture > > mScreenTextures {}
 All the debug/screen textures produced by this target.
 
EntityID mActiveCamera {}
 The ID of the entity treated as this render set's active camera.
 
std::shared_ptr< MaterialmLightMaterialHandle {nullptr}
 Storage for light-related settings.
 
std::shared_ptr< GeometryRenderStagemGeometryRenderStage { nullptr }
 Handle to this set's geometry render stage.
 
std::shared_ptr< LightingRenderStagemLightingRenderStage { nullptr }
 Handle to this set's lighting render stage.
 
std::shared_ptr< BlurRenderStagemBlurRenderStage { nullptr }
 Handle to this set's blur render stage (used for bloom).
 
std::shared_ptr< TonemappingRenderStagemTonemappingRenderStage { nullptr }
 Handle to this set's tonemapping and gamma render stage.
 
std::shared_ptr< SkyboxRenderStagemSkyboxRenderStage { nullptr }
 Handle to this set's skybox render stage.
 
std::shared_ptr< ResizeRenderStagemResizeRenderStage { nullptr }
 Handle to this set's resize render stage.
 
std::shared_ptr< ScreenRenderStagemScreenRenderStage { nullptr }
 Handle to this set's screen render stage.
 
std::shared_ptr< AdditionRenderStagemAdditionRenderStage { nullptr }
 Handle to this set's addition render stage.
 
std::map< std::string, std::shared_ptr< Texture > > mRenderSources {}
 Textures designated as sources for this render set.
 
RenderType mRenderType { RenderType::BASIC_3D }
 An ID representing the type of pipeline used in this set.
 
float mGamma { 2.f }
 This sets presently configured gamma correction value.
 
float mExposure { 1.f }
 This sets presently configured exposure value.
 
bool mRerendered { true }
 A marker for when the 3D pipeline or the addition pipeline has been rerendered, and a corresponding screen or resize step is required.
 

Detailed Description

A collection of shaders, render configurations, cameras, and related framebuffers used by a viewport within an ECSWorld.

These render sets have in common with each other opaque geometry, light sources, a skybox, and a common uniform buffer for storing camera matrices.

Member Enumeration Documentation

◆ RenderType

enum class ToyMaker::RenderSet::RenderType : uint8_t
strong

Enum listing the different rendering pipelines available.

Todo
Split this out into different configuration files for the render system instead of their current "if-else" structure.

Member Function Documentation

◆ addOrAssignRenderSource()

void RenderSet::addOrAssignRenderSource ( const std::string & name,
std::shared_ptr< Texture > renderSource )

Adds a named render source, presumably intended for use by a render stage in this pipeline.

Parameters
nameThe name of the render source.
renderSourceA handle to the texture used as render source.

◆ getCurrentScreenTexture()

std::shared_ptr< Texture > RenderSet::getCurrentScreenTexture ( )

Returns the currently active debug render texture.

Returns
std::shared_ptr<Texture> A reference to the currently active debug render texture.

◆ getExposure()

float RenderSet::getExposure ( )

Returns the value of exposure set on this render set.

Returns
float This set's exposure.

◆ getGamma()

float RenderSet::getGamma ( )

Gets the gamma value used in this set's tonemapping-stage.

Returns
float This set's gamma value.

◆ removeRenderSource()

void RenderSet::removeRenderSource ( const std::string & name)

Removes a named render source.

Parameters
nameThe name of the render source removed.

◆ renderNextTexture()

void RenderSet::renderNextTexture ( )

Renders the next debug texture to the render system's final render target.

Mainly a debug option.

◆ setCamera()

void RenderSet::setCamera ( EntityID cameraEntity)

Sets the entity to be treated as this render set's active camera.

Parameters
cameraEntityAn entity which fulfils CameraSystem prerequisites.

◆ setExposure()

void RenderSet::setExposure ( float exposure)

Sets the exposure value responsible for determining the behaviour of tonemapping in the tonemapping-stage.

Parameters
exposureThe new exposure value, similar to real-world camera exposure.

◆ setGamma()

void RenderSet::setGamma ( float gamma)

Sets the gamma value used for gamma correction in the tonemapping stage of the pipeline.

Parameters
gammaThe new gamma value.

◆ setRenderProperties()

void RenderSet::setRenderProperties ( glm::u16vec2 renderDimensions,
glm::u16vec2 targetDimensions,
const SDL_Rect & viewportDimensions,
RenderType renderType )

Sets the render properties for this render set.

Creates and reconfigures all the shader stages in the render pipeline with the properties specified.

Parameters
renderDimensionsThe texture dimensions used for all non resize-stage and screen-stage framebuffers.
targetDimensionsThe texture dimensions used by the resize-stage and screen-stage framebuffers.
viewportDimensionsThe sub-region of the pipeline target dimensions rendered to.
renderTypeThe type of pipeline desired for this RenderSet.

TODO: remove this hacky render debug system, replace it with something that can be configured from file

◆ setSkybox()

void ToyMaker::RenderSet::setSkybox ( std::shared_ptr< Texture > skyboxTexture)

Sets the texture of the skybox painted to the background of the current scene in the 3D pipeline.

Parameters
skyboxTextureAn appropriately formatted cubemap texture.

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