Renderer Setup

Setting up a renderer via the renderer API

Static polymorphism is used for the renderer implementation, meaning that you can specify its type on compile time but cannot change it during run-time of your application. That said, it is a simple and easily extendable interface for creating different types of renderers if needed. The most stable one, that is supported now is the ForwardRenderer, which is also the simplest one when it comes to 3D renderers.

Set up flow of the Renderer

Create a renderer object

auto renderer = std::make_shared<ForwardRenderer>();

Create renderer queue (initially allocated 1000 rend. commands)

renderer.Begin()

Submit all renderable objects to the queue

The SubmitMesh function accepts renderables of base type Mesh.

std::for_each(meshes.begin(), meshes.end(), [&](const auto& mesh)
{
    ...
    renderer.SubmitMesh(mesh)
    ...
}

Display all content from the renderer

renderer.Present();

Optimize renderer queue if needed (batching, sorting, etc.)

renderer.End()

Last updated