Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cqsp::engine::LayerRenderer Class Reference

Renders a series of framebuffers onto screen. This is a relatively simple way of allowing organization of multiple framebuffers. But layer management is a bit scuffed and could be made more intuitive. How, that's a different question.
How to use:
More...

#include <framebuffer.h>

Public Member Functions

template<class T >
int AddLayer (asset::ShaderProgram_t shader, const engine::Window &window)
 
void BeginDraw (int layer)
 
void EndDraw (int layer)
 
void DrawAllLayers ()
 
void NewFrame (const cqsp::engine::Window &window)
 
int GetLayerCount ()
 
IFramebufferGetFrameBuffer (int layer)
 

Private Member Functions

void InitFramebuffer (IFramebuffer *buffer, cqsp::asset::ShaderProgram_t shader, const cqsp::engine::Window &window)
 

Private Attributes

std::vector< std::unique_ptr< IFramebuffer > > framebuffers
 

Detailed Description

Renders a series of framebuffers onto screen. This is a relatively simple way of allowing organization of multiple framebuffers. But layer management is a bit scuffed and could be made more intuitive. How, that's a different question.
How to use:

ShaderProgram_t shader; // Initialized somewhere above
// Init layer renderer
LayerRenderer layers;
// Add a new layer, and you can note down the index number
// The layers will be rendered in order of what you define it, so to reorganize layers
// you can just reorder the order they are initialized.
int first = layers.AddLayer<FramebufferRenderer>(shader, window);
int second = layers.AddLayer<FramebufferRenderer>(shader, window);
// Initialize the frame by doing this:
// .. Inside render loop
NewFrame(window); // Will clear all framebuffers
BeginDraw(first);
// .. some drawing
EndDraw(first);
// .. More drawing
// Now this will be drawn at the end
void EndDraw(int layer)
Definition: framebuffer.cpp:207
void NewFrame(const cqsp::engine::Window &window)
Definition: framebuffer.cpp:223
void BeginDraw(int layer)
Definition: framebuffer.cpp:205
void DrawAllLayers()
Definition: framebuffer.cpp:209
std::shared_ptr< ShaderProgram > ShaderProgram_t
The preferred way of using a shader program.
Definition: shader.h:112
double second
Definition: units.h:42

Member Function Documentation

◆ AddLayer()

template<class T >
int cqsp::engine::LayerRenderer::AddLayer ( asset::ShaderProgram_t  shader,
const engine::Window window 
)
inline

◆ BeginDraw()

void LayerRenderer::BeginDraw ( int  layer)

◆ DrawAllLayers()

void LayerRenderer::DrawAllLayers ( )

◆ EndDraw()

void LayerRenderer::EndDraw ( int  layer)

◆ GetFrameBuffer()

IFramebuffer * cqsp::engine::LayerRenderer::GetFrameBuffer ( int  layer)
inline

◆ GetLayerCount()

int LayerRenderer::GetLayerCount ( )

◆ InitFramebuffer()

void LayerRenderer::InitFramebuffer ( IFramebuffer buffer,
cqsp::asset::ShaderProgram_t  shader,
const cqsp::engine::Window window 
)
private

◆ NewFrame()

void LayerRenderer::NewFrame ( const cqsp::engine::Window window)

Member Data Documentation

◆ framebuffers

std::vector<std::unique_ptr<IFramebuffer> > cqsp::engine::LayerRenderer::framebuffers
private

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