charcoal/charcoal-builtin/TextPipeline.h

59 lines
1017 B
C++

#pragma once
#include <string>
#include <glm/glm.hpp>
#include <charcoal/Font.h>
#include "GLUtil.h"
#include "BuiltinPipeline.h"
#include "WithCamera.h"
#include "TextTypes.h"
#include "TextBatch.h"
namespace charcoal
{
namespace builtin
{
namespace text
{
class Pipeline : private builtin::Pipeline<ShaderProgram, Batch>, public WithCamera
{
public:
Pipeline(
Font& font
)
: m_font(font)
{
// TODO: Initialize character batches.
}
void render()
{
builtin::Pipeline<ShaderProgram, Batch>::render();
}
void add_text(const vec3& position, const std::string& text)
{
}
protected:
void prepare_opengl() override
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
void prepare_uniforms() override
{
glutil::uniform_matrix(0, get_camera()->get_world_to_view_matrix());
}
private:
Font& m_font;
};
}
}
}