class hiro::draw::Renderer

Overview

Abstract base class for an arbitrary renderer object. More…

#include <Renderer.h>

class Renderer {
public:
    // construction

    Renderer();

    // methods

    virtual bool IsCompatibileWithStyle(const hiro::draw::Style* style) = 0;

protected:
    // methods

    virtual void LoadRequiredShaderPrograms(glw::ProgramList* programs);
    virtual void Render(const std::string& program);
    virtual void OnRenderSimple();
    virtual void Render2D(const std::string& program);
    virtual void OnRenderSimple2D();
    virtual void FillTextRenderer(hiro::draw::TextRenderer* t_renderer);

    template <typename StyleType>
    const StyleType* GetStyle() const;

    const Scene* GetScene() const;
};

Detailed Documentation

Abstract base class for an arbitrary renderer object.

Methods

virtual bool IsCompatibileWithStyle(const hiro::draw::Style* style) = 0

Test whether specified style is compatible with object.

virtual void LoadRequiredShaderPrograms(glw::ProgramList* programs)

Override this method to load specialized shader programs for your object.

virtual void Render(const std::string& program)

Override this method to specify custom rendering behavior in 3D rendering pass.

virtual void OnRenderSimple()

Provides the possibility to render shapes using a simple color shader.

Vertex attributes:

vec3 in_position; at location 0 vec3 in_color; at location 1

Uniforms:

bool use_uniform_color = false; at location ULOC_CUSTOM_0 vec3 uniform_color = vec3(0,0,0); at location ULOC_CUSTOM_1

virtual void Render2D(const std::string& program)

Override this method to specify custom rendering behavior in 2D rendering pass.

virtual void OnRenderSimple2D()

Provides the possibility to render shapes using a simple color shader.

Vertex attributes:

vec3 in_position; at location 0 vec3 in_color; at location 1

Uniforms:

bool use_uniform_color = false; at location ULOC_CUSTOM_0 vec3 uniform_color = vec3(0,0,0); at location ULOC_CUSTOM_1

virtual void FillTextRenderer(hiro::draw::TextRenderer* t_renderer)

Override this method to define texts to be rendered.

template <typename StyleType>
const StyleType* GetStyle() const

Obtain currently set object style of specific type. Can be used only in Update-Render stage!