2018-10-14 19:44:04 +00:00
|
|
|
#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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-16 02:38:59 +00:00
|
|
|
protected:
|
2018-10-14 19:44:04 +00:00
|
|
|
virtual void prepare_opengl() {};
|
|
|
|
|
|
|
|
virtual void prepare_uniforms() {};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|