charcoal/CharcoalBuiltin/BuiltinPipeline.h

31 lines
736 B
C
Raw Permalink Normal View History

#pragma once
#include <charcoal/Pipeline.h>
namespace charcoal
{
namespace builtin
{
template <typename ShaderProgramType, typename BatchType>
class Pipeline : public charcoal::Pipeline<ShaderProgramType, BatchType>
{
public:
void render() override
{
prepare_opengl();
charcoal::Pipeline<ShaderProgramType, BatchType>::m_shader_program.use();
prepare_uniforms();
for (auto iter = charcoal::Pipeline<ShaderProgramType, BatchType>::m_batches.begin(); iter != charcoal::Pipeline<ShaderProgramType, BatchType>::m_batches.end(); ++iter)
{
BatchType* batch = *iter;
batch->render();
}
}
protected:
virtual void prepare_opengl() {};
virtual void prepare_uniforms() {};
};
}
}